1 { lib, stdenv, fetchurl, fetchpatch, autoconf213, pkg-config, perl, python2, python3, zip, buildPackages
2 , which, readline, zlib, icu, cargo, rustc, llvmPackages }:
7 python3Env = buildPackages.python3.withPackages (p: [p.six]);
8 in stdenv.mkDerivation rec {
9 pname = "spidermonkey";
13 url = "mirror://mozilla/firefox/releases/${version}esr/source/firefox-${version}esr.source.tar.xz";
14 sha256 = "0azdinwqjfv2q37gqpxmfvzsk86pvsi6cjaq1310zs26gric5j1f";
17 outputs = [ "out" "dev" ];
18 setOutputFlags = false; # Configure script only understands --includedir
39 export CXXFLAGS="-fpermissive"
40 export LIBXUL_DIST=$out
41 export PYTHON3="${python3Env.interpreter}"
43 # We can't build in js/src/, so create a build dir
46 configureScript=../js/src/configure
50 # Reccommended by gjs upstream
52 "--enable-unaligned-private-values"
54 "--enable-posix-nspr-emulation"
58 "--with-libclang-path=${llvmPackages.libclang}/lib"
59 "--with-clang-path=${llvmPackages.clang}/bin/clang"
63 # Fedora and Arch disable optimize, but it doesn't seme to be necessary
64 # It turns on -O3 which some gcc version had a problem with:
65 # https://src.fedoraproject.org/rpms/mozjs38/c/761399aba092bcb1299bb4fccfd60f370ab4216e
68 ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
69 # Spidermonkey seems to use different host/build terminology for cross
71 "--host=${stdenv.buildPlatform.config}"
72 "--target=${stdenv.hostPlatform.config}"
75 configurePlatforms = [];
77 depsBuildBuild = [ buildPackages.stdenv.cc ];
79 # Remove unnecessary static lib
81 moveToOutput bin/js60-config "$dev"
82 rm $out/lib/libjs_static.ajs
83 ln -s $out/bin/js60 $out/bin/js
86 enableParallelBuilding = true;
89 description = "Mozilla's JavaScript engine written in C/C++";
90 homepage = "https://developer.mozilla.org/en/SpiderMonkey";
91 license = licenses.gpl2; # TODO: MPL/GPL/LGPL tri-license.
92 maintainers = [ maintainers.abbradar ];
93 platforms = platforms.linux;