diff --git a/.gitattributes b/.gitattributes index 206c7c5aa0ce..efff6931bbdf 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1 @@ -/tools/create_version_h.sh export-subst -/CMakeList.txt export-subst +/CMakeLists.txt export-subst diff --git a/CMakeLists.txt b/CMakeLists.txt index 48efa783fbfc..dc9727a1a2b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,37 +86,43 @@ endif(WIN32) # Check if this is source package build if(NOT IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.git) - set(SOURCE_PACKAGE 1) + set(SOURCE_PACKAGE 1) +else() + set(SOURCE_PACKAGE 0) endif() # # Set package version # - +file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/src/") # the src/ subdirectory won't exist yet if(DEFINED PROJECT_VERSION) - #project version is defined by -D on the cmake command line - # only use that value, do not upate it at make time - EXECUTE_PROCESS( COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools/create_version_h.sh ${CMAKE_CURRENT_BINARY_DIR}/src/version_gen.h ${PROJECT_VERSION} - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - ) + #project version is defined by -D on the cmake command line + # only use that value, do not upate it at make time + execute_process( + COMMAND ${CMAKE_SOURCE_DIR}/tools/create_version_h.sh ${CMAKE_CURRENT_BINARY_DIR}/src/version_gen.h ${PROJECT_VERSION} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ) else(DEFINED PROJECT_VERSION) - if(NOT SOURCE_PACKAGE) - # this part is setting the corresponding CMake variable which gets used for example when creating a source package - EXECUTE_PROCESS(COMMAND git describe --tags --dirty - COMMAND sed "s,^release-,,;s,-,+,;s,-,~,;" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE PROJECT_VERSION - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) - add_custom_target( - generate_version ALL - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools/create_version_h.sh ${CMAKE_CURRENT_BINARY_DIR}/src/version_gen.h - COMMENT "Updating version string" - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - ) - else(NOT SOURCE_PACKAGE) - set(PROJECT_VERSION "archive-$Format:%H$") - execute_process( COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools/create_version_h.sh ${CMAKE_CURRENT_BINARY_DIR}/src/version_gen.h ${PROJECT_VERSION} - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - ) - endif(NOT SOURCE_PACKAGE) + if(NOT SOURCE_PACKAGE) # i.e., a git checkout + # this part is setting the corresponding CMake variable which gets used for example when creating a source package + execute_process( + COMMAND git describe --tags --dirty + COMMAND sed "s,^release-,,;s,-,+,;s,-,~,;" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE PROJECT_VERSION + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + add_custom_target(generate_version ALL + COMMAND ${CMAKE_SOURCE_DIR}/tools/create_version_h.sh ${CMAKE_CURRENT_BINARY_DIR}/src/version_gen.h + COMMENT "Updating version string" + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ) + elseif(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/version_gen.h) + # no need to create version_gen.h if it's already shipped. that is for example the case with our release tarballs +# else(NOT SOURCE_PACKAGE) + set(PROJECT_VERSION "archive-$Format:%H$") + execute_process( + COMMAND ${CMAKE_SOURCE_DIR}/tools/create_version_h.sh ${CMAKE_CURRENT_BINARY_DIR}/src/version_gen.h ${PROJECT_VERSION} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ) + endif(NOT SOURCE_PACKAGE) endif(DEFINED PROJECT_VERSION) diff --git a/tools/create_release.sh b/tools/create_release.sh index 73d2743ae63d..66ef96dcc49b 100755 --- a/tools/create_release.sh +++ b/tools/create_release.sh @@ -6,33 +6,40 @@ echo "are you sure these guys received proper credit in the about dialog?" read answer # prefix rc with ~, so debian thinks its less than +echo "* archiving git tree" dt_decoration=$(git describe --tags $branch | sed 's,^release-,,;s,-,+,;s,-,~,;' | sed 's/rc/~rc/') git archive HEAD --prefix=darktable-$dt_decoration/ -o darktable-$dt_decoration.tar -mkdir -p tmp -cd tmp -tar xvf ../darktable-$dt_decoration.tar +SRCDIR=`pwd` +TMPDIR=`mktemp -d -t darktable-XXXXXX` +cd "$TMPDIR" +tar xf "$SRCDIR/darktable-$dt_decoration.tar" # create version header for non-git tarball: +echo "* creating version header" echo "#define PACKAGE_VERSION \"$dt_decoration\"" > darktable-$dt_decoration/src/version_gen.h -# remove docs, that's > 45 MB -rm -rf darktable-$dt_decoration/doc/htdocs +# remove usermanual, that's > 80 MB and released separately +echo "* removing usermanual" rm -rf darktable-$dt_decoration/doc/usermanual -tar cvzf darktable-$dt_decoration.tar.gz darktable-$dt_decoration/ -tar cvJf darktable-$dt_decoration.tar.xz darktable-$dt_decoration/ -rm ../darktable-$dt_decoration.tar -mv darktable-$dt_decoration.tar.gz .. -mv darktable-$dt_decoration.tar.xz .. -# now test the build: -rm -rf darktable-* -tar xvzf ../darktable-$dt_decoration.tar.gz -cd darktable-* -./build.sh +echo "* creating final tarball" +tar cJf darktable-$dt_decoration.tar.xz darktable-$dt_decoration/ +rm "$SRCDIR/darktable-$dt_decoration.tar" +cp darktable-$dt_decoration.tar.xz "$SRCDIR" -echo "actually to test this build you should do:" -echo "cd tmp/darktable-$dt_decoration/build && sudo make install" +# now test the build: +echo "* test compiling" +rm -rf darktable-$dt_decoration/ +tar xf darktable-$dt_decoration.tar.xz +cd darktable-$dt_decoration/ +./build.sh --prefix "$TMPDIR/darktable/" + +echo +echo "to actually test this build you should do:" +echo "cd $TMPDIR/darktable-$dt_decoration/build && make install" +echo "then run darktable from:" +echo "$TMPDIR/darktable/bin/darktable" diff --git a/tools/create_version_h.sh b/tools/create_version_h.sh index 487578722460..9b5a5c83d812 100755 --- a/tools/create_version_h.sh +++ b/tools/create_version_h.sh @@ -3,16 +3,15 @@ set -e H_FILE=$1 +NEW_VERSION=$2 VERSION_H_NEEDS_UPDATE=1 -if [ -z "$2" ]; then - NEW_VERSION=`git describe --tags --dirty | sed 's,^release-,,;s,-,+,;s,-,~,;'` -else - NEW_VERSION=$2 +if [ -z "$NEW_VERSION" ]; then + NEW_VERSION=`git describe --tags --dirty | sed 's,^release-,,;s,-,+,;s,-,~,;'` fi if [ -n "`echo -e $NEW_VERSION | grep Format`" ]; then - NEW_VERSION="unknown-version" + NEW_VERSION="unknown-version" fi # version.h exists => check if it containts the up-to-date version