on master help sign in
#3171: Use *_HOST_OS instead of flags defined in idris.cabal.
commitb20cff5a6fb2dffb905f568dd190e26fcfddfe86 authorEduard Nicodei <eddnicodei@gmail.com> dateMon 16 May 2016, 12:10 (10 years ago) parent0917cf8
3 files changed+8−13
idris.cabal−5 src/IRTS/System.hs+1−1 src/Util/DynamicLinker.hs+7−7
idris.cabal−5
@@ -1090,19 +1090,14 @@ Library
10901090 ghc-prof-options: -auto-all -caf-all
10911091
10921092 if os(linux)
1093− cpp-options: -DLINUX
10941093 build-depends: unix < 2.8
10951094 if os(freebsd)
1096− cpp-options: -DFREEBSD
10971095 build-depends: unix < 2.8
10981096 if os(dragonfly)
1099− cpp-options: -DDRAGONFLY
11001097 build-depends: unix < 2.8
11011098 if os(darwin)
1102− cpp-options: -DMACOSX
11031099 build-depends: unix < 2.8
11041100 if os(windows)
1105− cpp-options: -DWINDOWS
11061101 build-depends: Win32 < 2.4
11071102 if flag(FFI)
11081103 build-depends: libffi < 0.2
src/IRTS/System.hs+1−1
@@ -29,7 +29,7 @@ getEnvFlags = maybe [] (splitOn " ") <$> lookupEnv "IDRIS_CFLAGS"
2929getTargetDir :: IO String
3030getTargetDir = overrideDataDirWith "TARGET"
3131
32−#if defined(FREEBSD) || defined(DRAGONFLY)
32+#if defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS)
3333extraLib = ["-L/usr/local/lib"]
3434extraInclude = ["-I/usr/local/include"]
3535#else
src/Util/DynamicLinker.hs+7−7
@@ -7,7 +7,7 @@ module Util.DynamicLinker (ForeignFun(..), DynamicLib(..), tryLoadLib, tryLoadFn
77import Foreign.LibFFI
88import Foreign.Ptr (Ptr(), nullPtr, FunPtr, nullFunPtr, castPtrToFunPtr)
99import System.Directory
10−#ifndef WINDOWS
10+#ifndef mingw32_HOST_OS
1111import System.Posix.DynamicLinker
1212import System.FilePath.Posix ((</>))
1313#else
@@ -19,15 +19,15 @@ type DL = HMODULE
1919#endif
2020
2121hostDynamicLibExt :: String
22−#ifdef LINUX
22+#ifdef linux_HOST_OS
2323hostDynamicLibExt = "so"
24−#elif MACOSX
24+#elif darwin_HOST_OS
2525hostDynamicLibExt = "dylib"
26−#elif WINDOWS
26+#elif mingw32_HOST_OS
2727hostDynamicLibExt = "dll"
28−#elif FREEBSD
28+#elif freebsd_HOST_OS
2929hostDynamicLibExt = "so"
30−#elif DRAGONFLY
30+#elif dragonfly_HOST_OS
3131hostDynamicLibExt = "so"
3232#else
3333hostDynamicLibExt = error $ unwords
@@ -61,7 +61,7 @@ libFileName dirs lib = do let names = [lib, lib ++ "." ++ hostDynamicLibExt]
6161 map ("."</>) names ++ [d </> f | d <- cwd:dirs, f <- names]
6262 return $ maybe (lib ++ "." ++ hostDynamicLibExt) id found
6363
64−#ifndef WINDOWS
64+#ifndef mingw32_HOST_OS
6565tryLoadLib :: [FilePath] -> String -> IO (Maybe DynamicLib)
6666tryLoadLib dirs lib = do filename <- libFileName dirs lib
6767 handle <- dlopen filename [RTLD_NOW, RTLD_GLOBAL]