Skip to content

Commit

Permalink
CMake|CPack|Unix: Fixes for Debian and RPM packaging
Browse files Browse the repository at this point in the history
Applied a number of corrections and additions to the metadata of the DEB
and RPM generators. Notably, corrected the executable permission on
installed libraries so the RPM packager finds them.

The default install prefix for Unix platforms is now /usr.

Now also using CMake's GNUInstallDirs module for specifying the library
directory name.
  • Loading branch information
skyjake committed May 24, 2015
1 parent b7d8617 commit e11f1c3
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 12 deletions.
6 changes: 6 additions & 0 deletions distrib/description.txt
@@ -0,0 +1,6 @@
The Doomsday Engine is a portable version of the classic first person
shooters DOOM, Heretic, and Hexen. It lets you enjoy the original games
using modern technology, including high-resolution OpenGL graphics, 3D
models, and dynamic lighting effects. Data files from the original games
are not included; you must acquire a copy of the original games from
id Software and/or Raven Software.
19 changes: 10 additions & 9 deletions doomsday/cmake/Config.cmake
Expand Up @@ -13,7 +13,11 @@ endmacro (set_path)
# Project Options & Paths ----------------------------------------------------

set_path (DENG_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/..")
set_path (DENG_DISTRIB_DIR "${DENG_SOURCE_DIR}/../distrib/products")
if (APPLE OR WIN32)
set_path (DENG_DISTRIB_DIR "${DENG_SOURCE_DIR}/../distrib/products")
else ()
set_path (DENG_DISTRIB_DIR /usr)
endif ()
set (DENG_EXTERNAL_SOURCE_DIR "${DENG_SOURCE_DIR}/external")
set (DENG_API_DIR "${DENG_SOURCE_DIR}/apps/api")
set (CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
Expand All @@ -32,14 +36,11 @@ include (Packaging)
set (DENG_INSTALL_DATA_DIR "share/doomsday")
set (DENG_INSTALL_DOC_DIR "share/doc")
set (DENG_INSTALL_MAN_DIR "share/man/man6")
set (DENG_INSTALL_LIB_DIR "lib")
if (ARCH_BITS EQUAL 64)
if (EXISTS ${CMAKE_INSTALL_PREFIX}/lib64)
set (DENG_INSTALL_LIB_DIR "lib64")
elseif (EXISTS ${CMAKE_INSTALL_PREFIX}/lib/x86_64-linux-gnu)
set (DENG_INSTALL_LIB_DIR "lib/x86_64-linux-gnu")
endif ()
endif ()
if (DEFINED CMAKE_INSTALL_LIBDIR)
set (DENG_INSTALL_LIB_DIR ${CMAKE_INSTALL_LIBDIR})
else ()
set (DENG_INSTALL_LIB_DIR "lib")
endif ()
set (DENG_INSTALL_PLUGIN_DIR "${DENG_INSTALL_LIB_DIR}/doomsday")

set (DENG_BUILD_STAGING_DIR "${CMAKE_BINARY_DIR}/bundle-staging")
Expand Down
4 changes: 4 additions & 0 deletions doomsday/cmake/InstallPrefix.cmake
@@ -1,3 +1,7 @@
if (UNIX AND NOT APPLE)
include (GNUInstallDirs)
endif()

set (_oldPrefix ${CMAKE_INSTALL_PREFIX})

# Install destination. PREFIX can be used to set the location manually.
Expand Down
1 change: 1 addition & 0 deletions doomsday/cmake/Macros.cmake
Expand Up @@ -659,6 +659,7 @@ macro (deng_install_library library)
file (GLOB _links ${library}.* ${versioned})
install (FILES ${library} ${_links}
DESTINATION ${DENG_INSTALL_PLUGIN_DIR}
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ OWNER_WRITE OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE
)
elseif (MSVC)
message (STATUS "Library will be installed: ${library}")
Expand Down
21 changes: 18 additions & 3 deletions doomsday/cmake/Packaging.cmake
@@ -1,8 +1,22 @@
# Basic package metadata.
set (CPACK_PACKAGE_NAME doomsday)
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Doomsday Engine")
set (CPACK_PACKAGE_VENDOR "Jaakko Keränen (skyjake)")
set (CPACK_PACKAGE_VERSION_MAJOR ${DENG_VERSION_MAJOR})
set (CPACK_PACKAGE_VERSION_MINOR ${DENG_VERSION_MINOR})

set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Doom/Heretic/Hexen port with enhanced graphics")
set (CPACK_PACKAGE_DESCRIPTION_FILE ${DENG_SOURCE_DIR}/../distrib/description.txt)

set (CPACK_DEBIAN_PACKAGE_MAINTAINER "Jaakko Keränen (skyjake) <jaakko.keranen@iki.fi>")
set (CPACK_DEBIAN_PACKAGE_SECTION universe/games)

set (CPACK_RPM_PACKAGE_SUMMARY ${summary})
set (CPACK_RPM_PACKAGE_LICENSE "GPL3, LGPL3")
set (CPACK_RPM_PACKAGE_GROUP Amusements/Games)
set (CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/share/man /usr/share/man/man6)
set (CPACK_RPM_PACKAGE_REQUIRES "qt5-qtx11extras >= 5.2")

if (DENG_BUILD)
# Whenever the build number is specified, include it in the package version.
# This ensures newer builds of the same version will have a greater number.
Expand All @@ -16,17 +30,18 @@ else ()
endif ()

if (DENG_BUILD AND NOT DENG_STABLE)
set (CPACK_PACKAGE_FILE_NAME doomsday_${DENG_VERSION}-build${DENG_BUILD}_${DENG_ARCH})
set (CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}_${DENG_VERSION}-build${DENG_BUILD}_${DENG_ARCH})
else ()
set (CPACK_PACKAGE_FILE_NAME doomsday_${DENG_VERSION}_${DENG_ARCH})
set (CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}_${DENG_VERSION}_${DENG_ARCH})
endif ()

# File formats.
if (APPLE)
set (CPACK_GENERATOR DragNDrop)
set (CPACK_DMG_FORMAT UDZO)
elseif (UNIX)
set (CPACK_GENERATOR TGZ)
set (CPACK_GENERATOR RPM;DEB)
set (CPACK_PROJECT_CONFIG_FILE ${CMAKE_CURRENT_LIST_DIR}/PackagingUnix.cmake)
else ()
set (CPACK_GENERATOR WIX)
set (CPACK_PROJECT_CONFIG_FILE ${CMAKE_CURRENT_LIST_DIR}/WIX.cmake)
Expand Down
10 changes: 10 additions & 0 deletions doomsday/cmake/PackagingUnix.cmake
@@ -0,0 +1,10 @@
# CPack: Generator-specific configuration for Unix
if (CPACK_GENERATOR STREQUAL DEB)
string (REPLACE x86_64 amd64 CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME})

elseif (CPACK_GENERATOR STREQUAL RPM)
string (REPLACE _x86_64 -1.x86_64 CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME})
string (REPLACE _i386 -1.i686 CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME})
string (REPLACE y_ y- CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME})

endif ()

0 comments on commit e11f1c3

Please sign in to comment.