aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Setup.hs19
1 files changed, 12 insertions, 7 deletions
diff --git a/Setup.hs b/Setup.hs
index 6a28ba8..6fc3581 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -8,18 +8,20 @@ import System.FilePath
import System.Posix.Files (createSymbolicLink, removeLink)
import System.Process
import Text.Printf
+import Data.Maybe (fromJust)
main = do
defaultMainWithHooks $
simpleUserHooks
- { preConf = \_ _ -> do
- callCommand "cd wlroots && meson setup build -Dexamples=false --reconfigure"
+ { preConf = \_ conf -> do
+ let path = fromJust (flagToMaybe $ configDistPref conf)
+ callCommand $
+ printf "cd wlroots && meson setup %s -Dexamples=false --reconfigure" (wlrootsDir path)
return emptyHookedBuildInfo,
- preBuild = \_ _ -> do
- callCommand "cd wlroots && ninja -C build"
+ preBuild = \_ conf -> do
+ let path = fromJust (flagToMaybe $ buildDistPref conf)
+ callCommand $ printf "cd wlroots && ninja -C %s" (wlrootsDir path)
return emptyHookedBuildInfo,
- cleanHook = \_ _ _ _ -> do
- callCommand "cd wlroots && ninja -C build clean",
postCopy = \a f pd _ -> do
forM_ (flagToMaybe (copyDistPref f)) $ \copyDest -> do
let harnessFile = copyDest </> "build" </> "wtr_harness" </> "wtr_harness"
@@ -29,7 +31,10 @@ main = do
lnF pluginFile "wtr.so"
}
where
+ wlrootsDir :: String -> String
+ wlrootsDir = printf "../%s/build/wlroots"
+
lnF from to = do
- printf "%s -> %s" from to
+ printf "%s -> %s\n" from to
flip when (removeLink to) =<< doesFileExist to
createSymbolicLink from to