summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2020-12-12 16:30:02 +0100
committerPatric Stout <github@truebrain.nl>2020-12-19 18:26:29 +0100
commit6228dde3da9b1368e8ca26e16fb2623f25b249ed (patch)
tree5b6ef4a2d30e217685dd0a54e228542248f9fa6b /cmake
parentb8217610ce11ab0b87c601e604462d8ed0f7b0f9 (diff)
downloadopenttd-6228dde3da9b1368e8ca26e16fb2623f25b249ed.tar.xz
Fix: [bundle] postfix the distribution for Linux bundles
Diffstat (limited to 'cmake')
-rw-r--r--cmake/InstallAndPackage.cmake19
1 files changed, 18 insertions, 1 deletions
diff --git a/cmake/InstallAndPackage.cmake b/cmake/InstallAndPackage.cmake
index e6bc7a0b7..53b6ce3e2 100644
--- a/cmake/InstallAndPackage.cmake
+++ b/cmake/InstallAndPackage.cmake
@@ -121,7 +121,24 @@ elseif(UNIX)
set(CPACK_GENERATOR "TXZ")
endif()
- set(CPACK_PACKAGE_FILE_NAME "openttd-#CPACK_PACKAGE_VERSION#-linux-${CPACK_SYSTEM_NAME}")
+ find_program(LSB_RELEASE_EXEC lsb_release)
+ execute_process(COMMAND ${LSB_RELEASE_EXEC} -is
+ OUTPUT_VARIABLE LSB_RELEASE_ID
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ if(NOT LSB_RELEASE_ID)
+ set(PLATFORM "generic")
+ elseif(LSB_RELEASE_ID STREQUAL "Ubuntu" OR LSB_RELEASE_ID STREQUAL "Debian")
+ execute_process(COMMAND ${LSB_RELEASE_EXEC} -cs
+ OUTPUT_VARIABLE LSB_RELEASE_CODENAME
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ string(TOLOWER "${LSB_RELEASE_ID}-${LSB_RELEASE_CODENAME}" PLATFORM)
+ else()
+ message(FATAL_ERROR "Unknown Linux distribution found for packaging; please consider creating a Pull Request to add support for this distribution.")
+ endif()
+
+ set(CPACK_PACKAGE_FILE_NAME "openttd-#CPACK_PACKAGE_VERSION#-linux-${PLATFORM}-${CPACK_SYSTEM_NAME}")
else()
message(FATAL_ERROR "Unknown OS found for packaging; please consider creating a Pull Request to add support for this OS.")
endif()