mozjs102-vl.spec 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. %global major 102
  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: 102.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. Patch16: 0001-Python-Build-Use-r-instead-of-rU-file-read-modes.patch
  37. # TODO: Check with mozilla for cause of these fails and re-enable spidermonkey compile time checks if needed
  38. Patch20: spidermonkey_checks_disable.patch
  39. # s390x/ppc64 fixes
  40. Patch21: 0001-Skip-failing-tests-on-ppc64-and-s390x.patch
  41. BuildRequires: cargo
  42. BuildRequires: ccache
  43. BuildRequires: clang-devel
  44. BuildRequires: gcc
  45. BuildRequires: gcc-c++
  46. BuildRequires: m4
  47. BuildRequires: make
  48. %if !0%{?rhel}
  49. BuildRequires: nasm
  50. %endif
  51. BuildRequires: libatomic
  52. BuildRequires: libicu-devel
  53. BuildRequires: llvm
  54. BuildRequires: rust
  55. BuildRequires: rustfmt
  56. BuildRequires: perl
  57. BuildRequires: pkgconfig(libffi)
  58. BuildRequires: pkgconfig(zlib)
  59. BuildRequires: python3-devel
  60. BuildRequires: python3-setuptools
  61. BuildRequires: python3-six
  62. BuildRequires: readline-devel
  63. BuildRequires: wget
  64. BuildRequires: zip
  65. %description
  66. SpiderMonkey is the code-name for Mozilla Firefox's C++ implementation of
  67. JavaScript. It is intended to be embedded in other applications
  68. that provide host environments for JavaScript.
  69. %package devel
  70. Summary: Development files for %{name}
  71. Requires: %{name}%{?_isa} = %{version}-%{release}
  72. %description devel
  73. The %{name}-devel package contains libraries and header files for
  74. developing applications that use %{name}.
  75. %debug_package
  76. %prep
  77. %autosetup -n firefox-%{version}/js/src -N
  78. pushd ../..
  79. %autopatch -p1
  80. # Copy out the LICENSE file
  81. cp LICENSE js/src/
  82. # Copy out file containing known test failures with system libicu
  83. cp %{SOURCE1} js/src/
  84. # Remove zlib directory (to be sure using system version)
  85. rm -rf modules/zlib
  86. # Remove unneeded bundled stuff
  87. rm -rf js/src/devtools/automation/variants/
  88. rm -rf js/src/octane/
  89. rm -rf js/src/ctypes/libffi/
  90. popd
  91. %build
  92. %if 0%{?build_with_lto}
  93. # https://github.com/ptomato/mozjs/commit/36bb7982b41e0ef9a65f7174252ab996cd6777bd
  94. export CARGO_PROFILE_RELEASE_LTO=true
  95. %endif
  96. # Use bundled autoconf
  97. export M4=m4
  98. export AWK=awk
  99. export AC_MACRODIR=%{_builddir}/firefox-%{version}/build/autoconf/
  100. sh ../../build/autoconf/autoconf.sh --localdir=%{_builddir}/firefox-%{version}/js/src configure.in > configure
  101. chmod +x configure
  102. %configure \
  103. --with-system-icu \
  104. --with-system-zlib \
  105. --disable-tests \
  106. --disable-strip \
  107. --with-intl-api \
  108. --enable-readline \
  109. --enable-shared-js \
  110. --enable-optimize \
  111. --disable-debug \
  112. --enable-pie \
  113. --disable-jemalloc
  114. %make_build
  115. %install
  116. %make_install
  117. # Fix permissions
  118. chmod -x %{buildroot}%{_libdir}/pkgconfig/*.pc
  119. # Avoid multilib conflicts
  120. %ifarch x86_64
  121. wordsize="64"
  122. %else
  123. wordsize="32"
  124. %endif
  125. if test -n "$wordsize"
  126. then
  127. mv %{buildroot}%{_includedir}/mozjs-%{major}/js-config.h \
  128. %{buildroot}%{_includedir}/mozjs-%{major}/js-config-$wordsize.h
  129. cat >%{buildroot}%{_includedir}/mozjs-%{major}/js-config.h <<EOF
  130. #ifndef JS_CONFIG_H_MULTILIB
  131. #define JS_CONFIG_H_MULTILIB
  132. #include <bits/wordsize.h>
  133. #if __WORDSIZE == 32
  134. # include "js-config-32.h"
  135. #elif __WORDSIZE == 64
  136. # include "js-config-64.h"
  137. #else
  138. # error "unexpected value for __WORDSIZE macro"
  139. #endif
  140. #endif
  141. EOF
  142. fi
  143. # Remove unneeded files
  144. rm %{buildroot}%{_bindir}/js%{major}-config
  145. rm %{buildroot}%{_libdir}/libjs_static.ajs
  146. # Rename library and create symlinks, following fix-soname.patch
  147. mv %{buildroot}%{_libdir}/libmozjs-%{major}.so \
  148. %{buildroot}%{_libdir}/libmozjs-%{major}.so.0.0.0
  149. ln -s libmozjs-%{major}.so.0.0.0 %{buildroot}%{_libdir}/libmozjs-%{major}.so.0
  150. ln -s libmozjs-%{major}.so.0 %{buildroot}%{_libdir}/libmozjs-%{major}.so
  151. %check
  152. # Run SpiderMonkey tests
  153. %if 0%{?require_tests}
  154. %{python3} tests/jstests.py -d -s -t 2400 --exclude-file=known_failures.txt --no-progress --wpt=disabled ../../js/src/dist/bin/js%{major}
  155. %else
  156. %{python3} tests/jstests.py -d -s -t 2400 --exclude-file=known_failures.txt --no-progress --wpt=disabled ../../js/src/dist/bin/js%{major} || :
  157. %endif
  158. # Run basic JIT tests
  159. %if 0%{?require_tests}
  160. # large-arraybuffers/basic.js fails on s390x
  161. %ifarch s390 s390x
  162. %{python3} jit-test/jit_test.py -s -t 2400 --no-progress -x large-arraybuffers/basic.js ../../js/src/dist/bin/js%{major} basic
  163. %else
  164. %{python3} jit-test/jit_test.py -s -t 2400 --no-progress ../../js/src/dist/bin/js%{major} basic
  165. %endif
  166. %else
  167. %{python3} jit-test/jit_test.py -s -t 2400 --no-progress ../../js/src/dist/bin/js%{major} basic || :
  168. %endif
  169. %files
  170. %doc README.html
  171. %license LICENSE
  172. %{_libdir}/libmozjs-%{major}.so.0*
  173. %files devel
  174. %{_bindir}/js%{major}
  175. %{_libdir}/libmozjs-%{major}.so
  176. %{_libdir}/pkgconfig/*.pc
  177. %{_includedir}/mozjs-%{major}/
  178. %changelog
  179. * Tue Nov 01 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 102.4.0-2
  180. - initial build for Vine Linux.
  181. * Mon Oct 17 2022 Frantisek Zatloukal <fzatlouk@redhat.com> - 102.4.0-1
  182. - mozjs102-102.4.0 (fixes RHBZ#2135298)
  183. * Wed Sep 21 2022 Frantisek Zatloukal <fzatlouk@redhat.com> - 102.3.0-1
  184. - mozjs102-102.3.0 (fixes RHBZ#2127989)
  185. * Mon Aug 22 2022 Frantisek Zatloukal <fzatlouk@redhat.com> - 102.2.0-1
  186. - mozjs102-102.2.0
  187. * Wed Jul 27 2022 Frantisek Zatloukal <fzatlouk@redhat.com> - 102.1.0-1
  188. - Initial mozjs102 package based on mozjs91