diff options
author | Charles Pigott <charlespigott@googlemail.com> | 2021-01-02 17:45:42 +0000 |
---|---|---|
committer | Charles Pigott <charlespigott@googlemail.com> | 2021-01-02 19:47:14 +0000 |
commit | 10090d0ac67c477f53f881402189b4ae53753c39 (patch) | |
tree | 5129e6a2ff216797368079a15f14be487d7019ea /cmake | |
parent | 3dfee979a7e486b8d90f6398ea557d2889855059 (diff) | |
download | openttd-10090d0ac67c477f53f881402189b4ae53753c39.tar.xz |
Add: [CMake] Explicitly support txz for Arch Linux
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/InstallAndPackage.cmake | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/cmake/InstallAndPackage.cmake b/cmake/InstallAndPackage.cmake index 3f33f699e..2a735e9dc 100644 --- a/cmake/InstallAndPackage.cmake +++ b/cmake/InstallAndPackage.cmake @@ -122,25 +122,37 @@ elseif(UNIX) OUTPUT_VARIABLE LSB_RELEASE_ID OUTPUT_STRIP_TRAILING_WHITESPACE ) - if(NOT LSB_RELEASE_ID) - set(PLATFORM "generic") - set(CPACK_GENERATOR "TXZ") - - message(WARNING "Unknown Linux distribution found for packaging; can only pack to a txz. Please consider creating a Pull Request to add support for this distribution.") - 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) - - set(CPACK_GENERATOR "DEB") - include(PackageDeb) + if(LSB_RELEASE_ID) + if(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) + + set(CPACK_GENERATOR "DEB") + include(PackageDeb) + else() + set(UNSUPPORTED_PLATFORM_NAME "LSB-based Linux distribution '${LSB_RELEASE_ID}'") + endif() + elseif(EXISTS "/etc/os-release") + file(STRINGS "/etc/os-release" OS_RELEASE_CONTENTS REGEX "^ID=") + string(REGEX MATCH "ID=(.*)" _ ${OS_RELEASE_CONTENTS}) + set(DISTRO_ID ${CMAKE_MATCH_1}) + if(DISTRO_ID STREQUAL "arch") + set(PLATFORM "generic") + set(CPACK_GENERATOR "TXZ") + else() + set(UNSUPPORTED_PLATFORM_NAME "Linux distribution '${DISTRO_ID}' from /etc/os-release") + endif() else() - set(PLATFORM "unknown") - set(CPACK_GENERATOR "TXZ") + set(UNSUPPORTED_PLATFORM_NAME "Linux distribution") + endif() - message(WARNING "Unknown LSB-based Linux distribution '${LSB_RELEASE_ID}' found for packaging; can only pack to a txz. Please consider creating a Pull Request to add support for this distribution.") + if(NOT PLATFORM) + set(PLATFORM "generic") + set(CPACK_GENERATOR "TXZ") + message(WARNING "Unknown ${UNSUPPORTED_PLATFORM_NAME} found for packaging; can only pack to a txz. 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}") |