2021-01-23 13:15:07 +00:00
|
|
|
{ lib, stdenv, fetchurl, fetchpatch, autoconf213, pkg-config, perl, python2, python3, zip, buildPackages
|
2020-02-07 03:20:17 +00:00
|
|
|
, which, readline, zlib, icu, cargo, rustc, llvmPackages }:
|
|
|
|
|
2021-01-23 13:15:07 +00:00
|
|
|
with lib;
|
2020-02-07 03:20:17 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
python3Env = buildPackages.python3.withPackages (p: [p.six]);
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
pname = "spidermonkey";
|
2020-07-07 18:10:05 +01:00
|
|
|
version = "68.10.0";
|
2020-02-07 03:20:17 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://mozilla/firefox/releases/${version}esr/source/firefox-${version}esr.source.tar.xz";
|
2020-07-07 18:10:05 +01:00
|
|
|
sha256 = "0azdinwqjfv2q37gqpxmfvzsk86pvsi6cjaq1310zs26gric5j1f";
|
2020-02-07 03:20:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
setOutputFlags = false; # Configure script only understands --includedir
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
autoconf213
|
2021-01-19 06:50:56 +00:00
|
|
|
pkg-config
|
2020-02-07 03:20:17 +00:00
|
|
|
perl
|
|
|
|
which
|
|
|
|
python2
|
|
|
|
zip
|
|
|
|
cargo
|
|
|
|
rustc
|
|
|
|
llvmPackages.llvm
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
readline
|
|
|
|
zlib
|
|
|
|
icu
|
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
export CXXFLAGS="-fpermissive"
|
|
|
|
export LIBXUL_DIST=$out
|
|
|
|
export PYTHON3="${python3Env.interpreter}"
|
|
|
|
|
|
|
|
# We can't build in js/src/, so create a build dir
|
|
|
|
mkdir obj
|
|
|
|
cd obj/
|
|
|
|
configureScript=../js/src/configure
|
|
|
|
'';
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
# Reccommended by gjs upstream
|
|
|
|
"--disable-jemalloc"
|
|
|
|
"--enable-unaligned-private-values"
|
|
|
|
"--with-intl-api"
|
|
|
|
"--enable-posix-nspr-emulation"
|
|
|
|
"--with-system-zlib"
|
|
|
|
"--with-system-icu"
|
|
|
|
|
llvmPackages: Multuple outputs for everythting
Also begin to start work on cross compilation, though that will have to
be finished later.
The patches are based on the first version of
https://reviews.llvm.org/D99484. It's very annoying to do the
back-porting but the review has uncovered nothing super major so I'm
fine sticking with what I've got.
Beyond making the outputs work, I also strove to re-sync the packages,
as they have been drifting pointlessly apart for some time.
----
Other misc notes, highly incomplete
- lvm-config-native and llvm-config are put in `dev` because they are
tools just for build time.
- Clang no longer has an lld dep. That was introduced in
db29857eb391ed002046090851a44c452b80bdbd, but if clang needs help
finding lld when it is used we should just pass it flags / put in the
resource dir. Providing it at build time increases critical path
length for no good reason.
----
A note on `nativeCC`:
`stdenv` takes tools from the previous stage, so:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.stdenv.cc`: `(?0, ?1, x)`
while:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.targetPackages`: `(x, x, ?2)`
3. `pkgsBuildBuild.targetPackages.stdenv.cc`: `(?1, x, x)`
2020-10-15 09:23:57 +01:00
|
|
|
"--with-libclang-path=${llvmPackages.libclang.lib}/lib"
|
2020-02-07 03:20:17 +00:00
|
|
|
"--with-clang-path=${llvmPackages.clang}/bin/clang"
|
|
|
|
|
|
|
|
"--enable-shared-js"
|
|
|
|
"--enable-readline"
|
|
|
|
# Fedora and Arch disable optimize, but it doesn't seme to be necessary
|
|
|
|
# It turns on -O3 which some gcc version had a problem with:
|
|
|
|
# https://src.fedoraproject.org/rpms/mozjs38/c/761399aba092bcb1299bb4fccfd60f370ab4216e
|
|
|
|
"--enable-optimize"
|
|
|
|
"--enable-release"
|
|
|
|
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
|
|
|
# Spidermonkey seems to use different host/build terminology for cross
|
|
|
|
# compilation here.
|
|
|
|
"--host=${stdenv.buildPlatform.config}"
|
|
|
|
"--target=${stdenv.hostPlatform.config}"
|
|
|
|
];
|
|
|
|
|
|
|
|
configurePlatforms = [];
|
|
|
|
|
|
|
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
|
|
|
|
|
|
|
# Remove unnecessary static lib
|
|
|
|
preFixup = ''
|
|
|
|
moveToOutput bin/js60-config "$dev"
|
|
|
|
rm $out/lib/libjs_static.ajs
|
|
|
|
ln -s $out/bin/js60 $out/bin/js
|
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-01-23 13:15:07 +00:00
|
|
|
meta = with lib; {
|
2020-02-07 03:20:17 +00:00
|
|
|
description = "Mozilla's JavaScript engine written in C/C++";
|
2020-04-11 14:01:38 +01:00
|
|
|
homepage = "https://developer.mozilla.org/en/SpiderMonkey";
|
2020-02-07 03:20:17 +00:00
|
|
|
license = licenses.gpl2; # TODO: MPL/GPL/LGPL tri-license.
|
|
|
|
maintainers = [ maintainers.abbradar ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|