%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}

Summary:        Foreign function interface library
Summary(ja):    Foreign function interface ライブラリ
Name:           libffi
Version:        3.4.6
Release:        1%{?_dist_release}
Group:          system
Vendor:         Project Vine
Distribution:   Vine Linux

License:        Distributable
URL:            http://sourceware.org/libffi/
Source0:        https://github.com/libffi/libffi/releases/download/v%{version}/%{name}-%{version}.tar.gz

BuildRequires:  gcc
BuildRequires:  texinfo
BuildRoot:      %{_tmppath}/%{name}-%{version}-root

%description
A foreign function interface is the popular name for the interface
that allows code written in one language to call code written in
another language. 

%description -l ja
Foreign function interface は一般に普及しているインターフェイスで、
ある言語で書かれたコードから、他の言語で書かれたコードを呼び出すこ
とを可能にします。

#-----------------------------------------------------------------------------

%package        devel
Summary:        Libraries and headers for %{name}
Summary(ja):    %{name} 用の開発ライブラリおよびヘッダファイル
Group:          programmming
Requires:       %{name} = %{version}-%{release}
Requires:       pkgconfig

%description devel
This package includes the files needed for developing and compiling
applications which use the ffi library.

You should install the libffi-devel package if you would like to
develop applications using libffi.

%description devel -l ja
このパッケージは ffi ライブラリを使用するアプリケーションを開発
するのに必要なライブラリやヘッダファイルを含んでいます。

libffi を使用したアプリケーションを開発するなら、このパッケージ
をインストールしてください。

#-----------------------------------------------------------------------------

%package        static
Summary:        Static libraries for %{name}
Summary(ja):    %{name} の静的ライブラリ
Group:          programmming
Requires:       %{name}-devel = %{version}-%{release}

%description static
This package includes the static library of libffi.

%description static -l ja
このパッケージは ffi ライブラリの静的ライブラリを含んでいます。

#-----------------------------------------------------------------------------

#compat32
%package -n     compat32-%{name}
Summary:        Foreign function interface library
Summary(ja):    Foreign function interface ライブラリ
Group:          system,legacy
Requires:       %{name} = %{version}

%description -n compat32-%{name}
A foreign function interface is the popular name for the interface
that allows code written in one language to call code written in
another language.

%description -n compat32-%{name} -l ja
Foreign function interface は一般に普及しているインターフェイスで、
ある言語で書かれたコードから、他の言語で書かれたコードを呼び出すこ
とを可能にします。

#-----------------------------------------------------------------------------

%package -n     compat32-%{name}-devel
Summary:        Libraries and headers for %{name}
Summary(ja):    %{name} 用の開発ライブラリおよびヘッダファイル
Group:          programming,legacy
Requires:       compat32-%{name} = %{version}
Requires:       %{name}-devel = %{version}

%description -n compat32-%{name}-devel
This package includes the files needed for developing and compiling
applications which use the ffi library.

You should install the libffi-devel package if you would like to
develop applications using libffi.

%description -n compat32-%{name}-devel -l ja
このパッケージは ffi ライブラリを使用するアプリケーションを開発
するのに必要なライブラリやヘッダファイルを含んでいます。

libffi を使用したアプリケーションを開発するなら、このパッケージ
をインストールしてください。

#-----------------------------------------------------------------------------


%prep
%setup -q
sed -i -e 's/{toolexeclibdir}/{libdir}/' libffi.pc.in


%build
autoreconf -ifv
%configure
%{__make}


%install
%{__rm} -rf ${RPM_BUILD_ROOT}
%{__make} install DESTDIR=${RPM_BUILD_ROOT}

# remove unnecessary files.
%{__rm} -rf ${RPM_BUILD_ROOT}/%{_libdir}/libffi.la
%{__rm} -rf ${RPM_BUILD_ROOT}/%{_infodir}/dir

%clean
%{__rm} -rf ${RPM_BUILD_ROOT}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig


%files
%defattr(-,root,root)
%license LICENSE
%doc ChangeLog* README*
%{_libdir}/libffi.so.*

%files devel
%defattr(-,root,root)
%{_libdir}/pkgconfig/*
%{_libdir}/libffi.so
%{_includedir}/*.h
%{_infodir}/libffi.info*
%{_mandir}/man3/*.3*

%files static
%defattr(-,root,root)
%{_libdir}/libffi.a

# compat32
%if %{build_compat32}
%files -n compat32-%{name}
%defattr(-,root,root)
%{_libdir}/libffi.so.*

%files -n compat32-%{name}-devel
%defattr(-,root,root)
%{_libdir}/libffi.so
%endif

%changelog
* Sat May 04 2024 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.4.6-1
- updated to 3.4.6.

* Wed Apr 15 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.3-1
- updated to 3.3.
- dropped Patch0.

* Tue Jan 02 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.2.1-1
- updated to 3.2.1.
- imported Patch0 from rawhide.

* Sun Jul 06 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.0.13-1
- update to 3.0.13

* Wed Aug 17 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.0.9-4
- create compat32 sub packages

* Fri Nov 26 2010 Shu KONNO <owa@bg.wakwak.com> 3.0.9-3
- fixed includedir in libffi.pc

* Tue Sep 21 2010 IWAI, Masaharu <iwai@alib.jp> 3.0.9-2
- build with rpm-4.8.1-1 for pkg-config file

* Tue Feb 23 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 3.0.9-1
- new upstream release
- built with new toolchain

* Wed Jan 21 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 3.0.8-1
- new upstream release
- spec in UTF-8

* Thu Apr 17 2008 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 3.0.5-1
- updated to new upstream release

* Wed Apr 02 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 3.0.4-1
- apply new versioning policy

* Sun Mar 02 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 3.0.4-0vl1
- initial build for Vine Linux