From 388dbb01c14a655574cfc220188d50913771626d Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Mon, 23 Jun 2008 23:07:28 +0200 Subject: [PATCH] build: implement make dist using git-archive Instead of jumping through hoops to get the ignore list right just use git-archive to get a clean source tarball. --- CMakeLists.txt | 8 ++++++++ awesomeConfig.cmake | 37 ++++++++++++++++++++----------------- build-utils/dist.sh | 11 +++++++++++ 3 files changed, 39 insertions(+), 17 deletions(-) create mode 100755 build-utils/dist.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d729ff0..bdf82a24 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -285,6 +285,14 @@ if(LUADOC_EXECUTABLE) endif() # }}} +# {{{ dist tarball +if(BUILD_FROM_GIT) + add_custom_target(dist + COMMAND ${SOURCE_DIR}/build-utils/dist.sh ${VERSION} + WORKING_DIRECTORY ${SOURCE_DIR}) +endif() +# }}} + # {{{ Installation. install(TARGETS ${PROJECT_AWE_NAME} ${PROJECT_AWECLIENT_NAME} RUNTIME DESTINATION bin) install(FILES ${AWE_LUA_FILES} DESTINATION ${AWESOME_REL_LUA_LIB_PATH}) diff --git a/awesomeConfig.cmake b/awesomeConfig.cmake index 4d4a58d8..c943f2cf 100644 --- a/awesomeConfig.cmake +++ b/awesomeConfig.cmake @@ -1,7 +1,10 @@ set(PROJECT_AWE_NAME awesome) set(PROJECT_AWECLIENT_NAME awesome-client) -set(VERSION 3) +# If ${SOURCE_DIR} is a git repository VERSION is set to +# `git-describe` later. +set(VERSION 3-devel) + set(VERSION_MAJOR ${VERSION}) set(VERSION_MINOR 0) set(VERSION_PATCH 0) @@ -63,22 +66,22 @@ if(GENERATE_MANPAGES) endif() # }}} -# {{{ git version stamp -# If this is a git repository... -if(EXISTS ${SOURCE_DIR}/.git/HEAD) - if(GIT_EXECUTABLE) - # get current version - execute_process( - COMMAND ${GIT_EXECUTABLE} describe - WORKING_DIRECTORY ${SOURCE_DIR} - OUTPUT_VARIABLE VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE) - # file the git-version-stamp.sh script will look into - set(VERSION_STAMP_FILE ${BUILD_DIR}/.version_stamp) - file(WRITE ${VERSION_STAMP_FILE} ${VERSION}) - # create a version_stamp target later - set(BUILD_FROM_GIT TRUE) - endif() +# {{{ version stamp +if(EXISTS ${SOURCE_DIR}/.git/HEAD AND GIT_EXECUTABLE) + # get current version + execute_process( + COMMAND ${GIT_EXECUTABLE} describe + WORKING_DIRECTORY ${SOURCE_DIR} + OUTPUT_VARIABLE VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) + # file the git-version-stamp.sh script will look into + set(VERSION_STAMP_FILE ${BUILD_DIR}/.version_stamp) + file(WRITE ${VERSION_STAMP_FILE} ${VERSION}) + # create a version_stamp target later + set(BUILD_FROM_GIT TRUE) +else() + # get version from version stamp + file(READ ${SOURCE_DIR}/.version_stamp VERSION LIMIT 128) endif() # }}} diff --git a/build-utils/dist.sh b/build-utils/dist.sh new file mode 100755 index 00000000..7642be8c --- /dev/null +++ b/build-utils/dist.sh @@ -0,0 +1,11 @@ +#!/bin/sh +# +# $1 version to package + +set -e + +VERSION=$1 +git-archive --prefix=dist/awesome-$VERSION/ $VERSION | tar -xf - +cd dist +echo -n $VERSION > awesome-$VERSION/.version_stamp +tar czf awesome-$VERSION.tar.gz awesome-$VERSION