diff options
author | John Ericson <git@JohnEricson.me> | 2023-01-04 09:12:10 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-04 09:12:10 -0500 |
commit | b92fb601c2479f5c58c42fe35781347ba7f79d55 (patch) | |
tree | 6746557feee3873601c90537a660cf5d6369fa24 /pkgs/development | |
parent | 91e05c47f82bb122f16576e0f2c631349b2efb1c (diff) | |
parent | 6392c21c1fefd50d9dda8bec70bcbbf01622f769 (diff) | |
download | nixlib-b92fb601c2479f5c58c42fe35781347ba7f79d55.tar nixlib-b92fb601c2479f5c58c42fe35781347ba7f79d55.tar.gz nixlib-b92fb601c2479f5c58c42fe35781347ba7f79d55.tar.bz2 nixlib-b92fb601c2479f5c58c42fe35781347ba7f79d55.tar.lz nixlib-b92fb601c2479f5c58c42fe35781347ba7f79d55.tar.xz nixlib-b92fb601c2479f5c58c42fe35781347ba7f79d55.tar.zst nixlib-b92fb601c2479f5c58c42fe35781347ba7f79d55.zip |
Merge pull request #208947 from sternenseemann/ghc-head-js-backend-try-1
haskell.compiler.ghcHEAD: support JS backend
Diffstat (limited to 'pkgs/development')
-rw-r--r-- | pkgs/development/compilers/emscripten/default.nix | 8 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/8.10.7.nix | 4 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/8.8.4.nix | 4 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/9.0.2.nix | 3 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/9.2.4.nix | 3 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/9.2.5.nix | 3 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/9.4.2.nix | 3 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/9.4.3.nix | 3 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/9.4.4.nix | 3 | ||||
-rw-r--r-- | pkgs/development/compilers/ghc/common-hadrian.nix | 36 | ||||
-rw-r--r-- | pkgs/development/compilers/openjdk/19.nix | 4 | ||||
-rw-r--r-- | pkgs/development/compilers/temurin-bin/jdk-linux-base.nix | 4 |
12 files changed, 59 insertions, 19 deletions
diff --git a/pkgs/development/compilers/emscripten/default.nix b/pkgs/development/compilers/emscripten/default.nix index 44ba33247b40..eca67f832102 100644 --- a/pkgs/development/compilers/emscripten/default.nix +++ b/pkgs/development/compilers/emscripten/default.nix @@ -3,6 +3,7 @@ , llvmPackages , symlinkJoin, makeWrapper, substituteAll , mkYarnModules +, emscripten }: stdenv.mkDerivation rec { @@ -116,6 +117,13 @@ stdenv.mkDerivation rec { runHook postInstall ''; + passthru = { + # HACK: Make emscripten look more like a cc-wrapper to GHC + # when building the javascript backend. + targetPrefix = "em"; + bintools = emscripten; + }; + meta = with lib; { homepage = "https://github.com/emscripten-core/emscripten"; description = "An LLVM-to-JavaScript Compiler"; diff --git a/pkgs/development/compilers/ghc/8.10.7.nix b/pkgs/development/compilers/ghc/8.10.7.nix index b7f027440de1..afc06e09edb0 100644 --- a/pkgs/development/compilers/ghc/8.10.7.nix +++ b/pkgs/development/compilers/ghc/8.10.7.nix @@ -21,7 +21,9 @@ , # 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 ? !(lib.meta.availableOn stdenv.hostPlatform gmp), gmp + enableIntegerSimple ? !(lib.meta.availableOn stdenv.hostPlatform gmp + && lib.meta.availableOn stdenv.targetPlatform gmp) +, gmp , # If enabled, use -fPIC when compiling static libs. enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform diff --git a/pkgs/development/compilers/ghc/8.8.4.nix b/pkgs/development/compilers/ghc/8.8.4.nix index 40dabc6c9837..be4ca5edb823 100644 --- a/pkgs/development/compilers/ghc/8.8.4.nix +++ b/pkgs/development/compilers/ghc/8.8.4.nix @@ -20,7 +20,9 @@ , # 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 ? !(lib.meta.availableOn stdenv.hostPlatform gmp), gmp + enableIntegerSimple ? !(lib.meta.availableOn stdenv.hostPlatform gmp + && lib.meta.availableOn stdenv.targetPlatform gmp) +, gmp , # If enabled, use -fPIC when compiling static libs. enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform diff --git a/pkgs/development/compilers/ghc/9.0.2.nix b/pkgs/development/compilers/ghc/9.0.2.nix index 0881b58ff717..f69e52701a93 100644 --- a/pkgs/development/compilers/ghc/9.0.2.nix +++ b/pkgs/development/compilers/ghc/9.0.2.nix @@ -23,7 +23,8 @@ , # If enabled, GHC will be built with the GPL-free but slightly slower native # bignum backend instead of the faster but GPLed gmp backend. - enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp) + enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp + && lib.meta.availableOn stdenv.targetPlatform gmp) , gmp , # If enabled, use -fPIC when compiling static libs. diff --git a/pkgs/development/compilers/ghc/9.2.4.nix b/pkgs/development/compilers/ghc/9.2.4.nix index 68657c9178a0..6b8efae06e5b 100644 --- a/pkgs/development/compilers/ghc/9.2.4.nix +++ b/pkgs/development/compilers/ghc/9.2.4.nix @@ -23,7 +23,8 @@ , # If enabled, GHC will be built with the GPL-free but slightly slower native # bignum backend instead of the faster but GPLed gmp backend. - enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp) + enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp + && lib.meta.availableOn stdenv.targetPlatform gmp) , gmp , # If enabled, use -fPIC when compiling static libs. diff --git a/pkgs/development/compilers/ghc/9.2.5.nix b/pkgs/development/compilers/ghc/9.2.5.nix index 12511c761391..e7c75fcaccf9 100644 --- a/pkgs/development/compilers/ghc/9.2.5.nix +++ b/pkgs/development/compilers/ghc/9.2.5.nix @@ -23,7 +23,8 @@ , # If enabled, GHC will be built with the GPL-free but slightly slower native # bignum backend instead of the faster but GPLed gmp backend. - enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp) + enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp + && lib.meta.availableOn stdenv.targetPlatform gmp) , gmp , # If enabled, use -fPIC when compiling static libs. diff --git a/pkgs/development/compilers/ghc/9.4.2.nix b/pkgs/development/compilers/ghc/9.4.2.nix index a3eb18e15687..d3702f4e849d 100644 --- a/pkgs/development/compilers/ghc/9.4.2.nix +++ b/pkgs/development/compilers/ghc/9.4.2.nix @@ -25,7 +25,8 @@ , # If enabled, GHC will be built with the GPL-free but slightly slower native # bignum backend instead of the faster but GPLed gmp backend. - enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp) + enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp + && lib.meta.availableOn stdenv.targetPlatform gmp) , gmp , # If enabled, use -fPIC when compiling static libs. diff --git a/pkgs/development/compilers/ghc/9.4.3.nix b/pkgs/development/compilers/ghc/9.4.3.nix index 2b0f206a6fb0..fea2d4c4c8c9 100644 --- a/pkgs/development/compilers/ghc/9.4.3.nix +++ b/pkgs/development/compilers/ghc/9.4.3.nix @@ -25,7 +25,8 @@ , # If enabled, GHC will be built with the GPL-free but slightly slower native # bignum backend instead of the faster but GPLed gmp backend. - enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp) + enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp + && lib.meta.availableOn stdenv.targetPlatform gmp) , gmp , # If enabled, use -fPIC when compiling static libs. diff --git a/pkgs/development/compilers/ghc/9.4.4.nix b/pkgs/development/compilers/ghc/9.4.4.nix index fafa24808489..b9897b0f4d82 100644 --- a/pkgs/development/compilers/ghc/9.4.4.nix +++ b/pkgs/development/compilers/ghc/9.4.4.nix @@ -25,7 +25,8 @@ , # If enabled, GHC will be built with the GPL-free but slightly slower native # bignum backend instead of the faster but GPLed gmp backend. - enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp) + enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp + && lib.meta.availableOn stdenv.targetPlatform gmp) , gmp , # If enabled, use -fPIC when compiling static libs. diff --git a/pkgs/development/compilers/ghc/common-hadrian.nix b/pkgs/development/compilers/ghc/common-hadrian.nix index c54e6a4baf86..15073bfec107 100644 --- a/pkgs/development/compilers/ghc/common-hadrian.nix +++ b/pkgs/development/compilers/ghc/common-hadrian.nix @@ -39,7 +39,8 @@ , useLLVM ? !(stdenv.targetPlatform.isx86 || stdenv.targetPlatform.isPower || stdenv.targetPlatform.isSparc - || (stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin)) + || (stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin) + || stdenv.targetPlatform.isGhcjs) , # 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. @@ -48,7 +49,9 @@ , # If enabled, GHC will be built with the GPL-free but slightly slower native # bignum backend instead of the faster but GPLed gmp backend. - enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp) + enableNativeBignum ? !(lib.meta.availableOn stdenv.hostPlatform gmp + && lib.meta.availableOn stdenv.targetPlatform gmp) + || stdenv.targetPlatform.isGhcjs , gmp , # If enabled, use -fPIC when compiling static libs. @@ -62,7 +65,8 @@ enableShared ? with stdenv.targetPlatform; !isWindows && !useiOSPrebuilt && !isStatic , # Whether to build terminfo. - enableTerminfo ? !stdenv.targetPlatform.isWindows + enableTerminfo ? !(stdenv.targetPlatform.isWindows + || stdenv.targetPlatform.isGhcjs) , # Libdw.c only supports x86_64, i686 and s390x as of 2022-08-04 enableDwarf ? (stdenv.targetPlatform.isx86 || @@ -195,17 +199,19 @@ let # Splicer will pull out correct variations libDeps = platform: lib.optional enableTerminfo ncurses - ++ [libffi] + ++ lib.optionals (!targetPlatform.isGhcjs) [libffi] # Bindist configure script fails w/o elfutils in linker search path # https://gitlab.haskell.org/ghc/ghc/-/issues/22081 ++ lib.optional enableDwarf elfutils ++ lib.optional (!enableNativeBignum) gmp - ++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv; + ++ lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows && !targetPlatform.isGhcjs) libiconv; # TODO(@sternenseemann): is buildTarget LLVM unnecessary? # GHC doesn't seem to have {LLC,OPT}_HOST toolsForTarget = [ - pkgsBuildTarget.targetPackages.stdenv.cc + (if targetPlatform.isGhcjs + then pkgsBuildTarget.emscripten + else pkgsBuildTarget.targetPackages.stdenv.cc) ] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm; targetCC = builtins.head toolsForTarget; @@ -245,7 +251,7 @@ in # C compiler, bintools and LLVM are used at build time, but will also leak into # the resulting GHC's settings file and used at runtime. This means that we are # currently only able to build GHC if hostPlatform == buildPlatform. -assert targetCC == pkgsHostTarget.targetPackages.stdenv.cc; +assert !targetPlatform.isGhcjs -> targetCC == pkgsHostTarget.targetPackages.stdenv.cc; assert buildTargetLlvmPackages.llvm == llvmPackages.llvm; assert stdenv.targetPlatform.isDarwin -> buildTargetLlvmPackages.clang == llvmPackages.clang; @@ -328,6 +334,13 @@ stdenv.mkDerivation ({ '*-android*|*-gnueabi*|*-musleabi*)' done '' + # Need to make writable EM_CACHE for emscripten + # https://gitlab.haskell.org/ghc/ghc/-/wikis/javascript-backend#configure-fails-with-sub-word-sized-atomic-operations-not-available + + lib.optionalString targetPlatform.isGhcjs '' + export EM_CACHE="$(mktemp -d emcache.XXXXXXXXXX)" + cp -Lr ${targetCC /* == emscripten */}/share/emscripten/cache/* "$EM_CACHE/" + chmod u+rwX -R "$EM_CACHE" + '' # Create bash array hadrianFlagsArray for use in buildPhase. Do it in # preConfigure, so overrideAttrs can be used to modify it effectively. # hadrianSettings are passed via the command line so they are more visible @@ -339,6 +352,8 @@ stdenv.mkDerivation ({ ) ''; + ${if targetPlatform.isGhcjs then "configureScript" else null} = "emconfigure ./configure"; + # TODO(@Ericson2314): Always pass "--target" and always prefix. configurePlatforms = [ "build" "host" ] ++ lib.optional (targetPlatform != hostPlatform) "target"; @@ -347,7 +362,7 @@ stdenv.mkDerivation ({ configureFlags = [ "--datadir=$doc/share/doc/ghc" "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" - ] ++ lib.optionals (libffi != null) [ + ] ++ lib.optionals (libffi != null && !targetPlatform.isGhcjs) [ "--with-system-libffi" "--with-ffi-includes=${targetPackages.libffi.dev}/include" "--with-ffi-libraries=${targetPackages.libffi.out}/lib" @@ -386,6 +401,9 @@ stdenv.mkDerivation ({ autoSignDarwinBinariesHook ] ++ lib.optionals enableDocs [ sphinx + ] ++ lib.optionals targetPlatform.isGhcjs [ + # emscripten itself is added via depBuildTarget / targetCC + python3 ]; # For building runtime libs @@ -444,7 +462,7 @@ stdenv.mkDerivation ({ preInstall = '' pushd _build/bindist/* - ./configure $configureFlags "''${configureFlagsArray[@]}" + $configureScript $configureFlags "''${configureFlagsArray[@]}" ''; postInstall = '' diff --git a/pkgs/development/compilers/openjdk/19.nix b/pkgs/development/compilers/openjdk/19.nix index 87c978ec8305..fb4a273aed4f 100644 --- a/pkgs/development/compilers/openjdk/19.nix +++ b/pkgs/development/compilers/openjdk/19.nix @@ -4,7 +4,9 @@ , libXi, libXinerama, libXcursor, libXrandr, fontconfig, openjdk19-bootstrap , ensureNewerSourcesForZipFilesHook , setJavaClassPath -, headless ? false +# TODO(@sternenseemann): gtk3 fails to evaluate in pkgsCross.ghcjs.buildPackages +# which should be fixable, this is a no-rebuild workaround for GHC. +, headless ? stdenv.targetPlatform.isGhcjs , enableJavaFX ? openjfx.meta.available, openjfx , enableGnome2 ? true, gtk3, gnome_vfs, glib, GConf }: diff --git a/pkgs/development/compilers/temurin-bin/jdk-linux-base.nix b/pkgs/development/compilers/temurin-bin/jdk-linux-base.nix index a7ed81ca8acb..c601ca63b7cd 100644 --- a/pkgs/development/compilers/temurin-bin/jdk-linux-base.nix +++ b/pkgs/development/compilers/temurin-bin/jdk-linux-base.nix @@ -20,7 +20,9 @@ # runtime dependencies , cups # runtime dependencies for GTK+ Look and Feel -, gtkSupport ? true +# TODO(@sternenseemann): gtk3 fails to evaluate in pkgsCross.ghcjs.buildPackages +# which should be fixable, this is a no-rebuild workaround for GHC. +, gtkSupport ? !stdenv.targetPlatform.isGhcjs , cairo , glib , gtk3 |