mirror of
https://github.com/ilyakooo0/Idris-dev.git
synced 2024-09-22 14:38:20 +03:00
Remove dynamically loaded RTS due to 32/64-bit issues on OS X
This commit is contained in:
parent
ecd9ead0ce
commit
cf9d50faee
14
Setup.hs
14
Setup.hs
@ -56,14 +56,12 @@ installStdLib pkg local withoutEffects verbosity copy
|
||||
[ "-C", "lib", "install"
|
||||
, "TARGET=" ++ idir
|
||||
, "IDRIS=" ++ icmd
|
||||
, "RTS=" ++ rtsDir local
|
||||
]
|
||||
unless withoutEffects $
|
||||
make verbosity
|
||||
[ "-C", "effects", "install"
|
||||
, "TARGET=" ++ idir
|
||||
, "IDRIS=" ++ icmd
|
||||
, "RTS=" ++ rtsDir local
|
||||
]
|
||||
let idirRts = idir </> "rts"
|
||||
putStrLn $ "Installing run time system in " ++ idirRts
|
||||
@ -71,7 +69,6 @@ installStdLib pkg local withoutEffects verbosity copy
|
||||
[ "-C", "rts", "install"
|
||||
, "TARGET=" ++ idirRts
|
||||
, "IDRIS=" ++ icmd
|
||||
, "RTS=" ++ rtsDir local
|
||||
]
|
||||
|
||||
installJavaLib pkg local verbosity copy version = do
|
||||
@ -106,26 +103,17 @@ checkStdLib local withoutEffects verbosity
|
||||
make verbosity
|
||||
[ "-C", "lib", "check"
|
||||
, "IDRIS=" ++ icmd
|
||||
, "RTS=" ++ rtsDir local
|
||||
]
|
||||
unless withoutEffects $
|
||||
make verbosity
|
||||
[ "-C", "effects", "check"
|
||||
, "IDRIS=" ++ icmd
|
||||
, "RTS=" ++ rtsDir local
|
||||
]
|
||||
make verbosity
|
||||
[ "-C", "rts", "check"
|
||||
, "IDRIS=" ++ icmd
|
||||
]
|
||||
|
||||
buildRTS dir verbosity
|
||||
= do putStrLn "Building RTS..."
|
||||
make verbosity
|
||||
[ "-C", "rts", "build"
|
||||
, "DIST=../" ++ dir
|
||||
]
|
||||
|
||||
checkJavaLib verbosity = mvn verbosity [ "-f", "java" </> "pom.xml", "package" ]
|
||||
|
||||
javaFlag flags =
|
||||
@ -180,8 +168,6 @@ main = do
|
||||
cleanJavaLib verb
|
||||
, postBuild = \ _ flags _ lbi -> do
|
||||
let verb = S.fromFlag $ S.buildVerbosity flags
|
||||
let distdir = buildDir lbi
|
||||
buildRTS distdir verb
|
||||
let withoutEffects = noEffectsFlag $ configFlags lbi
|
||||
checkStdLib lbi withoutEffects verb
|
||||
when (javaFlag $ configFlags lbi) (checkJavaLib verb)
|
||||
|
@ -1,13 +1,13 @@
|
||||
|
||||
check: .PHONY
|
||||
$(IDRIS) --dynamicrts $(RTS) --build effects.ipkg
|
||||
$(IDRIS) --build effects.ipkg
|
||||
|
||||
recheck: clean check
|
||||
|
||||
install:
|
||||
$(IDRIS) --dynamicrts $(RTS) --install effects.ipkg
|
||||
install:
|
||||
$(IDRIS) --install effects.ipkg
|
||||
|
||||
clean: .PHONY
|
||||
$(IDRIS) --dynamicrts $(RTS) --clean effects.ipkg
|
||||
$(IDRIS) --clean effects.ipkg
|
||||
|
||||
.PHONY:
|
||||
|
@ -1,14 +1,14 @@
|
||||
|
||||
check: .PHONY
|
||||
$(IDRIS) --dynamicrts $(RTS) --build base.ipkg
|
||||
$(IDRIS) --build base.ipkg
|
||||
|
||||
recheck: clean check
|
||||
|
||||
install:
|
||||
$(IDRIS) --dynamicrts $(RTS) --install base.ipkg
|
||||
$(IDRIS) --install base.ipkg
|
||||
|
||||
clean: .PHONY
|
||||
$(IDRIS) --dynamicrts $(RTS) --clean base.ipkg
|
||||
$(IDRIS) --clean base.ipkg
|
||||
|
||||
linecount: .PHONY
|
||||
wc -l *.idr Network/*.idr Language/*.idr Prelude/*.idr Data/*.idr Control/Monad/*.idr Control/*.idr
|
||||
|
16
rts/Makefile
16
rts/Makefile
@ -8,13 +8,7 @@ ifneq ($(GMP_INCLUDE_DIR),)
|
||||
CFLAGS += -isystem $(GMP_INCLUDE_DIR)
|
||||
endif
|
||||
|
||||
# Build a fat lib on Mac OS X
|
||||
ifeq ($(OS),darwin)
|
||||
CFLAGS += -arch $(shell ghc -e System.Info.arch | tr -d '"')
|
||||
endif
|
||||
|
||||
LIBTARGET = libidris_rts.a
|
||||
DYLIBTARGET = libidris_rts$(SHLIB_SUFFIX)
|
||||
|
||||
check : $(LIBTARGET) $(DYLIBTARGET)
|
||||
|
||||
@ -22,17 +16,9 @@ $(LIBTARGET) : $(OBJS)
|
||||
ar r $(LIBTARGET) $(OBJS)
|
||||
ranlib $(LIBTARGET)
|
||||
|
||||
$(DYLIBTARGET) : $(OBJS)
|
||||
$(CC) $(CFLAGS) -lgmp -shared -o $(DYLIBTARGET) $(OBJS)
|
||||
|
||||
build: $(DYLIBTARGET)
|
||||
mkdir -p $(DIST)/rts
|
||||
install $(DYLIBTARGET) $(DIST)/rts
|
||||
|
||||
|
||||
install : .PHONY
|
||||
mkdir -p $(TARGET)
|
||||
install $(LIBTARGET) $(DYLIBTARGET) $(HDRS) $(TARGET)
|
||||
install $(LIBTARGET) $(HDRS) $(TARGET)
|
||||
|
||||
clean : .PHONY
|
||||
rm -f $(OBJS) $(LIBTARGET) $(DYLIBTARGET)
|
||||
|
@ -25,30 +25,6 @@ int fileError(void* h) {
|
||||
return ferror(f);
|
||||
}
|
||||
|
||||
char* freadStr(void* h) {
|
||||
FILE* f = (FILE*)h;
|
||||
char* str;
|
||||
printf("foo");
|
||||
if (f != NULL) {
|
||||
fseek(f, 0L, SEEK_END);
|
||||
size_t size = ftell(f);
|
||||
rewind(f);
|
||||
printf("bar");
|
||||
str = malloc(size + sizeof(char));
|
||||
if (str != NULL && fread(str, size, 1, f)) {
|
||||
(*(str + size)) = '\0';
|
||||
printf("asf");
|
||||
} else {
|
||||
printf("Failed to allocate string from file\n");
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
str = malloc(sizeof(char));
|
||||
str[0] = '\0';
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
void fputStr(void* h, char* str) {
|
||||
FILE* f = (FILE*)h;
|
||||
fputs(str, f);
|
||||
|
@ -8,7 +8,6 @@ void putStr(char* str);
|
||||
|
||||
void* fileOpen(char* f, char* mode);
|
||||
void fileClose(void* h);
|
||||
char* freadStr(void* h);
|
||||
void fputStr(void*h, char* str);
|
||||
|
||||
int isNull(void* ptr);
|
||||
|
@ -232,7 +232,6 @@ data Opt = Filename String
|
||||
| UseTarget Target
|
||||
| OutputTy OutputType
|
||||
| Extension LanguageExt
|
||||
| DynamicRTS FilePath
|
||||
deriving (Show, Eq)
|
||||
|
||||
-- Parsed declarations
|
||||
|
@ -496,7 +496,6 @@ parseArgs ("--dumpdefuns":n:ns) = DumpDefun n : (parseArgs ns)
|
||||
parseArgs ("--dumpcases":n:ns) = DumpCases n : (parseArgs ns)
|
||||
parseArgs ("--target":n:ns) = UseTarget (parseTarget n) : (parseArgs ns)
|
||||
parseArgs ("-XTypeProviders":ns) = Extension TypeProviders : (parseArgs ns)
|
||||
parseArgs ("--dynamicrts":f:ns) = DynamicRTS f : (parseArgs ns)
|
||||
parseArgs (n:ns) = Filename n : (parseArgs ns)
|
||||
|
||||
helphead =
|
||||
@ -637,12 +636,8 @@ getLanguageExt :: Opt -> Maybe LanguageExt
|
||||
getLanguageExt (Extension e) = Just e
|
||||
getLanguageExt _ = Nothing
|
||||
|
||||
getDynamicRTS :: Opt -> Maybe FilePath
|
||||
getDynamicRTS (DynamicRTS f) = Just f
|
||||
getDynamicRTS _ = Nothing
|
||||
|
||||
opt :: (Opt -> Maybe a) -> [Opt] -> [a]
|
||||
opt = mapMaybe
|
||||
opt = mapMaybe
|
||||
|
||||
ver = showVersion version
|
||||
|
||||
|
14
src/Main.hs
14
src/Main.hs
@ -49,7 +49,6 @@ runIdris opts = do
|
||||
when (ShowIncs `elem` opts) $ liftIO showIncs
|
||||
when (ShowLibs `elem` opts) $ liftIO showLibs
|
||||
when (ShowLibdir `elem` opts) $ liftIO showLibdir
|
||||
loadRTS opts
|
||||
case opt getPkgClean opts of
|
||||
[] -> return ()
|
||||
fs -> do liftIO $ mapM_ cleanPkg fs
|
||||
@ -97,17 +96,4 @@ usagemsg = "Idris version " ++ ver ++ "\n" ++
|
||||
"\t--include Show C include directories and exit (for C linking)\n" ++
|
||||
"\t--target [target] Type the target: C, Java, bytecode, javascript, node\n"
|
||||
|
||||
-- | Attempt to load the RTS as a shared lib in the interpreter
|
||||
loadRTS :: [Opt] -> Idris ()
|
||||
loadRTS opts = (flip idrisCatch) (\e -> iputStrLn (show e)) $
|
||||
do rtslib <- liftIO $
|
||||
case listToMaybe . catMaybes . map getDynamicRTS $ opts of
|
||||
Just path -> return path
|
||||
Nothing -> getDataFileName ("rts" </> "libidris_rts")
|
||||
handle <- liftIO (tryLoadLib rtslib)
|
||||
case handle of
|
||||
Nothing -> return ()
|
||||
Just x -> do i <- getIState
|
||||
let libs = idris_dynamic_libs i
|
||||
putIState $ i { idris_dynamic_libs = x:libs }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user