aboutsummaryrefslogtreecommitdiff
path: root/Setup.hs
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2024-02-09 12:24:23 -0700
committerJosh Rahm <rahm@google.com>2024-02-09 12:24:23 -0700
commitebde8665851ca21ff00685eeaf5057ccec6eb05d (patch)
treebb5b38f048846d8196b5a12b270b2e87d6717d5e /Setup.hs
parentdc9c17145c8774738d8b1c395d8796aabfcb828c (diff)
downloadwetterhorn-ebde8665851ca21ff00685eeaf5057ccec6eb05d.tar.gz
wetterhorn-ebde8665851ca21ff00685eeaf5057ccec6eb05d.tar.bz2
wetterhorn-ebde8665851ca21ff00685eeaf5057ccec6eb05d.zip
Setup now builds wlroots in the .stack-work directory.
Diffstat (limited to 'Setup.hs')
-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