aboutsummaryrefslogtreecommitdiff
path: root/srcpkgs/mozjs102/template
blob: 7f01a2732b1952280dca166137f7d3c8b262f5a7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Template file for 'mozjs102'
pkgname=mozjs102
version=102.15.1
revision=1
build_wrksrc=js/src
build_style=gnu-configure
build_helper=rust
make_check_target=check-jit-test
configure_args="--disable-jemalloc --disable-strip --disable-tests \
 --disable-optimize --disable-debug --enable-ctypes --enable-readline \
 --enable-shared-js --enable-system-ffi --with-intl-api --with-system-icu \
 --with-system-nspr --with-system-zlib --enable-hardening --enable-release"
hostmakedepends="make pkg-config python3 python3-setuptools python3-six perl m4
 rust cargo llvm18 clang18 python3-looseversion"
makedepends="icu-devel libffi-devel nspr-devel python3-devel readline-devel
 zlib-devel rust-std"
checkdepends="python3"
short_desc="SpiderMonkey JavaScript interpreter and library (102.x)"
maintainer="oreo639 <oreo6391@gmail.com>"
license="MPL-2.0"
homepage="https://spidermonkey.dev"
distfiles="${MOZILLA_SITE}/firefox/releases/${version}esr/source/firefox-${version}esr.source.tar.xz"
checksum=09194fb765953bc6979a35aa8834118c453b9d6060bf1ec4e134551bad740113
broken="ModuleNotFoundError: No module named 'distutils'"

LDFLAGS="-Wl,-z,stack-size=1048576"

if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
	LDFLAGS+=" -latomic"
fi

if [ "$XBPS_TARGET_MACHINE" = i686 ]; then
	# Disable LTO on i686, otherwise compilation of `jsrust` fails with -
	# 	error: ran out of registers during register allocation
	# 	LLVM ERROR: Cannot emit physreg copy instruction
	# 	error: could not compile `jsrust` due to previous error
	export MOZ_NO_RUST_LTO=1
fi

pre_configure() {
	if [ "$CROSS_BUILD" ]; then
		configure_args+=" --host=${XBPS_TRIPLET} --target=${XBPS_CROSS_TRIPLET} --enable-linker=bfd"
	fi
	export M4=m4
	export AWK=awk
	export AC_MACRODIR=../../build/autoconf
	chmod 0755 ../../build/autoconf/autoconf.sh
	sh ../../build/autoconf/autoconf.sh configure.in > configure
	chmod 0755 configure

	rm -rf ${wrksrc}/third_party/python/six
	mkdir ${wrksrc}/third_party/python/six
	ln -s /${py3_sitelib}/six.py ${wrksrc}/third_party/python/six

	rm -rf ${wrksrc}/third_party/python/looseversion
	mkdir ${wrksrc}/third_party/python/looseversion
	ln -s /${py3_sitelib}/looseversion/__init__.py ${wrksrc}/third_party/python/looseversion/looseversion.py
	echo "vendored:third_party/python/looseversion" >>  ${wrksrc}/python/sites/mach.txt
}

post_install() {
	# Remove unneeded static library
	rm -f "${DESTDIR}"/usr/lib/*.ajs

	# it has correct soname but not the right file name
	mv "${DESTDIR}"/usr/lib/libmozjs-102.so \
	   "${DESTDIR}"/usr/lib/libmozjs-102.so.0
	ln -rs "${DESTDIR}"/usr/lib/libmozjs-102.so.0 \
	       "${DESTDIR}"/usr/lib/libmozjs-102.so
}

pre_check() {
	if [ "$XBPS_WORDSIZE" = 32 ]; then
		vsed -i jit-test/tests/basic/bug653153.js -e s/65536/65568/g
		vsed -i jit-test/tests/basic/bug653153.js -e s/65537/65569/g
	fi
	if [ "$XBPS_TARGET_MACHINE" = i686 ]; then
		export JITTEST_EXTRA_ARGS="${JITTEST_EXTRA_ARGS} \
			-x basic/fdlibm-for-sin-cos-tan-argument.js \
			-x gc/gcparam.js \
			-x ion/dce-with-rinstructions.js \
			-x sunspider/check-3d-cube.js \
			-x sunspider/check-3d-raytrace.js \
			-x sunspider/check-access-nbody.js \
			-x wasm/nan-semantics.js \
			-x wasm/spec/spec/float_literals.wast.js \
			-x wasm/spec/spec/float_memory.wast.js \
			-x wasm/spec/threads/float_memory.wast.js \
			"
	fi
	if [ "$XBPS_LIBC" = musl ]; then
		export JITTEST_EXTRA_ARGS="${JITTEST_EXTRA_ARGS} \
			-x sunspider/check-date-format-tofte.js \
			"
	fi
}

mozjs102-devel_package() {
	depends="nspr-devel ${sourcepkg}>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/bin/js102-config
		vmove usr/include
		vmove "usr/lib/*.so"
		vmove usr/lib/pkgconfig
	}
}