Skip to content

Commit

Permalink
Flag to disable effects
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBessai committed Mar 24, 2013
1 parent 81865b4 commit b68a1a7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 16 deletions.
39 changes: 25 additions & 14 deletions Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ cleanJavaLib verbosity
execPomExists <- doesFileExist ("java" </> "executable_pom.xml")
when pomExists $ removeFile ("java" </> "executable_pom.xml")

installStdLib pkg local verbosity copy
installStdLib pkg local withoutEffects verbosity copy
= do let dirs = L.absoluteInstallDirs pkg local copy
let idir = datadir dirs
let icmd = idrisCmd local
Expand All @@ -54,11 +54,12 @@ installStdLib pkg local verbosity copy
, "TARGET=" ++ idir
, "IDRIS=" ++ icmd
]
make verbosity
[ "-C", "effects", "install"
, "TARGET=" ++ idir
, "IDRIS=" ++ icmd
]
unless withoutEffects $
make verbosity
[ "-C", "effects", "install"
, "TARGET=" ++ idir
, "IDRIS=" ++ icmd
]
let idirRts = idir </> "rts"
putStrLn $ "Installing run time system in " ++ idirRts
make verbosity
Expand Down Expand Up @@ -93,17 +94,18 @@ removeLibIdris local verbosity
, "IDRIS=" ++ icmd
]

checkStdLib local verbosity
checkStdLib local withoutEffects verbosity
= do let icmd = idrisCmd local
putStrLn $ "Building libraries..."
make verbosity
[ "-C", "lib", "check"
, "IDRIS=" ++ icmd
]
make verbosity
[ "-C", "effects", "check"
, "IDRIS=" ++ icmd
]
unless withoutEffects $
make verbosity
[ "-C", "effects", "check"
, "IDRIS=" ++ icmd
]
make verbosity
[ "-C", "rts", "check"
, "IDRIS=" ++ icmd
Expand All @@ -117,6 +119,12 @@ javaFlag flags =
Just False -> False
Nothing -> False

noEffectsFlag flags =
case lookup (FlagName "noeffects") (S.configConfigurationsFlags flags) of
Just True -> True
Just False -> False
Nothing -> False

preparePoms version
= do pomTemplate <- TIO.readFile ("java" </> "pom_template.xml")
TIO.writeFile ("java" </> "pom.xml") (insertVersion pomTemplate)
Expand All @@ -132,11 +140,13 @@ main = do
defaultMainWithHooks $ simpleUserHooks
{ postCopy = \ _ flags pkg lbi -> do
let verb = S.fromFlag $ S.copyVerbosity flags
installStdLib pkg lbi verb
let withoutEffects = noEffectsFlag $ configFlags lbi
installStdLib pkg lbi withoutEffects verb
(S.fromFlag $ S.copyDest flags)
, postInst = \ _ flags pkg lbi -> do
let verb = (S.fromFlag $ S.installVerbosity flags)
installStdLib pkg lbi verb
let withoutEffects = noEffectsFlag $ configFlags lbi
installStdLib pkg lbi withoutEffects verb
NoCopyDest
when (javaFlag $ configFlags lbi)
(installJavaLib pkg
Expand All @@ -155,6 +165,7 @@ main = do
cleanJavaLib verb
, postBuild = \ _ flags _ lbi -> do
let verb = S.fromFlag $ S.buildVerbosity flags
checkStdLib lbi verb
let withoutEffects = noEffectsFlag $ configFlags lbi
checkStdLib lbi withoutEffects verb
when (javaFlag $ configFlags lbi) (checkJavaLib verb)
}
5 changes: 4 additions & 1 deletion config.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
GMP_INCLUDE_DIR :=
CC :=gcc
CABAL :=cabal
CABALFLAGS :=
#CABALFLAGS :=
## Enable Java RTS:
#CABALFLAGS :=-f Java
## Disable building of Effects
CABALFLAGS :=-f NoEffects

5 changes: 4 additions & 1 deletion idris.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Extra-source-files: lib/Makefile lib/*.idr lib/Prelude/*.idr
config.mk
rts/*.c rts/*.h rts/Makefile
js/*.js
java/org/idris/rts/*.java
java/org/idris/rts/*.java

source-repository head
type: git
Expand All @@ -75,6 +75,9 @@ Flag Java
Description: Build the Java RTS
Default: False

Flag NoEffects
Description: Do not build the effects package
Default: False

Executable idris
Main-is: Main.hs
Expand Down

0 comments on commit b68a1a7

Please sign in to comment.