mozjs78/mozjs78.spec

217 lines
5.9 KiB
RPMSpec
Raw Permalink Normal View History

%define MAJver %(echo %version | cut -d. -f1)
%define majver %(echo %version | cut -d. -f1-2)
Name: mozjs78
Version: 78.8.0
Release: 2mamba
Summary: SpiderMonkey JavaScript library
Group: System/Libraries
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://www.mozilla.org
Source: https://ftp.mozilla.org/pub/firefox/releases/%{version}esr/source/firefox-%{version}esr.source.tar.xz
#Source: http://ftp.gnome.org/pub/gnome/teams/releng/tarballs-needing-help/mozjs/mozjs-%{version}gnome.tar.xz
#Source: http://ftp.mozilla.org/pub/mozilla.org/js/mozjs-%{version}.tar.bz2
Patch0: mozjs-68.4.2-fix-soname.patch
Patch1: mozjs-68.4.2-arm-Add-options-to-specify-Rust-target-name.patch
Patch2: mozjs78-78.8.0-arm-disable_emulate_arm_unaligned_fp_access.patch
Patch3: mozjs-68.4.2-gcc-10.0.patch
Patch4: mozjs78-78.8.0-init_patch.patch
Patch5: mozjs78-78.8.0-spidermonkey_checks_disable.patch
Patch6: mozjs78-78.8.0-fix-soname.patch
Patch7: mozjs78-78.8.0-copy-headers.patch
Patch8: mozjs78-78.8.0-emitter.patch
Patch9: mozjs78-78.8.0-arm-force-rust-target.patch
# Only GPL because linking to readline
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libatomic-devel
BuildRequires: libgcc
BuildRequires: libreadline-devel
BuildRequires: libstdc++6-devel
BuildRequires: libz-devel
## AUTOBUILDREQ-END
BuildRequires: pkg-config
BuildRequires: autoconf2.13
Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release}
Requires(post): %{__install_info}
Requires(preun): %{__install_info}
%description
SpiderMonkey JavaScript library.
%package -n lib%{name}
Group: System/Libraries
Summary: SpiderMonkey JavaScript library
%description -n lib%{name}
SpiderMonkey JavaScript library.
%package -n lib%{name}-devel
Group: Development/Libraries
Summary: Development files for %{name}
Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release}
Requires: pkg-config
%description -n lib%{name}-devel
This package contains libraries and header files for developing applications that use %{name}.
%debug_package
%prep
%setup -q -c
#-D -T
#:<< _EOF
cd firefox-%{version}
%ifarch arm
%patch2 -p1
%endif
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%build
#:<< _EOF
cd firefox-%{version}/js/src
# From Fedora
# Prefer GCC for now
export CC=gcc
export CXX=g++
# Workaround
# error: options `-C embed-bitcode=no` and `-C lto` are incompatible
# error: could not compile `jsrust`
# https://github.com/japaric/cargo-call-stack/issues/25
export RUSTFLAGS="-C embed-bitcode"
# build_with_lto
# https://github.com/ptomato/mozjs/commit/36bb7982b41e0ef9a65f7174252ab996cd6777bd
export CARGO_PROFILE_RELEASE_LTO=true
export CFLAGS="%{optflags}"
export CXXFLAGS="$CFLAGS"
export LINKFLAGS="%{?__global_ldflags}"
export PYTHON="%{__python3}"
autoconf-2.13
%configure \
%ifarch %{ix86}
--host=i686-pc-linux-gnu \
--build=i686-pc-linux-gnu \
%endif
--without-system-icu \
--with-system-zlib \
--disable-tests \
--disable-strip \
--with-intl-api \
--enable-readline \
--enable-shared-js \
--enable-optimize \
--disable-debug \
--enable-pie \
--disable-jemalloc
%make
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
cd firefox-%{version}/js/src
%makeinstall
# Fix permissions
chmod -x %{buildroot}%{_libdir}/pkgconfig/*.pc
# Avoid multilib conflicts
case `uname -m` in
i386 | arm | ppc | s390 | sparc )
wordsize="32"
;;
x86_64 | aarch64 | ppc64 | s390x | sparc64 )
wordsize="64"
;;
*)
wordsize=""
;;
esac
if test -n "$wordsize"
then
mv %{buildroot}%{_includedir}/mozjs-%{MAJver}/js-config.h \
%{buildroot}%{_includedir}/mozjs-%{MAJver}/js-config-$wordsize.h
cat >%{buildroot}%{_includedir}/mozjs-%{MAJver}/js-config.h <<EOF
#ifndef JS_CONFIG_H_MULTILIB
#define JS_CONFIG_H_MULTILIB
#include <bits/wordsize.h>
#if __WORDSIZE == 32
# include "js-config-32.h"
#elif __WORDSIZE == 64
# include "js-config-64.h"
#else
# error "unexpected value for __WORDSIZE macro"
#endif
#endif
EOF
fi
# Remove unneeded files
rm %{buildroot}%{_bindir}/js%{MAJver}-config
rm %{buildroot}%{_libdir}/libjs_static.ajs
# Rename library and create symlinks, following fix-soname.patch
mv %{buildroot}%{_libdir}/libmozjs-%{MAJver}.so \
%{buildroot}%{_libdir}/libmozjs-%{MAJver}.so.0.0.0
ln -s libmozjs-%{MAJver}.so.0.0.0 %{buildroot}%{_libdir}/libmozjs-%{MAJver}.so.0
ln -s libmozjs-%{MAJver}.so.0 %{buildroot}%{_libdir}/libmozjs-%{MAJver}.so
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%post -n lib%{name} -p /sbin/ldconfig
%postun -n lib%{name} -p /sbin/ldconfig
%files -n lib%{name}
%defattr(-,root,root)
%{_libdir}/libmozjs-%{MAJver}.so.*
%doc firefox-%{version}/LICENSE
%files -n lib%{name}-devel
%defattr(-,root,root)
%{_bindir}/js%{MAJver}
#%{_bindir}/js%{MAJver}-config
%dir %{_includedir}/mozjs-%{MAJver}/
%{_includedir}/mozjs-%{MAJver}/*
%{_libdir}/libmozjs-%{MAJver}.so
%{_libdir}/pkgconfig/mozjs-%{MAJver}.pc
%changelog
* Tue Mar 16 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 78.8.0-2mamba
- fix broken shared library symlinks
* Mon Mar 15 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 78.8.0-1mamba
- update to 78.8.0
* Sun Mar 22 2020 Silvan Calarco <silvan.calarco@mambasoft.it> 68.4.2-1mamba
- update to 68.4.2
* Sat Jul 06 2019 Silvan Calarco <silvan.calarco@mambasoft.it> 60.1.0-1mamba
- update to 60.1.0
* Tue Dec 11 2018 Silvan Calarco <silvan.calarco@mambasoft.it> 52.6.0-1mamba
- update to 52.6.0
* Mon Dec 10 2018 Silvan Calarco <silvan.calarco@mambasoft.it> 52.2.1-2mamba
- arm: rebuilt
* Mon Aug 13 2018 Silvan Calarco <silvan.calarco@mambasoft.it> 52.2.1-1mamba
- update to 52.2.1
* Thu Jun 19 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 24.2.0-1mamba
- package created from mozjs185