on master help sign in
Remove dynamically loaded RTS due to 32/64-bit issues on OS X
commitcf9d50faee75a14de8173278d2c167f9dc0f1b52 authorDavid Christiansen <david@davidchristiansen.dk> dateMon 8 Apr 2013, 15:19 (14 years ago) parentecd9ead
9 files changed+9−82
Setup.hs−14 effects/Makefile+4−4 lib/Makefile+3−3 rts/Makefile+1−15 rts/idris_stdfgn.c−24 rts/idris_stdfgn.h−1 src/Idris/AbsSyntaxTree.hs−1 src/Idris/REPL.hs+1−6 src/Main.hs−14
Setup.hs−14
@@ -56,14 +56,12 @@ installStdLib pkg local withoutEffects verbosity copy
5656 [ "-C", "lib", "install"
5757 , "TARGET=" ++ idir
5858 , "IDRIS=" ++ icmd
59− , "RTS=" ++ rtsDir local
6059 ]
6160 unless withoutEffects $
6261 make verbosity
6362 [ "-C", "effects", "install"
6463 , "TARGET=" ++ idir
6564 , "IDRIS=" ++ icmd
66− , "RTS=" ++ rtsDir local
6765 ]
6866 let idirRts = idir </> "rts"
6967 putStrLn $ "Installing run time system in " ++ idirRts
@@ -71,7 +69,6 @@ installStdLib pkg local withoutEffects verbosity copy
7169 [ "-C", "rts", "install"
7270 , "TARGET=" ++ idirRts
7371 , "IDRIS=" ++ icmd
74− , "RTS=" ++ rtsDir local
7572 ]
7673
7774installJavaLib pkg local verbosity copy version = do
@@ -106,26 +103,17 @@ checkStdLib local withoutEffects verbosity
106103 make verbosity
107104 [ "-C", "lib", "check"
108105 , "IDRIS=" ++ icmd
109− , "RTS=" ++ rtsDir local
110106 ]
111107 unless withoutEffects $
112108 make verbosity
113109 [ "-C", "effects", "check"
114110 , "IDRIS=" ++ icmd
115− , "RTS=" ++ rtsDir local
116111 ]
117112 make verbosity
118113 [ "-C", "rts", "check"
119114 , "IDRIS=" ++ icmd
120115 ]
121116
122−buildRTS dir verbosity
123− = do putStrLn "Building RTS..."
124− make verbosity
125− [ "-C", "rts", "build"
126− , "DIST=../" ++ dir
127− ]
128−
129117checkJavaLib verbosity = mvn verbosity [ "-f", "java" </> "pom.xml", "package" ]
130118
131119javaFlag flags =
@@ -180,8 +168,6 @@ main = do
180168 cleanJavaLib verb
181169 , postBuild = \ _ flags _ lbi -> do
182170 let verb = S.fromFlag $ S.buildVerbosity flags
183− let distdir = buildDir lbi
184− buildRTS distdir verb
185171 let withoutEffects = noEffectsFlag $ configFlags lbi
186172 checkStdLib lbi withoutEffects verb
187173 when (javaFlag $ configFlags lbi) (checkJavaLib verb)
effects/Makefile+4−4
@@ -1,13 +1,13 @@
11
22check: .PHONY
3− $(IDRIS) --dynamicrts $(RTS) --build effects.ipkg
3+ $(IDRIS) --build effects.ipkg
44
55recheck: clean check
66
7−install:
8− $(IDRIS) --dynamicrts $(RTS) --install effects.ipkg
7+install:
8+ $(IDRIS) --install effects.ipkg
99
1010clean: .PHONY
11− $(IDRIS) --dynamicrts $(RTS) --clean effects.ipkg
11+ $(IDRIS) --clean effects.ipkg
1212
1313.PHONY:
lib/Makefile+3−3
@@ -1,14 +1,14 @@
11
22check: .PHONY
3− $(IDRIS) --dynamicrts $(RTS) --build base.ipkg
3+ $(IDRIS) --build base.ipkg
44
55recheck: clean check
66
77install:
8− $(IDRIS) --dynamicrts $(RTS) --install base.ipkg
8+ $(IDRIS) --install base.ipkg
99
1010clean: .PHONY
11− $(IDRIS) --dynamicrts $(RTS) --clean base.ipkg
11+ $(IDRIS) --clean base.ipkg
1212
1313linecount: .PHONY
1414 wc -l *.idr Network/*.idr Language/*.idr Prelude/*.idr Data/*.idr Control/Monad/*.idr Control/*.idr
rts/Makefile+1−15
@@ -8,13 +8,7 @@ ifneq ($(GMP_INCLUDE_DIR),)
88 CFLAGS += -isystem $(GMP_INCLUDE_DIR)
99endif
1010
11−# Build a fat lib on Mac OS X
12−ifeq ($(OS),darwin)
13− CFLAGS += -arch $(shell ghc -e System.Info.arch | tr -d '"')
14−endif
15−
1611LIBTARGET = libidris_rts.a
17−DYLIBTARGET = libidris_rts$(SHLIB_SUFFIX)
1812
1913check : $(LIBTARGET) $(DYLIBTARGET)
2014
@@ -22,17 +16,9 @@ $(LIBTARGET) : $(OBJS)
2216 ar r $(LIBTARGET) $(OBJS)
2317 ranlib $(LIBTARGET)
2418
25−$(DYLIBTARGET) : $(OBJS)
26− $(CC) $(CFLAGS) -lgmp -shared -o $(DYLIBTARGET) $(OBJS)
27−
28−build: $(DYLIBTARGET)
29− mkdir -p $(DIST)/rts
30− install $(DYLIBTARGET) $(DIST)/rts
31−
32−
3319install : .PHONY
3420 mkdir -p $(TARGET)
35− install $(LIBTARGET) $(DYLIBTARGET) $(HDRS) $(TARGET)
21+ install $(LIBTARGET) $(HDRS) $(TARGET)
3622
3723clean : .PHONY
3824 rm -f $(OBJS) $(LIBTARGET) $(DYLIBTARGET)
rts/idris_stdfgn.c−24
@@ -25,30 +25,6 @@ int fileError(void* h) {
2525 return ferror(f);
2626}
2727
28−char* freadStr(void* h) {
29− FILE* f = (FILE*)h;
30− char* str;
31− printf("foo");
32− if (f != NULL) {
33− fseek(f, 0L, SEEK_END);
34− size_t size = ftell(f);
35− rewind(f);
36− printf("bar");
37− str = malloc(size + sizeof(char));
38− if (str != NULL && fread(str, size, 1, f)) {
39− (*(str + size)) = '\0';
40− printf("asf");
41− } else {
42− printf("Failed to allocate string from file\n");
43− exit(1);
44− }
45− } else {
46− str = malloc(sizeof(char));
47− str[0] = '\0';
48− }
49− return str;
50−}
51−
5228void fputStr(void* h, char* str) {
5329 FILE* f = (FILE*)h;
5430 fputs(str, f);
rts/idris_stdfgn.h−1
@@ -8,7 +8,6 @@ void putStr(char* str);
88
99void* fileOpen(char* f, char* mode);
1010void fileClose(void* h);
11−char* freadStr(void* h);
1211void fputStr(void*h, char* str);
1312
1413int isNull(void* ptr);
src/Idris/AbsSyntaxTree.hs−1
@@ -232,7 +232,6 @@ data Opt = Filename String
232232 | UseTarget Target
233233 | OutputTy OutputType
234234 | Extension LanguageExt
235− | DynamicRTS FilePath
236235 deriving (Show, Eq)
237236
238237-- Parsed declarations
src/Idris/REPL.hs+1−6
@@ -496,7 +496,6 @@ parseArgs ("--dumpdefuns":n:ns) = DumpDefun n : (parseArgs ns)
496496parseArgs ("--dumpcases":n:ns) = DumpCases n : (parseArgs ns)
497497parseArgs ("--target":n:ns) = UseTarget (parseTarget n) : (parseArgs ns)
498498parseArgs ("-XTypeProviders":ns) = Extension TypeProviders : (parseArgs ns)
499−parseArgs ("--dynamicrts":f:ns) = DynamicRTS f : (parseArgs ns)
500499parseArgs (n:ns) = Filename n : (parseArgs ns)
501500
502501helphead =
@@ -637,12 +636,8 @@ getLanguageExt :: Opt -> Maybe LanguageExt
637636getLanguageExt (Extension e) = Just e
638637getLanguageExt _ = Nothing
639638
640−getDynamicRTS :: Opt -> Maybe FilePath
641−getDynamicRTS (DynamicRTS f) = Just f
642−getDynamicRTS _ = Nothing
643−
644639opt :: (Opt -> Maybe a) -> [Opt] -> [a]
645−opt = mapMaybe
640+opt = mapMaybe
646641
647642ver = showVersion version
648643
src/Main.hs−14
@@ -49,7 +49,6 @@ runIdris opts = do
4949 when (ShowIncs `elem` opts) $ liftIO showIncs
5050 when (ShowLibs `elem` opts) $ liftIO showLibs
5151 when (ShowLibdir `elem` opts) $ liftIO showLibdir
52− loadRTS opts
5352 case opt getPkgClean opts of
5453 [] -> return ()
5554 fs -> do liftIO $ mapM_ cleanPkg fs
@@ -97,17 +96,4 @@ usagemsg = "Idris version " ++ ver ++ "\n" ++
9796 "\t--include Show C include directories and exit (for C linking)\n" ++
9897 "\t--target [target] Type the target: C, Java, bytecode, javascript, node\n"
9998
100−-- | Attempt to load the RTS as a shared lib in the interpreter
101−loadRTS :: [Opt] -> Idris ()
102−loadRTS opts = (flip idrisCatch) (\e -> iputStrLn (show e)) $
103− do rtslib <- liftIO $
104− case listToMaybe . catMaybes . map getDynamicRTS $ opts of
105− Just path -> return path
106− Nothing -> getDataFileName ("rts" </> "libidris_rts")
107− handle <- liftIO (tryLoadLib rtslib)
108− case handle of
109− Nothing -> return ()
110− Just x -> do i <- getIState
111− let libs = idris_dynamic_libs i
112− putIState $ i { idris_dynamic_libs = x:libs }
11399