2021-01-23 13:15:07 +00:00
{ lib , stdenv , fetchurl , pkg-config , gnused_422 , perl , python2 , zip , libffi , readline , icu , zlib , buildPackages
2018-05-21 05:06:51 +01:00
, libobjc } :
2016-11-10 22:31:31 +00:00
2021-01-23 13:15:07 +00:00
with lib ;
2019-08-01 22:22:12 +01:00
2016-11-10 22:31:31 +00:00
stdenv . mkDerivation rec {
2018-12-13 17:09:11 +00:00
version = " 3 8 . 8 . 0 " ;
2019-08-15 13:41:18 +01:00
pname = " s p i d e r m o n k e y " ;
2016-11-10 22:31:31 +00:00
src = fetchurl {
2018-12-13 17:09:11 +00:00
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 " ;
2016-11-10 22:31:31 +00:00
} ;
2019-08-01 22:22:12 +01:00
buildInputs = [ libffi readline icu zlib ]
2021-01-23 13:15:07 +00:00
++ lib . optional stdenv . isDarwin libobjc ;
2021-01-19 06:50:56 +00:00
nativeBuildInputs = [ pkg-config perl python2 zip gnused_422 ] ;
2016-11-10 22:31:31 +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
2019-08-01 22:22:12 +01:00
export PYTHON = " ${ buildPackages . python2 . interpreter } "
2016-11-10 22:31:31 +00:00
'' ;
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 "
2019-08-01 22:22:12 +01:00
" - - e n a b l e - p o s i x - n s p r - e m u l a t i o n "
2016-11-10 22:31:31 +00:00
" - - 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 "
2019-08-01 22:22:12 +01:00
] ++ 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 } "
2016-11-10 22:31:31 +00:00
] ;
2019-08-01 22:22:12 +01:00
configurePlatforms = [ ] ;
depsBuildBuild = [ buildPackages . stdenv . cc ] ;
2016-11-10 22:31:31 +00:00
# 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-01-23 13:15:07 +00:00
meta = with lib ; {
2016-11-10 22:31:31 +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 + + " ;
2020-04-01 02:11:51 +01:00
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 " ;
2016-11-10 22:31:31 +00:00
# TODO: MPL/GPL/LGPL tri-license.
maintainers = [ maintainers . abbradar ] ;
2018-05-21 05:06:51 +01:00
platforms = platforms . unix ;
2020-09-30 15:11:10 +01: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
2016-11-10 22:31:31 +00:00
} ;
}