diff options
author | Gerald Combs <gerald@wireshark.org> | 2019-01-11 22:34:03 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2019-01-14 17:41:43 +0000 |
commit | 290214adc986cc5f8bbbf87df023c290f32d982d (patch) | |
tree | 40d237c5aa4f59d18d0293d705d145ba803e7260 /CMakeLists.txt | |
parent | c3d198c401d5ec17289159cc88e2f891070e7779 (diff) |
tarball+RPM: Fetch our version from CMake.
Move git-export-release.sh to packaging/source. Have the source and RPM
packaging derive version information from CMake's VERSION variable. This
brings them in line with the rest of our packaging and avoids having to
read chicken entrails^W^Wgit output.
Make sure we always generate wireshark.spec.
Bug: 15359
Change-Id: I188efda489c94449a10a612abebf9c2872c305cb
Reviewed-on: https://code.wireshark.org/review/31504
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 37 |
1 files changed, 8 insertions, 29 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f74e5f957..62a920d3a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1165,7 +1165,7 @@ endforeach() # dist target that prepares source dir # XXX Duplicated in the RPM section below. add_custom_target(dist - COMMAND ./tools/git-export-release.sh -d "${CMAKE_BINARY_DIR}" + COMMAND ${CMAKE_BINARY_DIR}/packaging/source/git-export-release.sh -d "${CMAKE_BINARY_DIR}" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) @@ -1546,6 +1546,7 @@ set(CFG_OUT_FILES packaging/macosx/osx-dmg.sh packaging/macosx/Read_me_first.rtf packaging/macosx/Wireshark_package.pmdoc/index.xml + packaging/source/git-export-release.sh wireshark.pc ) foreach( _cfg_file ${CFG_OUT_FILES} ) @@ -2773,18 +2774,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") find_program(APPIMAGETOOL_EXECUTABLE appimagetool) endif() -function(_SET_GITVERSION_CMAKE_VARIABLE OUTPUT_VARIABLE) - # Load version string and write it to a cmake variable so it can be accessed from cmake. - FILE(READ "${CMAKE_CURRENT_BINARY_DIR}/version.h" VERSION_H_FILE_CONTENT) - string(REPLACE "\n" "" VERSION_H_FILE_CONTENT ${VERSION_H_FILE_CONTENT}) - #define VCSVERSION "v2.9.0rc0-305-gb8e8aa87" - string(SUBSTRING "${VERSION_H_FILE_CONTENT}" 21 -1 VERSION_STRING) - STRING(REGEX REPLACE "\"" "" VERSION_STRING "${VERSION_STRING}") - MESSAGE(STATUS "Version string created from version.h: ${VERSION_STRING}") - SET(${OUTPUT_VARIABLE} "${VERSION_STRING}" CACHE INTERNAL "${OUTPUT_VARIABLE}") -endfunction(_SET_GITVERSION_CMAKE_VARIABLE) - +string(REPLACE "-" "_" RPM_VERSION "${VERSION}") +configure_file(packaging/rpm/wireshark.spec.in ${CMAKE_BINARY_DIR}/packaging/rpm/SPECS/wireshark.spec) if(RPMBUILD_EXECUTABLE) foreach(_rpm_dir BUILD RPMS SOURCES SPECS SRPMS) file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/packaging/rpm/${_rpm_dir}") @@ -2834,26 +2826,13 @@ if(RPMBUILD_EXECUTABLE) ${CMAKE_SOURCE_DIR} ) - _SET_GITVERSION_CMAKE_VARIABLE(_git_description) - - if (NOT _git_description) - # We're building the rpm outside the source. Guess the version from the dirname. - get_filename_component(CMAKE_SOURCE_DIR_NAME ${CMAKE_SOURCE_DIR} NAME) - # XXX this assumes the directory to start with "wireshark-" - string(SUBSTRING "${CMAKE_SOURCE_DIR_NAME}" 10 -1 _git_description) - endif() - string(REPLACE "-" "_" RPM_VERSION "${_git_description}") - configure_file(packaging/rpm/wireshark.spec.in ${CMAKE_BINARY_DIR}/packaging/rpm/SPECS/wireshark.spec) - # XXX Replace with the "dist" target? - set(_export_tarball "${CPACK_PACKAGE_NAME}-${_git_description}.tar.xz") + set(_export_tarball "${CPACK_PACKAGE_NAME}-${VERSION}.tar.xz") add_custom_command( OUTPUT "${CMAKE_BINARY_DIR}/packaging/rpm/SOURCES/${_export_tarball}" - COMMAND ./tools/git-export-release.sh + COMMAND ${CMAKE_BINARY_DIR}/packaging/source/git-export-release.sh -d "${CMAKE_BINARY_DIR}/packaging/rpm/SOURCES" - "${_git_description}" - # XXX Add an option to git-export-release.sh to write to a - # specific directory so that we can get rid of `ln` below. + "${VERSION}" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) add_custom_target(rpm-package @@ -3249,9 +3228,9 @@ if(SHELLCHECK_EXECUTABLE) packaging/appimage/AppRun packaging/macosx/osx-app.sh.in packaging/macosx/osx-dmg.sh.in + packaging/source/git-export-release.sh.in tools/compress-pngs.sh tools/debian-setup.sh - tools/git-export-release.sh tools/fuzz-test.sh tools/gen-bugnote tools/pre-commit |