diff options
-rw-r--r-- | CMakeLists.txt | 21 | ||||
-rw-r--r-- | cmake/modules/Dist.cmake | 11 | ||||
-rwxr-xr-x | tools/git-export-release.sh | 13 |
3 files changed, 20 insertions, 25 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b6c4275bdc..063027c89e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1106,13 +1106,10 @@ endforeach() include( UseWinLibs ) # dist target that prepares source dir +# XXX Duplicated in the RPM section below. add_custom_target(dist - COMMAND "${CMAKE_COMMAND}" - -DPROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}" - -DGIT_EXECUTABLE="${GIT_EXECUTABLE}" - -DWS_SOURCE_DIR="${WS_SOURCE_DIR}" - -P "${CMAKE_SOURCE_DIR}/cmake/modules/Dist.cmake" - COMMAND "${CMAKE_MAKE_PROGRAM}" package_source + COMMAND ./tools/git-export-release.sh -d "${CMAKE_BINARY_DIR}" + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) @@ -2943,24 +2940,24 @@ if(RPMBUILD_EXECUTABLE) string(REPLACE "-" "_" RPM_VERSION "${RPM_TARBALL_VERSION}") 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}-${RPM_TARBALL_VERSION}.tar.xz") add_custom_command( - OUTPUT "${CMAKE_SOURCE_DIR}/${_export_tarball}" - COMMAND ./tools/git-export-release.sh "${_git_description}" + OUTPUT "${CMAKE_BINARY_DIR}/packaging/rpm/SOURCES/${_export_tarball}" + COMMAND ./tools/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. WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) add_custom_target(rpm-package - COMMAND ${CMAKE_COMMAND} -E create_symlink - "${CMAKE_SOURCE_DIR}/${_export_tarball}" - "SOURCES/${_export_tarball}" COMMAND ${RPMBUILD_EXECUTABLE} --define "_topdir ${CMAKE_BINARY_DIR}/packaging/rpm" --define "_prefix ${CMAKE_INSTALL_PREFIX}" ${_rpmbuild_with_args} --clean -ba SPECS/wireshark.spec - DEPENDS "${CMAKE_SOURCE_DIR}/${_export_tarball}" + DEPENDS "${CMAKE_BINARY_DIR}/packaging/rpm/SOURCES/${_export_tarball}" WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/packaging/rpm" COMMENT "Create a tarball from the current git commit." ) diff --git a/cmake/modules/Dist.cmake b/cmake/modules/Dist.cmake deleted file mode 100644 index 7c0b3bb105..0000000000 --- a/cmake/modules/Dist.cmake +++ /dev/null @@ -1,11 +0,0 @@ -message("Copying source files from ${PROJECT_SOURCE_DIR} to ${WS_SOURCE_DIR}") - -# create destination dir -file(MAKE_DIRECTORY "${WS_SOURCE_DIR}") - -# Copy all files in the state *as known by git*, respecting export-ignore in .gitattributes -execute_process(COMMAND "${GIT_EXECUTABLE}" checkout-index -a -f --prefix "${WS_SOURCE_DIR}/" WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}") - -# Generate the version.conf and put it in brand new source dir -execute_process(COMMAND "${GIT_EXECUTABLE}" describe WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" OUTPUT_VARIABLE GIT_DESCRIBE) -file(WRITE "${WS_SOURCE_DIR}/version.conf" "git_description=${GIT_DESCRIBE}") diff --git a/tools/git-export-release.sh b/tools/git-export-release.sh index eb670dbb2b..4abd8bafa9 100755 --- a/tools/git-export-release.sh +++ b/tools/git-export-release.sh @@ -12,7 +12,16 @@ set -e -# First paremeter, if set, is a git commit, like v1.12.0-rc1 or 54819e5699f +DESTDIR=. + +while getopts "d:" OPTCHAR ; do + case $OPTCHAR in + d) DESTDIR=$OPTARG ;; + esac +done +shift $(($OPTIND - 1)) + +# The remaining parameter, if set, is a git commit, like v1.12.0-rc1 or 54819e5699f # By default HEAD is used. # Note, that filtering takes place base on the _exported_ version's # .gitattributes files thus archives generated from older commits will contain @@ -59,7 +68,7 @@ fi echo "Creating wireshark-$VERSION.tar.xz" -git archive --prefix=wireshark-${VERSION}/ ${COMMIT} | xz > wireshark-${VERSION}.tar.xz +git archive --prefix=wireshark-${VERSION}/ ${COMMIT} | xz > ${DESTDIR}/wireshark-${VERSION}.tar.xz if [ "$STASH_POP" == "True" ] ; then git stash pop |