File v8.spec of Package v8

#
# spec file for package v8
#
# 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:           v8
Version:        3.12.19.1
Release:        0
Summary:        JavaScript Engine
License:        BSD-3-Clause
Group:          System/Libraries
Url:            http://code.google.com/p/v8
Source0:        %{name}.%{version}.tar.lzma
Patch0:         arm-use-hardfloat.diff
BuildRequires:  gcc-c++
BuildRequires:  lzma
BuildRequires:  python-devel
BuildRequires:  readline-devel
ExclusiveArch:  %{ix86} x86_64 %arm
%if 0%{?suse_version} < 1120
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%endif

%global somajor `echo %{version} | cut -f1 -d'.'`
%global sominor `echo %{version} | cut -f2 -d'.'`
%global sobuild `echo %{version} | cut -f3 -d'.'`
%global sover %{somajor}.%{sominor}.%{sobuild}

%ifarch i586
%global target ia32
%endif
%ifarch x86_64
%global target x64
%endif
%ifarch armv7l armv7hl
%global target arm
%endif

%description
V8 is Google's open source JavaScript engine. V8 is written in C++ and is used
in Google Chrome, the open source browser from Google. V8 implements ECMAScript
as specified in ECMA-262, 3rd edition.

%package -n libv8-3

Summary:        JavaScript Engine
Group:          Development/Libraries/Other
Obsoletes:      v8 < %{version}
Provides:       v8 = %{version}

%description -n libv8-3
Libraries for v8.

%package devel

Summary:        Development headers and libraries for v8
Group:          Development/Libraries/Other
Requires:       lib%{name}-3 = %{version}

%description devel
Development headers and libraries for v8.

%if 0%{?suse_version} > 1140 || 0%{?fedora_version}

%package private-headers-devel

Summary:        Private Development headers for v8
Group:          Development/Libraries/C and C++
Requires:       %{name}-devel = %{version}

%description private-headers-devel
Special Private Development headers for v8.
%endif

%prep
rm -rf %{name}
lzma -cd %{SOURCE0} | tar xf -

%setup -D -T -n %{name}
%patch0

%build

env=CCFLAGS:"-fPIC"
MAKE_EXTRA_FLAGS=""
%ifarch armv7hl
MAKE_EXTRA_FLAGS+=use_arm_eabi_hardfloat=true
%endif
make %{target}.release -j3 library=shared snapshots=on soname_version=%{somajor} $MAKE_EXTRA_FLAGS

%install
%if 0%{?suse_version} > 1140 || 0%{?fedora_version}
mkdir -p %{buildroot}%{_includedir}/v8/x64
%else
mkdir -p %{buildroot}%{_includedir}
%endif
mkdir -p %{buildroot}%{_libdir}
install -p include/*.h %{buildroot}%{_includedir}

%if 0%{?suse_version} > 1140 || 0%{?fedora_version}
install -p src/*.h %{buildroot}%{_includedir}/v8
install -p src/x64/*.h %{buildroot}%{_includedir}/v8/x64
%endif

install -p out/%{target}.release/lib.target/libv8.so* %{buildroot}%{_libdir}
mkdir -p %{buildroot}%{_bindir}
install -p -m0755 out/%{target}.release/d8 %{buildroot}%{_bindir}

cd %{buildroot}%{_libdir}
ln -sf libv8.so.%{somajor} libv8.so

chmod -x %{buildroot}%{_includedir}/v8*.h

%post -n libv8-3 -p /sbin/ldconfig

%postun -n libv8-3 -p /sbin/ldconfig

%files -n libv8-3
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog LICENSE
%{_bindir}/d8
%{_libdir}/*.so.*

%files devel
%defattr(-,root,root,-)
%{_includedir}/*.h
%{_libdir}/*.so

%if 0%{?suse_version} > 1140 || 0%{?fedora_version}

%files private-headers-devel
%defattr(644,root,root,-)
%{_includedir}/v8/
%endif

%changelog
openSUSE Build Service is sponsored by