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() 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. # {{{ Installation.
install(TARGETS ${PROJECT_AWE_NAME} ${PROJECT_AWECLIENT_NAME} RUNTIME DESTINATION bin) install(TARGETS ${PROJECT_AWE_NAME} ${PROJECT_AWECLIENT_NAME} RUNTIME DESTINATION bin)
install(FILES ${AWE_LUA_FILES} DESTINATION ${AWESOME_REL_LUA_LIB_PATH}) install(FILES ${AWE_LUA_FILES} DESTINATION ${AWESOME_REL_LUA_LIB_PATH})

View File

@ -1,7 +1,10 @@
set(PROJECT_AWE_NAME awesome) set(PROJECT_AWE_NAME awesome)
set(PROJECT_AWECLIENT_NAME awesome-client) 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_MAJOR ${VERSION})
set(VERSION_MINOR 0) set(VERSION_MINOR 0)
set(VERSION_PATCH 0) set(VERSION_PATCH 0)
@ -63,10 +66,8 @@ if(GENERATE_MANPAGES)
endif() endif()
# }}} # }}}
# {{{ git version stamp # {{{ version stamp
# If this is a git repository... if(EXISTS ${SOURCE_DIR}/.git/HEAD AND GIT_EXECUTABLE)
if(EXISTS ${SOURCE_DIR}/.git/HEAD)
if(GIT_EXECUTABLE)
# get current version # get current version
execute_process( execute_process(
COMMAND ${GIT_EXECUTABLE} describe COMMAND ${GIT_EXECUTABLE} describe
@ -78,7 +79,9 @@ if(EXISTS ${SOURCE_DIR}/.git/HEAD)
file(WRITE ${VERSION_STAMP_FILE} ${VERSION}) file(WRITE ${VERSION_STAMP_FILE} ${VERSION})
# create a version_stamp target later # create a version_stamp target later
set(BUILD_FROM_GIT TRUE) set(BUILD_FROM_GIT TRUE)
endif() else()
# get version from version stamp
file(READ ${SOURCE_DIR}/.version_stamp VERSION LIMIT 128)
endif() 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