mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 04:43:09 +03:00
parent
1901f3fe77
commit
d590a0f4b6
@ -1,282 +0,0 @@
|
|||||||
# generic builder for Cabal packages
|
|
||||||
|
|
||||||
{ stdenv, fetchurl, lib, pkgconfig, ghcjs, ghc, Cabal, jailbreakCabal, glibcLocales
|
|
||||||
, gnugrep, coreutils, hscolour # hscolour is unused
|
|
||||||
, enableLibraryProfiling ? false
|
|
||||||
, enableSharedLibraries ? false
|
|
||||||
, enableSharedExecutables ? false
|
|
||||||
, enableStaticLibraries ? true
|
|
||||||
, enableCheckPhase ? true
|
|
||||||
, enableHyperlinkSource ? false
|
|
||||||
, extension ? (self : super : {})
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
|
||||||
enableFeature = stdenv.lib.enableFeature;
|
|
||||||
optional = stdenv.lib.optional;
|
|
||||||
optionals = stdenv.lib.optionals;
|
|
||||||
optionalString = stdenv.lib.optionalString;
|
|
||||||
filter = stdenv.lib.filter;
|
|
||||||
|
|
||||||
defaultSetupHs = builtins.toFile "Setup.hs" ''
|
|
||||||
import Distribution.Simple
|
|
||||||
main = defaultMain
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
|
|
||||||
{
|
|
||||||
mkDerivation =
|
|
||||||
args : # arguments for the individual package, can modify the defaults
|
|
||||||
let # These attributes are removed in the end. This is in order not to spoil the build
|
|
||||||
# environment overly, but also to keep hash-backwards-compatible with the old cabal.nix.
|
|
||||||
internalAttrs = [
|
|
||||||
"internalAttrs" "buildDepends" "buildTools" "extraLibraries" "pkgconfigDepends"
|
|
||||||
"isLibrary" "isExecutable" "testDepends"
|
|
||||||
];
|
|
||||||
|
|
||||||
# Stuff happening after the user preferences have been processed. We remove
|
|
||||||
# internal attributes and strip null elements from the dependency lists, all
|
|
||||||
# in the interest of keeping hashes stable.
|
|
||||||
postprocess =
|
|
||||||
x : (removeAttrs x internalAttrs) // {
|
|
||||||
buildInputs = filter (y : ! (y == null)) x.buildInputs;
|
|
||||||
propagatedBuildInputs = filter (y : ! (y == null)) x.propagatedBuildInputs;
|
|
||||||
propagatedUserEnvPkgs = filter (y : ! (y == null)) x.propagatedUserEnvPkgs;
|
|
||||||
doCheck = enableCheckPhase && x.doCheck;
|
|
||||||
hyperlinkSource = enableHyperlinkSource && x.hyperlinkSource;
|
|
||||||
};
|
|
||||||
|
|
||||||
defaults =
|
|
||||||
self : { # self is the final version of the attribute set
|
|
||||||
|
|
||||||
# pname should be defined by the client to be the package basename
|
|
||||||
# version should be defined by the client to be the package version
|
|
||||||
|
|
||||||
# fname is the internal full name of the package
|
|
||||||
fname = "${self.pname}-${self.version}";
|
|
||||||
|
|
||||||
# name is the external full name of the package; usually we prefix
|
|
||||||
# all packages with haskell- to avoid name clashes for libraries;
|
|
||||||
# if that is not desired (for applications), name can be set to
|
|
||||||
# fname.
|
|
||||||
name = if self.isLibrary then
|
|
||||||
if enableLibraryProfiling && self.enableSharedLibraries then
|
|
||||||
"haskell-${self.pname}-ghcjs${ghc.ghc.version}-${self.version}-profiling-shared"
|
|
||||||
else if enableLibraryProfiling && !self.enableSharedLibraries then
|
|
||||||
"haskell-${self.pname}-ghcjs${ghc.ghc.version}-${self.version}-profiling"
|
|
||||||
else if !enableLibraryProfiling && self.enableSharedLibraries then
|
|
||||||
"haskell-${self.pname}-ghcjs${ghc.ghc.version}-${self.version}-shared"
|
|
||||||
else
|
|
||||||
"haskell-${self.pname}-ghcjs${ghc.ghc.version}-${self.version}"
|
|
||||||
else
|
|
||||||
"${self.pname}-${self.version}";
|
|
||||||
|
|
||||||
# the default download location for Cabal packages is Hackage,
|
|
||||||
# you still have to specify the checksum
|
|
||||||
src = fetchurl {
|
|
||||||
url = "mirror://hackage/${self.pname}/${self.fname}.tar.gz";
|
|
||||||
inherit (self) sha256;
|
|
||||||
};
|
|
||||||
|
|
||||||
# default buildInputs are just ghc, if more buildInputs are required
|
|
||||||
# buildInputs can be extended by the client by using extraBuildInputs,
|
|
||||||
# but often propagatedBuildInputs is preferable anyway
|
|
||||||
buildInputs = [ghc ghc.ghc.parent.Cabal_1_22_0_0] ++ self.extraBuildInputs;
|
|
||||||
extraBuildInputs = self.buildTools ++
|
|
||||||
(optionals self.doCheck self.testDepends) ++
|
|
||||||
(if self.pkgconfigDepends == [] then [] else [pkgconfig]) ++
|
|
||||||
(if self.isLibrary then [] else self.buildDepends ++ self.extraLibraries ++ self.pkgconfigDepends);
|
|
||||||
|
|
||||||
# we make sure that propagatedBuildInputs is defined, so that we don't
|
|
||||||
# have to check for its existence
|
|
||||||
propagatedBuildInputs = if self.isLibrary then self.buildDepends ++ self.extraLibraries ++ self.pkgconfigDepends else [];
|
|
||||||
|
|
||||||
# By default, also propagate all dependencies to the user environment. This is required, otherwise packages would be broken, because
|
|
||||||
# GHC also needs all dependencies to be available.
|
|
||||||
propagatedUserEnvPkgs = if self.isLibrary then self.buildDepends else [];
|
|
||||||
|
|
||||||
# library directories that have to be added to the Cabal files
|
|
||||||
extraLibDirs = [];
|
|
||||||
|
|
||||||
# build-depends Cabal field
|
|
||||||
buildDepends = [];
|
|
||||||
|
|
||||||
# target(s) passed to the cabal build phase as an argument
|
|
||||||
buildTarget = "";
|
|
||||||
|
|
||||||
# build-depends Cabal fields stated in test-suite stanzas
|
|
||||||
testDepends = [];
|
|
||||||
|
|
||||||
# target(s) passed to the cabal test phase as an argument
|
|
||||||
testTarget = "";
|
|
||||||
|
|
||||||
# build-tools Cabal field
|
|
||||||
buildTools = [];
|
|
||||||
|
|
||||||
# extra-libraries Cabal field
|
|
||||||
extraLibraries = [];
|
|
||||||
|
|
||||||
# pkgconfig-depends Cabal field
|
|
||||||
pkgconfigDepends = [];
|
|
||||||
|
|
||||||
isLibrary = ! self.isExecutable;
|
|
||||||
isExecutable = false;
|
|
||||||
|
|
||||||
# ignore version restrictions on the build inputs that the cabal file might specify
|
|
||||||
jailbreak = false;
|
|
||||||
|
|
||||||
# pass the '--enable-split-objs' flag to cabal in the configure stage
|
|
||||||
enableSplitObjs = false; # !stdenv.isDarwin; # http://hackage.haskell.org/trac/ghc/ticket/4013
|
|
||||||
|
|
||||||
# pass the '--enable-tests' flag to cabal in the configure stage
|
|
||||||
# and run any regression test suites the package might have
|
|
||||||
doCheck = false; #enableCheckPhase;
|
|
||||||
|
|
||||||
# pass the '--hyperlink-source' flag to ./Setup haddock
|
|
||||||
hyperlinkSource = enableHyperlinkSource;
|
|
||||||
|
|
||||||
# abort the build if the configure phase detects that the package
|
|
||||||
# depends on multiple versions of the same build input
|
|
||||||
strictConfigurePhase = true;
|
|
||||||
|
|
||||||
# pass the '--enable-library-vanilla' flag to cabal in the
|
|
||||||
# configure stage to enable building shared libraries
|
|
||||||
inherit enableStaticLibraries;
|
|
||||||
|
|
||||||
# pass the '--enable-shared' flag to cabal in the configure
|
|
||||||
# stage to enable building shared libraries
|
|
||||||
inherit enableSharedLibraries;
|
|
||||||
|
|
||||||
# pass the '--enable-executable-dynamic' flag to cabal in
|
|
||||||
# the configure stage to enable linking shared libraries
|
|
||||||
inherit enableSharedExecutables;
|
|
||||||
|
|
||||||
extraConfigureFlags = [
|
|
||||||
(enableFeature self.enableSplitObjs "split-objs")
|
|
||||||
(enableFeature enableLibraryProfiling "library-profiling")
|
|
||||||
(enableFeature true "shared")
|
|
||||||
(enableFeature self.enableStaticLibraries "library-vanilla")
|
|
||||||
(enableFeature self.enableSharedExecutables "executable-dynamic")
|
|
||||||
(enableFeature self.doCheck "tests")
|
|
||||||
];
|
|
||||||
|
|
||||||
# GHC needs the locale configured during the Haddock phase.
|
|
||||||
LANG = "en_US.UTF-8";
|
|
||||||
LOCALE_ARCHIVE = optionalString stdenv.isLinux "${glibcLocales}/lib/locale/locale-archive";
|
|
||||||
|
|
||||||
# compiles Setup and configures
|
|
||||||
configurePhase = ''
|
|
||||||
eval "$preConfigure"
|
|
||||||
|
|
||||||
${optionalString self.jailbreak "${ghc.ghc.parent.jailbreakCabal}/bin/jailbreak-cabal ${self.pname}.cabal"}
|
|
||||||
|
|
||||||
PATH=$PATH:${ghc.ghc.ghc}/bin
|
|
||||||
|
|
||||||
for i in Setup.hs Setup.lhs ${defaultSetupHs}; do
|
|
||||||
test -f $i && break
|
|
||||||
done
|
|
||||||
ghc --make -o Setup -odir $TMPDIR -hidir $TMPDIR $i
|
|
||||||
|
|
||||||
for p in $extraBuildInputs $propagatedBuildInputs $propagatedNativeBuildInputs; do
|
|
||||||
PkgDir="$p/lib/ghcjs-${ghc.ghc.version}_ghc-${ghc.ghc.ghc.version}/package.conf.d"
|
|
||||||
if [ -f "$PkgDir/package.cache" ]; then
|
|
||||||
extraConfigureFlags+=" --package-db=$PkgDir"
|
|
||||||
continue;
|
|
||||||
fi
|
|
||||||
if [ -d "$p/include" ]; then
|
|
||||||
extraConfigureFlags+=" --extra-include-dirs=$p/include"
|
|
||||||
fi
|
|
||||||
for d in lib{,64}; do
|
|
||||||
if [ -d "$p/$d" ]; then
|
|
||||||
extraConfigureFlags+=" --extra-lib-dirs=$p/$d"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
configureFlags+=" --package-db=${ghc.ghc}/${ghc.ghc.libDir}/package.conf.d"
|
|
||||||
|
|
||||||
${optionalString (self.enableSharedExecutables && self.stdenv.isLinux) ''
|
|
||||||
configureFlags+=" --ghc-option=-optl=-Wl,-rpath=$out/lib/${ghc.ghc.name}/${self.pname}-${self.version}";
|
|
||||||
''}
|
|
||||||
${optionalString (self.enableSharedExecutables && self.stdenv.isDarwin) ''
|
|
||||||
configureFlags+=" --ghc-option=-optl=-Wl,-headerpad_max_install_names";
|
|
||||||
''}
|
|
||||||
|
|
||||||
echo "configure flags: $extraConfigureFlags $configureFlags"
|
|
||||||
./Setup configure --ghcjs --verbose --prefix="$out" --libdir='$prefix/lib/$compiler' \
|
|
||||||
--libsubdir='$pkgid' $extraConfigureFlags $configureFlags 2>&1 \
|
|
||||||
${optionalString self.strictConfigurePhase ''
|
|
||||||
| ${coreutils}/bin/tee "$NIX_BUILD_TOP/cabal-configure.log"
|
|
||||||
if ${gnugrep}/bin/egrep -q '^Warning:.*depends on multiple versions' "$NIX_BUILD_TOP/cabal-configure.log"; then
|
|
||||||
echo >&2 "*** abort because of serious configure-time warning from Cabal"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
''}
|
|
||||||
|
|
||||||
eval "$postConfigure"
|
|
||||||
'';
|
|
||||||
|
|
||||||
# builds via Cabal
|
|
||||||
buildPhase = ''
|
|
||||||
eval "$preBuild"
|
|
||||||
|
|
||||||
./Setup build ${self.buildTarget}
|
|
||||||
|
|
||||||
export GHC_PACKAGE_PATH=$(${ghc.GHCPackages})
|
|
||||||
#test -n "$noHaddock" || ./Setup haddock --html --hoogle \
|
|
||||||
# ${optionalString self.hyperlinkSource "--hyperlink-source"}
|
|
||||||
|
|
||||||
eval "$postBuild"
|
|
||||||
'';
|
|
||||||
|
|
||||||
checkPhase = optional self.doCheck ''
|
|
||||||
eval "$preCheck"
|
|
||||||
|
|
||||||
./Setup test ${self.testTarget}
|
|
||||||
|
|
||||||
eval "$postCheck"
|
|
||||||
'';
|
|
||||||
|
|
||||||
# installs via Cabal; creates a registration file for nix-support
|
|
||||||
# so that the package can be used in other Haskell-builds; also
|
|
||||||
# adds all propagated build inputs to the user environment packages
|
|
||||||
installPhase = ''
|
|
||||||
eval "$preInstall"
|
|
||||||
|
|
||||||
./Setup copy
|
|
||||||
|
|
||||||
mkdir -p $out/bin # necessary to get it added to PATH
|
|
||||||
|
|
||||||
local confDir=$out/lib/ghcjs-${ghc.ghc.version}_ghc-${ghc.ghc.ghc.version}/package.conf.d
|
|
||||||
local installedPkgConf=$confDir/${self.fname}.installedconf
|
|
||||||
local pkgConf=$confDir/${self.fname}.conf
|
|
||||||
mkdir -p $confDir
|
|
||||||
./Setup register --gen-pkg-config=$pkgConf
|
|
||||||
if test -f $pkgConf; then
|
|
||||||
echo '[]' > $installedPkgConf
|
|
||||||
GHC_PACKAGE_PATH=$installedPkgConf ghcjs-pkg --global register $pkgConf --force --package-db=$confDir || true
|
|
||||||
ghcjs-pkg recache --package-db=$confDir
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -f $out/nix-support/propagated-native-build-inputs; then
|
|
||||||
ln -s $out/nix-support/propagated-native-build-inputs $out/nix-support/propagated-user-env-packages
|
|
||||||
fi
|
|
||||||
|
|
||||||
${optionalString (self.enableSharedExecutables && self.isExecutable && self.stdenv.isDarwin) ''
|
|
||||||
for exe in $out/bin/* ; do
|
|
||||||
install_name_tool -add_rpath $out/lib/${ghc.ghc.name}/${self.pname}-${self.version} $exe || true # Ignore failures, which seem to be due to hitting bash scripts rather than binaries
|
|
||||||
done
|
|
||||||
''}
|
|
||||||
|
|
||||||
eval "$postInstall"
|
|
||||||
'';
|
|
||||||
|
|
||||||
# We inherit stdenv and ghc so that they can be used
|
|
||||||
# in Cabal derivations.
|
|
||||||
inherit stdenv ghc;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
stdenv.mkDerivation (postprocess (let super = defaults self // args self;
|
|
||||||
self = super // extension self super;
|
|
||||||
in self));
|
|
||||||
}
|
|
@ -28,7 +28,9 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
# We patch Cabal for GHCJS. See: https://github.com/haskell/cabal/issues/2454
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
|
sed -i 's/HcPkg.useSingleFileDb = .*/HcPkg.useSingleFileDb = False/' libraries/Cabal/Cabal/Distribution/Simple/GHCJS.hs
|
||||||
echo >mk/build.mk "${buildMK}"
|
echo >mk/build.mk "${buildMK}"
|
||||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||||
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
||||||
|
@ -1,64 +1,91 @@
|
|||||||
{ nodejs, cabal, filepath, HTTP, HUnit, mtl, network, QuickCheck, random, stm
|
{ mkDerivation
|
||||||
, testFramework, testFrameworkHunit, testFrameworkQuickcheck2, time
|
, test-framework
|
||||||
, zlib, aeson, attoparsec, bzlib, dataDefault, ghcPaths, hashable
|
, test-framework-hunit
|
||||||
, haskellSrcExts, haskellSrcMeta, lens, optparseApplicative
|
, test-framework-quickcheck2
|
||||||
, parallel, safe, shelly, split, stringsearch, syb, systemFileio
|
, data-default
|
||||||
, systemFilepath, tar, terminfo, textBinary, unorderedContainers
|
, ghc-paths
|
||||||
, vector, wlPprintText, yaml, fetchgit, Cabal, cabalInstall
|
, haskell-src-exts
|
||||||
, regexPosix, alex, happy, git, gnumake, gcc, autoconf, patch
|
, haskell-src-meta
|
||||||
, automake, libtool, gmp, base16Bytestring
|
, optparse-applicative
|
||||||
, cryptohash, executablePath, transformersCompat, haddockApi
|
, system-fileio
|
||||||
, haddock, hspec, xhtml, primitive, cacert, pkgs, ghc
|
, system-filepath
|
||||||
|
, text-binary
|
||||||
|
, unordered-containers
|
||||||
|
, cabal-install
|
||||||
|
, wl-pprint-text
|
||||||
|
, base16-bytestring
|
||||||
|
, executable-path
|
||||||
|
, transformers-compat
|
||||||
|
, haddock-api
|
||||||
|
, ghcjs-prim
|
||||||
|
, regex-posix
|
||||||
|
|
||||||
|
, ghc, gmp
|
||||||
|
, jailbreak-cabal
|
||||||
|
|
||||||
|
, nodejs, stdenv, filepath, HTTP, HUnit, mtl, network, QuickCheck, random, stm
|
||||||
|
, time
|
||||||
|
, zlib, aeson, attoparsec, bzlib, hashable
|
||||||
|
, lens
|
||||||
|
, parallel, safe, shelly, split, stringsearch, syb
|
||||||
|
, tar, terminfo
|
||||||
|
, vector, yaml, fetchgit, Cabal
|
||||||
|
, alex, happy, git, gnumake, autoconf, patch
|
||||||
|
, automake, libtool
|
||||||
|
, cryptohash
|
||||||
|
, haddock, hspec, xhtml, primitive, cacert, pkgs
|
||||||
, coreutils
|
, coreutils
|
||||||
, ghcjsPrim
|
, libiconv
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
version = "0.1.0";
|
version = "0.1.0";
|
||||||
libDir = "share/ghcjs/${pkgs.stdenv.system}-${version}-${ghc.ghc.version}/ghcjs";
|
libDir = "share/ghcjs/${pkgs.stdenv.system}-${version}-${ghc.version}/ghcjs";
|
||||||
ghcjsBoot = fetchgit {
|
ghcjsBoot = fetchgit {
|
||||||
url = git://github.com/ghcjs/ghcjs-boot.git;
|
url = git://github.com/ghcjs/ghcjs-boot.git;
|
||||||
rev = "5c7a71472d5a797e895914d3b82cea447a058793";
|
rev = "8cd6144870470258fb037b3e04a0a2a98c2b6551"; # 7.10 branch
|
||||||
sha256 = "0dp97bgbnlr3sd9yfnk27p6dfv46fi26sn6y6qv1wxs5i29kmjav";
|
sha256 = "16cbncx179n5khf8hkj9r221wf73rc8isffk8rv3n9psshv1jiji";
|
||||||
fetchSubmodules = true;
|
fetchSubmodules = true;
|
||||||
};
|
};
|
||||||
shims = fetchgit {
|
shims = fetchgit {
|
||||||
url = git://github.com/ghcjs/shims.git;
|
url = git://github.com/ghcjs/shims.git;
|
||||||
rev = "99bbd4bed584ec42bfcc5ea61c3808a2c670053d";
|
rev = "6ada4bf1a084d1b80b993303d35ed863d219b031"; # master branch
|
||||||
sha256 = "1my3gqkln7hgm0bpy32pnhwjfza096alh0n9x9ny8xfpxhmzz4h6";
|
sha256 = "0dhfnjj3rxdbb2m1pbnjc2yp4xcgsfdrsinljgdmg0hpqkafp4vc";
|
||||||
};
|
};
|
||||||
in cabal.mkDerivation (self: rec {
|
in mkDerivation (rec {
|
||||||
pname = "ghcjs";
|
pname = "ghcjs";
|
||||||
inherit version;
|
inherit version;
|
||||||
src = fetchgit {
|
src = fetchgit {
|
||||||
url = git://github.com/ghcjs/ghcjs.git;
|
url = git://github.com/ghcjs/ghcjs.git;
|
||||||
rev = "4b9461e8be646d5152a0ae7ece5b3616bf938637";
|
rev = "35a59743c4027f26a227635cb24a6246bd851f8d"; # master branch
|
||||||
sha256 = "19g62j1kkdwcgp0042ppmskwbvfk7qkf1fjs8bpjc6wwd19ipiar";
|
sha256 = "107sh36ji3psdl3py84vxgqbywjyzglj3p0akzpvcmbarxwfr1mw";
|
||||||
};
|
};
|
||||||
isLibrary = true;
|
isLibrary = true;
|
||||||
isExecutable = true;
|
isExecutable = true;
|
||||||
jailbreak = true;
|
jailbreak = true;
|
||||||
noHaddock = true;
|
doHaddock = false;
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
buildDepends = [
|
buildDepends = [
|
||||||
filepath HTTP mtl network random stm time zlib aeson attoparsec
|
filepath HTTP mtl network random stm time zlib aeson attoparsec
|
||||||
bzlib dataDefault ghcPaths hashable haskellSrcExts haskellSrcMeta
|
bzlib data-default ghc-paths hashable haskell-src-exts haskell-src-meta
|
||||||
lens optparseApplicative parallel safe shelly split
|
lens optparse-applicative parallel safe shelly split
|
||||||
stringsearch syb systemFileio systemFilepath tar terminfo textBinary
|
stringsearch syb system-fileio system-filepath tar terminfo text-binary
|
||||||
unorderedContainers vector wlPprintText yaml
|
unordered-containers vector wl-pprint-text yaml
|
||||||
alex happy git gnumake gcc autoconf automake libtool patch gmp
|
alex happy git gnumake autoconf automake libtool patch gmp
|
||||||
base16Bytestring cryptohash executablePath haddockApi
|
base16-bytestring cryptohash executable-path haddock-api
|
||||||
transformersCompat QuickCheck haddock hspec xhtml
|
transformers-compat QuickCheck haddock hspec xhtml
|
||||||
ghcjsPrim regexPosix
|
ghcjs-prim regex-posix libiconv
|
||||||
];
|
];
|
||||||
buildTools = [ nodejs git ];
|
buildTools = [ nodejs git ];
|
||||||
testDepends = [
|
testDepends = [
|
||||||
HUnit testFramework testFrameworkHunit
|
HUnit test-framework test-framework-hunit
|
||||||
];
|
];
|
||||||
patches = [ ./ghcjs.patch ];
|
patches = [ ./ghcjs.patch ];
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
substituteInPlace Setup.hs --replace "/usr/bin/env" "${coreutils}/bin/env"
|
substituteInPlace Setup.hs --replace "/usr/bin/env" "${coreutils}/bin/env"
|
||||||
substituteInPlace src/Compiler/Info.hs --replace "@PREFIX@" "$out"
|
substituteInPlace src/Compiler/Info.hs --replace "@PREFIX@" "$out"
|
||||||
substituteInPlace src-bin/Boot.hs --replace "@PREFIX@" "$out"
|
substituteInPlace src-bin/Boot.hs \
|
||||||
|
--replace "@PREFIX@" "$out" \
|
||||||
|
--replace "@CC@" "${stdenv.cc}/bin/cc"
|
||||||
'';
|
'';
|
||||||
preBuild = ''
|
preBuild = ''
|
||||||
local topDir=$out/${libDir}
|
local topDir=$out/${libDir}
|
||||||
@ -69,23 +96,33 @@ in cabal.mkDerivation (self: rec {
|
|||||||
|
|
||||||
cp -r ${shims} $topDir/shims
|
cp -r ${shims} $topDir/shims
|
||||||
chmod -R u+w $topDir/shims
|
chmod -R u+w $topDir/shims
|
||||||
|
|
||||||
|
# Make the patches be relative their corresponding package's directory.
|
||||||
|
# See: https://github.com/ghcjs/ghcjs-boot/pull/12
|
||||||
|
for patch in $topDir/ghcjs-boot/patches/*.patch; do
|
||||||
|
echo "fixing patch: $patch"
|
||||||
|
sed -i -e 's@ \(a\|b\)/boot/[^/]\+@ \1@g' $patch
|
||||||
|
done
|
||||||
'';
|
'';
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
PATH=$out/bin:${Cabal}/bin:$PATH LD_LIBRARY_PATH=${gmp}/lib:${gcc.cc}/lib64:$LD_LIBRARY_PATH \
|
PATH=$out/bin:$PATH LD_LIBRARY_PATH=${gmp}/lib:${stdenv.cc}/lib64:$LD_LIBRARY_PATH \
|
||||||
env -u GHC_PACKAGE_PATH $out/bin/ghcjs-boot \
|
env -u GHC_PACKAGE_PATH $out/bin/ghcjs-boot \
|
||||||
--dev \
|
--dev \
|
||||||
--with-cabal ${cabalInstall}/bin/cabal \
|
--with-cabal ${cabal-install}/bin/cabal \
|
||||||
--with-gmp-includes ${gmp}/include \
|
--with-gmp-includes ${gmp}/include \
|
||||||
--with-gmp-libraries ${gmp}/lib
|
--with-gmp-libraries ${gmp}/lib
|
||||||
'';
|
'';
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit libDir;
|
inherit libDir;
|
||||||
|
isGhcjs = true;
|
||||||
|
nativeGhc = ghc;
|
||||||
};
|
};
|
||||||
meta = {
|
|
||||||
homepage = "https://github.com/ghcjs/ghcjs";
|
homepage = "https://github.com/ghcjs/ghcjs";
|
||||||
description = "GHCJS is a Haskell to JavaScript compiler that uses the GHC API";
|
description = "GHCJS is a Haskell to JavaScript compiler that uses the GHC API";
|
||||||
license = self.stdenv.lib.licenses.bsd3;
|
license = stdenv.lib.licenses.bsd3;
|
||||||
platforms = self.ghc.meta.platforms;
|
platforms = ghc.meta.platforms;
|
||||||
maintainers = [ self.stdenv.lib.maintainers.jwiegley ];
|
maintainers = with stdenv.lib.maintainers; [
|
||||||
};
|
jwiegley cstrahan
|
||||||
|
];
|
||||||
})
|
})
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
diff --git a/src-bin/Boot.hs b/src-bin/Boot.hs
|
diff --git a/src-bin/Boot.hs b/src-bin/Boot.hs
|
||||||
index 988955b..a55f07b 100644
|
index 3c68dcf..64f3cf7 100644
|
||||||
--- a/src-bin/Boot.hs
|
--- a/src-bin/Boot.hs
|
||||||
+++ b/src-bin/Boot.hs
|
+++ b/src-bin/Boot.hs
|
||||||
@@ -512,9 +512,7 @@ initPackageDB :: B ()
|
@@ -512,9 +512,7 @@ initPackageDB :: B ()
|
||||||
@ -46,9 +46,11 @@ index 988955b..a55f07b 100644
|
|||||||
mapM_ patchPackage =<< allPackages
|
mapM_ patchPackage =<< allPackages
|
||||||
preparePrimops
|
preparePrimops
|
||||||
buildGenPrim
|
buildGenPrim
|
||||||
@@ -1086,7 +1077,9 @@ cabalInstallFlags parmakeGhcjs = do
|
@@ -1085,8 +1076,11 @@ cabalInstallFlags parmakeGhcjs = do
|
||||||
|
, "--avoid-reinstalls"
|
||||||
, "--builddir", "dist"
|
, "--builddir", "dist"
|
||||||
, "--with-compiler", ghcjs ^. pgmLocText
|
, "--with-compiler", ghcjs ^. pgmLocText
|
||||||
|
+ , "--with-gcc", "@CC@"
|
||||||
, "--with-hc-pkg", ghcjsPkg ^. pgmLocText
|
, "--with-hc-pkg", ghcjsPkg ^. pgmLocText
|
||||||
- , "--prefix", toTextI instDir
|
- , "--prefix", toTextI instDir
|
||||||
+ , "--prefix", "@PREFIX@"
|
+ , "--prefix", "@PREFIX@"
|
||||||
|
@ -33,6 +33,9 @@ self: super: {
|
|||||||
unix = null;
|
unix = null;
|
||||||
xhtml = null;
|
xhtml = null;
|
||||||
|
|
||||||
|
# Cabal_1_22_1_1 requires filepath >=1 && <1.4
|
||||||
|
cabal-install = dontCheck (super.cabal-install.override { Cabal = null; });
|
||||||
|
|
||||||
# We have Cabal 1.22.x.
|
# We have Cabal 1.22.x.
|
||||||
jailbreak-cabal = super.jailbreak-cabal.override { Cabal = null; };
|
jailbreak-cabal = super.jailbreak-cabal.override { Cabal = null; };
|
||||||
|
|
||||||
@ -55,6 +58,9 @@ self: super: {
|
|||||||
# We have time 1.5
|
# We have time 1.5
|
||||||
aeson = disableCabalFlag super.aeson "old-locale";
|
aeson = disableCabalFlag super.aeson "old-locale";
|
||||||
|
|
||||||
|
# requires filepath >=1.1 && <1.4
|
||||||
|
Glob = doJailbreak super.Glob;
|
||||||
|
|
||||||
# Setup: At least the following dependencies are missing: base <4.8
|
# Setup: At least the following dependencies are missing: base <4.8
|
||||||
hspec-expectations = overrideCabal super.hspec-expectations (drv: {
|
hspec-expectations = overrideCabal super.hspec-expectations (drv: {
|
||||||
patchPhase = "sed -i -e 's|base < 4.8|base|' hspec-expectations.cabal";
|
patchPhase = "sed -i -e 's|base < 4.8|base|' hspec-expectations.cabal";
|
||||||
@ -83,6 +89,20 @@ self: super: {
|
|||||||
# Test suite fails in "/tokens_bytestring_unicode.g.bin".
|
# Test suite fails in "/tokens_bytestring_unicode.g.bin".
|
||||||
alex = dontCheck super.alex;
|
alex = dontCheck super.alex;
|
||||||
|
|
||||||
|
# TODO: should eventually update the versions in hackage-packages.nix
|
||||||
|
haddock-library = overrideCabal super.haddock-library (drv: {
|
||||||
|
version = "1.2.0";
|
||||||
|
sha256 = "0kf8qihkxv86phaznb3liq6qhjs53g3iq0zkvz5wkvliqas4ha56";
|
||||||
|
});
|
||||||
|
haddock-api = overrideCabal super.haddock-api (drv: {
|
||||||
|
version = "2.16.0";
|
||||||
|
sha256 = "0hk42w6fbr6xp8xcpjv00bhi9r75iig5kp34vxbxdd7k5fqxr1hj";
|
||||||
|
});
|
||||||
|
haddock = overrideCabal super.haddock (drv: {
|
||||||
|
version = "2.16.0";
|
||||||
|
sha256 = "1afb96w1vv3gmvha2f1h3p8zywpdk8dfk6bgnsa307ydzsmsc3qa";
|
||||||
|
});
|
||||||
|
|
||||||
# Upstream was notified about the over-specified constraint on 'base'
|
# Upstream was notified about the over-specified constraint on 'base'
|
||||||
# but refused to do anything about it because he "doesn't want to
|
# but refused to do anything about it because he "doesn't want to
|
||||||
# support a moving target". Go figure.
|
# support a moving target". Go figure.
|
||||||
@ -109,9 +129,8 @@ self: super: {
|
|||||||
unix-time = dontCheck super.unix-time;
|
unix-time = dontCheck super.unix-time;
|
||||||
|
|
||||||
# Until the changes have been pushed to Hackage
|
# Until the changes have been pushed to Hackage
|
||||||
haskell-src-meta = appendPatch super.haskell-src-meta (pkgs.fetchpatch {
|
haskell-src-meta = overrideCabal (doJailbreak (appendPatch super.haskell-src-meta ./haskell-src-meta-ghc710.patch)) (drv: {
|
||||||
url = "https://github.com/bmillwood/haskell-src-meta/pull/31.patch";
|
prePatch = "sed -i -e 's|template-haskell [^,]\\+|template-haskell|' haskell-src-meta.cabal && cat haskell-src-meta.cabal";
|
||||||
sha256 = "0idf12b2wd6chyvsgdcfl5kzx67crvgs1cqklx5say3426j57g4q";
|
|
||||||
});
|
});
|
||||||
foldl = appendPatch super.foldl (pkgs.fetchpatch {
|
foldl = appendPatch super.foldl (pkgs.fetchpatch {
|
||||||
url = "https://github.com/Gabriel439/Haskell-Foldl-Library/pull/30.patch";
|
url = "https://github.com/Gabriel439/Haskell-Foldl-Library/pull/30.patch";
|
||||||
@ -144,4 +163,16 @@ self: super: {
|
|||||||
sha256 = "1fycvjfr1l9wa03k30bnppl3ns99lffh9kmp9r7sr8b6yiydcajq";
|
sha256 = "1fycvjfr1l9wa03k30bnppl3ns99lffh9kmp9r7sr8b6yiydcajq";
|
||||||
stripLen = 1;
|
stripLen = 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ghcjs-prim = self.callPackage ({ mkDerivation, fetchgit, primitive }: mkDerivation {
|
||||||
|
pname = "ghcjs-prim";
|
||||||
|
version = "0.1.0.0";
|
||||||
|
src = fetchgit {
|
||||||
|
url = git://github.com/ghcjs/ghcjs-prim.git;
|
||||||
|
rev = "ca08e46257dc276e01d08fb47a693024bae001fa"; # ghc-7.10 branch
|
||||||
|
sha256 = "0w7sqzp5p70yhmdhqasgkqbf3b61wb24djlavwil2j8ry9y472w3";
|
||||||
|
};
|
||||||
|
buildDepends = [ primitive ];
|
||||||
|
license = pkgs.stdenv.lib.licenses.bsd3;
|
||||||
|
}) {};
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,12 @@ self: super: {
|
|||||||
# LLVM is not supported on this GHC; use the latest one.
|
# LLVM is not supported on this GHC; use the latest one.
|
||||||
inherit (pkgs) llvmPackages;
|
inherit (pkgs) llvmPackages;
|
||||||
|
|
||||||
|
jailbreak-cabal = pkgs.haskell-ng.packages.ghc7101.jailbreak-cabal;
|
||||||
|
|
||||||
|
# Many packages fail with:
|
||||||
|
# haddock: internal error: expectJust getPackageDetails
|
||||||
|
mkDerivation = drv: super.mkDerivation (drv // { doHaddock = false; });
|
||||||
|
|
||||||
# This is the list of packages that are built into a booted ghcjs installation
|
# This is the list of packages that are built into a booted ghcjs installation
|
||||||
# It can be generated with the command:
|
# It can be generated with the command:
|
||||||
# nix-shell '<nixpkgs>' -A pkgs.haskellPackages_ghcjs.ghc --command "ghcjs-pkg list | sed -n 's/^ \(.*\)-\([0-9.]*\)$/\1_\2/ p' | sed 's/\./_/g' | sed 's/-\(.\)/\U\1/' | sed 's/^\([^_]*\)\(.*\)$/\1 = null;/'"
|
# nix-shell '<nixpkgs>' -A pkgs.haskellPackages_ghcjs.ghc --command "ghcjs-pkg list | sed -n 's/^ \(.*\)-\([0-9.]*\)$/\1_\2/ p' | sed 's/\./_/g' | sed 's/-\(.\)/\U\1/' | sed 's/^\([^_]*\)\(.*\)$/\1 = null;/'"
|
||||||
@ -19,21 +25,21 @@ self: super: {
|
|||||||
binary = null;
|
binary = null;
|
||||||
rts = null;
|
rts = null;
|
||||||
bytestring = null;
|
bytestring = null;
|
||||||
caseInsensitive = null;
|
case-insensitive = null;
|
||||||
containers = null;
|
containers = null;
|
||||||
deepseq = null;
|
deepseq = null;
|
||||||
directory = null;
|
directory = null;
|
||||||
dlist = null;
|
dlist = null;
|
||||||
extensibleExceptions = null;
|
extensible-exceptions = null;
|
||||||
filepath = null;
|
filepath = null;
|
||||||
ghcPrim = null;
|
ghc-prim = null;
|
||||||
ghcjsBase = null;
|
ghcjs-base = null;
|
||||||
ghcjsPrim = null;
|
ghcjs-prim = null;
|
||||||
hashable = null;
|
hashable = null;
|
||||||
integerGmp = null;
|
integer-gmp = null;
|
||||||
mtl = null;
|
mtl = null;
|
||||||
oldLocale = null;
|
old-locale = null;
|
||||||
oldTime = null;
|
old-time = null;
|
||||||
parallel = null;
|
parallel = null;
|
||||||
pretty = null;
|
pretty = null;
|
||||||
primitive = null;
|
primitive = null;
|
||||||
@ -41,12 +47,64 @@ self: super: {
|
|||||||
scientific = null;
|
scientific = null;
|
||||||
stm = null;
|
stm = null;
|
||||||
syb = null;
|
syb = null;
|
||||||
templateHaskell = null;
|
template-haskell = null;
|
||||||
text = null;
|
text = null;
|
||||||
time = null;
|
time = null;
|
||||||
transformers = null;
|
transformers = null;
|
||||||
unix = null;
|
unix = null;
|
||||||
unorderedContainers = null;
|
unordered-containers = null;
|
||||||
vector = null;
|
vector = null;
|
||||||
|
|
||||||
|
pqueue = overrideCabal super.pqueue (drv: {
|
||||||
|
patchPhase = ''
|
||||||
|
sed -i -e '12s|null|Data.PQueue.Internals.null|' Data/PQueue/Internals.hs
|
||||||
|
sed -i -e '64s|null|Data.PQueue.Internals.null|' Data/PQueue/Internals.hs
|
||||||
|
sed -i -e '32s|null|Data.PQueue.Internals.null|' Data/PQueue/Min.hs
|
||||||
|
sed -i -e '32s|null|Data.PQueue.Max.null|' Data/PQueue/Max.hs
|
||||||
|
sed -i -e '42s|null|Data.PQueue.Prio.Internals.null|' Data/PQueue/Prio/Min.hs
|
||||||
|
sed -i -e '42s|null|Data.PQueue.Prio.Max.null|' Data/PQueue/Prio/Max.hs
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
|
||||||
|
reactive-banana = overrideCabal super.reactive-banana (drv: {
|
||||||
|
patchPhase = ''
|
||||||
|
cat >> src/Reactive/Banana/Switch.hs <<EOF
|
||||||
|
instance Functor (AnyMoment Identity) where
|
||||||
|
fmap = liftM
|
||||||
|
|
||||||
|
instance Applicative (AnyMoment Identity) where
|
||||||
|
pure = return
|
||||||
|
(<*>) = ap
|
||||||
|
EOF
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
|
||||||
|
transformers-compat = overrideCabal super.transformers-compat (drv: {
|
||||||
|
configureFlags = [];
|
||||||
|
});
|
||||||
|
|
||||||
|
dependent-map = overrideCabal super.dependent-map (drv: {
|
||||||
|
preConfigure = ''
|
||||||
|
sed -i 's/^.*trust base.*$//' *.cabal
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
|
||||||
|
profunctors = overrideCabal super.profunctors (drv: {
|
||||||
|
preConfigure = ''
|
||||||
|
sed -i 's/^{-# ANN .* #-}//' src/Data/Profunctor/Unsafe.hs
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
|
||||||
|
"ghcjs-dom" = self.callPackage
|
||||||
|
({ mkDerivation, base, mtl, text, ghcjs-base
|
||||||
|
}:
|
||||||
|
mkDerivation {
|
||||||
|
pname = "ghcjs-dom";
|
||||||
|
version = "0.1.1.3";
|
||||||
|
sha256 = "0pdxb2s7fflrh8sbqakv0qi13jkn3d0yc32xhg2944yfjg5fvlly";
|
||||||
|
buildDepends = [ base mtl text ghcjs-base ];
|
||||||
|
description = "DOM library that supports both GHCJS and WebKitGTK";
|
||||||
|
license = pkgs.stdenv.lib.licenses.mit;
|
||||||
|
hydraPlatforms = pkgs.stdenv.lib.platforms.none;
|
||||||
|
}) {};
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
, doHoogle ? true
|
, doHoogle ? true
|
||||||
, editedCabalFile ? null
|
, editedCabalFile ? null
|
||||||
, enableLibraryProfiling ? false
|
, enableLibraryProfiling ? false
|
||||||
, enableSharedExecutables ? stdenv.lib.versionOlder "7.7" ghc.version
|
, enableSharedExecutables ? ((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version)
|
||||||
, enableSharedLibraries ? stdenv.lib.versionOlder "7.7" ghc.version
|
, enableSharedLibraries ? ((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version)
|
||||||
, enableSplitObjs ? !stdenv.isDarwin # http://hackage.haskell.org/trac/ghc/ticket/4013
|
, enableSplitObjs ? !stdenv.isDarwin # http://hackage.haskell.org/trac/ghc/ticket/4013
|
||||||
, enableStaticLibraries ? true
|
, enableStaticLibraries ? true
|
||||||
, extraLibraries ? []
|
, extraLibraries ? []
|
||||||
@ -53,6 +53,8 @@ let
|
|||||||
inherit (stdenv.lib) optional optionals optionalString versionOlder
|
inherit (stdenv.lib) optional optionals optionalString versionOlder
|
||||||
concatStringsSep enableFeature optionalAttrs;
|
concatStringsSep enableFeature optionalAttrs;
|
||||||
|
|
||||||
|
isGhcjs = ghc.isGhcjs or false;
|
||||||
|
|
||||||
newCabalFile = fetchurl {
|
newCabalFile = fetchurl {
|
||||||
url = "http://hackage.haskell.org/package/${pname}-${version}/revision/${revision}.cabal";
|
url = "http://hackage.haskell.org/package/${pname}-${version}/revision/${revision}.cabal";
|
||||||
sha256 = editedCabalFile;
|
sha256 = editedCabalFile;
|
||||||
@ -64,7 +66,7 @@ let
|
|||||||
main = defaultMain
|
main = defaultMain
|
||||||
'';
|
'';
|
||||||
|
|
||||||
ghc76xOrLater = stdenv.lib.versionOlder "7.6" ghc.version;
|
ghc76xOrLater = isGhcjs || stdenv.lib.versionOlder "7.6" ghc.version;
|
||||||
packageDbFlag = if ghc76xOrLater then "package-db" else "package-conf";
|
packageDbFlag = if ghc76xOrLater then "package-db" else "package-conf";
|
||||||
|
|
||||||
hasActiveLibrary = isLibrary && (enableStaticLibraries || enableSharedLibraries || enableLibraryProfiling);
|
hasActiveLibrary = isLibrary && (enableStaticLibraries || enableSharedLibraries || enableLibraryProfiling);
|
||||||
@ -82,14 +84,17 @@ let
|
|||||||
(enableFeature enableSplitObjs "split-objs")
|
(enableFeature enableSplitObjs "split-objs")
|
||||||
(enableFeature enableLibraryProfiling "library-profiling")
|
(enableFeature enableLibraryProfiling "library-profiling")
|
||||||
(enableFeature enableSharedLibraries "shared")
|
(enableFeature enableSharedLibraries "shared")
|
||||||
(optionalString (versionOlder "7" ghc.version) (enableFeature enableStaticLibraries "library-vanilla"))
|
(optionalString (isGhcjs || versionOlder "7" ghc.version) (enableFeature enableStaticLibraries "library-vanilla"))
|
||||||
(optionalString (versionOlder "7.4" ghc.version) (enableFeature enableSharedExecutables "executable-dynamic"))
|
(optionalString (isGhcjs || versionOlder "7.4" ghc.version) (enableFeature enableSharedExecutables "executable-dynamic"))
|
||||||
(optionalString (versionOlder "7" ghc.version) (enableFeature doCheck "tests"))
|
(optionalString (isGhcjs || versionOlder "7" ghc.version) (enableFeature doCheck "tests"))
|
||||||
|
] ++ optionals isGhcjs [
|
||||||
|
"--with-hsc2hs=${ghc.nativeGhc}/bin/hsc2hs"
|
||||||
|
"--ghcjs"
|
||||||
];
|
];
|
||||||
|
|
||||||
setupCompileFlags = [
|
setupCompileFlags = [
|
||||||
(optionalString (!coreSetup) "-${packageDbFlag}=$packageConfDir")
|
(optionalString (!coreSetup) "-${packageDbFlag}=$packageConfDir")
|
||||||
(optionalString (versionOlder "7.8" ghc.version) "-j$NIX_BUILD_CORES")
|
(optionalString (isGhcjs || versionOlder "7.8" ghc.version) "-j$NIX_BUILD_CORES")
|
||||||
(optionalString (versionOlder "7.10" ghc.version) "-threaded") # https://github.com/haskell/cabal/issues/2398
|
(optionalString (versionOlder "7.10" ghc.version) "-threaded") # https://github.com/haskell/cabal/issues/2398
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -108,9 +113,12 @@ let
|
|||||||
|
|
||||||
ghcEnv = ghc.withPackages (p: haskellBuildInputs);
|
ghcEnv = ghc.withPackages (p: haskellBuildInputs);
|
||||||
|
|
||||||
|
setupBuilder = if isGhcjs then "${ghc.nativeGhc}/bin/ghc" else "ghc";
|
||||||
|
ghcCommand = if isGhcjs then "ghcjs" else "ghc";
|
||||||
|
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation ({
|
stdenv.mkDerivation ({
|
||||||
name = "${optionalString hasActiveLibrary "haskell-"}${pname}-${version}";
|
name = "${optionalString (hasActiveLibrary && pname != "ghcjs") "haskell-"}${pname}-${version}";
|
||||||
|
|
||||||
pos = builtins.unsafeGetAttrPos "pname" args;
|
pos = builtins.unsafeGetAttrPos "pname" args;
|
||||||
|
|
||||||
@ -162,7 +170,7 @@ stdenv.mkDerivation ({
|
|||||||
configureFlags+=" --extra-lib-dirs=$p/lib"
|
configureFlags+=" --extra-lib-dirs=$p/lib"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
ghc-pkg --${packageDbFlag}="$packageConfDir" recache
|
${ghcCommand}-pkg --${packageDbFlag}="$packageConfDir" recache
|
||||||
|
|
||||||
runHook postSetupCompilerEnvironment
|
runHook postSetupCompilerEnvironment
|
||||||
'';
|
'';
|
||||||
@ -175,7 +183,7 @@ stdenv.mkDerivation ({
|
|||||||
done
|
done
|
||||||
|
|
||||||
echo setupCompileFlags: $setupCompileFlags
|
echo setupCompileFlags: $setupCompileFlags
|
||||||
ghc $setupCompileFlags --make -o Setup -odir $TMPDIR -hidir $TMPDIR $i
|
${setupBuilder} $setupCompileFlags --make -o Setup -odir $TMPDIR -hidir $TMPDIR $i
|
||||||
|
|
||||||
runHook postCompileBuildDriver
|
runHook postCompileBuildDriver
|
||||||
'';
|
'';
|
||||||
@ -248,13 +256,13 @@ stdenv.mkDerivation ({
|
|||||||
isHaskellLibrary = hasActiveLibrary;
|
isHaskellLibrary = hasActiveLibrary;
|
||||||
|
|
||||||
env = stdenv.mkDerivation {
|
env = stdenv.mkDerivation {
|
||||||
name = "interactive-${optionalString hasActiveLibrary "haskell-"}${pname}-${version}-environment";
|
name = "interactive-${optionalString (hasActiveLibrary && pname != "ghcjs") "haskell-"}${pname}-${version}-environment";
|
||||||
nativeBuildInputs = [ ghcEnv systemBuildInputs ];
|
nativeBuildInputs = [ ghcEnv systemBuildInputs ];
|
||||||
LANG = "en_US.UTF-8";
|
LANG = "en_US.UTF-8";
|
||||||
LOCALE_ARCHIVE = optionalString stdenv.isLinux "${glibcLocales}/lib/locale/locale-archive";
|
LOCALE_ARCHIVE = optionalString stdenv.isLinux "${glibcLocales}/lib/locale/locale-archive";
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
export NIX_GHC="${ghcEnv}/bin/ghc"
|
export NIX_GHC="${ghcEnv}/bin/${ghcCommand}"
|
||||||
export NIX_GHCPKG="${ghcEnv}/bin/ghc"
|
export NIX_GHCPKG="${ghcEnv}/bin/${ghcCommand}-pkg"
|
||||||
export NIX_GHC_DOCDIR="${ghcEnv}/share/doc/ghc/html"
|
export NIX_GHC_DOCDIR="${ghcEnv}/share/doc/ghc/html"
|
||||||
export NIX_GHC_LIBDIR="${ghcEnv}/lib/${ghcEnv.name}"
|
export NIX_GHC_LIBDIR="${ghcEnv}/lib/${ghcEnv.name}"
|
||||||
'';
|
'';
|
||||||
|
@ -0,0 +1,55 @@
|
|||||||
|
From 24e6f45408083745080ff2f3710f58209041113c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Luite Stegeman <stegeman@gmail.com>
|
||||||
|
Date: Sun, 28 Dec 2014 21:33:22 +0100
|
||||||
|
Subject: [PATCH] updates for GHC 7.10 and Template Haskell 2.10
|
||||||
|
|
||||||
|
---
|
||||||
|
haskell-src-meta.cabal | 4 ++--
|
||||||
|
src/Language/Haskell/Meta/Syntax/Translate.hs | 6 ++++++
|
||||||
|
src/Language/Haskell/Meta/Utils.hs | 5 ++++-
|
||||||
|
3 files changed, 12 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/Language/Haskell/Meta/Syntax/Translate.hs b/src/Language/Haskell/Meta/Syntax/Translate.hs
|
||||||
|
index 189d32e..36a08f1 100644
|
||||||
|
--- a/src/Language/Haskell/Meta/Syntax/Translate.hs
|
||||||
|
+++ b/src/Language/Haskell/Meta/Syntax/Translate.hs
|
||||||
|
@@ -384,9 +384,15 @@ a .->. b = AppT (AppT ArrowT a) b
|
||||||
|
toCxt :: Hs.Context -> Cxt
|
||||||
|
toCxt = fmap toPred
|
||||||
|
where
|
||||||
|
+#if MIN_VERSION_template_haskell(2,10,0)
|
||||||
|
+ toPred (Hs.ClassA n ts) = foldl' AppT (ConT (toName n)) (fmap toType ts)
|
||||||
|
+ toPred (Hs.InfixA t1 n t2) = foldl' AppT (ConT (toName n)) (fmap toType [t1,t2])
|
||||||
|
+ toPred (Hs.EqualP t1 t2) = foldl' AppT EqualityT (fmap toType [t1,t2])
|
||||||
|
+#else
|
||||||
|
toPred (Hs.ClassA n ts) = ClassP (toName n) (fmap toType ts)
|
||||||
|
toPred (Hs.InfixA t1 n t2) = ClassP (toName n) (fmap toType [t1, t2])
|
||||||
|
toPred (Hs.EqualP t1 t2) = EqualP (toType t1) (toType t2)
|
||||||
|
+#endif
|
||||||
|
toPred a@Hs.IParam{} = noTH "toCxt" a
|
||||||
|
|
||||||
|
foldAppT :: Type -> [Type] -> Type
|
||||||
|
diff --git a/src/Language/Haskell/Meta/Utils.hs b/src/Language/Haskell/Meta/Utils.hs
|
||||||
|
index 36f7e96..d194f3e 100644
|
||||||
|
--- a/src/Language/Haskell/Meta/Utils.hs
|
||||||
|
+++ b/src/Language/Haskell/Meta/Utils.hs
|
||||||
|
@@ -166,6 +166,9 @@ renameT env new (ForallT ns cxt t) =
|
||||||
|
unVarT (VarT n) = PlainTV n
|
||||||
|
renamePreds = renameThings renamePred
|
||||||
|
|
||||||
|
+#if MIN_VERSION_template_haskell(2,10,0)
|
||||||
|
+ renamePred = renameT
|
||||||
|
+#else
|
||||||
|
renamePred env new (ClassP n ts) = let
|
||||||
|
(ts', env', new') = renameTs env new [] ts
|
||||||
|
in (ClassP (normaliseName n) ts', env', new')
|
||||||
|
@@ -174,7 +177,7 @@ renameT env new (ForallT ns cxt t) =
|
||||||
|
(t1', env1, new1) = renameT env new t1
|
||||||
|
(t2', env2, new2) = renameT env1 new1 t2
|
||||||
|
in (EqualP t1' t2', env2, new2)
|
||||||
|
-
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
-- | Remove qualification, etc.
|
||||||
|
normaliseName :: Name -> Name
|
||||||
|
|
@ -29,9 +29,10 @@ assert versionOlder "6.12" ghc.version;
|
|||||||
# fi
|
# fi
|
||||||
|
|
||||||
let
|
let
|
||||||
ghc761OrLater = versionOlder "7.6.1" ghc.version;
|
ghc761OrLater = ghc.isGhcjs || versionOlder "7.6.1" ghc.version;
|
||||||
packageDBFlag = if ghc761OrLater then "--global-package-db" else "--global-conf";
|
packageDBFlag = if ghc761OrLater then "--global-package-db" else "--global-conf";
|
||||||
libDir = "$out/lib/ghc-${ghc.version}";
|
ghcCommand = if ghc.isGhcjs then "ghcjs" else "ghc";
|
||||||
|
libDir = "$out/lib/${ghcCommand}-${ghc.version}";
|
||||||
docDir = "$out/share/doc/ghc/html";
|
docDir = "$out/share/doc/ghc/html";
|
||||||
packageCfgDir = "${libDir}/package.conf.d";
|
packageCfgDir = "${libDir}/package.conf.d";
|
||||||
paths = filter (x: x ? isHaskellLibrary) (closePropagation packages);
|
paths = filter (x: x ? isHaskellLibrary) (closePropagation packages);
|
||||||
@ -50,6 +51,10 @@ buildEnv {
|
|||||||
postBuild = ''
|
postBuild = ''
|
||||||
. ${makeWrapper}/nix-support/setup-hook
|
. ${makeWrapper}/nix-support/setup-hook
|
||||||
|
|
||||||
|
${lib.optionalString ghc.isGhcjs ''
|
||||||
|
cp -r ${ghc}/${ghc.libDir}/* ${libDir}/
|
||||||
|
''}
|
||||||
|
|
||||||
if test -L "$out/bin"; then
|
if test -L "$out/bin"; then
|
||||||
binTarget="$(readlink -f "$out/bin")"
|
binTarget="$(readlink -f "$out/bin")"
|
||||||
rm "$out/bin"
|
rm "$out/bin"
|
||||||
@ -61,8 +66,8 @@ buildEnv {
|
|||||||
rm -f $out/bin/$prg
|
rm -f $out/bin/$prg
|
||||||
makeWrapper ${ghc}/bin/$prg $out/bin/$prg \
|
makeWrapper ${ghc}/bin/$prg $out/bin/$prg \
|
||||||
--add-flags '"-B$NIX_GHC_LIBDIR"' \
|
--add-flags '"-B$NIX_GHC_LIBDIR"' \
|
||||||
--set "NIX_GHC" "$out/bin/ghc" \
|
--set "NIX_GHC" "$out/bin/${ghcCommand}" \
|
||||||
--set "NIX_GHCPKG" "$out/bin/ghc-pkg" \
|
--set "NIX_GHCPKG" "$out/bin/${ghcCommand}-pkg" \
|
||||||
--set "NIX_GHC_DOCDIR" "${docDir}" \
|
--set "NIX_GHC_DOCDIR" "${docDir}" \
|
||||||
--set "NIX_GHC_LIBDIR" "${libDir}" \
|
--set "NIX_GHC_LIBDIR" "${libDir}" \
|
||||||
${optionalString withLLVM ''--prefix "PATH" ":" "${llvm}"''}
|
${optionalString withLLVM ''--prefix "PATH" ":" "${llvm}"''}
|
||||||
@ -72,19 +77,19 @@ buildEnv {
|
|||||||
rm -f $out/bin/$prg
|
rm -f $out/bin/$prg
|
||||||
makeWrapper ${ghc}/bin/$prg $out/bin/$prg \
|
makeWrapper ${ghc}/bin/$prg $out/bin/$prg \
|
||||||
--add-flags "-f $out/bin/ghc" \
|
--add-flags "-f $out/bin/ghc" \
|
||||||
--set "NIX_GHC" "$out/bin/ghc" \
|
--set "NIX_GHC" "$out/bin/${ghcCommand}" \
|
||||||
--set "NIX_GHCPKG" "$out/bin/ghc-pkg" \
|
--set "NIX_GHCPKG" "$out/bin/${ghcCommand}-pkg" \
|
||||||
--set "NIX_GHC_DOCDIR" "${docDir}" \
|
--set "NIX_GHC_DOCDIR" "${docDir}" \
|
||||||
--set "NIX_GHC_LIBDIR" "${libDir}"
|
--set "NIX_GHC_LIBDIR" "${libDir}"
|
||||||
done
|
done
|
||||||
|
|
||||||
for prg in ghc-pkg ghc-pkg-${ghc.version}; do
|
for prg in ${ghcCommand}-pkg ${ghcCommand}-pkg-${ghc.version}; do
|
||||||
rm -f $out/bin/$prg
|
rm -f $out/bin/$prg
|
||||||
makeWrapper ${ghc}/bin/$prg $out/bin/$prg --add-flags "${packageDBFlag}=${packageCfgDir}"
|
makeWrapper ${ghc}/bin/$prg $out/bin/$prg --add-flags "${packageDBFlag}=${packageCfgDir}"
|
||||||
done
|
done
|
||||||
|
|
||||||
${optionalString hasLibraries "$out/bin/ghc-pkg recache"}
|
${optionalString hasLibraries "$out/bin/${ghcCommand}-pkg recache"}
|
||||||
$out/bin/ghc-pkg check
|
$out/bin/${ghcCommand}-pkg check
|
||||||
'';
|
'';
|
||||||
} // {
|
} // {
|
||||||
preferLocalBuild = true;
|
preferLocalBuild = true;
|
||||||
|
@ -3664,7 +3664,6 @@ let
|
|||||||
haskellPackages_ghc784_no_profiling = recurseIntoAttrs haskell.packages_ghc784.noProfiling;
|
haskellPackages_ghc784_no_profiling = recurseIntoAttrs haskell.packages_ghc784.noProfiling;
|
||||||
haskellPackages_ghc784_profiling = recurseIntoAttrs haskell.packages_ghc784.profiling;
|
haskellPackages_ghc784_profiling = recurseIntoAttrs haskell.packages_ghc784.profiling;
|
||||||
haskellPackages_ghc784 = recurseIntoAttrs haskell.packages_ghc784.highPrio;
|
haskellPackages_ghc784 = recurseIntoAttrs haskell.packages_ghc784.highPrio;
|
||||||
haskellPackages_ghcjs = haskell.packages_ghcjs;
|
|
||||||
haskellPackages = haskellPackages_ghc784;
|
haskellPackages = haskellPackages_ghc784;
|
||||||
|
|
||||||
haskell-ng = callPackage ./haskell-ng.nix { };
|
haskell-ng = callPackage ./haskell-ng.nix { };
|
||||||
|
@ -17,15 +17,6 @@
|
|||||||
ghcHEADPrefs = self : super : super // {
|
ghcHEADPrefs = self : super : super // {
|
||||||
cabalInstall_1_20_0_6 = super.cabalInstall_1_20_0_6.override { Cabal = null; };
|
cabalInstall_1_20_0_6 = super.cabalInstall_1_20_0_6.override { Cabal = null; };
|
||||||
mtl = self.mtl_2_2_1;
|
mtl = self.mtl_2_2_1;
|
||||||
ghcjsBase = null;
|
|
||||||
ghcjsDom = with self; super.ghcjsDom.override {
|
|
||||||
cabal = self.cabal.override {
|
|
||||||
extension = self: super: {
|
|
||||||
configureFlags = [ "-f-ghcjs" "-fwebkit" "-f-gtk3" ];
|
|
||||||
buildDepends = [ mtl glib transformers gtk webkit ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ghc784Prefs = self : super : ghcHEADPrefs self super // {
|
ghc784Prefs = self : super : ghcHEADPrefs self super // {
|
||||||
@ -200,88 +191,6 @@
|
|||||||
prefFun = ghc784Prefs;
|
prefFun = ghc784Prefs;
|
||||||
};
|
};
|
||||||
|
|
||||||
packages_ghcjs =
|
|
||||||
packages {
|
|
||||||
ghc = pkgs.haskell-ng.compiler.ghc784;
|
|
||||||
prefFun = self : super : super // {
|
|
||||||
ghc = let parent = packages_ghc784; in
|
|
||||||
callPackage ../development/compilers/ghcjs/wrapper.nix {
|
|
||||||
ghc = parent.ghcjs // { inherit parent; };
|
|
||||||
};
|
|
||||||
cabal = self.cabalJs;
|
|
||||||
buildLocalCabalWithArgs = args: super.buildLocalCabalWithArgs (args // {
|
|
||||||
nativePkgs = packages_ghc784;
|
|
||||||
});
|
|
||||||
ghcjsDom = with self; super.ghcjsDom.override {
|
|
||||||
cabal = self.cabal.override {
|
|
||||||
extension = self: super: {
|
|
||||||
configureFlags = [ ];
|
|
||||||
buildDepends = [ mtl ghcjsBase ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
# This is the list of packages that are built into a booted ghcjs installation
|
|
||||||
# It can be generated with the command:
|
|
||||||
# nix-shell '<nixpkgs>' -A pkgs.haskellPackages_ghcjs.ghc --command "ghcjs-pkg list | sed -n 's/^ \(.*\)-\([0-9.]*\)$/\1_\2/ p' | sed 's/\./_/g' | sed 's/-\(.\)/\U\1/' | sed 's/^\([^_]*\)\(.*\)$/\1 = null;/'"
|
|
||||||
Cabal = null;
|
|
||||||
aeson = null;
|
|
||||||
array = null;
|
|
||||||
async = null;
|
|
||||||
attoparsec = null;
|
|
||||||
base = null;
|
|
||||||
binary = null;
|
|
||||||
rts = null;
|
|
||||||
bytestring = null;
|
|
||||||
caseInsensitive = null;
|
|
||||||
containers = null;
|
|
||||||
deepseq = null;
|
|
||||||
directory = null;
|
|
||||||
dlist = null;
|
|
||||||
extensibleExceptions = null;
|
|
||||||
filepath = null;
|
|
||||||
ghcPrim = null;
|
|
||||||
ghcjsBase = null;
|
|
||||||
ghcjsPrim = null;
|
|
||||||
hashable = null;
|
|
||||||
integerGmp = null;
|
|
||||||
mtl = null;
|
|
||||||
oldLocale = null;
|
|
||||||
oldTime = null;
|
|
||||||
parallel = null;
|
|
||||||
pretty = null;
|
|
||||||
primitive = null;
|
|
||||||
process = null;
|
|
||||||
scientific = null;
|
|
||||||
stm = null;
|
|
||||||
syb = null;
|
|
||||||
templateHaskell = null;
|
|
||||||
text = null;
|
|
||||||
time = null;
|
|
||||||
transformers = null;
|
|
||||||
unix = null;
|
|
||||||
unorderedContainers = null;
|
|
||||||
vector = null;
|
|
||||||
|
|
||||||
# GHCJS-specific workarounds
|
|
||||||
split = super.split.override {
|
|
||||||
cabal = self.cabal.override {
|
|
||||||
extension = self: super: {
|
|
||||||
doCheck = false; # Under ghcjs, the tests hang
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
dependentMap = super.dependentMap.override {
|
|
||||||
cabal = self.cabal.override {
|
|
||||||
extension = self: super: {
|
|
||||||
preConfigure = ''
|
|
||||||
sed -i 's/^.*ghc-options:.*$//' *.cabal
|
|
||||||
''; # Without this, we get "target ‘base’ is not a module name or a source file"
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
packages_ghc763 =
|
packages_ghc763 =
|
||||||
packages { ghc = pkgs.haskell-ng.compiler.ghc763;
|
packages { ghc = pkgs.haskell-ng.compiler.ghc763;
|
||||||
prefFun = ghc763Prefs;
|
prefFun = ghc763Prefs;
|
||||||
|
@ -39,6 +39,9 @@ rec {
|
|||||||
});
|
});
|
||||||
ghc = compiler.ghc784;
|
ghc = compiler.ghc784;
|
||||||
|
|
||||||
|
ghcjs = packages.ghc7101.callPackage ../development/compilers/ghcjs {
|
||||||
|
ghc = compiler.ghc7101;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
packages = {
|
packages = {
|
||||||
@ -77,6 +80,7 @@ rec {
|
|||||||
packageSetConfig = callPackage ../development/haskell-modules/configuration-ghc-head.nix { };
|
packageSetConfig = callPackage ../development/haskell-modules/configuration-ghc-head.nix { };
|
||||||
};
|
};
|
||||||
ghcjs = callPackage ../development/haskell-modules {
|
ghcjs = callPackage ../development/haskell-modules {
|
||||||
|
ghc = compiler.ghcjs;
|
||||||
packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { };
|
packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -103,15 +103,6 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in
|
|||||||
extension = self : super : {};
|
extension = self : super : {};
|
||||||
};
|
};
|
||||||
|
|
||||||
cabalJs = callPackage ../build-support/cabal/ghcjs.nix {
|
|
||||||
Cabal = null; # prefer the Cabal version shipped with the compiler
|
|
||||||
hscolour = self.hscolourBootstrap;
|
|
||||||
inherit enableLibraryProfiling enableCheckPhase
|
|
||||||
enableStaticLibraries enableSharedLibraries enableSharedExecutables;
|
|
||||||
glibcLocales = if pkgs.stdenv.isLinux then pkgs.glibcLocales else null;
|
|
||||||
extension = self : super : {};
|
|
||||||
};
|
|
||||||
|
|
||||||
# A variant of the cabal build driver that disables unit testing.
|
# A variant of the cabal build driver that disables unit testing.
|
||||||
# Useful for breaking cycles, where the unit test of a package A
|
# Useful for breaking cycles, where the unit test of a package A
|
||||||
# depends on package B, which has A as a regular build input.
|
# depends on package B, which has A as a regular build input.
|
||||||
@ -968,14 +959,6 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in
|
|||||||
|
|
||||||
ghcid = callPackage ../development/tools/haskell/ghcid {};
|
ghcid = callPackage ../development/tools/haskell/ghcid {};
|
||||||
|
|
||||||
ghcjs = callPackage ../development/compilers/ghcjs {
|
|
||||||
Cabal = self.Cabal_1_22_0_0;
|
|
||||||
cabalInstall = self.cabalInstall_1_22_0_0;
|
|
||||||
haddock = self.haddock.override {
|
|
||||||
Cabal = null;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
ghcjsDom = callPackage ../development/libraries/haskell/ghcjs-dom {};
|
ghcjsDom = callPackage ../development/libraries/haskell/ghcjs-dom {};
|
||||||
|
|
||||||
ghcjsCodemirror = callPackage ../development/libraries/haskell/ghcjs-codemirror {};
|
ghcjsCodemirror = callPackage ../development/libraries/haskell/ghcjs-codemirror {};
|
||||||
|
Loading…
Reference in New Issue
Block a user