2021-02-05 17:12:51 +00:00
{ lib , stdenv , fetchurl , pkg-config , gnused_422 , perl , python2 , zip , libffi , readline , icu , zlib , buildPackages
2020-04-24 23:36:52 +00:00
, libobjc } :
2021-02-05 17:12:51 +00:00
with lib ;
2020-04-24 23:36:52 +00:00
stdenv . mkDerivation rec {
version = " 3 8 . 8 . 0 " ;
pname = " s p i d e r m o n k e y " ;
src = fetchurl {
url = " m i r r o r : / / m o z i l l a / f i r e f o x / r e l e a s e s / ${ version } e s r / s o u r c e / f i r e f o x - ${ version } e s r . s o u r c e . t a r . b z 2 " ;
sha256 = " 1 0 l r y n c 6 c x n j l n a d c 0 j 3 v g 8 r 2 d q 9 b 3 w w a n w 8 q j 1 h 6 n c x w b 7 a s x c l " ;
} ;
buildInputs = [ libffi readline icu zlib ]
2021-02-05 17:12:51 +00:00
++ lib . optional stdenv . isDarwin libobjc ;
nativeBuildInputs = [ pkg-config perl python2 zip gnused_422 ] ;
2020-04-24 23:36:52 +00:00
postUnpack = " s o u r c e R o o t = \$ { s o u r c e R o o t } / j s / s r c " ;
preConfigure = ''
export CXXFLAGS = " - f p e r m i s s i v e "
export LIBXUL_DIST = $ out
export PYTHON = " ${ buildPackages . python2 . interpreter } "
'' ;
configureFlags = [
" - - e n a b l e - t h r e a d s a f e "
" - - w i t h - s y s t e m - f f i "
" - - e n a b l e - p o s i x - n s p r - e m u l a t i o n "
" - - w i t h - s y s t e m - z l i b "
" - - w i t h - s y s t e m - i c u "
" - - e n a b l e - r e a d l i n e "
# enabling these because they're wanted by 0ad. They may or may
# not be good defaults for other uses.
" - - e n a b l e - g c g e n e r a t i o n a l "
" - - e n a b l e - s h a r e d - j s "
] ++ optionals ( stdenv . hostPlatform != stdenv . buildPlatform ) [
# Spidermonkey seems to use different host/build terminology for cross
# compilation here.
" - - h o s t = ${ stdenv . buildPlatform . config } "
" - - t a r g e t = ${ stdenv . hostPlatform . config } "
] ;
configurePlatforms = [ ] ;
depsBuildBuild = [ buildPackages . stdenv . cc ] ;
# This addresses some build system bug. It's quite likely to be safe
# to re-enable parallel builds if the source revision changes.
enableParallelBuilding = true ;
postFixup = ''
# The headers are symlinks to a directory that doesn't get put
# into $out, so they end up broken. Fix that by just resolving the
# symlinks.
for i in $ ( find $ out - type l ) ; do
cp - - remove-destination " $ ( r e a d l i n k " $ i " ) " " $ i " ;
done
'' ;
2021-02-05 17:12:51 +00:00
meta = with lib ; {
2020-04-24 23:36:52 +00:00
description = " M o z i l l a ' s J a v a S c r i p t e n g i n e w r i t t e n i n C / C + + " ;
homepage = " h t t p s : / / d e v e l o p e r . m o z i l l a . o r g / e n / S p i d e r M o n k e y " ;
# TODO: MPL/GPL/LGPL tri-license.
maintainers = [ maintainers . abbradar ] ;
platforms = platforms . unix ;
2020-10-07 09:15:18 +00:00
knownVulnerabilities = [ " S p i d e r M o n k e y 3 8 i s o u t d a t e d a n d c o n t a i n s k n o w n s e c u r i t y v u l n e r a b i l i t i e s . " ] ; # as per https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Releases/38
2020-04-24 23:36:52 +00:00
} ;
}