File ffcall.spec of Package ffcall

#
# spec file for package ffcall
#
# Copyright (c) 2013 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/
#


# Only a static library is provided, so no debug information can be extracted.
%global debug_package %{nil}

# This package uses assembly to do its work.  This is the entire list of
# supported architectures understood by RPM, even those not currently supported
# by Fedora.  RPM hasn't heard about line continuations, hence the mess.
%global ffcall_arches %ix86 x86_64 %alpha %arm parisc hppa1.0 hppa1.1 hppa1.2 hppa2.0 ia64 m68k mips mipsel ppc ppc64 ppc8260 ppc8560 ppc32dy4 ppciseries ppcpseries s390 s390x %sparc

Name:           ffcall
Version:        1.10
Release:        cvs20100619
Summary:        Libraries for foreign function call interfaces
License:        GPL-2.0+
Group:          Development/Libraries/Other
# As this package only provides a static library together with the header files
Provides:       %{name}-devel = %version-%release
Url:            http://www.gnu.org/software/libffcall/
#
# There has been no official release for several years, and the project web
# site encourages use of a CVS snapshot.  Make the tarball as follows:
#   cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/libffcall 
#       export -D 2012-04-24 ffcall
#   tar cJf ffcall-20120424cvs.tar.xz ffcall
#
Source0:        ffcall-1.10+cvs20100619.tar.gz
# PATCH-EXTEND-UPSTREAM --
# This patch will not be sent upstream.  It removes the possibility of using
# mprotect() to make memory executable, as that runs afoul of SELinux.
Patch0:         %{name}-trampoline.patch
# PATCH-FIX-OPENSUSE -- There is no <asm/cachectl.h>
Patch1:         %{name}-asm_cachectl.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  %{ffcall_arches}

%description
This is a collection of four libraries which can be used to build
foreign function call interfaces in embedded interpreters.  The four
packages are:
 - avcall: calling C functions with variable arguments
 - vacall: C functions accepting variable argument prototypes
 - trampoline: closures as first-class C functions
 - callback: closures with variable arguments as first-class C functions
   (a reentrant combination of vacall and trampoline)


%prep
%setup -q -n ffcall
%patch0
%patch1

# Remove prebuilt object files
find . -name \*.o | xargs rm -f

%build
export CFLAGS="$RPM_OPT_FLAGS -fPIC -DMAP_VARIABLE=MAP_PRIVATE"
%configure
make # %{?_smp_mflags}

%install
mkdir -p %{buildroot}%{_libdir}
mkdir -p %{buildroot}%{_mandir}
make install DESTDIR=%{buildroot}
rm -fr %{buildroot}%{_datadir}/html
rm -f %{buildroot}%{_libdir}/*.la
cd %{buildroot}%{_mandir}/man3

# Advertise supported architectures
mkdir -p %{buildroot}%{_sysconfdir}/rpm
cat > %{buildroot}%{_sysconfdir}/rpm/macros.ffcall << EOF
# arches that ffcall supports
%%ffcall_arches %{ffcall_arches}
EOF

# Fix man pages with overly generic names (bz 800360)
for page in *; do
  mv $page %{name}-$page
done

%files
%defattr(-,root,root,-)
%doc README NEWS COPYING
%doc avcall/avcall.html
%doc callback/callback.html
%doc callback/trampoline_r/trampoline_r.html
%doc trampoline/trampoline.html
%doc vacall/vacall.html
%{_libdir}/*.a
%{_includedir}/*
%doc %{_mandir}/man*/*
%config %{_sysconfdir}/rpm/macros.%{name}

%changelog
openSUSE Build Service is sponsored by