Description: Make the new network-bsd package optional, by implementing the keyword REQUIRED in the check_haskell_package_exists macro
authorGianfranco Costamagna <locutusofborg@debian.org>
Wed, 08 Jul 2020 17:13:42 +0300
changeset 15722 a3d2f69f3ac1
parent 15721 27eb5abd5058
child 15723 f8688e1bcc13
Description: Make the new network-bsd package optional, by implementing the keyword REQUIRED in the check_haskell_package_exists macro Author: Gianfranco Costamagna <locutusofborg@debian.org> Last-Update: 2020-07-08
cmake_modules/CheckHaskellPackageExists.cmake
gameServer/CMakeLists.txt
--- a/cmake_modules/CheckHaskellPackageExists.cmake	Wed Jul 08 17:02:45 2020 +0300
+++ b/cmake_modules/CheckHaskellPackageExists.cmake	Wed Jul 08 17:13:42 2020 +0300
@@ -11,7 +11,7 @@
 # See the License for more information.
 #=============================================================================
 
-macro(CHECK_HASKELL_PACKAGE_EXISTS PACKAGE MODULE FUNCTION PARAMCOUNT)
+macro(CHECK_HASKELL_PACKAGE_EXISTS PACKAGE MODULE FUNCTION PARAMCOUNT REQUIRED)
 # NOTE: MODULE, FUNCTION and PARAMCOUNT are curretly ignored.
 # TODO: Either implement these or drop?
 
@@ -41,7 +41,11 @@
         "Determining if the Haskell package ${PACKAGE} "
         "exists failed with the following output:\n"
         "${BUILD_ERROR}\n\n")
-      message(FATAL_ERROR "Haskell package '${PACKAGE}' required")
+      if("${REQUIRED}" STREQUAL "REQUIRED")
+        message(FATAL_ERROR "Haskell package '${PACKAGE}' required")
+      else()
+        message(STATUS "Haskell package '${PACKAGE}' optionally required, but not found")
+      endif()
     endif()
   endif()
 endmacro()
--- a/gameServer/CMakeLists.txt	Wed Jul 08 17:02:45 2020 +0300
+++ b/gameServer/CMakeLists.txt	Wed Jul 08 17:13:42 2020 +0300
@@ -5,24 +5,24 @@
 
 include(${CMAKE_MODULE_PATH}/CheckHaskellPackageExists.cmake)
 
-check_haskell_package_exists(base "Control.Exception" mask 1)
-check_haskell_package_exists(containers "Data.Map" size 1)
-check_haskell_package_exists(vector "Data.Vector" length 1)
-check_haskell_package_exists(bytestring "Data.ByteString" pack 1)
-check_haskell_package_exists(network "Network.Socket" defaultHints 0)
-check_haskell_package_exists(network-bsd "Network.BSD" getHostName 0)
-check_haskell_package_exists(time "Data.Time" getCurrentTime 0)
-check_haskell_package_exists(mtl "Control.Monad.State" fix 1)
-check_haskell_package_exists(sandi "Codec.Binary.Base64" encode 1)
-check_haskell_package_exists(hslogger "System.Log.Logger" warningM 1)
-check_haskell_package_exists(process "System.Process" createProcess 3)
-check_haskell_package_exists(utf8-string "Data.ByteString.Lazy.UTF8" decode 1)
-check_haskell_package_exists(SHA "Data.Digest.Pure.SHA" sha1 1)
-check_haskell_package_exists(entropy "System.Entropy" openHandle 0)
-check_haskell_package_exists(zlib "Codec.Compression.Zlib" decompress 1)
-check_haskell_package_exists(random "System.Random" getStdGen 0)
-check_haskell_package_exists(regex-tdfa "Text.Regex.TDFA.ByteString" execute 2)
-check_haskell_package_exists(deepseq "Control.DeepSeq" deepseq 2)
+check_haskell_package_exists(base "Control.Exception" mask 1 REQUIRED)
+check_haskell_package_exists(containers "Data.Map" size 1 REQUIRED)
+check_haskell_package_exists(vector "Data.Vector" length 1 REQUIRED)
+check_haskell_package_exists(bytestring "Data.ByteString" pack 1 REQUIRED)
+check_haskell_package_exists(network "Network.Socket" defaultHints 0 REQUIRED)
+check_haskell_package_exists(network-bsd "Network.BSD" getHostName 0 OPTIONAL)
+check_haskell_package_exists(time "Data.Time" getCurrentTime 0 REQUIRED)
+check_haskell_package_exists(mtl "Control.Monad.State" fix 1 REQUIRED)
+check_haskell_package_exists(sandi "Codec.Binary.Base64" encode 1 REQUIRED)
+check_haskell_package_exists(hslogger "System.Log.Logger" warningM 1 REQUIRED)
+check_haskell_package_exists(process "System.Process" createProcess 3 REQUIRED)
+check_haskell_package_exists(utf8-string "Data.ByteString.Lazy.UTF8" decode 1 REQUIRED)
+check_haskell_package_exists(SHA "Data.Digest.Pure.SHA" sha1 1 REQUIRED)
+check_haskell_package_exists(entropy "System.Entropy" openHandle 0 REQUIRED)
+check_haskell_package_exists(zlib "Codec.Compression.Zlib" decompress 1 REQUIRED)
+check_haskell_package_exists(random "System.Random" getStdGen 0 REQUIRED)
+check_haskell_package_exists(regex-tdfa "Text.Regex.TDFA.ByteString" execute 2 REQUIRED)
+check_haskell_package_exists(deepseq "Control.DeepSeq" deepseq 2 REQUIRED)