aboutsummaryrefslogtreecommitdiff
path: root/Setup.hs
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2025-03-11 12:13:07 -0600
committerJosh Rahm <rahm@google.com>2025-03-11 12:13:07 -0600
commitb0ac29dc21a8ccd95a269c82d9eda47392c084a4 (patch)
tree18a46e69d5fba070ad05c562123392171c4b166f /Setup.hs
parent0a7f561f3821968605c16a03ea278e3611b6c775 (diff)
downloadmontis-b0ac29dc21a8ccd95a269c82d9eda47392c084a4.tar.gz
montis-b0ac29dc21a8ccd95a269c82d9eda47392c084a4.tar.bz2
montis-b0ac29dc21a8ccd95a269c82d9eda47392c084a4.zip
Update to wlroots 0.18.
Diffstat (limited to 'Setup.hs')
-rw-r--r--Setup.hs23
1 files changed, 15 insertions, 8 deletions
diff --git a/Setup.hs b/Setup.hs
index f3a2180..e8a6b6b 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -1,14 +1,15 @@
+import Control.Exception
import Control.Monad (forM_, when)
+import Data.Maybe (fromJust)
import Distribution.Simple
import Distribution.Simple.Setup
import Distribution.Types.HookedBuildInfo
import System.Directory
import System.Environment (getArgs)
import System.FilePath
-import System.Posix.Files (createSymbolicLink, removeLink)
+import System.Posix.Files
import System.Process
import Text.Printf
-import Data.Maybe (fromJust)
main = do
putStrLn "Running Setup.hs"
@@ -19,10 +20,10 @@ main = do
let buildPath = fromJust (flagToMaybe $ configDistPref conf)
callCommand $
- printf "cd wlroots && meson setup %s -Dexamples=false -Dbackends=x11,drm,libinput --reconfigure" (wlrootsDir buildPath)
+ printf "cd wlroots && meson setup %s -Dexamples=false -Dbackends=x11,drm,libinput --reconfigure" (wlrootsDir buildPath)
callCommand $
- printf "cmake -B %s -S harness" (harnessDir buildPath)
+ printf "cmake -B %s -S harness" (harnessDir buildPath)
lnF ("../" ++ harnessDir buildPath) "harness/build"
@@ -33,14 +34,13 @@ main = do
callCommand $ printf "cd wlroots && ninja -C %s" (wlrootsDir path)
callCommand $
- printf "make -C %s" (harnessDir path)
+ printf "make -C %s" (harnessDir path)
lnF (printf "%s/wtr_harness" (harnessDir path)) "wtr_harness"
return emptyHookedBuildInfo,
postCopy = \a f pd _ -> do
forM_ (flagToMaybe (copyDistPref f)) $ \copyDest -> do
-
let pluginFile = copyDest </> "build" </> "wtr.so" </> "wtr.so"
lnF pluginFile "wtr.so"
}
@@ -53,10 +53,17 @@ main = do
lnF from to = do
printf "%s -> %s\n" from to
- flip when (removeLink to) =<< doesExist to
+ flip
+ when
+ ( do
+ printf "Removing %s." to
+ removeLink to
+ )
+ =<< doesExist to
createSymbolicLink from to
doesExist f = do
b1 <- doesFileExist f
b2 <- doesDirectoryExist f
- return (b1 || b2)
+ b3 <- catch (pathIsSymbolicLink f) (\(e :: SomeException) -> return False)
+ return (b1 || b2 || b3)