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.
This commit is contained in:
Michael Gehring 2008-06-23 23:07:28 +02:00 committed by Julien Danjou
parent 02fdfcc01e
commit 388dbb01c1
3 changed files with 39 additions and 17 deletions

View File

@ -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})

View File

@ -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()
# }}}

11
build-utils/dist.sh Executable file
View File

@ -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