mozjs78-vl.spec 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  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.7.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 error to build with rust-1.50
  47. Patch1000: mozjs-rust1_50.patch
  48. BuildRequires: make
  49. BuildRequires: autoconf213
  50. BuildRequires: cargo
  51. BuildRequires: clang-devel
  52. BuildRequires: gcc
  53. BuildRequires: gcc-c++
  54. BuildRequires: nasm
  55. BuildRequires: llvm
  56. BuildRequires: llvm-devel
  57. BuildRequires: rust
  58. BuildRequires: perl
  59. BuildRequires: pkgconfig(libffi)
  60. BuildRequires: pkgconfig(zlib)
  61. BuildRequires: python3-devel
  62. BuildRequires: python3-setuptools
  63. BuildRequires: python3-six
  64. BuildRequires: readline-devel
  65. BuildRequires: zip
  66. %if 0%{?big_endian}
  67. BuildRequires: icu
  68. %endif
  69. %if 0%{?system_libatomic}
  70. BuildRequires: libatomic
  71. %endif
  72. %description
  73. SpiderMonkey is the code-name for Mozilla Firefox's C++ implementation of
  74. JavaScript. It is intended to be embedded in other applications
  75. that provide host environments for JavaScript.
  76. %package devel
  77. Summary: Development files for %{name}
  78. Group: programming
  79. Requires: %{name}%{?_isa} = %{version}-%{release}
  80. %description devel
  81. The %{name}-devel package contains libraries and header files for
  82. developing applications that use %{name}.
  83. %debug_package
  84. %prep
  85. %setup -q -n firefox-%{version}/js/src
  86. pushd ../..
  87. %patch01 -p1
  88. %patch02 -p1
  89. %patch03 -p1
  90. %patch09 -p1
  91. %patch10 -p1
  92. %patch12 -p1
  93. %patch14 -p1
  94. %patch15 -p1
  95. %ifarch armv7hl
  96. # Disable WASM_EMULATE_ARM_UNALIGNED_FP_ACCESS as it causes the compilation to fail
  97. # https://bugzilla.mozilla.org/show_bug.cgi?id=1526653
  98. %patch17 -p1
  99. %endif
  100. %ifarch s390x
  101. %patch18 -p1
  102. %endif
  103. # Fixes for ppc64 and s390x, there is no need to keep it in ifarch here since mozilla tests support ifarch conditions
  104. %patch19 -p1
  105. # for rust-1.50.0
  106. %patch1000 -p1
  107. # Copy out the LICENSE file
  108. cp LICENSE js/src/
  109. popd
  110. # Remove zlib directory (to be sure using system version)
  111. rm -rf ../../modules/zlib
  112. %build
  113. # Prefer GCC for now
  114. export CC=gcc
  115. export CXX=g++
  116. # Workaround
  117. # error: options `-C embed-bitcode=no` and `-C lto` are incompatible
  118. # error: could not compile `jsrust`.
  119. # https://github.com/japaric/cargo-call-stack/issues/25
  120. export RUSTFLAGS="-C embed-bitcode"
  121. %if 0%{?build_with_lto}
  122. # https://github.com/ptomato/mozjs/commit/36bb7982b41e0ef9a65f7174252ab996cd6777bd
  123. export CARGO_PROFILE_RELEASE_LTO=true
  124. %endif
  125. export CFLAGS="%{optflags}"
  126. export CXXFLAGS="$CFLAGS"
  127. export LINKFLAGS="%{?__global_ldflags}"
  128. export PYTHON="%{__python3}"
  129. autoconf-2.13
  130. %configure \
  131. --without-system-icu \
  132. --with-system-zlib \
  133. --disable-tests \
  134. --disable-strip \
  135. --with-intl-api \
  136. --enable-readline \
  137. --enable-shared-js \
  138. --enable-optimize \
  139. --disable-debug \
  140. --enable-pie \
  141. --disable-jemalloc
  142. %if 0%{?big_endian}
  143. echo "Generate big endian version of config/external/icu/data/icud67l.dat"
  144. pushd ../..
  145. icupkg -tb config/external/icu/data/icudt67l.dat config/external/icu/data/icudt67b.dat
  146. rm -f config/external/icu/data/icudt*l.dat
  147. popd
  148. %endif
  149. %make_build
  150. %install
  151. %make_install
  152. # Fix permissions
  153. chmod -x %{buildroot}%{_libdir}/pkgconfig/*.pc
  154. # Avoid multilib conflicts
  155. case `uname -i` in
  156. i386 | ppc | s390 | sparc )
  157. wordsize="32"
  158. ;;
  159. x86_64 | ppc64 | s390x | sparc64 )
  160. wordsize="64"
  161. ;;
  162. *)
  163. wordsize=""
  164. ;;
  165. esac
  166. if test -n "$wordsize"
  167. then
  168. mv %{buildroot}%{_includedir}/mozjs-%{major}/js-config.h \
  169. %{buildroot}%{_includedir}/mozjs-%{major}/js-config-$wordsize.h
  170. cat >%{buildroot}%{_includedir}/mozjs-%{major}/js-config.h <<EOF
  171. #ifndef JS_CONFIG_H_MULTILIB
  172. #define JS_CONFIG_H_MULTILIB
  173. #include <bits/wordsize.h>
  174. #if __WORDSIZE == 32
  175. # include "js-config-32.h"
  176. #elif __WORDSIZE == 64
  177. # include "js-config-64.h"
  178. #else
  179. # error "unexpected value for __WORDSIZE macro"
  180. #endif
  181. #endif
  182. EOF
  183. fi
  184. # Remove unneeded files
  185. rm %{buildroot}%{_bindir}/js%{major}-config
  186. rm %{buildroot}%{_libdir}/libjs_static.ajs
  187. # Rename library and create symlinks, following fix-soname.patch
  188. mv %{buildroot}%{_libdir}/libmozjs-%{major}.so \
  189. %{buildroot}%{_libdir}/libmozjs-%{major}.so.0.0.0
  190. ln -s libmozjs-%{major}.so.0.0.0 %{buildroot}%{_libdir}/libmozjs-%{major}.so.0
  191. ln -s libmozjs-%{major}.so.0 %{buildroot}%{_libdir}/libmozjs-%{major}.so
  192. %check
  193. # Run SpiderMonkey tests
  194. %if 0%{?require_tests}
  195. PYTHONPATH=tests/lib %{__python3} tests/jstests.py -d -s -t 1800 --no-progress --wpt=disabled ../../js/src/dist/bin/js%{major}
  196. %else
  197. PYTHONPATH=tests/lib %{__python3} tests/jstests.py -d -s -t 1800 --no-progress --wpt=disabled ../../js/src/dist/bin/js%{major} || :
  198. %endif
  199. # Run basic JIT tests
  200. %if 0%{?require_tests}
  201. PYTHONPATH=tests/lib %{__python3} jit-test/jit_test.py -s -t 1800 --no-progress ../../js/src/dist/bin/js%{major} basic
  202. %else
  203. PYTHONPATH=tests/lib %{__python3} jit-test/jit_test.py -s -t 1800 --no-progress ../../js/src/dist/bin/js%{major} basic || :
  204. %endif
  205. %ldconfig_scriptlets
  206. %files
  207. %doc README.html
  208. %license LICENSE
  209. %{_libdir}/libmozjs-%{major}.so.0*
  210. %files devel
  211. %{_bindir}/js%{major}
  212. %{_libdir}/libmozjs-%{major}.so
  213. %{_libdir}/pkgconfig/*.pc
  214. %{_includedir}/mozjs-%{major}/
  215. %changelog
  216. * Wed Feb 24 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 78.7.0-1
  217. - switched to mozjs-78.
  218. * Tue Aug 04 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 68.11.0-1
  219. - initial build for Vine Linux.
  220. - new upstream release.
  221. * Tue Jun 30 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.10.0-1
  222. - Update to 68.10.0
  223. * Tue Jun 02 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.9.0-1
  224. - Update to 68.9.0
  225. - Drop llvm and rust deps
  226. * Wed May 06 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.8.0-1
  227. - Update to 68.8.0
  228. * Tue Apr 07 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.7.0-1
  229. - Update to 68.7.0
  230. * Tue Mar 17 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.6.0-2
  231. - Rebuild with GCC 10
  232. - Nuke check_spidermonkey_style.py on s390x
  233. * Wed Mar 11 2020 Kalev Lember <klember@redhat.com> - 68.6.0-1
  234. - Update to 68.6.0
  235. * Mon Feb 10 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.5.0-1
  236. - Update to 68.5.0
  237. * Mon Feb 03 2020 Kalev Lember <klember@redhat.com> - 68.4.2-3
  238. - Build with --enable-unaligned-private-values
  239. * Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 68.4.2-2
  240. - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
  241. * Wed Jan 22 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.4.2-1
  242. - Update to 68.4.2
  243. * Tue Jan 07 2020 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.4.0-1
  244. - Update to 68.4.0
  245. * Sat Dec 07 2019 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.3.0-1
  246. - Update to 68.3.0
  247. * Wed Nov 20 2019 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.2.0-5
  248. - Don't enforce tests to pass on s390 and s390x again
  249. * Tue Nov 19 2019 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.2.0-4
  250. - Enable LTO
  251. - Enforce SpiderMonkey tests in check section on all architectures
  252. * Sun Nov 17 2019 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.2.0-3
  253. - Fix armv7 build
  254. * Thu Nov 14 2019 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.2.0-2
  255. - Fix s390x build
  256. - Exclude armv7 for now, see comment up in the spec
  257. * Mon Nov 04 2019 Frantisek Zatloukal <fzatlouk@redhat.com> - 68.2.0-1
  258. - Initial mozjs68 package based on mozjs60