diff --git a/.gitignore b/.gitignore index ede9d6e835..97561e469b 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,8 @@ TAGS .vscode .idea +# Nix expression generated via cabal2nix +idris-generated.nix + +# Nix output +result diff --git a/.travis.yml b/.travis.yml index 4834b60eaf..46e13e2b46 100644 --- a/.travis.yml +++ b/.travis.yml @@ -149,7 +149,7 @@ script: ### - echo 'Benchmarks...' && echo -en 'travis_fold:start:script.benchmarks\\r' - if [[ "$TESTS" == "test_c" ]]; then - cd benchmarks && ./build.pl && ./run.pl && cd ..; + cd benchmarks && ./build && ./run && cd ..; fi - echo -en 'travis_fold:end:script.benchmarks\\r' ### diff --git a/INSTALL.md b/INSTALL.md index 15121a7fbc..06ae74e5f5 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -122,4 +122,22 @@ encounter this then the fix is to augment the `PKG_CONFIG_PATH` for ``` PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig stack build -``` +``` + +## Experimental Support for Building on NixOS or systems with Nixpkgs + +To run the full build process: + + nix-build + +The resulting build should be on the `result` directory. + +If you wish to install it to your environment: + + nix-env -f default.nix -i idris + +For local development with Cabal: + + nix-shell + cabal configure --enable-tests -fFFI -fGMP + cabal test diff --git a/Makefile b/Makefile index 63b62a2019..83d64857f5 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: build configure doc install linecount nodefault pinstall lib_clean relib fast test_js test_c stylize test test_clean lib_doc lib_doc_clean user_doc_html user_doc_pdf user_docs +.PHONY: build configure doc install linecount nodefault pinstall lib_clean relib fast test_js test_c stylize test test_clean lib_doc lib_doc_clean user_doc_html user_doc_pdf user_docs rts rts_clean ARGS= TEST-JOBS= @@ -7,6 +7,8 @@ TEST-ARGS= include config.mk -include custom.mk +IDRIS ?= $(CURDIR)/dist/build/idris/idris + ifdef CI CABALFLAGS += -f CI ifndef APPVEYOR @@ -22,7 +24,10 @@ pinstall: dist/setup-config $(CABAL) install $(CABALFLAGS) build: dist/setup-config - $(CABAL) build $(CABALFLAGS) + $(CABAL) build + +$(IDRIS): dist/setup-config + $(CABAL) build "exe:idris" test: doc test_c stylize @@ -45,8 +50,29 @@ test_clean: rm -f test/*~ rm -f test/*/output +rts: + $(MAKE) -C rts + +rts_install: + $(MAKE) -C rts install + +rts_clean: + $(MAKE) -C rts clean + +lib: + $(MAKE) -C libs + +lib_install: + $(MAKE) -C libs install + lib_clean: - $(MAKE) -C libs IDRIS=../../dist/build/idris/idris RTS=../../dist/build/rts/libidris_rts clean + $(MAKE) -C libs clean + +lib_doc: + $(MAKE) -C libs doc + +lib_doc_clean: + $(MAKE) -C libs doc_clean relib: lib_clean $(CABAL) install $(CABALFLAGS) @@ -58,12 +84,6 @@ linecount: doc: dist/setup-config $(CABAL) haddock --hyperlink-source --html --hoogle --html-location="http://hackage.haskell.org/packages/archive/\$$pkg/latest/doc/html" --haddock-options="--title Idris" -lib_doc: - $(MAKE) -C libs IDRIS=../../dist/build/idris/idris doc - -lib_doc_clean: - $(MAKE) -C libs IDRIS=../../dist/build/idris/idris doc_clean - user_docs: user_doc_html user_doc_pdf user_doc_clean: @@ -80,3 +100,5 @@ fast: dist/setup-config: $(CABAL) configure $(CABALFLAGS) + +.EXPORT_ALL_VARIABLES: diff --git a/Setup.hs b/Setup.hs index 1db0c20e8e..4d33208e22 100644 --- a/Setup.hs +++ b/Setup.hs @@ -6,6 +6,8 @@ import Control.Monad import Data.IORef +import Data.Maybe (fromMaybe) +import Data.List (nub, isInfixOf) import Control.Exception (SomeException, catch) import Distribution.Simple @@ -36,14 +38,11 @@ import Distribution.Types.UnqualComponentName -- ----------------------------------------------------------------------------- -- Idris Command Path +idrisCmd local = Px.joinPath $ splitDirectories $ ".." ".." buildDir local "idris" "idris" + + +shinvoke verbosity cmd = P.runProgramInvocation verbosity . P.simpleProgramInvocation cmd --- make on mingw32 exepects unix style separators -#ifdef mingw32_HOST_OS -() = (Px.) -idrisCmd local = Px.joinPath $ splitDirectories $ ".." ".." buildDir local "idris" "idris" -#else -idrisCmd local = ".." ".." buildDir local "idris" "idris" -#endif -- ----------------------------------------------------------------------------- -- Make Commands @@ -55,8 +54,7 @@ mymake = "gmake" #else mymake = "make" #endif -make verbosity = - P.runProgramInvocation verbosity . P.simpleProgramInvocation mymake +make verbosity = shinvoke verbosity mymake #ifdef mingw32_HOST_OS windres verbosity = P.runProgramInvocation verbosity . P.simpleProgramInvocation "windres" @@ -64,37 +62,30 @@ windres verbosity = P.runProgramInvocation verbosity . P.simpleProgramInvocation -- ----------------------------------------------------------------------------- -- Flags -usesGMP :: S.ConfigFlags -> Bool -usesGMP flags = - case lookupFlagAssignment (mkFlagName "gmp") (S.configConfigurationsFlags flags) of + +flag nm flags = case lookupFlagAssignment (mkFlagName nm) (S.configConfigurationsFlags flags) of Just True -> True Just False -> False Nothing -> False + +usesGMP :: S.ConfigFlags -> Bool +usesGMP = flag "gmp" + execOnly :: S.ConfigFlags -> Bool -execOnly flags = - case lookupFlagAssignment (mkFlagName "execonly") (S.configConfigurationsFlags flags) of - Just True -> True - Just False -> False - Nothing -> False +execOnly = flag "execonly" isRelease :: S.ConfigFlags -> Bool -isRelease flags = - case lookupFlagAssignment (mkFlagName "release") (S.configConfigurationsFlags flags) of - Just True -> True - Just False -> False - Nothing -> False +isRelease = flag "release" isFreestanding :: S.ConfigFlags -> Bool -isFreestanding flags = - case lookupFlagAssignment (mkFlagName "freestanding") (S.configConfigurationsFlags flags) of - Just True -> True - Just False -> False - Nothing -> False +isFreestanding = flag "freestanding" #if !(MIN_VERSION_Cabal(2,0,0)) mkFlagName :: String -> FlagName mkFlagName = FlagName + +unUnqualComponentName = id #endif #if !(MIN_VERSION_Cabal(2,2,0)) @@ -102,16 +93,16 @@ lookupFlagAssignment :: FlagName -> FlagAssignment -> Maybe Bool lookupFlagAssignment = lookup #endif + -- ----------------------------------------------------------------------------- -- Clean -idrisClean _ flags _ _ = cleanStdLib +idrisClean _ flags _ _ = cleanStdLib >> cleanRts where verbosity = S.fromFlag $ S.cleanVerbosity flags - cleanStdLib = makeClean "libs" - - makeClean dir = make verbosity [ "-C", dir, "clean", "IDRIS=idris" ] + cleanStdLib = make verbosity ["lib_clean"] + cleanRts = make verbosity ["rts_clean"] -- ----------------------------------------------------------------------------- -- Configure @@ -183,12 +174,16 @@ generateToolchainModule verbosity srcDir toolDir = do createDirectoryIfMissingVerbose verbosity True srcDir rewriteFileEx verbosity toolPath (commonContent ++ toolContent) -idrisConfigure _ flags pkgdesc local = do +idrisPostConf _ flags pkgdesc local = do + nixLDFLAGS <- lookupEnv "NIX_LDFLAGS" configureRTS withLibLBI pkgdesc local $ \lib libcfg -> do let libAutogenDir = autogenComponentModulesDir local libcfg let libDirs = extraLibDirs $ libBuildInfo lib - generateBuildFlagsModule verbosity libAutogenDir libDirs + let nixLibDirs = map (drop 2) + $ filter ("-gmp-" `Data.List.isInfixOf`) + $ words $ fromMaybe "" nixLDFLAGS + generateBuildFlagsModule verbosity libAutogenDir (nub $ libDirs ++ nixLibDirs) generateVersionModule verbosity libAutogenDir (isRelease (configFlags local)) if isFreestanding $ configFlags local then do @@ -209,7 +204,7 @@ idrisConfigure _ flags pkgdesc local = do -- installing but shouldn't be in the distribution. And it won't make the -- distribution if it's not there, so instead I just delete -- the file after configure. - configureRTS = make verbosity ["-C", "rts", "clean"] + configureRTS = make verbosity ["rts_clean"] #if !(MIN_VERSION_Cabal(2,0,0)) autogenComponentModulesDir lbi _ = autogenModulesDir lbi @@ -273,27 +268,34 @@ idrisPreBuild args flags = do verbosity = S.fromFlag $ S.buildVerbosity flags dir = S.fromFlagOrDefault "dist" $ S.buildDistPref flags #else - return (Nothing, []) + preBuild simpleUserHooks args flags #endif -idrisBuild _ flags _ local +idrisBuildHook pd lbi hooks flags = do + let exe = ("exe:" ++) . unUnqualComponentName . exeName + exes = map exe (executables pd) + nflags = case S.buildArgs flags of + orig@["regression-and-feature-tests"] -> + flags { S.buildArgs = exes ++ orig } + _ -> flags + buildHook simpleUserHooks pd lbi hooks nflags + + +idrisPostBuild _ flags _ local = if (execOnly (configFlags local)) then buildRTS else do buildStdLib buildRTS where verbosity = S.fromFlag $ S.buildVerbosity flags - buildStdLib = do - putStrLn "Building libraries..." - makeBuild "libs" - where - makeBuild dir = make verbosity [ "-C", dir, "build" , "IDRIS=" ++ idrisCmd local] - - buildRTS = make verbosity (["-C", "rts", "build"] ++ - gmpflag (usesGMP (configFlags local))) - + putStrLn "Building libraries..." + make verbosity [ "-j8", "lib", "IDRIS=" ++ idrisCmd local] + buildRTS = do + putStrLn "Building runtime..." + make verbosity $ ["rts"] ++ gmp gmpflag False = [] gmpflag True = ["GMP=-DIDRIS_GMP"] + gmp = gmpflag (usesGMP (configFlags local)) -- ----------------------------------------------------------------------------- -- Copy/Install @@ -307,22 +309,22 @@ idrisInstall verbosity copy pkg local target = datadir $ L.absoluteInstallDirs pkg local copy installStdLib = do - let target' = target -- "libs" - putStrLn $ "Installing libraries in " ++ target' - makeInstall "libs" target' + let target' = target -- "libs" + putStrLn $ "Installing libraries in " ++ target' + make' "lib_install" target' installRTS = do let target' = target "rts" putStrLn $ "Installing run time system in " ++ target' - makeInstall "rts" target' + make' "rts_install" target' installManPage = do let mandest = mandir (L.absoluteInstallDirs pkg local copy) ++ "/man1" notice verbosity $ unwords ["Copying man page to", mandest] installOrdinaryFiles verbosity mandest [("man", "idris.1")] - makeInstall src target = - make verbosity [ "-C", src, "install" , "TARGET=" ++ target, "IDRIS=" ++ idrisCmd local] + make' x target = + make verbosity [ x, "TARGET=" ++ target, "IDRIS=" ++ idrisCmd local] -- ----------------------------------------------------------------------------- -- Test @@ -335,7 +337,14 @@ fixPkg pkg target = pkg { dataDir = target } idrisTestHook args pkg local hooks flags = do let target = datadir $ L.absoluteInstallDirs pkg local NoCopyDest - testHook simpleUserHooks args (fixPkg pkg target) local hooks flags + idris <- lookupEnv "IDRIS" + case idris of + Just _ -> pure () -- Test using provided idris + Nothing -> -- Test built idris + canonicalizePath (buildDir local "idris" "idris") + >>= setEnv "IDRIS" +-- testHook simpleUserHooks args (fixPkg pkg target) local hooks flags + testHook simpleUserHooks args pkg local hooks flags -- ----------------------------------------------------------------------------- -- Main @@ -344,9 +353,10 @@ idrisTestHook args pkg local hooks flags = do -- See https://github.com/haskell/cabal/issues/709 main = defaultMainWithHooks $ simpleUserHooks { postClean = idrisClean - , postConf = idrisConfigure + , postConf = idrisPostConf , preBuild = idrisPreBuild - , postBuild = idrisBuild + , buildHook = idrisBuildHook + , postBuild = idrisPostBuild , postCopy = \_ flags pkg local -> idrisInstall (S.fromFlag $ S.copyVerbosity flags) (S.fromFlag $ S.copyDest flags) pkg local diff --git a/appveyor.yml b/appveyor.yml index 4087020743..374d30e173 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -22,6 +22,6 @@ environment: MSYS2_PATH_TYPE: inherit build_script: - ps: >- - c:\msys64\usr\bin\bash -l -c "cd $env:current_posix && cabal install -fffi --enable-tests 2>&1" + c:\msys64\usr\bin\bash -l -c "cd $env:current_posix && cabal install -f FFI -f CI --enable-tests 2>&1" test_script: -- ps: c:\msys64\usr\bin\bash -l -c "cd $env:current_posix && make test_c 2>&1" +- ps: c:\msys64\usr\bin\bash -l -c "cd $env:current_posix && make test_c IDRIS=idris 2>&1" diff --git a/benchmarks/README b/benchmarks/README index 055e001eba..b879dcef83 100644 --- a/benchmarks/README +++ b/benchmarks/README @@ -3,10 +3,10 @@ Benchmarks To run: -$ ./build.pl -- builds all benchmark binaries -$ ./run.pl -- runs all benchmarks +$ ./build -- builds all benchmark binaries +$ ./run -- runs all benchmarks -Adding a test +Adding a test ------------- Add a line to the 'ALL' file of the following form: @@ -15,7 +15,7 @@ dir/main arg where 'dir' is the directory the benchmark lives in, 'main' is the name of the ipkg file and executable (these must be the same), 'arg' is the input to give -to the binary. +to the binary. It is assumed that all benchmarks take exactly one argument, which helps to ensure that they are not simply doing all the work at compile time. diff --git a/benchmarks/build b/benchmarks/build new file mode 100755 index 0000000000..841835fddf --- /dev/null +++ b/benchmarks/build @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -eu + +build() { + while read dir nm arg; do + idr=${IDRIS:-idris} + pkg=$nm.ipkg + cd $dir + $idr --clean $pkg + $idr --build $pkg + cd .. + done +} + +sed 's-/- -g' ALL | build diff --git a/benchmarks/build.pl b/benchmarks/build.pl deleted file mode 100755 index 4c88a2917d..0000000000 --- a/benchmarks/build.pl +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env perl - -$bmarks = `cat ALL`; -@bm = split(/\n/, $bmarks); -$idris = $ENV{'IDRIS'} || "idris"; - -foreach $b (@bm) { - if ($b =~ /([a-zA-Z0-9]+)\/([a-zA-Z0-9]+)\s+(.*)/) { - print "Building $1 / $2\n"; - chdir $1; - system("$idris --clean $2.ipkg"); - system("$idris --build $2.ipkg") == 0 or die "Unable to build $2: $?"; - chdir ".."; - } -} diff --git a/benchmarks/run b/benchmarks/run new file mode 100755 index 0000000000..1fc022b819 --- /dev/null +++ b/benchmarks/run @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -eu + +TIMEFORMAT=%U +run() { + total=0 + while read dir nm arg; do + idr=${IDRIS:-idris} + pkg=$nm.ipkg + cd $dir + user=$(time (./$nm $arg 2>&1 >/dev/null) 2>&1) + echo "$dir / $nm $user" + total=$(echo $total + $user | bc) + cd .. + done + echo "TOTAL $total" +} + +sed 's-/- -g' ALL | run diff --git a/benchmarks/run.pl b/benchmarks/run.pl deleted file mode 100755 index 5532308c07..0000000000 --- a/benchmarks/run.pl +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env perl - -$bmarks = `cat ALL`; -@bm = split(/\n/, $bmarks); - -$total = 0; - -foreach $b (@bm) { - if ($b =~ /([a-zA-Z0-9]+)\/([a-zA-Z0-9]+)\s+(.*)/) { - #print "Running $1 $2\n"; - chdir $1; - $result = `/usr/bin/time ./$2 $3 2> .times`; - $time = `cat .times`; - chdir ".."; - #print $time; - @timeflds = split(/\s+/, $time); - $user = $timeflds[3]; - print "$1 / $2 $user\n"; - $total += $user; - } -} - -print "\nTOTAL $total\n"; - diff --git a/config.mk b/config.mk index a474ff0ba1..eef654b863 100644 --- a/config.mk +++ b/config.mk @@ -1,3 +1,7 @@ +# Parent makefile exports now all variables, avoid including config.mk twice +ifndef CONFIGMK_INCLUDED +CONFIGMK_INCLUDED := 1 + UNAME_INFO := $(shell uname -a) ifeq ($(filter , $(findstring MSYS, $(UNAME_INFO)) $(findstring MINGW, $(UNAME_INFO))),) @@ -48,3 +52,5 @@ else ifeq ($(OS),windows) else SHLIB_SUFFIX :=.so endif + +endif # CONFIGMK_INCLUDED diff --git a/default.nix b/default.nix new file mode 100644 index 0000000000..6757dc9651 --- /dev/null +++ b/default.nix @@ -0,0 +1,26 @@ +{ nixpkgs ? import {} }: +with nixpkgs; +with pkgs; +let + gen = haskellPackages.callCabal2nix "idris" ./. {}; + pkg = haskell.lib.overrideCabal gen (orig:{ + configureFlags = [ "-fFFI" "-fGMP" ]; + librarySystemDepends = orig.librarySystemDepends + ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ + Cocoa + CoreServices + ]); + testHaskellDepends = orig.testHaskellDepends ++ [ nodejs ]; + preBuild = '' + export DYLD_LIBRARY_PATH=`pwd`/dist/build + ''; + preCheck = '' + export DYLD_LIBRARY_PATH=`pwd`/dist/build + export TARGET=`pwd` + patchShebangs test/scripts/timeout + ''; + setupHaskellDepends = orig.setupHaskellDepends + ++ lib.optionals lib.inNixShell [ cabal-install ]; + }); +in + if lib.inNixShell then pkg.env else pkg diff --git a/libs/Makefile b/libs/Makefile index 3d88db1298..dff3116ba2 100644 --- a/libs/Makefile +++ b/libs/Makefile @@ -1,37 +1,45 @@ -build: - $(MAKE) -C prelude build - $(MAKE) -C base build - $(MAKE) -C contrib build - $(MAKE) -C effects build - $(MAKE) -C pruviloj build - - -install: - $(MAKE) -C prelude install - $(MAKE) -C base install - $(MAKE) -C contrib install - $(MAKE) -C effects install - $(MAKE) -C pruviloj install - -clean: - $(MAKE) -C prelude clean - $(MAKE) -C base clean - $(MAKE) -C contrib clean - $(MAKE) -C effects clean - $(MAKE) -C pruviloj clean - -doc: - $(MAKE) -C prelude doc - $(MAKE) -C base doc - $(MAKE) -C contrib doc - $(MAKE) -C effects doc - $(MAKE) -C pruviloj doc +LIBS=prelude base contrib effects pruviloj + +build: $(LIBS:=.built) + +doc: $(LIBS:=.doc) + +install: $(LIBS:=.install) + +clean: $(LIBS:=.clean) doc_clean: - $(MAKE) -C prelude doc_clean - $(MAKE) -C base doc_clean - $(MAKE) -C contrib doc_clean - $(MAKE) -C effects doc_clean - $(MAKE) -C pruviloj doc_clean + rm -rf */*_doc *.doc + +rebuild: clean build + +linecount: $(LIBS:=.linecount) + + +%.built: % + cd $< && $(IDRIS) --build $<.ipkg + touch $@ + +%.clean: % + cd $< && $(IDRIS) --clean $<.ipkg + rm -f $<.built + +%.install: % %.built %.doc + cd $< && $(IDRIS) --install $<.ipkg && $(IDRIS) --installdoc $<.ipkg + +%.doc: % + cd $< && $(IDRIS) --mkdoc $<.ipkg + touch $@ + +%.linecount: % + cd $< && find . -name '*.idr' | xargs wc -l + +base.built: prelude.built + +contrib.built: prelude.built base.built + +pruviloj.built: prelude.built base.built + +effects.built: prelude.built base.built -.PHONY: build install clean doc doc_clean +.PHONY: build rebuild install clean doc doc_clean diff --git a/libs/base/Makefile b/libs/base/Makefile deleted file mode 100644 index c19a423429..0000000000 --- a/libs/base/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -IDRIS ?= idris -PKG := base - -build: - $(IDRIS) --build ${PKG}.ipkg - -install: - $(IDRIS) --install ${PKG}.ipkg - ${IDRIS} --installdoc ${PKG}.ipkg - -clean: - $(IDRIS) --clean ${PKG}.ipkg - -rebuild: clean build - -doc: - ${IDRIS} --mkdoc ${PKG}.ipkg - -doc_clean: - rm -rf ${PKG}_doc - -linecount: - find . -name '*.idr' | xargs wc -l - -.PHONY: build install clean rebuild linecount doc doc_clean diff --git a/libs/contrib/Makefile b/libs/contrib/Makefile deleted file mode 100644 index 9ddad55ce7..0000000000 --- a/libs/contrib/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -IDRIS ?= idris -PKG := contrib - -build: - $(IDRIS) --build ${PKG}.ipkg - -install: - $(IDRIS) --install ${PKG}.ipkg - ${IDRIS} --installdoc ${PKG}.ipkg - -clean: - $(IDRIS) --clean ${PKG}.ipkg - -rebuild: clean build - -doc: - ${IDRIS} --mkdoc ${PKG}.ipkg - -doc_clean: - rm -rf ${PKG}_doc - -linecount: - find . -name '*.idr' | xargs wc -l - -.PHONY: build install clean rebuild linecount doc doc_clean diff --git a/libs/effects/Makefile b/libs/effects/Makefile deleted file mode 100644 index d5afee18b3..0000000000 --- a/libs/effects/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -IDRIS ?= idris -PKG := effects - -build: - $(IDRIS) --build ${PKG}.ipkg - -clean: - $(IDRIS) --clean ${PKG}.ipkg - -install: - $(IDRIS) --install ${PKG}.ipkg - ${IDRIS} --installdoc ${PKG}.ipkg - -rebuild: clean build - -doc: - $(IDRIS) --mkdoc ${PKG}.ipkg - -doc_clean: - rm -rf ${PKG}_doc - -.PHONY: build clean install rebuild doc doc_clean diff --git a/libs/prelude/Makefile b/libs/prelude/Makefile deleted file mode 100644 index b3a981d8d8..0000000000 --- a/libs/prelude/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -IDRIS ?= idris -PKG := prelude - -build: - $(IDRIS) --build ${PKG}.ipkg - -install: - $(IDRIS) --install ${PKG}.ipkg - ${IDRIS} --installdoc ${PKG}.ipkg - -clean: - $(IDRIS) --clean ${PKG}.ipkg - -rebuild: clean build - -linecount: - find . -name '*.idr' | xargs wc -l - -doc: - $(IDRIS) --mkdoc ${PKG}.ipkg - -doc_clean: - rm -rf ${PKG}_doc - -.PHONY: build install clean rebuild linecount doc diff --git a/libs/pruviloj/Makefile b/libs/pruviloj/Makefile deleted file mode 100644 index f53be41fdf..0000000000 --- a/libs/pruviloj/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -IDRIS ?= idris -PKG := pruviloj - -build: - $(IDRIS) --build ${PKG}.ipkg - -clean: - $(IDRIS) --clean ${PKG}.ipkg - -install: - $(IDRIS) --install ${PKG}.ipkg - ${IDRIS} --installdoc ${PKG}.ipkg - -rebuild: clean build - -doc: - $(IDRIS) --mkdoc ${PKG}.ipkg - -doc_clean: - rm -rf ${PKG}_doc - -.PHONY: build clean install rebuild doc doc_clean diff --git a/src/IRTS/CodegenC.hs b/src/IRTS/CodegenC.hs index 2e55543415..21a2090967 100644 --- a/src/IRTS/CodegenC.hs +++ b/src/IRTS/CodegenC.hs @@ -5,7 +5,7 @@ Description : The default code generator for Idris, generating C code. License : BSD3 Maintainer : The Idris Community. -} -{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE CPP, FlexibleContexts #-} module IRTS.CodegenC (codegenC) where @@ -100,6 +100,12 @@ codegenC' defs out exec incs objs libs flags exports iface dbg exit <- rawSystem comp args when (exit /= ExitSuccess) $ putStrLn ("FAILURE: " ++ show comp ++ " " ++ show args) +#ifdef darwin_HOST_OS + cexit <- rawSystem "chmod" ["755", out] + when (cexit /= ExitSuccess) $ + putStrLn $ "Unable to change permissions for " ++ out +#endif + where getExp (Export _ _ exp) = exp diff --git a/test/interactive007/run b/test/interactive007/run index 92b0b63f7d..2c4373fd45 100755 --- a/test/interactive007/run +++ b/test/interactive007/run @@ -1,2 +1,2 @@ #!/usr/bin/env bash -${IDRIS:-idris} $@ -p contrib --nobanner --nocolor --port none < input | perl -pe 's-Data\\Z-Data/Z-g' +${IDRIS:-idris} $@ -p contrib --nobanner --nocolor --port none < input | sed 's-Data\\Z-Data/Z-g' diff --git a/test/scripts/timeout b/test/scripts/timeout index 04a6d0b026..97a177668f 100755 --- a/test/scripts/timeout +++ b/test/scripts/timeout @@ -1,17 +1,13 @@ -#!/usr/bin/env perl - -use strict; -use File::Basename; - -sub Usage { - my $name = basename($0); - print STDERR "usage: $name seconds shell-command...\n"; - exit 2; -} - -Usage if (scalar @ARGV) < 2; - -my $timeout = shift; - -alarm $timeout; -exec @ARGV; +#!/usr/bin/env node +var cp = require('child_process'); +var args = process.argv.slice(2); +var timeout = parseInt(args.shift()); +var exe = args.shift(); +cp.execFile(exe, args, { timeout:timeout*1000 }, function(error,stdout,stderr) { + if (stdout) + process.stdout.write(stdout); + if (stderr) + process.stderr.write(stderr); + if (error) + console.error(error); +});