Merge master into staging-next

This commit is contained in:
Frederik Rietdijk
2018-10-17 08:04:22 +02:00
351 changed files with 8830 additions and 5150 deletions

View File

@@ -88,8 +88,7 @@ stdenv.mkDerivation (rec {
sha256 = "1z05vkpaj54xdypmaml50hgsdpw29dhbs2r7magx0cm199iw73mv";
};
# https://ghc.haskell.org/trac/ghc/ticket/15449
enableParallelBuilding = !buildPlatform.isAarch64;
enableParallelBuilding = true;
outputs = [ "out" "doc" ];

View File

@@ -90,8 +90,7 @@ stdenv.mkDerivation (rec {
sha256 = "1mk046vb561j75saz05rghhbkps46ym5aci4264dwc2qk3dayixf";
};
# https://ghc.haskell.org/trac/ghc/ticket/15449
enableParallelBuilding = !buildPlatform.isAarch64;
enableParallelBuilding = true;
outputs = [ "out" "doc" ];

View File

@@ -0,0 +1,247 @@
{ stdenv, targetPackages
# build-tools
, bootPkgs
, autoconf, automake, coreutils, fetchurl, fetchpatch, perl, python3, m4
, libiconv ? null, ncurses
, useLLVM ? !stdenv.targetPlatform.isx86 || (stdenv.targetPlatform.isMusl && stdenv.hostPlatform != stdenv.targetPlatform)
, # LLVM is conceptually a run-time-only depedendency, but for
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
# build-time dependency too.
buildLlvmPackages, llvmPackages
, # If enabled, GHC will be built with the GPL-free but slower integer-simple
# library instead of the faster but GPLed integer-gmp library.
enableIntegerSimple ? !(stdenv.lib.any (stdenv.lib.meta.platformMatch stdenv.hostPlatform) gmp.meta.platforms), gmp
, # If enabled, use -fPIC when compiling static libs.
enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform
, # Whether to build dynamic libs for the standard library (on the target
# platform). Static libs are always built.
enableShared ? !stdenv.targetPlatform.isWindows && !stdenv.targetPlatform.useiOSPrebuilt
, # Whetherto build terminfo.
enableTerminfo ? !stdenv.targetPlatform.isWindows
, # What flavour to build. An empty string indicates no
# specific flavour and falls back to ghc default values.
ghcFlavour ? stdenv.lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform) "perf-cross"
, # Whether to backport https://phabricator.haskell.org/D4388 for
# deterministic profiling symbol names, at the cost of a slightly
# non-standard GHC API
deterministicProfiling ? false
}:
assert !enableIntegerSimple -> gmp != null;
let
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
inherit (bootPkgs) ghc;
# TODO(@Ericson2314) Make unconditional
targetPrefix = stdenv.lib.optionalString
(targetPlatform != hostPlatform)
"${targetPlatform.config}-";
buildMK = ''
BuildFlavour = ${ghcFlavour}
ifneq \"\$(BuildFlavour)\" \"\"
include mk/flavours/\$(BuildFlavour).mk
endif
DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"}
INTEGER_LIBRARY = ${if enableIntegerSimple then "integer-simple" else "integer-gmp"}
'' + stdenv.lib.optionalString (targetPlatform != hostPlatform) ''
Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"}
CrossCompilePrefix = ${targetPrefix}
HADDOCK_DOCS = NO
BUILD_SPHINX_HTML = NO
BUILD_SPHINX_PDF = NO
'' + stdenv.lib.optionalString enableRelocatedStaticLibs ''
GhcLibHcOpts += -fPIC
GhcRtsHcOpts += -fPIC
'' + stdenv.lib.optionalString targetPlatform.useAndroidPrebuilt ''
EXTRA_CC_OPTS += -std=gnu99
'';
# Splicer will pull out correct variations
libDeps = platform: stdenv.lib.optional enableTerminfo [ ncurses ]
++ stdenv.lib.optional (!enableIntegerSimple) gmp
++ stdenv.lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
toolsForTarget =
if hostPlatform == buildPlatform then
[ targetPackages.stdenv.cc ] ++ stdenv.lib.optional useLLVM llvmPackages.llvm
else assert targetPlatform == hostPlatform; # build != host == target
[ stdenv.cc ] ++ stdenv.lib.optional useLLVM buildLlvmPackages.llvm;
targetCC = builtins.head toolsForTarget;
in
stdenv.mkDerivation (rec {
version = "8.4.4";
name = "${targetPrefix}ghc-${version}";
src = fetchurl {
url = "https://downloads.haskell.org/~ghc/${version}/ghc-${version}-src.tar.xz";
sha256 = "1ch4j2asg7pr52ai1hwzykxyj553wndg7wq93i47ql4fllspf48i";
};
enableParallelBuilding = true;
outputs = [ "out" "doc" ];
patches = [(fetchpatch {
url = "https://git.haskell.org/hsc2hs.git/patch/738f3666c878ee9e79c3d5e819ef8b3460288edf";
sha256 = "0plzsbfaq6vb1023lsarrjglwgr9chld4q3m99rcfzx0yx5mibp3";
extraPrefix = "utils/hsc2hs/";
stripLen = 1;
}) (fetchpatch rec { # https://phabricator.haskell.org/D5123
url = "http://tarballs.nixos.org/sha256/${sha256}";
name = "D5123.diff";
sha256 = "0nhqwdamf2y4gbwqxcgjxs0kqx23w9gv5kj0zv6450dq19rji82n";
})] ++ stdenv.lib.optional deterministicProfiling
(fetchpatch rec {
url = "http://tarballs.nixos.org/sha256/${sha256}";
name = "D4388.diff";
sha256 = "0w6sdcvnqjlnlzpvnzw20b80v150ijjyjvs9548ildc1928j0w7s";
})
++ stdenv.lib.optional stdenv.isDarwin ./backport-dylib-command-size-limit.patch;
postPatch = "patchShebangs .";
# GHC is a bit confused on its cross terminology.
preConfigure = ''
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
export "''${env#TARGET_}=''${!env}"
done
# GHC is a bit confused on its cross terminology, as these would normally be
# the *host* tools.
export CC="${targetCC}/bin/${targetCC.targetPrefix}cc"
export CXX="${targetCC}/bin/${targetCC.targetPrefix}cxx"
# Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString targetPlatform.isAarch32 ".gold"}"
export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as"
export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar"
export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm"
export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib"
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip"
echo -n "${buildMK}" > mk/build.mk
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
'' + stdenv.lib.optionalString stdenv.isDarwin ''
export NIX_LDFLAGS+=" -no_dtrace_dof"
'' + stdenv.lib.optionalString targetPlatform.useAndroidPrebuilt ''
sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets
'' + stdenv.lib.optionalString targetPlatform.isMusl ''
echo "patching llvm-targets for musl targets..."
echo "Cloning these existing '*-linux-gnu*' targets:"
grep linux-gnu llvm-targets | sed 's/^/ /'
echo "(go go gadget sed)"
sed -i 's,\(^.*linux-\)gnu\(.*\)$,\0\n\1musl\2,' llvm-targets
echo "llvm-targets now contains these '*-linux-musl*' targets:"
grep linux-musl llvm-targets | sed 's/^/ /'
echo "And now patching to preserve '-musleabi' as done with '-gnueabi'"
# (aclocal.m4 is actual source, but patch configure as well since we don't re-gen)
for x in configure aclocal.m4; do
substituteInPlace $x \
--replace '*-android*|*-gnueabi*)' \
'*-android*|*-gnueabi*|*-musleabi*)'
done
'';
# TODO(@Ericson2314): Always pass "--target" and always prefix.
configurePlatforms = [ "build" "host" ]
++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
# `--with` flags for libraries needed for RTS linker
configureFlags = [
"--datadir=$doc/share/doc/ghc"
"--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
] ++ stdenv.lib.optional (targetPlatform == hostPlatform && !enableIntegerSimple) [
"--with-gmp-includes=${targetPackages.gmp.dev}/include" "--with-gmp-libraries=${targetPackages.gmp.out}/lib"
] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.libc != "glibc" && !targetPlatform.isWindows) [
"--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib"
] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [
"--enable-bootstrap-with-devel-snapshot"
] ++ stdenv.lib.optionals (targetPlatform.isAarch32) [
"CFLAGS=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold"
"CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold"
] ++ stdenv.lib.optionals (targetPlatform.isDarwin && targetPlatform.isAarch64) [
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
"--disable-large-address-space"
];
# Make sure we never relax`$PATH` and hooks support for compatability.
strictDeps = true;
nativeBuildInputs = [
perl autoconf automake m4 python3
ghc bootPkgs.alex bootPkgs.happy bootPkgs.hscolour
];
# For building runtime libs
depsBuildTarget = toolsForTarget;
buildInputs = libDeps hostPlatform;
propagatedBuildInputs = [ targetPackages.stdenv.cc ]
++ stdenv.lib.optional useLLVM llvmPackages.llvm;
depsTargetTarget = map stdenv.lib.getDev (libDeps targetPlatform);
depsTargetTargetPropagated = map (stdenv.lib.getOutput "out") (libDeps targetPlatform);
# required, because otherwise all symbols from HSffi.o are stripped, and
# that in turn causes GHCi to abort
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
checkTarget = "test";
hardeningDisable = [ "format" ];
postInstall = ''
for bin in "$out"/lib/${name}/bin/*; do
isELF "$bin" || continue
paxmark m "$bin"
done
# Install the bash completion file.
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
# Patch scripts to include "readelf" and "cat" in $PATH.
for i in "$out/bin/"*; do
test ! -h $i || continue
egrep --quiet '^#!' <(head -n 1 $i) || continue
sed -i -e '2i export PATH="$PATH:${stdenv.lib.makeBinPath [ targetPackages.stdenv.cc.bintools coreutils ]}"' $i
done
'';
passthru = {
inherit bootPkgs targetPrefix;
inherit llvmPackages;
inherit enableShared;
# Our Cabal compiler name
haskellCompilerName = "ghc-8.4.4";
};
meta = {
homepage = http://haskell.org/ghc;
description = "The Glasgow Haskell Compiler";
maintainers = with stdenv.lib.maintainers; [ marcweber andres peti ];
inherit (ghc.meta) license platforms;
};
} // stdenv.lib.optionalAttrs targetPlatform.useAndroidPrebuilt {
dontStrip = true;
dontPatchELF = true;
noAuditTmpdir = true;
})

View File

@@ -86,8 +86,7 @@ stdenv.mkDerivation (rec {
sha256 = "0dkh7idgrqr567fq94a0f5x3w0r4cm2ydn51nb5wfisw3rnw499c";
};
# https://ghc.haskell.org/trac/ghc/ticket/15449
enableParallelBuilding = !buildPlatform.isAarch64;
enableParallelBuilding = true;
outputs = [ "out" "doc" ];

View File

@@ -1,8 +1,5 @@
{ stdenv, fetchFromGitHub, tzdata, iana-etc, go_bootstrap, runCommand, writeScriptBin
, perl, which, pkgconfig, patch, procps
, pcre, cacert, llvm
, Security, Foundation
, makeWrapper, git, subversion, mercurial, bazaar }:
, perl, which, pkgconfig, patch, procps, pcre, cacert, llvm, Security, Foundation }:
let
@@ -37,7 +34,7 @@ stdenv.mkDerivation rec {
GOCACHE = "off";
# perl is used for testing go vet
nativeBuildInputs = [ perl which pkgconfig patch makeWrapper procps ];
nativeBuildInputs = [ perl which pkgconfig patch procps ];
buildInputs = [ cacert pcre ]
++ optionals stdenv.isLinux [ stdenv.cc.libc.out ]
++ optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ];
@@ -165,9 +162,6 @@ stdenv.mkDerivation rec {
installPhase = ''
cp -r . $GOROOT
( cd $GOROOT/src && ./all.bash )
# (https://github.com/golang/go/wiki/GoGetTools)
wrapProgram $out/share/go/bin/go --prefix PATH ":" "${stdenv.lib.makeBinPath [ git subversion mercurial bazaar ]}"
'';
preFixup = ''

View File

@@ -1,8 +1,5 @@
{ stdenv, fetchFromGitHub, tzdata, iana-etc, go_bootstrap, runCommand, writeScriptBin
, perl, which, pkgconfig, patch, procps
, pcre, cacert, llvm
, Security, Foundation
, makeWrapper, git, subversion, mercurial, bazaar }:
, perl, which, pkgconfig, patch, procps, pcre, cacert, llvm, Security, Foundation }:
let
@@ -37,7 +34,7 @@ stdenv.mkDerivation rec {
GOCACHE = "off";
# perl is used for testing go vet
nativeBuildInputs = [ perl which pkgconfig patch makeWrapper procps ];
nativeBuildInputs = [ perl which pkgconfig patch procps ];
buildInputs = [ cacert pcre ]
++ optionals stdenv.isLinux [ stdenv.cc.libc.out ]
++ optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ];
@@ -171,9 +168,6 @@ stdenv.mkDerivation rec {
installPhase = ''
cp -r . $GOROOT
( cd $GOROOT/src && ./all.bash )
# (https://github.com/golang/go/wiki/GoGetTools)
wrapProgram $out/share/go/bin/go --prefix PATH ":" "${stdenv.lib.makeBinPath [ git subversion mercurial bazaar ]}"
'';
preFixup = ''

View File

@@ -1,8 +1,5 @@
{ stdenv, fetchFromGitHub, tzdata, iana-etc, go_bootstrap, runCommand, writeScriptBin
, perl, which, pkgconfig, patch, procps
, pcre, cacert, llvm
, Security, Foundation
, makeWrapper, git, subversion, mercurial, bazaar }:
, perl, which, pkgconfig, patch, procps, pcre, cacert, llvm, Security, Foundation }:
let
@@ -35,7 +32,7 @@ stdenv.mkDerivation rec {
};
# perl is used for testing go vet
nativeBuildInputs = [ perl which pkgconfig patch makeWrapper procps ];
nativeBuildInputs = [ perl which pkgconfig patch procps ];
buildInputs = [ cacert pcre ]
++ optionals stdenv.isLinux [ stdenv.cc.libc.out ]
++ optionals (stdenv.hostPlatform.libc == "glibc") [ stdenv.cc.libc.static ];
@@ -165,9 +162,6 @@ stdenv.mkDerivation rec {
installPhase = ''
cp -r . $GOROOT
( cd $GOROOT/src && ./all.bash )
# (https://github.com/golang/go/wiki/GoGetTools)
wrapProgram $out/share/go/bin/go --prefix PATH ":" "${stdenv.lib.makeBinPath [ git subversion mercurial bazaar ]}"
'';
preFixup = ''

View File

@@ -1,6 +1,6 @@
import ./shared.nix {
majorVersion = "1";
minorVersion = "0";
maintenanceVersion = "0";
src_sha256 = "083277z90m1jxr2d1ysb96rgjj9h5q97l6h54mx3pb3f38ykshz2";
maintenanceVersion = "1";
src_sha256 = "0bqb5c63c7jnb753nplqj5v4k9pvh792k8y4b1n5pq8jiibr86i0";
}

View File

@@ -0,0 +1,118 @@
{ stdenv, fetchurl, patchelf, gmp }:
let
version = "20130715";
usr_prefix = if stdenv.isDarwin then "usr/local" else "usr";
dynamic_linker = stdenv.cc.bintools.dynamicLinker;
in
stdenv.mkDerivation rec {
name = "mlton-${version}";
binSrc =
if stdenv.hostPlatform.system == "i686-linux" then (fetchurl {
url = "mirror://sourceforge/project/mlton/mlton/${version}/${name}-1.x86-linux.tgz";
sha256 = "1kxjjmnw4xk2d9hpvz43w9dvyhb3025k4zvjx785c33nrwkrdn4j";
})
else if stdenv.hostPlatform.system == "x86_64-linux" then (fetchurl {
url = "mirror://sourceforge/project/mlton/mlton/${version}/${name}-1.amd64-linux.tgz";
sha256 = "0fyhwxb4nmpirjbjcvk9f6w67gmn2gkz7xcgz0xbfih9kc015ygn";
})
else if stdenv.hostPlatform.system == "x86_64-darwin" then (fetchurl {
url = "mirror://sourceforge/project/mlton/mlton/${version}/${name}-1.amd64-darwin.gmp-macports.tgz";
sha256 = "044wnh9hhg6if886xy805683k0as347xd37r0r1yi4x7qlxzzgx9";
})
else throw "Architecture not supported";
codeSrc =
fetchurl {
url = "mirror://sourceforge/project/mlton/mlton/${version}/${name}.src.tgz";
sha256 = "0v1x2hrh9hiqkvnbq11kf34v4i5a2x0ffxbzqaa8skyl26nmfn11";
};
srcs = [ binSrc codeSrc ];
sourceRoot = name;
buildInputs = [ gmp ];
nativeBuildInputs = stdenv.lib.optional stdenv.isLinux patchelf;
makeFlags = [ "all-no-docs" ];
configurePhase = ''
# Fix paths in the source.
find . -type f | grep -v -e '\.tgz''$' | xargs sed -i "s@/usr/bin/env bash@$(type -p bash)@"
substituteInPlace $(pwd)/Makefile --replace '/bin/cp' $(type -p cp)
substituteInPlace bin/mlton-script --replace gcc cc
substituteInPlace bin/regression --replace gcc cc
substituteInPlace lib/mlnlffi-lib/Makefile --replace gcc cc
substituteInPlace mlnlffigen/gen-cppcmd --replace gcc cc
substituteInPlace runtime/Makefile --replace gcc cc
substituteInPlace ../${usr_prefix}/bin/mlton --replace gcc cc
# Fix paths in the binary distribution.
BIN_DIST_DIR="$(pwd)/../${usr_prefix}"
for f in "bin/mlton" "lib/mlton/platform" "lib/mlton/static-library" ; do
substituteInPlace "$BIN_DIST_DIR/$f" --replace '/${usr_prefix}/bin/env bash' $(type -p bash)
done
substituteInPlace $(pwd)/../${usr_prefix}/bin/mlton --replace '/${usr_prefix}/lib/mlton' $(pwd)/../${usr_prefix}/lib/mlton
'' + stdenv.lib.optionalString stdenv.cc.isClang ''
sed -i "s_ patch -s -p0 <gdtoa.hide-public-fns.patch_ patch -s -p0 <gdtoa.hide-public-fns.patch\n\tsed -i 's|printf(emptyfmt|printf(\"\"|g' ./gdtoa/arithchk.c_" ./runtime/Makefile
'' + stdenv.lib.optionalString stdenv.isDarwin ''
sed -i 's|XCFLAGS += -I/usr/local/include -I/sw/include -I/opt/local/include||' ./runtime/Makefile
'';
preBuild = ''
# To build the source we have to put the binary distribution in the $PATH.
export PATH="$PATH:$(pwd)/../${usr_prefix}/bin/"
# Let the builder execute the binary distribution.
chmod u+x $(pwd)/../${usr_prefix}/bin/mllex
chmod u+x $(pwd)/../${usr_prefix}/bin/mlyacc
chmod u+x $(pwd)/../${usr_prefix}/bin/mlton
# So the builder runs the binary compiler with gmp.
export LD_LIBRARY_PATH=${gmp.out}/lib:$LD_LIBRARY_PATH
'' + stdenv.lib.optionalString stdenv.isLinux ''
# Patch ELF interpreter.
patchelf --set-interpreter ${dynamic_linker} $(pwd)/../${usr_prefix}/lib/mlton/mlton-compile
for e in mllex mlyacc ; do
patchelf --set-interpreter ${dynamic_linker} $(pwd)/../${usr_prefix}/bin/$e
done
'' + stdenv.lib.optionalString stdenv.isDarwin ''
# Patch libgmp linking
install_name_tool -change /opt/local/lib/libgmp.10.dylib ${gmp}/lib/libgmp.10.dylib $(pwd)/../${usr_prefix}/lib/mlton/mlton-compile
install_name_tool -change /opt/local/lib/libgmp.10.dylib ${gmp}/lib/libgmp.10.dylib $(pwd)/../${usr_prefix}/bin/mlyacc
install_name_tool -change /opt/local/lib/libgmp.10.dylib ${gmp}/lib/libgmp.10.dylib $(pwd)/../${usr_prefix}/bin/mllex
'';
doCheck = true;
installTargets = [ "install-no-docs" ];
postInstall = ''
# Fix path to mlton libraries.
substituteInPlace $(pwd)/install/${usr_prefix}/bin/mlton --replace '/${usr_prefix}/lib/mlton' $out/lib/mlton
# Path to libgmp.
substituteInPlace $(pwd)/install/${usr_prefix}/bin/mlton --replace "-link-opt '-lm -lgmp'" "-link-opt '-lm -lgmp -L${gmp.out}/lib'"
# Path to gmp.h.
substituteInPlace $(pwd)/install/${usr_prefix}/bin/mlton --replace "-cc-opt '-O1 -fno-common'" "-cc-opt '-O1 -fno-common -I${gmp.dev}/include'"
# Path to the same cc used in the build; needed at runtime.
substituteInPlace $(pwd)/install/${usr_prefix}/bin/mlton --replace "gcc='gcc'" "gcc='"$(type -p cc)"'"
# Copy files to final positions.
cp -r $(pwd)/install/${usr_prefix}/bin $out
cp -r $(pwd)/install/${usr_prefix}/lib $out
cp -r $(pwd)/install/${usr_prefix}/man $out
'';
meta = import ./meta.nix;
}

View File

@@ -0,0 +1,57 @@
{ stdenv, fetchurl, patchelf, gmp }:
let
dynamic-linker = stdenv.cc.bintools.dynamicLinker;
in
stdenv.mkDerivation rec {
name = "mlton-${version}";
version = "20180207";
src = if stdenv.hostPlatform.system == "x86_64-linux" then (fetchurl {
url = "https://github.com/MLton/mlton/releases/download/on-${version}-release/${name}-1.amd64-linux.tgz";
sha256 = "0f4q575yfm5dpg4a2wsnqn4l2zrar96p6rlsk0dw10ggyfwvsjlf";
})
else if stdenv.hostPlatform.system == "x86_64-darwin" then (fetchurl {
url = "https://github.com/MLton/mlton/releases/download/on-${version}-release/${name}-1.amd64-darwin.gmp-static.tgz";
sha256 = "1cw7yhw48qp12q0adwf8srpjzrgkp84kmlkqw3pz8vkxz4p9hbdv";
})
else
throw "Architecture not supported";
buildInputs = [ gmp ];
nativeBuildInputs = stdenv.lib.optional stdenv.isLinux patchelf;
buildPhase = ''
make update \
CC="$(type -p cc)" \
WITH_GMP_INC_DIR="${gmp.dev}/include" \
WITH_GMP_LIB_DIR="${gmp}/lib"
'';
installPhase = ''
make install PREFIX=$out
'';
postFixup = stdenv.lib.optionalString stdenv.isLinux ''
patchelf --set-interpreter ${dynamic-linker} $out/lib/mlton/mlton-compile
patchelf --set-rpath ${gmp}/lib $out/lib/mlton/mlton-compile
for e in mllex mlnlffigen mlprof mlyacc; do
patchelf --set-interpreter ${dynamic-linker} $out/bin/$e
patchelf --set-rpath ${gmp}/lib $out/bin/$e
done
'' + stdenv.lib.optionalString stdenv.isDarwin ''
install_name_tool -change \
/opt/local/lib/libgmp.10.dylib \
${gmp}/lib/libgmp.10.dylib \
$out/lib/mlton/mlton-compile
for e in mllex mlnlffigen mlprof mlyacc; do
install_name_tool -change \
/opt/local/lib/libgmp.10.dylib \
${gmp}/lib/libgmp.10.dylib \
$out/bin/$e
done
'';
meta = import ./meta.nix;
}

View File

@@ -1,134 +1,26 @@
{ stdenv, fetchurl, patchelf, gmp }:
{ stdenv, fetchurl, fetchgit, patchelf, gmp }:
rec {
mlton20130715 = import ./20130715.nix {
inherit stdenv fetchurl patchelf gmp;
};
let
version = "20130715";
mlton20180207Binary = import ./20180207-binary.nix {
inherit stdenv fetchurl patchelf gmp;
};
usr_prefix = if stdenv.isDarwin then "usr/local" else "usr";
mlton20180207 = import ./from-git-source.nix {
mltonBootstrap = mlton20180207Binary;
version = "20180207";
rev = "on-20180207-release";
sha256 = "00rdd2di5x1dzac64il9z05m3fdzicjd3226wwjyynv631jj3q2a";
inherit stdenv fetchgit gmp;
};
dynamic_linker =
if stdenv.isx86_64 then "${stdenv.glibc.out}/lib/ld-linux-x86-64.so.2"
else "${stdenv.glibc.out}/lib/ld-linux.so.2";
in
stdenv.mkDerivation rec {
name = "mlton-${version}";
binSrc =
if stdenv.hostPlatform.system == "i686-linux" then (fetchurl {
url = "mirror://sourceforge/project/mlton/mlton/${version}/${name}-1.x86-linux.tgz";
sha256 = "1kxjjmnw4xk2d9hpvz43w9dvyhb3025k4zvjx785c33nrwkrdn4j";
})
else if stdenv.hostPlatform.system == "x86_64-linux" then (fetchurl {
url = "mirror://sourceforge/project/mlton/mlton/${version}/${name}-1.amd64-linux.tgz";
sha256 = "0fyhwxb4nmpirjbjcvk9f6w67gmn2gkz7xcgz0xbfih9kc015ygn";
})
else if stdenv.hostPlatform.system == "x86_64-darwin" then (fetchurl {
url = "mirror://sourceforge/project/mlton/mlton/${version}/${name}-1.amd64-darwin.gmp-macports.tgz";
sha256 = "044wnh9hhg6if886xy805683k0as347xd37r0r1yi4x7qlxzzgx9";
})
else throw "Architecture not supported";
codeSrc =
fetchurl {
url = "mirror://sourceforge/project/mlton/mlton/${version}/${name}.src.tgz";
sha256 = "0v1x2hrh9hiqkvnbq11kf34v4i5a2x0ffxbzqaa8skyl26nmfn11";
};
srcs = [ binSrc codeSrc ];
sourceRoot = name;
buildInputs = [ gmp ];
nativeBuildInputs = stdenv.lib.optional stdenv.isLinux patchelf;
makeFlags = [ "all-no-docs" ];
configurePhase = ''
# Fix paths in the source.
find . -type f | grep -v -e '\.tgz''$' | xargs sed -i "s@/usr/bin/env bash@$(type -p bash)@"
substituteInPlace $(pwd)/Makefile --replace '/bin/cp' $(type -p cp)
substituteInPlace bin/mlton-script --replace gcc cc
substituteInPlace bin/regression --replace gcc cc
substituteInPlace lib/mlnlffi-lib/Makefile --replace gcc cc
substituteInPlace mlnlffigen/gen-cppcmd --replace gcc cc
substituteInPlace runtime/Makefile --replace gcc cc
substituteInPlace ../${usr_prefix}/bin/mlton --replace gcc cc
# Fix paths in the binary distribution.
BIN_DIST_DIR="$(pwd)/../${usr_prefix}"
for f in "bin/mlton" "lib/mlton/platform" "lib/mlton/static-library" ; do
substituteInPlace "$BIN_DIST_DIR/$f" --replace '/${usr_prefix}/bin/env bash' $(type -p bash)
done
substituteInPlace $(pwd)/../${usr_prefix}/bin/mlton --replace '/${usr_prefix}/lib/mlton' $(pwd)/../${usr_prefix}/lib/mlton
'' + stdenv.lib.optionalString stdenv.cc.isClang ''
sed -i "s_ patch -s -p0 <gdtoa.hide-public-fns.patch_ patch -s -p0 <gdtoa.hide-public-fns.patch\n\tsed -i 's|printf(emptyfmt|printf(\"\"|g' ./gdtoa/arithchk.c_" ./runtime/Makefile
'' + stdenv.lib.optionalString stdenv.isDarwin ''
sed -i 's|XCFLAGS += -I/usr/local/include -I/sw/include -I/opt/local/include||' ./runtime/Makefile
'';
preBuild = ''
# To build the source we have to put the binary distribution in the $PATH.
export PATH="$PATH:$(pwd)/../${usr_prefix}/bin/"
# Let the builder execute the binary distribution.
chmod u+x $(pwd)/../${usr_prefix}/bin/mllex
chmod u+x $(pwd)/../${usr_prefix}/bin/mlyacc
chmod u+x $(pwd)/../${usr_prefix}/bin/mlton
# So the builder runs the binary compiler with gmp.
export LD_LIBRARY_PATH=${gmp.out}/lib:$LD_LIBRARY_PATH
'' + stdenv.lib.optionalString stdenv.isLinux ''
# Patch ELF interpreter.
patchelf --set-interpreter ${dynamic_linker} $(pwd)/../${usr_prefix}/lib/mlton/mlton-compile
for e in mllex mlyacc ; do
patchelf --set-interpreter ${dynamic_linker} $(pwd)/../${usr_prefix}/bin/$e
done
'' + stdenv.lib.optionalString stdenv.isDarwin ''
# Patch libgmp linking
install_name_tool -change /opt/local/lib/libgmp.10.dylib ${gmp}/lib/libgmp.10.dylib $(pwd)/../${usr_prefix}/lib/mlton/mlton-compile
install_name_tool -change /opt/local/lib/libgmp.10.dylib ${gmp}/lib/libgmp.10.dylib $(pwd)/../${usr_prefix}/bin/mlyacc
install_name_tool -change /opt/local/lib/libgmp.10.dylib ${gmp}/lib/libgmp.10.dylib $(pwd)/../${usr_prefix}/bin/mllex
'';
doCheck = true;
installTargets = [ "install-no-docs" ];
postInstall = ''
# Fix path to mlton libraries.
substituteInPlace $(pwd)/install/${usr_prefix}/bin/mlton --replace '/${usr_prefix}/lib/mlton' $out/lib/mlton
# Path to libgmp.
substituteInPlace $(pwd)/install/${usr_prefix}/bin/mlton --replace "-link-opt '-lm -lgmp'" "-link-opt '-lm -lgmp -L${gmp.out}/lib'"
# Path to gmp.h.
substituteInPlace $(pwd)/install/${usr_prefix}/bin/mlton --replace "-cc-opt '-O1 -fno-common'" "-cc-opt '-O1 -fno-common -I${gmp.dev}/include'"
# Path to the same cc used in the build; needed at runtime.
substituteInPlace $(pwd)/install/${usr_prefix}/bin/mlton --replace "gcc='gcc'" "gcc='"$(type -p cc)"'"
# Copy files to final positions.
cp -r $(pwd)/install/${usr_prefix}/bin $out
cp -r $(pwd)/install/${usr_prefix}/lib $out
cp -r $(pwd)/install/${usr_prefix}/man $out
'';
meta = {
description = "Open-source, whole-program, optimizing Standard ML compiler";
longDescription = ''
MLton is an open source, whole-program optimizing compiler for the Standard ML programming language.
MLton aims to produce fast executables, and to encourage rapid prototyping and modular programming
by eliminating performance penalties often associated with the use of high-level language features.
MLton development began in 1997, and continues to this day with a growing worldwide community of
developers and users, who have helped to port MLton to a number of platforms.
Description taken from http://en.wikipedia.org/wiki/Mlton .
'';
homepage = http://mlton.org/;
license = "bsd";
platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin"];
mltonHEAD = import ./from-git-source.nix {
mltonBootstrap = mlton20180207Binary;
version = "HEAD";
rev = "e149c9917cfbfe6aba5c986a958ed76d5cc6cfde";
sha256 = "0a0j1i0f0fxw2my1309srq5j3vz0kawrrln01gxms2m5hy5dl50d";
inherit stdenv fetchgit gmp;
};
}

View File

@@ -0,0 +1,35 @@
{ fetchgit
, gmp
, mltonBootstrap
, url ? "https://github.com/mlton/mlton"
, rev
, sha256
, stdenv
, version
}:
stdenv.mkDerivation {
name = "mlton-${version}";
src = fetchgit {
inherit url rev sha256;
};
buildInputs = [mltonBootstrap gmp];
preBuild = ''
find . -type f | grep -v -e '\.tgz''$' | xargs sed -i "s@/usr/bin/env bash@$(type -p bash)@"
makeFlagsArray=(
MLTON_VERSION="${version} ${rev}"
CC="$(type -p cc)"
PREFIX="$out"
WITH_GMP_INC_DIR="${gmp.dev}/include"
WITH_GMP_LIB_DIR="${gmp}/lib"
)
'';
doCheck = true;
meta = import ./meta.nix;
}

View File

@@ -0,0 +1,15 @@
{
description = "Open-source, whole-program, optimizing Standard ML compiler";
longDescription = ''
MLton is an open source, whole-program optimizing compiler for the Standard ML programming language.
MLton aims to produce fast executables, and to encourage rapid prototyping and modular programming
by eliminating performance penalties often associated with the use of high-level language features.
MLton development began in 1997, and continues to this day with a growing worldwide community of
developers and users, who have helped to port MLton to a number of platforms.
Description taken from http://en.wikipedia.org/wiki/Mlton .
'';
homepage = http://mlton.org/;
license = "bsd";
platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin"];
}

View File

@@ -0,0 +1,26 @@
{ stdenv, fetchurl, fetchFromGitHub }:
stdenv.mkDerivation rec {
name = "openspin-${version}";
version = "unstable-2018-10-02";
src = fetchFromGitHub {
owner = "parallaxinc";
repo = "OpenSpin";
rev = "f3a587ed3e4f6a50b3c8d2022bbec5676afecedb";
sha256 = "1knkbzdanb60cwp7mggymkhd0167lh2sb1c00d1vhw7s0s1rj96n";
};
installPhase = ''
mkdir -p $out/bin
mv build/openspin $out/bin/openspin
'';
meta = with stdenv.lib; {
description = "Compiler for SPIN/PASM languages for Parallax Propeller MCU";
homepage = https://github.com/parallaxinc/OpenSpin;
license = licenses.mit;
maintainers = [ maintainers.redvers ];
platforms = platforms.all;
};
}

View File

@@ -1,9 +1,9 @@
{ stdenv, fetchzip, fetchFromGitHub, boost, cmake, z3 }:
let
version = "0.4.24";
rev = "e67f0147998a9e3835ed3ce8bf6a0a0c634216c5";
sha256 = "1gy2miv6ia1z98zy6w4y03balwfr964bnvwzyg8v7pn2mayqnaap";
version = "0.4.25";
rev = "59dbf8f1085b8b92e8b7eb0ce380cbeb642e97eb";
sha256 = "11lss1sldzjg4689c06iw0iivyi9f4zpi4l9za0fgy6k85qz43v9";
jsoncppURL = https://github.com/open-source-parsers/jsoncpp/archive/1.8.4.tar.gz;
jsoncpp = fetchzip {
url = jsoncppURL;