mozjs115-vl.spec 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. %global major 115
  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 the default
  8. %else
  9. %define _lto_cflags %{nil}
  10. %endif
  11. # Big endian platforms
  12. %ifarch ppc ppc64 s390 s390x
  13. %global big_endian 1
  14. %endif
  15. Name: mozjs%{major}
  16. Version: 115.4.0
  17. Release: 1%{?_dist_release}
  18. Summary: SpiderMonkey JavaScript library
  19. License: MPL-2.0 AND Apache-2.0 AND BSD-3-Clause AND BSD-2-Clause AND MIT AND GPL-3.0-or-later
  20. URL: https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey
  21. Source0: https://ftp.mozilla.org/pub/firefox/releases/%{version}esr/source/firefox-%{version}esr.source.tar.xz
  22. # Known failures with system libicu
  23. Source1: known_failures.txt
  24. # Patches from mozjs68, rebased for mozjs78:
  25. Patch01: fix-soname.patch
  26. Patch02: copy-headers.patch
  27. Patch03: tests-increase-timeout.patch
  28. Patch09: icu_sources_data.py-Decouple-from-Mozilla-build-system.patch
  29. Patch10: icu_sources_data-Write-command-output-to-our-stderr.patch
  30. # Build fixes - https://hg.mozilla.org/mozilla-central/rev/ca36a6c4f8a4a0ddaa033fdbe20836d87bbfb873
  31. Patch12: emitter.patch
  32. Patch13: tests-Use-native-TemporaryDirectory.patch
  33. # Build fixes
  34. Patch14: init_patch.patch
  35. Patch15: remove-sloppy-m4-detection-from-bundled-autoconf.patch
  36. # tentative patch for RUSTFLAGS parsing issue, taken from firefox package:
  37. # https://bugzilla.redhat.com/show_bug.cgi?id=2184743
  38. # https://bugzilla.mozilla.org/show_bug.cgi?id=1474486
  39. Patch16: firefox-112.0-commasplit.patch
  40. # TODO: Check with mozilla for cause of these fails and re-enable spidermonkey compile time checks if needed
  41. Patch20: spidermonkey_checks_disable.patch
  42. # s390x/ppc64 fixes
  43. Patch21: 0001-Skip-failing-tests-on-ppc64-and-s390x.patch
  44. BuildRequires: cargo
  45. BuildRequires: ccache
  46. BuildRequires: clang-devel
  47. BuildRequires: gcc
  48. BuildRequires: gcc-c++
  49. BuildRequires: m4
  50. BuildRequires: make
  51. %if !0%{?rhel}
  52. BuildRequires: nasm
  53. %endif
  54. BuildRequires: libatomic
  55. BuildRequires: libicu-devel
  56. BuildRequires: llvm
  57. BuildRequires: rust
  58. BuildRequires: rustfmt
  59. BuildRequires: perl
  60. BuildRequires: pkgconfig(libffi)
  61. BuildRequires: pkgconfig(zlib)
  62. BuildRequires: python3-devel
  63. BuildRequires: python3-setuptools
  64. BuildRequires: python3-six
  65. BuildRequires: readline-devel
  66. BuildRequires: wget
  67. BuildRequires: zip
  68. %description
  69. SpiderMonkey is the code-name for Mozilla Firefox's C++ implementation of
  70. JavaScript. It is intended to be embedded in other applications
  71. that provide host environments for JavaScript.
  72. %package devel
  73. Summary: Development files for %{name}
  74. Requires: %{name}%{?_isa} = %{version}-%{release}
  75. %description devel
  76. The %{name}-devel package contains libraries and header files for
  77. developing applications that use %{name}.
  78. %debug_package
  79. %prep
  80. %autosetup -n firefox-%{version}/js/src -N
  81. pushd ../..
  82. %autopatch -p1
  83. # Purge the bundled six library incompatible with Python 3.12
  84. rm third_party/python/six/six.py
  85. # Link the system six library (build tooling expects that)
  86. ln -s %{python3_sitelib}/six.py third_party/python/six/six.py
  87. # Copy out the LICENSE file
  88. cp LICENSE js/src/
  89. # Copy out file containing known test failures with system libicu
  90. cp %{SOURCE1} js/src/
  91. # Remove zlib directory (to be sure using system version)
  92. rm -rf modules/zlib
  93. # Remove unneeded bundled stuff
  94. rm -rf js/src/devtools/automation/variants/
  95. rm -rf js/src/octane/
  96. rm -rf js/src/ctypes/libffi/
  97. popd
  98. %build
  99. %if 0%{?build_with_lto}
  100. # https://github.com/ptomato/mozjs/commit/36bb7982b41e0ef9a65f7174252ab996cd6777bd
  101. export CARGO_PROFILE_RELEASE_LTO=true
  102. %endif
  103. # Use bundled autoconf
  104. export M4=m4
  105. export AWK=awk
  106. export AC_MACRODIR=%{_builddir}/firefox-%{version}/build/autoconf/
  107. %configure \
  108. --with-system-icu \
  109. --with-system-zlib \
  110. --disable-tests \
  111. --disable-strip \
  112. --with-intl-api \
  113. --enable-readline \
  114. --enable-shared-js \
  115. --enable-optimize \
  116. --disable-debug \
  117. --enable-pie \
  118. --disable-jemalloc
  119. %make_build
  120. %install
  121. %make_install
  122. # Fix permissions
  123. chmod -x %{buildroot}%{_libdir}/pkgconfig/*.pc
  124. # Avoid multilib conflicts
  125. %ifarch x86_64
  126. wordsize="64"
  127. %else
  128. wordsize="32"
  129. %endif
  130. if test -n "$wordsize"
  131. then
  132. mv %{buildroot}%{_includedir}/mozjs-%{major}/js-config.h \
  133. %{buildroot}%{_includedir}/mozjs-%{major}/js-config-$wordsize.h
  134. cat >%{buildroot}%{_includedir}/mozjs-%{major}/js-config.h <<EOF
  135. #ifndef JS_CONFIG_H_MULTILIB
  136. #define JS_CONFIG_H_MULTILIB
  137. #include <bits/wordsize.h>
  138. #if __WORDSIZE == 32
  139. # include "js-config-32.h"
  140. #elif __WORDSIZE == 64
  141. # include "js-config-64.h"
  142. #else
  143. # error "unexpected value for __WORDSIZE macro"
  144. #endif
  145. #endif
  146. EOF
  147. fi
  148. # Remove unneeded files
  149. rm %{buildroot}%{_bindir}/js%{major}-config
  150. rm %{buildroot}%{_libdir}/libjs_static.ajs
  151. # Rename library and create symlinks, following fix-soname.patch
  152. mv %{buildroot}%{_libdir}/libmozjs-%{major}.so \
  153. %{buildroot}%{_libdir}/libmozjs-%{major}.so.0.0.0
  154. ln -s libmozjs-%{major}.so.0.0.0 %{buildroot}%{_libdir}/libmozjs-%{major}.so.0
  155. ln -s libmozjs-%{major}.so.0 %{buildroot}%{_libdir}/libmozjs-%{major}.so
  156. %check
  157. # Run SpiderMonkey tests
  158. %if 0%{?require_tests}
  159. %{python3} tests/jstests.py -d -s -t 2400 --exclude-file=known_failures.txt --no-progress --wpt=disabled ../../js/src/dist/bin/js%{major}
  160. %else
  161. %{python3} tests/jstests.py -d -s -t 2400 --exclude-file=known_failures.txt --no-progress --wpt=disabled ../../js/src/dist/bin/js%{major} || :
  162. %endif
  163. # Run basic JIT tests
  164. %if 0%{?require_tests}
  165. # large-arraybuffers/basic.js fails on s390x
  166. %ifarch s390 s390x
  167. %{python3} jit-test/jit_test.py -s -t 2400 --no-progress -x large-arraybuffers/basic.js ../../js/src/dist/bin/js%{major} basic
  168. %else
  169. %{python3} jit-test/jit_test.py -s -t 2400 --no-progress ../../js/src/dist/bin/js%{major} basic
  170. %endif
  171. %else
  172. %{python3} jit-test/jit_test.py -s -t 2400 --no-progress ../../js/src/dist/bin/js%{major} basic || :
  173. %endif
  174. %files
  175. %doc README.html
  176. %license LICENSE
  177. %{_libdir}/libmozjs-%{major}.so.0*
  178. %files devel
  179. %{_bindir}/js%{major}
  180. %{_libdir}/libmozjs-%{major}.so
  181. %{_libdir}/pkgconfig/*.pc
  182. %{_includedir}/mozjs-%{major}/
  183. %changelog
  184. * Wed Nov 01 2023 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 115.4.0-1
  185. - new upstream release.
  186. * Tue Nov 01 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 102.4.0-2
  187. - initial build for Vine Linux.
  188. * Mon Oct 17 2022 Frantisek Zatloukal <fzatlouk@redhat.com> - 102.4.0-1
  189. - mozjs102-102.4.0 (fixes RHBZ#2135298)
  190. * Wed Sep 21 2022 Frantisek Zatloukal <fzatlouk@redhat.com> - 102.3.0-1
  191. - mozjs102-102.3.0 (fixes RHBZ#2127989)
  192. * Mon Aug 22 2022 Frantisek Zatloukal <fzatlouk@redhat.com> - 102.2.0-1
  193. - mozjs102-102.2.0
  194. * Wed Jul 27 2022 Frantisek Zatloukal <fzatlouk@redhat.com> - 102.1.0-1
  195. - Initial mozjs102 package based on mozjs91