File duktape.spec of Package duktape

# spec file for package duktape
# Copyright (c) 2018 SUSE LINUX 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

%define sover 201
Name:           duktape
Version:        2.3.0
Release:        0
Summary:        Embeddable Javascript engine
License:        MIT
Group:          Development/Libraries/C and C++
BuildRequires:  gcc
BuildRequires:  pkgconfig

Duktape is an embeddable Javascript engine, with a focus on portability and
compact footprint.

%package -n     lib%{name}%{sover}
Summary:        The core library for %{name}
Group:          System/Libraries

%description -n lib%{name}%{sover}
Embeddable Javascript engine.

This package contains the shared library.

%package        devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       lib%{name}%{sover} = %{version}

%description    devel
Embeddable Javascript engine.

This package contains header files and libraries needed to develop
application that use %{name}.

%setup -q

sed -e's|@prefix@|%{_prefix}|' \
    -e's|@libdir@|%{_lib}|' \
    -e's|@PACKAGE_VERSION@|%{version}|' \
    < %{SOURCE1} > %{name}

sed -e '/^INSTALL_PREFIX/s|[^=]*$|%{_prefix}|' \
    -e 's/\(-o.*\)/%{optflags} \1/' \
   	-e '/install\:/a\\tinstall -d $(DESTDIR)$(INSTALL_PREFIX)/%{_lib}\n\tinstall -d $(DESTDIR)$(INSTALL_PREFIX)/include' \
    -e 's/\(\$.INSTALL_PREFIX.\)/$(DESTDIR)\1/' \
    -e 's/\/lib\b/\/%{_lib}/g' \
     < Makefile.sharedlibrary > Makefile
make -j1


install -Dm0644 %{name} %{buildroot}%{_libdir}/pkgconfig/%{name}.pc

%post   -n lib%{name}%{sover} -p /sbin/ldconfig
%postun -n lib%{name}%{sover} -p /sbin/ldconfig

%files -n lib%{name}%{sover}
%doc AUTHORS.rst LICENSE.txt

%files devel