File mozjs17.spec of Package mozjs17

#
# spec file for package mozjs17
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#               2013 Wolfgang Rosenauer
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           mozjs17
Summary:        JavaScript interpreter
License:        MPL-2.0 and GPL-2.0+
Group:          System/Libraries
Version:        17.0
Release:        0
Url:            http://www.mozilla.org/js/
Source0:        http://ftp.mozilla.org/pub/mozilla.org/js/mozjs17.0.0.tar.gz
Source1:        baselibs.conf
#PATCH-FIX-UPSTREAM bmo#618485  64-bit big-endian jsval_layout is not defined, compile fails
Patch0:         mozjs-bmo618485-nojsuword.patch
# PATCH-FIX-UPSTREAM add support for aarch64
Patch1:         mozjs-aarch64-support.patch
Patch2:         mozjs-ppc64le-support.patch
Patch3:         mozbug746112-no-decommit-on-large-pages.patch
Patch4:         no_defined_array.patch
Patch5:         aarch64-64k-page.patch
Patch6:         mozjs-support-48bit-va.patch
Patch7:         gcc7-fix-warning.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  autoconf213
BuildRequires:  gcc-c++
BuildRequires:  mozilla-nspr-devel
BuildRequires:  pkg-config
BuildRequires:  python
BuildRequires:  readline-devel
BuildRequires:  zip

%description
JavaScript is the Netscape-developed object scripting language used in millions
of web pages and server applications worldwide. Netscape's JavaScript is a
superset of the ECMA-262 Edition 3 (ECMAScript) standard scripting language,
with only mild differences from the published standard.

%package -n libmozjs-17_0
Summary:        JavaScript library
Group:          System/Libraries

%description -n libmozjs-17_0
JavaScript is the Netscape-developed object scripting language used in millions
of web pages and server applications worldwide. Netscape's JavaScript is a
superset of the ECMA-262 Edition 3 (ECMAScript) standard scripting language,
with only mild differences from the published standard.

%package devel
Summary:        Header files, libraries and development documentation for %{name}
Group:          Development/Libraries/Other
Requires:       libmozjs-17_0 = %{version}-%{release}
Requires:       pkg-config
Provides:       mozjs17-devel = %{version}-%{release}

%description devel
This package contains the header files, static libraries and development
documentation for %{name}. If you like to develop programs using %{name},
you will need to install %{name}-devel.

%prep
%setup -q -n mozjs17.0.0
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1

%build
# no need to add build time to binaries
modified="$(sed -n '/^----/n;s/ - .*$//;p;q' "%{_sourcedir}/%{name}.changes")"
DATE="\"$(date -d "${modified}" "+%%b %%e %%Y")\""
TIME="\"$(date -d "${modified}" "+%%R")\""
find . -regex ".*\.c\|.*\.cpp\|.*\.h" -exec sed -i "s/__DATE__/${DATE}/g;s/__TIME__/${TIME}/g" {} +
#
cd js/src
%configure --disable-static --with-system-nspr --enable-threadsafe --enable-readline
%{__make} %{?_smp_mflags}

%install
cd js/src
%{makeinstall}
# Upstream does not honor --disable-static yet
%{__rm} -rf %{buildroot}%{_libdir}/libmozjs-17.0.a
# This is also statically linked; once that is fixed that we could
# consider shipping it.
rm -f %{buildroot}%{_bindir}/js17
# delete js-config since everything should use the pkg-config file
rm -f %{buildroot}%{_bindir}/js17-config
# headers are installed with executable permissions
find %{buildroot}%{_includedir}/js-17.0/ -type f -print | xargs chmod 644
chmod 644 %{buildroot}%{_libdir}/pkgconfig/*

%clean
%{__rm} -rf %{buildroot}

%post -n libmozjs-17_0 -p /sbin/ldconfig

%postun -n libmozjs-17_0 -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc js/src/README.html
#%{_bindir}/js17

%files -n libmozjs-17_0
%defattr(-,root,root,-)
%{_libdir}/*.so

%files devel
%defattr(-,root,root,-)
%{_libdir}/pkgconfig/*.pc
%{_includedir}/js-17.0

%changelog