##
##  v8b47.spec -- OpenPKG RPM Package Specification
##  Copyright (c) 2000-2025 OpenPKG Project <http://openpkg.org/>
##
##  Permission to use, copy, modify, and distribute this software for
##  any purpose with or without fee is hereby granted, provided that
##  the above copyright notice and this permission notice appear in all
##  copies.
##
##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
##  SUCH DAMAGE.
##

#   package version
%define       V_opkg   4.7.80.32
%define       V_branch 4.7
%define       V_comp   47

#   package information
Name:         v8b47
Summary:      V8 JavaScript Engine (Branch %{V_branch})
URL:          http://code.google.com/p/v8/
Vendor:       Google Inc.
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        EVAL
Group:        Language
License:      BSD
Version:      %{V_opkg}
Release:      20160119

#   list of sources
Source0:      https://github.com/v8/v8-git-mirror/archive/%{V_opkg}.tar.gz
Patch0:       v8b47.patch

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101, gcc, gcc::with_cxx = yes, gyp
PreReq:       OpenPKG, openpkg >= 20160101
BuildPreReq:  libexecinfo
PreReq:       libexecinfo

%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, 5th edition, and
    runs on all major platform that use IA32, x64 or ARM processors. V8
    can run standalone, or can be embedded into any C++ application.

%track
    prog v8b47 = {
        version   = %{V_opkg}
        url       = https://github.com/v8/v8-git-mirror/releases
        regex     = v8-(%{V_branch}\.\d+)\.tar\.gz
    }

%prep
    %setup -q -n v8-%{version}
    %patch -p0

%build
    %{l_shtool} subst -e 's;build/gyp/gyp;gyp;g' Makefile
    CC="%{l_cc} %{l_cflags -O} -I`pwd` %{l_cppflags}" \
    CXX="%{l_cxx} %{l_cxxflags -O} -I`pwd` %{l_cppflags}" \
    %{l_make} %{l_mflags} \
        native \
        snapshot=off \
        werror=no \
        component=static_library \
        strictaliasing=off \
        i18nsupport=off \
        vfp3=off

%install
    %{l_shtool} mkdir -f -p -m 755 \
        $RPM_BUILD_ROOT%{l_prefix}/bin \
        $RPM_BUILD_ROOT%{l_prefix}/include/v8b%{V_comp} \
        $RPM_BUILD_ROOT%{l_prefix}/lib/v8b%{V_comp}
    %{l_shtool} install -c -s -m 755 \
        out/native/d8 $RPM_BUILD_ROOT%{l_prefix}/bin/d8b%{V_comp}
    %{l_shtool} install -c -m 644 \
        include/*.h $RPM_BUILD_ROOT%{l_prefix}/include/v8b%{V_comp}
    %{l_shtool} install -c -m 644 \
        out/native/obj.target/tools/gyp/libv8_base*.a \
        $RPM_BUILD_ROOT%{l_prefix}/lib/v8b%{V_comp}/libv8.a
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean

