Skip to content

Commit

Permalink
Example debian packaging
Browse files Browse the repository at this point in the history
cmake .. && make deb
  • Loading branch information
Jeffrey Clark committed May 4, 2016
1 parent 6fae42e commit 3fcff30
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down Expand Up @@ -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})
21 changes: 21 additions & 0 deletions cmake/PackageDeb.cmake
Original file line number Diff line number Diff line change
@@ -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 "[email protected]")

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)

4 changes: 2 additions & 2 deletions config.h.in
Original file line number Diff line number Diff line change
@@ -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@
Expand Down
4 changes: 2 additions & 2 deletions src/attract.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3fcff30

Please sign in to comment.