File mozjs24.spec of Package mozjs24

#
# spec file for package mozjs24
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#               2014 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:           mozjs24
Summary:        JavaScript interpreter
License:        MPL-2.0
Group:          System/Libraries
Version:        24.2.0
Release:        0
Url:            http://www.mozilla.org/js/
Source0:        http://ftp.mozilla.org/pub/mozilla.org/js/mozjs-24.2.0.tar.bz2
Source1:        baselibs.conf
Patch1:         mozjs-aarch64-support.patch
Patch2:         no_defined_array.patch
Patch3:         mozjs-support-48bit-va.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-24
Summary:        JavaScript library
Group:          System/Libraries

%description -n libmozjs-24
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-24 = %{version}-%{release}
Requires:       pkg-config

%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 mozjs-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -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 --enable-xterm-updates
%{__make} %{?_smp_mflags}

%install
cd js/src
%{makeinstall}
# Upstream does not honor --disable-static yet
%{__rm} -rf %{buildroot}%{_libdir}/libmozjs-24.a
# TODO: This is also statically linked
#rm -f %{buildroot}%{_bindir}/js24
# delete js-config since everything should use the pkg-config file
rm -f %{buildroot}%{_bindir}/js24-config
# headers are installed with executable permissions
find %{buildroot}%{_includedir}/mozjs-24/ -type f -print | xargs chmod 644
chmod 644 %{buildroot}%{_libdir}/pkgconfig/*

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

%post -n libmozjs-24 -p /sbin/ldconfig

%postun -n libmozjs-24 -p /sbin/ldconfig

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

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

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

%changelog
openSUSE Build Service is sponsored by