on master help sign in
Support for FreeBSD

We use gnu make on FreeBSD instead of bsd make, due to incompatibilities: * -include is a GNUism * conditionals (ifneq/ifeq)

commitb23ac6e9aab7100faaf3c99b9f0d980d6e6b0c94 authorHannes Mehnert <hannes@mehnert.org> dateTue 19 Nov 2013, 13:03 (13 years ago) parent0927e78
6 files changed+30−6
Setup.hs+7−1 config.mk+5−1 idris.cabal+3 rts/Makefile+1−1 src/Util/DynamicLinker.hs+2 src/Util/System.hs+12−3
Setup.hs+7−1
@@ -34,8 +34,14 @@ idrisCmd local = ".." </> buildDir local </> "idris" </> "idris"
3434-- -----------------------------------------------------------------------------
3535-- Make Commands
3636
37+-- use GNU make on FreeBSD
38+#ifdef freebsd_HOST_OS
39+mymake = "gmake"
40+#else
41+mymake = "make"
42+#endif
3743make verbosity =
38− P.runProgramInvocation verbosity . P.simpleProgramInvocation "make"
44+ P.runProgramInvocation verbosity . P.simpleProgramInvocation mymake
3945
4046-- -----------------------------------------------------------------------------
4147-- Flags
config.mk+5−1
@@ -1,4 +1,3 @@
1−GMP_INCLUDE_DIR :=
21CC :=gcc
32CABAL :=cabal
43CFLAGS :=-O2 -Wall $(CFLAGS)
@@ -6,6 +5,11 @@ CFLAGS :=-O2 -Wall $(CFLAGS)
65## Disable building of Effects
76#CABALFLAGS :=-f NoEffects
87
8+ifneq (, $(findstring bsd, $(MACHINE)))
9+ GMP_INCLUDE_DIR :=
10+else
11+ GMP_INCLUDE_DIR :=-I/usr/local/include
12+endif
913
1014MACHINE := $(shell $(CC) -dumpmachine)
1115ifneq (, $(findstring darwin, $(MACHINE)))
idris.cabal+3
@@ -414,6 +414,9 @@ Executable idris
414414 if os(linux)
415415 cpp-options: -DLINUX
416416 build-depends: unix
417+ if os(freebsd)
418+ cpp-options: -DFREEBSD
419+ build-depends: unix
417420 if os(darwin)
418421 cpp-options: -DMACOSX
419422 build-depends: unix
rts/Makefile+1−1
@@ -3,7 +3,7 @@ include ../config.mk
33OBJS = idris_rts.o idris_heap.o idris_gc.o idris_gmp.o idris_stdfgn.o \
44 idris_bitstring.o idris_opts.o idris_stats.o
55HDRS = idris_rts.h idris_heap.h idris_gc.h idris_gmp.h idris_stdfgn.h \
6− idris_bitstring.h idris_opts.h idris_stats.h
6+ idris_bitstring.h idris_opts.h idris_stats.h
77CFLAGS:=-fPIC $(CFLAGS)
88ifneq ($(GMP_INCLUDE_DIR),)
99 CFLAGS += -isystem $(GMP_INCLUDE_DIR)
src/Util/DynamicLinker.hs+2
@@ -22,6 +22,8 @@ hostDynamicLibExt = "so"
2222hostDynamicLibExt = "dylib"
2323#elif WINDOWS
2424hostDynamicLibExt = "dll"
25+#elif FREEBSD
26+hostDynamicLibExt = "so"
2527#else
2628hostDynamicLibExt = error $ unwords
2729 [ "Undefined file extension for dynamic libraries"
src/Util/System.hs+12−3
@@ -71,15 +71,24 @@ rmFile f = do putStrLn $ "Removing " ++ f
7171 (\ioerr -> putStrLn $ "WARNING: Cannot remove file "
7272 ++ f ++ ", Error msg:" ++ show ioerr)
7373
74−
74+#ifdef FREEBSD
75+extraLib = " -L/usr/local/lib"
76+#else
77+extraLib = ""
78+#endif
7579getLibFlags = do dir <- getDataDir
76− return $ "-L" ++ (dir </> "rts") ++ " -lidris_rts -lgmp -lpthread"
80+ return $ "-L" ++ (dir </> "rts") ++ " -lidris_rts" ++ extraLib ++ " -lgmp -lpthread"
7781
7882getIdrisLibDir = do dir <- getDataDir
7983 return $ addTrailingPathSeparator dir
8084
85+#ifdef FREEBSD
86+extraInclude = " -I/usr/local/include"
87+#else
88+extraInclude = ""
89+#endif
8190getIncFlags = do dir <- getDataDir
82− return $ "-I" ++ dir </> "rts"
91+ return $ "-I" ++ dir </> "rts" ++ extraInclude
8392
8493getExecutablePom = do dir <- getDataDir
8594 return $ dir </> "java" </> "executable_pom.xml"