Blob Blame History Raw
# 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 amd64 %{alpha} %{arm} parisc hppa1.0 hppa1.1 hppa1.2 hppa2.0 ia64 m68k %{mips32} ppc ppc8260 ppc8560 ppc32dy4 ppciseries ppcpseries %{power64} s390 s390x %{sparc}

Name:           ffcall
Version:        1.13
Release:        2%{?dist}
Summary:        Libraries for foreign function call interfaces

License:        GPLv2+
URL:            http://www.gnu.org/software/libffcall/
# Upstream no longer provides tarballs.  To generate the tarball:
#   git clone git://git.savannah.gnu.org/libffcall.git
#   cd libffcall
#   git reset --hard 0455e86c9c24f7bc2bd7ed036b5815223254a965
#   rm -fr .git*
#   cd ..
#   tar cJf ffcall-%%{version}.tar.xz libfcall
Source0:        %{name}-%{version}.tar.xz
# Fix multiple errors in the 32-bit x86 assembly syntax conversion
Patch0:         %{name}-i386.patch

BuildRequires:  gcc
BuildRequires:  gnulib-devel
BuildRequires:  libtool

Provides:       %{name}-static = %{version}-%{release}

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 libffcall
%patch0

# Preserve timestamps
for fil in $(find . -name Makefile\*); do
  sed -i 's/^[[:blank:]]*cp[[:blank:]]/&-p /' $fil
done

# Upstream does not ship a configure script, and autogen.sh wants to download
make -f Makefile.maint \
         gnulib-clean glm4/gnulib-cache.m4 gnulib-imported-files \
         GNULIB_TOOL="%{_bindir}/gnulib-tool"
make -C callback/vacall_r -f Makefile.maint copied-files
make -C callback/trampoline_r -f Makefile.maint copied-files
make -f Makefile.maint totally-clean
autoreconf -fi -I $PWD/m4 -I $PWD/glm4

# Throw away OS X code that causes a syntax error on Linux
sed -i '\%/EH_FRAME_SECTION%,/EOF/d;/Likewise/aEOF' common/asm-x86_64.sh

# On ARM, the script throws away .file directives, but not .loc directives,
# leading to a compilation error.  Keep both for better debuginfo.
sed -i '/\.file/d' common/asm-arm.sh

# We are not AIX.  We are Linux.
sed -i 's, $(srcdir)/avcall-powerpc64-aix\.s,,' avcall/Makefile.in
sed -i 's, $(srcdir)/vacall-powerpc64-aix\.s,,' vacall/Makefile.in
sed -i 's, $(srcdir)/vacall-powerpc64-aix\.s,,' callback/vacall_r/Makefile.in

# Endianness comparisons always fail, but we don't care because we only want to
# build for the host architecture.
sed -i '/^\([[:blank:]]*\)cmp[[:blank:]]/d' avcall/Makefile.devel \
  vacall/Makefile.devel callback/vacall_r/Makefile.devel

# We are not really cross-compiling, even though the Makefile thinks so
cat > cross << EOF
#!/bin/sh
shift 2
if [ "\$1" = "-V" ]; then
  shift 2
fi
gcc $CFLAGS \$@
EOF
chmod a+x cross

%build
# Use our fake cross-compilation script
PATH=$PATH:$PWD
export CFLAGS="$RPM_OPT_FLAGS -fPIC"
%ifarch %{arm}
CFLAGS="$CFLAGS -fno-strict-aliasing"
%endif
%configure

# Find out what ffcall thinks the arch name is
FFARCH=$(sed -n "s/HOST_CPU_C_ABI='\(.*\)'/\1/p" config.log)

%ifarch %{ix86}
make -f Makefile.maint common/asm-i386.h
%endif

# Construct files needed for the build; failure is not necessarily fatal
make -C avcall -f Makefile.devel avcall-$FFARCH-linux.s || :
make -C avcall -f Makefile.devel avcall-$FFARCH-macro.S || :
make -C vacall -f Makefile.devel vacall-$FFARCH-linux.s || :
make -C vacall -f Makefile.devel vacall-$FFARCH-macro.S || :
make -C callback/vacall_r -f Makefile.devel vacall-$FFARCH-linux.s || :
make -C callback/vacall_r -f Makefile.devel vacall-$FFARCH-macro.S || :

# Build the actual library
make # %{?_smp_mflags}

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

# Advertise supported architectures
mkdir -p $RPM_BUILD_ROOT%{_rpmconfigdir}/macros.d
cat > $RPM_BUILD_ROOT%{_rpmconfigdir}/macros.d/macros.%{name} << 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
%license COPYING
%doc README NEWS
%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}/*
%{_mandir}/man*/*
%{_rpmconfigdir}/macros.d/macros.%{name}


%changelog
* Fri Feb 24 2017 Jerry James <loganjerry@gmail.com> - 1.13-2
- Fix missing symbols in the i386 build

* Fri Feb 24 2017 Jerry James <loganjerry@gmail.com> - 1.13-1
- New upstream release

* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.12-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.12-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Sep 29 2015 Jerry James <loganjerry@gmail.com> - 1.12-1
- New upstream release

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.10-18.20120424cvs
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Fri Feb 13 2015 Jerry James <loganjerry@gmail.com> - 1.10-17.20120424cvs
- Use license macro

* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.10-16.20120424cvs
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.10-15.20120424cvs
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Mon Feb  3 2014 Jerry James <loganjerry@gmail.com> - 1.10-14.20120424cvs
- Update location of rpm macro file for rpm >= 4.11

* Fri Sep  6 2013 Jerry James <loganjerry@gmail.com> - 1.10-13.20120424cvs
- Update -arm patch to really use the EABI and hopefully fix clisp

* Wed Sep  4 2013 Jerry James <loganjerry@gmail.com> - 1.10-12.20120424cvs
- Add -arm patch to fix clisp build failure

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.10-11.20120424cvs
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Wed Mar 27 2013 Jerry James <loganjerry@gmail.com> - 1.10-10.20120424cvs
- Update to CVS 20120424
- List all architectures supported by this package (bz 925335)
- Rename man pages to avoid conflicts (bz 800360)
- Add Provides: ffcall-static

* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.10-9.20100903cvs
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.10-8.20100903cvs
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Tue Jan 10 2012 Jerry James <loganjerry@gmail.com> - 1.10-7.20100903cvs
- Clean out prebuilt object files
- Add trampoline patch to force use of mmap() to get executable memory

* Mon Jan  9 2012 Jerry James <loganjerry@gmail.com> - 1.10-6.20100903cvs
- Update to CVS 20100903
- Minor spec file cleanups

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.10-5.20080704cvs.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.10-4.20080704cvs.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.10-3.20080704cvs.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Wed Dec 10 2008 Jochen Schmitt <Jochen herr-schmitt de> - 1.10-2.20080704cvs.1
- Fix -FPIC issue (BZ #475112)

* Fri Jul  4 2008 Gerard Milmeister <gemi@bluewin.ch> - 1.10-2.20080704cvs
- update to cvs 20080704
- support for ppc64

* Mon Feb 25 2008 Gerard Milmeister <gemi@bluewin.ch> - 1.10-1
- first Fedora release