on master help sign in
#3171: Use *_HOST_OS instead of flags defined in idris.cabal.
b20cff5Eduard Nicodei
idris.cabal−5
@@ -1090,19 +1090,14 @@ Library
1090 ghc-prof-options: -auto-all -caf-all
1090 ghc-prof-options: -auto-all -caf-all
1091
1091
1092 if os(linux)
1092 if os(linux)
1093− cpp-options: -DLINUX
1094 build-depends: unix < 2.8
1093 build-depends: unix < 2.8
1095 if os(freebsd)
1094 if os(freebsd)
1096− cpp-options: -DFREEBSD
1097 build-depends: unix < 2.8
1095 build-depends: unix < 2.8
1098 if os(dragonfly)
1096 if os(dragonfly)
1099− cpp-options: -DDRAGONFLY
1100 build-depends: unix < 2.8
1097 build-depends: unix < 2.8
1101 if os(darwin)
1098 if os(darwin)
1102− cpp-options: -DMACOSX
1103 build-depends: unix < 2.8
1099 build-depends: unix < 2.8
1104 if os(windows)
1100 if os(windows)
1105− cpp-options: -DWINDOWS
1106 build-depends: Win32 < 2.4
1101 build-depends: Win32 < 2.4
1107 if flag(FFI)
1102 if flag(FFI)
1108 build-depends: libffi < 0.2
1103 build-depends: libffi < 0.2
src/IRTS/System.hs+1−1
@@ -29,7 +29,7 @@ getEnvFlags = maybe [] (splitOn " ") <$> lookupEnv "IDRIS_CFLAGS"
29getTargetDir :: IO String
29getTargetDir :: IO String
30getTargetDir = overrideDataDirWith "TARGET"
30getTargetDir = overrideDataDirWith "TARGET"
31
31
32−#if defined(FREEBSD) || defined(DRAGONFLY)
32+#if defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS)
33extraLib = ["-L/usr/local/lib"]
33extraLib = ["-L/usr/local/lib"]
34extraInclude = ["-I/usr/local/include"]
34extraInclude = ["-I/usr/local/include"]
35#else
35#else
src/Util/DynamicLinker.hs+7−7
@@ -7,7 +7,7 @@ module Util.DynamicLinker (ForeignFun(..), DynamicLib(..), tryLoadLib, tryLoadFn
7import Foreign.LibFFI
7import Foreign.LibFFI
8import Foreign.Ptr (Ptr(), nullPtr, FunPtr, nullFunPtr, castPtrToFunPtr)
8import Foreign.Ptr (Ptr(), nullPtr, FunPtr, nullFunPtr, castPtrToFunPtr)
9import System.Directory
9import System.Directory
10−#ifndef WINDOWS
10+#ifndef mingw32_HOST_OS
11import System.Posix.DynamicLinker
11import System.Posix.DynamicLinker
12import System.FilePath.Posix ((</>))
12import System.FilePath.Posix ((</>))
13#else
13#else
@@ -19,15 +19,15 @@ type DL = HMODULE
19#endif
19#endif
20
20
21hostDynamicLibExt :: String
21hostDynamicLibExt :: String
22−#ifdef LINUX
22+#ifdef linux_HOST_OS
23hostDynamicLibExt = "so"
23hostDynamicLibExt = "so"
24−#elif MACOSX
24+#elif darwin_HOST_OS
25hostDynamicLibExt = "dylib"
25hostDynamicLibExt = "dylib"
26−#elif WINDOWS
26+#elif mingw32_HOST_OS
27hostDynamicLibExt = "dll"
27hostDynamicLibExt = "dll"
28−#elif FREEBSD
28+#elif freebsd_HOST_OS
29hostDynamicLibExt = "so"
29hostDynamicLibExt = "so"
30−#elif DRAGONFLY
30+#elif dragonfly_HOST_OS
31hostDynamicLibExt = "so"
31hostDynamicLibExt = "so"
32#else
32#else
33hostDynamicLibExt = error $ unwords
33hostDynamicLibExt = error $ unwords
@@ -61,7 +61,7 @@ libFileName dirs lib = do let names = [lib, lib ++ "." ++ hostDynamicLibExt]
61 map ("."</>) names ++ [d </> f | d <- cwd:dirs, f <- names]
61 map ("."</>) names ++ [d </> f | d <- cwd:dirs, f <- names]
62 return $ maybe (lib ++ "." ++ hostDynamicLibExt) id found
62 return $ maybe (lib ++ "." ++ hostDynamicLibExt) id found
63
63
64−#ifndef WINDOWS
64+#ifndef mingw32_HOST_OS
65tryLoadLib :: [FilePath] -> String -> IO (Maybe DynamicLib)
65tryLoadLib :: [FilePath] -> String -> IO (Maybe DynamicLib)
66tryLoadLib dirs lib = do filename <- libFileName dirs lib
66tryLoadLib dirs lib = do filename <- libFileName dirs lib
67 handle <- dlopen filename [RTLD_NOW, RTLD_GLOBAL]
67 handle <- dlopen filename [RTLD_NOW, RTLD_GLOBAL]