build: add OVERRIDE_VERSION, used in Travis

Fixes https://github.com/awesomeWM/awesome/issues/160.
This commit is contained in:
Daniel Hahler 2015-07-24 01:01:38 +02:00
parent 3cd0bb5783
commit fdc3f2cc17
2 changed files with 8 additions and 3 deletions

View file

@ -90,6 +90,9 @@ install:
# Deps for functional tests.
- sudo apt-get install -qq dbus-x11 xterm xdotool xterm xvfb
# Determine custom version.
- '[ "$TRAVIS_PULL_REQUEST" = false ] && version="${TRAVIS_BRANCH}-g$(git rev-parse --short HEAD)-$(date -Iseconds)" || version="${TRAVIS_BRANCH}-PR${TRAVIS_PULL_REQUEST}-g$(git rev-parse --short HEAD)-$(date -Iseconds)"'
script:
- export CMAKE_ARGS="-DLUA_LIBRARY=${LUALIB} -DLUA_INCLUDE_DIR=/usr/include/lua${LUAPKG}"
- export CMAKE_ARGS="-DLUA_LIBRARY=${LUALIB} -DLUA_INCLUDE_DIR=/usr/include/lua${LUAPKG} -D OVERRIDE_VERSION=$version"
- make && sudo env PATH=$PATH make install && awesome --version && tests/run.sh

View file

@ -89,14 +89,16 @@ endif()
# }}}
# {{{ Version stamp
if(EXISTS ${SOURCE_DIR}/.git/HEAD AND GIT_EXECUTABLE)
if(OVERRIDE_VERSION)
set(VERSION ${OVERRIDE_VERSION})
elseif(EXISTS ${SOURCE_DIR}/.git/HEAD AND GIT_EXECUTABLE)
# get current version
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --dirty
WORKING_DIRECTORY ${SOURCE_DIR}
OUTPUT_VARIABLE VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
# file the git-version-stamp.sh script will look into
# File the build-utils/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