diff options
author | Patric Stout <truebrain@openttd.org> | 2020-12-21 21:32:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-21 21:32:29 +0100 |
commit | 0c3ddc5436a28051aab41b100fa9cacfa1b3907c (patch) | |
tree | dc9ec5291b44ed7d6b6c024ca35c44c5de08fe94 /cmake | |
parent | f24bc8b509dc6148c355dfd7e3a393ea78cc7cef (diff) | |
download | openttd-0c3ddc5436a28051aab41b100fa9cacfa1b3907c.tar.xz |
Fix: support non-ubuntu/debian Linux variants with LSB support (#8408)
This now generates a warning, as we would still like people to
make a Pull Request to support the target. But it does continue
with packing to a txz.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/InstallAndPackage.cmake | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/cmake/InstallAndPackage.cmake b/cmake/InstallAndPackage.cmake index 53b6ce3e2..3f33f699e 100644 --- a/cmake/InstallAndPackage.cmake +++ b/cmake/InstallAndPackage.cmake @@ -114,31 +114,38 @@ elseif(UNIX) # With FHS, we can create deb/rpm/... Without it, they would be horribly broken # and not work. The other way around is also true; with FHS they are not # usable, and only flat formats work. - if(OPTION_INSTALL_FHS) - set(CPACK_GENERATOR "DEB") - include(PackageDeb) - else() + if(NOT OPTION_INSTALL_FHS) set(CPACK_GENERATOR "TXZ") - endif() - - 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 + else() + find_program(LSB_RELEASE_EXEC lsb_release) + execute_process(COMMAND ${LSB_RELEASE_EXEC} -is + OUTPUT_VARIABLE LSB_RELEASE_ID 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.") + 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) + else() + set(PLATFORM "unknown") + set(CPACK_GENERATOR "TXZ") + + 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.") + endif() + + set(CPACK_PACKAGE_FILE_NAME "openttd-#CPACK_PACKAGE_VERSION#-linux-${PLATFORM}-${CPACK_SYSTEM_NAME}") 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() |