From a274d68f77421c574a7f502075c90d2c0ef7cddd Mon Sep 17 00:00:00 2001 From: Jeffrey Clark Date: Wed, 4 May 2016 13:18:11 -0500 Subject: [PATCH] Example debian packaging cmake .. && make deb --- CMakeLists.txt | 8 +++++++- cmake/PackageDeb.cmake | 21 +++++++++++++++++++++ config.h.in | 4 ++-- src/attract.rc | 4 ++-- 4 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 cmake/PackageDeb.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index d9aabd997..917a280a9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,7 +78,7 @@ string(REGEX REPLACE "^v" "" RESULT ${VER_TAG}) string(REGEX REPLACE "[-\\.]" ";" RESULT ${RESULT}) list(GET RESULT 0 VER_MAJOR) list(GET RESULT 1 VER_MINOR) -list(GET RESULT 2 VER_POINT) +list(GET RESULT 2 VER_PATCH) git_describe(VER_DIRTY --dirty) if(NOT "${VER_COUNT}" EQUAL "0") set(VER_TAG "${VER_TAG}-${VER_COUNT}") @@ -129,3 +129,9 @@ add_subdirectory(src) install(DIRECTORY config/ DESTINATION ${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}) + +include(cmake/PackageDeb.cmake) +add_custom_target(deb DEPENDS attract + COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=/usr . + COMMAND ${CMAKE_CPACK_COMMAND} -G DEB + WORKING_DIRECTORY ${BUILD_DIR}) diff --git a/cmake/PackageDeb.cmake b/cmake/PackageDeb.cmake new file mode 100644 index 000000000..ed9762a8f --- /dev/null +++ b/cmake/PackageDeb.cmake @@ -0,0 +1,21 @@ +set(CPACK_SET_DESTDIR "on") +set(CPACK_PACKAGING_INSTALL_PREFIX "/tmp") +set(CPACK_GENERATOR "DEB") +set(CPACK_STRIP_FILES ON) + +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Attract-Mode emulator frontend") +set(CPACK_PACKAGE_VENDOR "Andrew Mickelson") +set(CPACK_PACKAGE_CONTACT "andrew@attractmode.org") + +set(CPACK_PACKAGE_VERSION_MAJOR "${VER_MAJOR}") +set(CPACK_PACKAGE_VERSION_MINOR "${VER_MINOR}") +set(CPACK_PACKAGE_VERSION_PATCH "${VER_PATCH}") + +set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") +set(CPACK_DEBIAN_PACKAGE_SECTION "games") +set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}") + +set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${VER_MAJOR}.${VER_MINOR}.${VER_PATCH}-${VER_COUNT}_${CMAKE_SYSTEM_PROCESSOR}") + +include(CPack) + diff --git a/config.h.in b/config.h.in index 4820981b6..c4e6b55be 100644 --- a/config.h.in +++ b/config.h.in @@ -1,8 +1,8 @@ #define FE_VERSION_MAJOR @VER_MAJOR@ #define FE_VERSION_MINOR @VER_MINOR@ -#define FE_VERSION_POINT @VER_POINT@ +#define FE_VERSION_PATCH @VER_PATCH@ #define FE_VERSION_COUNT @VER_COUNT@ -#define FE_VERSION_NUM @VER_MAJOR@@VER_MINOR@@VER_POINT@ +#define FE_VERSION_NUM @VER_MAJOR@@VER_MINOR@@VER_PATCH@ #define FE_VERSION_D "@VER_TAG@" #define @TARGET_SYSTEM@ diff --git a/src/attract.rc b/src/attract.rc index d5561d332..4949239d8 100644 --- a/src/attract.rc +++ b/src/attract.rc @@ -23,8 +23,8 @@ //#define LANG_WITH_CHARSET "040904E4" //#endif -#define RC_VERSION_BUILD FE_VERSION_MAJOR.FE_VERSION_MINOR.FE_VERSION_POINT.FE_VERSION_COUNT -#define RC_VERSION_FILE FE_VERSION_MAJOR,FE_VERSION_MINOR,FE_VERSION_POINT,FE_VERSION_COUNT +#define RC_VERSION_BUILD FE_VERSION_MAJOR.FE_VERSION_MINOR.FE_VERSION_PATCH.FE_VERSION_COUNT +#define RC_VERSION_FILE FE_VERSION_MAJOR,FE_VERSION_MINOR,FE_VERSION_PATCH,FE_VERSION_COUNT 1 VERSIONINFO FILEVERSION RC_VERSION_FILE