diff options
-rw-r--r-- | CMakeLists.txt | 9 | ||||
-rw-r--r-- | make-tar.sh | 17 |
2 files changed, 26 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index fc6fe98a..18486080 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -498,3 +498,12 @@ endif() if(WIN32) install(FILES "${CMAKE_SOURCE_DIR}/bin/cleye.config" DESTINATION .) endif() + +string(TIMESTAMP filename-date "%Y%m%d") +set(filename-ostype ${CMAKE_SYSTEM_NAME}) +set(filename_0 opentrack-build-${filename-ostype}-${filename-date}) +string(TOLOWER "${filename_0}" filename_1) +set(filename "${CMAKE_BINARY_DIR}/${filename_1}.tar.xz") + +add_custom_command(OUTPUT ${filename} COMMAND env sh "${CMAKE_SOURCE_DIR}/make-tar.sh" "${CMAKE_INSTALL_PREFIX}" "${filename}") +add_custom_target(tarball DEPENDS ${filename}) diff --git a/make-tar.sh b/make-tar.sh new file mode 100644 index 00000000..26b65dcb --- /dev/null +++ b/make-tar.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +prefix="$1" +filename="$2" + +if : && + make install && + cd $(dirname -- "${prefix}") && + tar Jcf "${filename}" $(basename "${prefix}") +then + ls -lh -- "${filename}" +else + rm -fv -- "${filename}" + exit 1 +fi + +exit 0 |