mozjs78-vl.spec 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. %global major 78
  2. # LTO - Enable in Release builds, but consider disabling for development as it increases compile time
  3. %global build_with_lto 1
  4. # Require tests to pass?
  5. %global require_tests 0
  6. %if 0%{?build_with_lto}
  7. # LTO is default since F33 and F32 package is backported as is, so no LTO there
  8. %else
  9. %define _lto_cflags %{nil}
  10. %endif
  11. # Require libatomic for ppc
  12. %ifarch ppc
  13. %global system_libatomic 1
  14. %endif
  15. # Big endian platforms
  16. %ifarch ppc ppc64 s390 s390x
  17. %global big_endian 1
  18. %endif
  19. Name: mozjs%{major}
  20. Version: 78.13.0
  21. Release: 1%{?_dist_release}
  22. Summary: SpiderMonkey JavaScript library
  23. Group: system
  24. Vendor: Project Vine
  25. Distribution: Vine Linux
  26. License: MPLv2.0 and MPLv1.1 and BSD and GPLv2+ and GPLv3+ and LGPLv2+ and AFL and ASL 2.0
  27. URL: https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey
  28. Source0: https://ftp.mozilla.org/pub/firefox/releases/%{version}esr/source/firefox-%{version}esr.source.tar.xz
  29. # Patches from mozjs68, rebased for mozjs78:
  30. Patch01: fix-soname.patch
  31. Patch02: copy-headers.patch
  32. Patch03: tests-increase-timeout.patch
  33. Patch09: icu_sources_data.py-Decouple-from-Mozilla-build-system.patch
  34. Patch10: icu_sources_data-Write-command-output-to-our-stderr.patch
  35. # Build fixes - https://hg.mozilla.org/mozilla-central/rev/ca36a6c4f8a4a0ddaa033fdbe20836d87bbfb873
  36. Patch12: emitter.patch
  37. # Build fixes
  38. Patch14: init_patch.patch
  39. # TODO: Check with mozilla for cause of these fails and re-enable spidermonkey compile time checks if needed
  40. Patch15: spidermonkey_checks_disable.patch
  41. # armv7 fixes
  42. Patch17: armv7_disable_WASM_EMULATE_ARM_UNALIGNED_FP_ACCESS.patch
  43. # s390x/ppc64 fixes, TODO: file bug report upstream?
  44. Patch18: spidermonkey_style_check_disable_s390x.patch
  45. Patch19: 0001-Skip-failing-tests-on-ppc64-and-s390x.patch
  46. # Fix for https://bugzilla.mozilla.org/show_bug.cgi?id=1644600 ( SharedArrayRawBufferRefs is not exported )
  47. # https://github.com/0ad/0ad/blob/83e81362d850cc6f2b3b598255b873b6d04d5809/libraries/source/spidermonkey/FixSharedArray.diff
  48. Patch30: FixSharedArray.diff
  49. # Avoid autoconf213 dependency, backported from upstream
  50. # https://bugzilla.mozilla.org/show_bug.cgi?id=1663863
  51. Patch31: 0002-D89554-autoconf1.diff
  52. Patch32: 0003-D94538-autoconf2.diff
  53. BuildRequires: make
  54. BuildRequires: autoconf213
  55. BuildRequires: cargo
  56. BuildRequires: clang-devel
  57. BuildRequires: gcc
  58. BuildRequires: gcc-c++
  59. BuildRequires: nasm
  60. BuildRequires: llvm
  61. BuildRequires: llvm-devel
  62. BuildRequires: rust
  63. BuildRequires: perl
  64. BuildRequires: pkgconfig(libffi)
  65. BuildRequires: pkgconfig(zlib)
  66. BuildRequires: python3-devel
  67. BuildRequires: python3-setuptools
  68. BuildRequires: python3-six
  69. BuildRequires: readline-devel
  70. BuildRequires: zip
  71. %if 0%{?big_endian}
  72. BuildRequires: icu
  73. %endif
  74. %if 0%{?system_libatomic}
  75. BuildRequires: libatomic
  76. %endif
  77. Obsoletes: mozjs68 < 78.0.0
  78. Obsoletes: mozjs60 < 68.0.0
  79. Obsoletes: mozjs52 < 60.0.0
  80. Obsoletes: mozjs24 < 52.0.0
  81. Obsoletes: js < 1:1.8.6
  82. %description
  83. SpiderMonkey is the code-name for Mozilla Firefox's C++ implementation of
  84. JavaScript. It is intended to be embedded in other applications
  85. that provide host environments for JavaScript.
  86. %package devel
  87. Summary: Development files for %{name}
  88. Group: programming
  89. Requires: %{name}%{?_isa} = %{version}-%{release}
  90. %description devel
  91. The %{name}-devel package contains libraries and header files for
  92. developing applications that use %{name}.
  93. %debug_package
  94. %prep
  95. %setup -q -n firefox-%{version}/js/src
  96. pushd ../..
  97. %patch01 -p1
  98. %patch02 -p1
  99. %patch03 -p1
  100. %patch09 -p1
  101. %patch10 -p1
  102. %patch12 -p1
  103. %patch14 -p1
  104. %patch15 -p1
  105. %ifarch armv7hl
  106. # Disable WASM_EMULATE_ARM_UNALIGNED_FP_ACCESS as it causes the compilation to fail
  107. # https://bugzilla.mozilla.org/show_bug.cgi?id=1526653
  108. %patch17 -p1
  109. %endif
  110. %ifarch s390x
  111. %patch18 -p1
  112. %endif
  113. # Fixes for ppc64 and s390x, there is no need to keep it in ifarch here since mozilla tests support ifarch conditions
  114. %patch19 -p1
  115. # Export SharedArrayRawBufferRefs
  116. %patch30 -p1
  117. %if 0
  118. # Avoid autoconf213 dependency
  119. %patch31 -p1 -b .autoconf213
  120. %patch32 -p1 -b .autoconf213-2
  121. AC_MACRODIR=`pwd`/build/autoconf
  122. sed -i \
  123. -e 's|@SHELL@|/bin/sh|' \
  124. -e 's|@M4@|/usr/bin/m4|' \
  125. -e 's|@AWK@|/bin/awk|' \
  126. -e "s|@AC_MACRODIR@|$AC_MACRODIR|" \
  127. build/autoconf/autoconf.sh
  128. %endif
  129. # Copy out the LICENSE file
  130. cp LICENSE js/src/
  131. popd
  132. # Remove zlib directory (to be sure using system version)
  133. rm -rf ../../modules/zlib
  134. %build
  135. # Prefer GCC for now
  136. export CC=gcc
  137. export CXX=g++
  138. # Workaround
  139. # error: options `-C embed-bitcode=no` and `-C lto` are incompatible
  140. # error: could not compile `jsrust`.
  141. # https://github.com/japaric/cargo-call-stack/issues/25
  142. export RUSTFLAGS="-C embed-bitcode"
  143. %if 0%{?build_with_lto}
  144. # https://github.com/ptomato/mozjs/commit/36bb7982b41e0ef9a65f7174252ab996cd6777bd
  145. export CARGO_PROFILE_RELEASE_LTO=true
  146. %endif
  147. export CFLAGS="%{optflags}"
  148. export CXXFLAGS="$CFLAGS"
  149. export LINKFLAGS="%{?__global_ldflags}"
  150. export PYTHON="%{__python3}"
  151. autoconf-2.13
  152. %configure \
  153. --without-system-icu \
  154. --with-system-zlib \
  155. --disable-tests \
  156. --disable-strip \
  157. --with-intl-api \
  158. --enable-readline \
  159. --enable-shared-js \
  160. --enable-optimize \
  161. --disable-debug \
  162. --enable-pie \
  163. --disable-jemalloc
  164. %if 0%{?big_endian}
  165. echo "Generate big endian version of config/external/icu/data/icud67l.dat"
  166. pushd ../..
  167. icupkg -tb config/external/icu/data/icudt67l.dat config/external/icu/data/icudt67b.dat
  168. rm -f config/external/icu/data/icudt*l.dat
  169. popd
  170. %endif
  171. %make_build
  172. %install
  173. %make_install
  174. # Fix permissions
  175. chmod -x %{buildroot}%{_libdir}/pkgconfig/*.pc
  176. # Avoid multilib conflicts
  177. case `uname -i` in
  178. i386 | ppc | s390 | sparc )
  179. wordsize="32"
  180. ;;
  181. x86_64 | ppc64 | s390x | sparc64 )
  182. wordsize="64"
  183. ;;
  184. *)
  185. wordsize=""
  186. ;;
  187. esac
  188. if test -n "$wordsize"
  189. then
  190. mv %{buildroot}%{_includedir}/mozjs-%{major}/js-config.h \
  191. %{buildroot}%{_includedir}/mozjs-%{major}/js-config-$wordsize.h
  192. cat >%{buildroot}%{_includedir}/mozjs-%{major}/js-config.h <<EOF
  193. #ifndef JS_CONFIG_H_MULTILIB
  194. #define JS_CONFIG_H_MULTILIB
  195. #include <bits/wordsize.h>
  196. #if __WORDSIZE == 32
  197. # include "js-config-32.h"
  198. #elif __WORDSIZE == 64
  199. # include "js-config-64.h"
  200. #else
  201. # error "unexpected value for __WORDSIZE macro"
  202. #endif
  203. #endif
  204. EOF
  205. fi
  206. # Remove unneeded files
  207. rm %{buildroot}%{_bindir}/js%{major}-config
  208. rm %{buildroot}%{_libdir}/libjs_static.ajs
  209. # Rename library and create symlinks, following fix-soname.patch
  210. mv %{buildroot}%{_libdir}/libmozjs-%{major}.so \
  211. %{buildroot}%{_libdir}/libmozjs-%{major}.so.0.0.0
  212. ln -s libmozjs-%{major}.so.0.0.0 %{buildroot}%{_libdir}/libmozjs-%{major}.so.0
  213. ln -s libmozjs-%{major}.so.0 %{buildroot}%{_libdir}/libmozjs-%{major}.so
  214. %check
  215. # Run SpiderMonkey tests
  216. %if 0%{?require_tests}
  217. PYTHONPATH=tests/lib %{__python3} tests/jstests.py -d -s -t 1800 --no-progress --wpt=disabled ../../js/src/dist/bin/js%{major}
  218. %else
  219. PYTHONPATH=tests/lib %{__python3} tests/jstests.py -d -s -t 1800 --no-progress --wpt=disabled ../../js/src/dist/bin/js%{major} || :
  220. %endif
  221. # Run basic JIT tests
  222. %if 0%{?require_tests}
  223. PYTHONPATH=tests/lib %{__python3} jit-test/jit_test.py -s -t 1800 --no-progress ../../js/src/dist/bin/js%{major} basic
  224. %else
  225. PYTHONPATH=tests/lib %{__python3} jit-test/jit_test.py -s -t 1800 --no-progress ../../js/src/dist/bin/js%{major} basic || :
  226. %endif
  227. %files
  228. %doc README.html
  229. %license LICENSE
  230. %{_libdir}/libmozjs-%{major}.so.0*
  231. %files devel
  232. %{_bindir}/js%{major}
  233. %{_libdir}/libmozjs-%{major}.so
  234. %{_libdir}/pkgconfig/*.pc
  235. %{_includedir}/mozjs-%{major}/
  236. %changelog
  237. * Tue Aug 17 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 78.13.0-1
  238. - new upstream release.
  239. - dropped ldconfig scriptlets.
  240. - imported Patch30-32 from rawhide.
  241. * Fri Jul 16 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 78.12.0-1
  242. - new upstream release.
  243. * Fri Feb 26 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 78.8.0-1
  244. - new upstream release.
  245. - dropped Patch1000: fixed in upstream.
  246. * Wed Feb 24 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 78.7.0-1
  247. - switched to mozjs-78.
  248. - added Patch1000 to build with rust-1.50.
  249. * Tue Aug 04 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 68.11.0-1
  250. - initial build for Vine Linux.
  251. - new upstream release.
  252. * Tue Jun 30 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.10.0-1
  253. - Update to 68.10.0
  254. * Tue Jun 02 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.9.0-1
  255. - Update to 68.9.0
  256. - Drop llvm and rust deps
  257. * Wed May 06 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.8.0-1
  258. - Update to 68.8.0
  259. * Tue Apr 07 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.7.0-1
  260. - Update to 68.7.0
  261. * Tue Mar 17 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.6.0-2
  262. - Rebuild with GCC 10
  263. - Nuke check_spidermonkey_style.py on s390x
  264. * Wed Mar 11 2020 Kalev Lember <klember@redhat.com> - 68.6.0-1
  265. - Update to 68.6.0
  266. * Mon Feb 10 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.5.0-1
  267. - Update to 68.5.0
  268. * Mon Feb 03 2020 Kalev Lember <klember@redhat.com> - 68.4.2-3
  269. - Build with --enable-unaligned-private-values
  270. * Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 68.4.2-2
  271. - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
  272. * Wed Jan 22 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.4.2-1
  273. - Update to 68.4.2
  274. * Tue Jan 07 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.4.0-1
  275. - Update to 68.4.0
  276. * Sat Dec 07 2019 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.3.0-1
  277. - Update to 68.3.0
  278. * Wed Nov 20 2019 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.2.0-5
  279. - Don't enforce tests to pass on s390 and s390x again
  280. * Tue Nov 19 2019 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.2.0-4
  281. - Enable LTO
  282. - Enforce SpiderMonkey tests in check section on all architectures
  283. * Sun Nov 17 2019 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.2.0-3
  284. - Fix armv7 build
  285. * Thu Nov 14 2019 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.2.0-2
  286. - Fix s390x build
  287. - Exclude armv7 for now, see comment up in the spec
  288. * Mon Nov 04 2019 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.2.0-1
  289. - Initial mozjs68 package based on mozjs60