Skip to content

Commit

Permalink
haskell-xenial: fix potential issue in find script, fix minimum ghc v…
Browse files Browse the repository at this point in the history
…ersion detection for haskell plugins
  • Loading branch information
e1528532 committed Aug 19, 2018
1 parent 73f3624 commit 10f1a77
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
10 changes: 6 additions & 4 deletions cmake/Modules/FindHaskell.cmake
Expand Up @@ -57,10 +57,12 @@ if (GHC-PKG_EXECUTABLE)
OUTPUT_VARIABLE GHC_TARGET_PLATFORM OUTPUT_STRIP_TRAILING_WHITESPACE
)

# correct the mapping..
string (REPLACE "apple-darwin" "osx" GHC_TARGET_PLATFORM ${GHC_TARGET_PLATFORM})
string (REPLACE "unknown-linux" "linux" GHC_TARGET_PLATFORM ${GHC_TARGET_PLATFORM})

# correct the mapping, if there is any
if (GHC_TARGET_PLATFORM)
string (REPLACE "apple-darwin" "osx" GHC_TARGET_PLATFORM ${GHC_TARGET_PLATFORM})
string (REPLACE "unknown-linux" "linux" GHC_TARGET_PLATFORM ${GHC_TARGET_PLATFORM})
endif (GHC_TARGET_PLATFORM)

# normalize the result variables, 0 means success which corresponds to 1 in cmake booleans
if (GHC_HSPEC_FOUND EQUAL 0)
set (GHC_HSPEC_FOUND 1)
Expand Down
30 changes: 18 additions & 12 deletions cmake/Modules/LibAddHaskellPlugin.cmake
Expand Up @@ -53,18 +53,24 @@ macro (add_haskell_plugin target)
if (NOT ENABLE_ASAN)
if (PLUGINPROCESS_FOUND)
if (HASKELL_FOUND)
check_binding_included ("haskell" HAVE_HASKELL_BINDING)
if (HAVE_HASKELL_BINDING)
if (BUILD_SHARED)
prepare_and_compile_haskell_plugin (${target}
${PLUGIN_NAME}
${PLUGIN_NAME_CAPITALIZED}
${ARG_SANDBOX_ADD_SOURCES}
${ARG_ADDITIONAL_SOURCES})
endif (BUILD_SHARED)
else (HAVE_HASKELL_BINDING)
remove_plugin (${target} "haskell bindings are not included in the cmake configuration")
endif (HAVE_HASKELL_BINDING)
set (GHC_MIN_VERSION "8.0.1")
if (NOT GHC_VERSION VERSION_LESS ${GHC_MIN_VERSION})
check_binding_included ("haskell" HAVE_HASKELL_BINDING)
if (HAVE_HASKELL_BINDING)
if (BUILD_SHARED)
prepare_and_compile_haskell_plugin (${target}
${PLUGIN_NAME}
${PLUGIN_NAME_CAPITALIZED}
${ARG_SANDBOX_ADD_SOURCES}
${ARG_ADDITIONAL_SOURCES})
endif (BUILD_SHARED)
else (HAVE_HASKELL_BINDING)
remove_plugin (${target}
"haskell bindings are not included in the cmake configuration")
endif (HAVE_HASKELL_BINDING)
else (NOT GHC_VERSION VERSION_LESS ${GHC_MIN_VERSION})
remove_plugin (${target} "ghc: ${GHC_VERSION} found, but ${GHC_MIN_VERSION} required")
endif (NOT GHC_VERSION VERSION_LESS ${GHC_MIN_VERSION})
else (HASKELL_FOUND)
remove_plugin (${target} ${HASKELL_NOTFOUND_INFO})
endif (HASKELL_FOUND)
Expand Down

0 comments on commit 10f1a77

Please sign in to comment.