From 431ef31d58b74e401cf182493bac098c78ae467c Mon Sep 17 00:00:00 2001 From: Vekhir Date: Wed, 31 Jan 2024 21:54:30 +0000 Subject: Enable use of shared libraries Haskell libraries can be linked statically or dynamically. Either way, all packages must be linked the same way. This means that if all dependencies of `xmobar` are shared libraries, then `xmobar` itself must be built using dynamic linking. Therefore, to compile the individual `xmobar` executables, add the `-dynamic` flag to signal that they are built with shared libraries. This flag is put behind an #ifdef to easily configure static vs dynamic linking. To use shared libraries, define SHARED_LIBRARIES --- src/Xmobar/App/Compile.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Xmobar/App/Compile.hs b/src/Xmobar/App/Compile.hs index 80dbac7..368c3e6 100644 --- a/src/Xmobar/App/Compile.hs +++ b/src/Xmobar/App/Compile.hs @@ -167,6 +167,9 @@ recompile confDir dataDir execName force verb = liftIO $ do #endif #ifdef RTSOPTS ++ ["-rtsopts", "-with-rtsopts", "-V0"] +#endif +#ifdef SHARED_LIBRARIES + ++ ["-dynamic"] #endif ++ ["-o", bin] runGHC bin = runProc "ghc" (opts bin) -- cgit v1.2.3