File js.spec of Package js

#
# spec file for package js
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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:           js
Summary:        JavaScript interpreter
License:        MPL-1.1 or GPL-2.0+ or LGPL-2.1+
Group:          Development/Languages/Other
Version:        1.8.5
Release:        0
Url:            http://www.mozilla.org/js/
Source0:        http://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.bz2
Patch0:         js-64bitbigendian.patch 
Patch1:         js-filter.patch
Patch2:         do-not-enforce-wrong-arm-flags.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  autoconf213
BuildRequires:  gcc-c++
BuildRequires:  mozilla-nspr-devel
BuildRequires:  pkg-config
BuildRequires:  python
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 libmozjs185-1_0
Summary:        JavaScript library
Group:          System/Libraries

%description -n libmozjs185-1_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:       libmozjs185-1_0 = %{version}-%{release}
Requires:       pkg-config
Provides:       libjs-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 %{name}-%{version}
%patch0 -p1
%patch1
%patch2

%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" {} +
#
export SUSE_ASNEEDED=0
export MOZILLA_VERSION=%{version}
cd js
pushd src
%configure --with-system-nspr --enable-threadsafe
popd
export BUILD_OPT=1
%{__make} %{?_smp_mflags} -C src \
	JS_THREADSAFE="1" \
	XCFLAGS="%{optflags} -fPIC " \
	BUILD_OPT="1" \

%install
cd js/src
%{makeinstall}
%{__rm} -rf %{buildroot}%{_libdir}/libmozjs185-1.0.a
# SO links are created wrong, fixing them
%{__rm} -rf %{buildroot}%{_libdir}/libmozjs185.so.1.0
%{__rm} -rf %{buildroot}%{_libdir}/libmozjs185.so
%{__ln_s} libmozjs185.so.1.0.0 %{buildroot}%{_libdir}/libmozjs185.so.1.0
%{__ln_s} libmozjs185.so.1.0.0 %{buildroot}%{_libdir}/libmozjs185.so
# JS shell
%{__install} -m 0755 shell/js %{buildroot}%{_bindir}/
# headers are installed with executable permissions
chmod 644 %{buildroot}%{_includedir}/js/*

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

%post -n libmozjs185-1_0 -p /sbin/ldconfig

%postun -n libmozjs185-1_0 -p /sbin/ldconfig

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

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

%files devel
%defattr(-,root,root,-)
#%{_bindir}/jscpucfg
%{_bindir}/js-config
%{_libdir}/pkgconfig/*.pc
%{_libdir}/*.so
%{_includedir}/js/

%changelog
openSUSE Build Service is sponsored by