Summary: An unwinding library
Name: libunwind
Version: 1.8.1
Release: 1%{?_dist_release}
Group: system
Vendor: Project Vine
Distribution: Vine Linux

License: BSD
URL: https://savannah.nongnu.org/projects/libunwind
Source: https://github.com/libunwind/libunwind/releases/download/v%{version}/%{name}-%{version}.tar.gz

BuildRoot: %{_tmppath}/%{name}-%{version}-root
ExclusiveArch: %{ix86} x86_64 ia64
BuildRequires: pkgconfig(zlib)

# host != target would cause REMOTE_ONLY build even if building i386 on x86_64.
%global _host %{_target_platform}

%description
Libunwind provides a C ABI to determine the call-chain of a program.


%package devel
Summary: Development package for libunwind
Group: programming
Requires: libunwind = %{version}-%{release}

%description devel
The libunwind-devel package includes the libraries and header files for
libunwind.


%debug_package


%prep
%autosetup -p1


%build
%global optflags %{optflags} -fcommon
autoreconf -fiv
%configure \
	--enable-static \
	--enable-shared \
	--enable-setjmp=no \
%if 0%{?_with_check:1} || 0%{?_with_testsuite:1}
	--enable-tests \
%else
	--disable-tests \
%endif
	%{nil}
%make_build


%install
%make_install

find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'

# [...] aren't really part of the libunwind API.  They are implemented in
# a archive library called libunwind-ptrace.a.
mv -f $RPM_BUILD_ROOT%{_libdir}/libunwind-ptrace.a $RPM_BUILD_ROOT%{_libdir}/libunwind-ptrace.a-save
rm -f $RPM_BUILD_ROOT%{_libdir}/libunwind*.a
mv -f $RPM_BUILD_ROOT%{_libdir}/libunwind-ptrace.a-save $RPM_BUILD_ROOT%{_libdir}/libunwind-ptrace.a
rm -f $RPM_BUILD_ROOT%{_libdir}/libunwind-ptrace*.so*


%if 0%{?_with_check:1} || 0%{?_with_testsuite:1}
%check
echo ====================TESTING=========================
make check || true
echo ====================TESTING END=====================
%else
echo ====================TESTSUITE DISABLED=========================
%endif


%files
%defattr(-,root,root)
%license COPYING
%doc README* NEWS
%{_libdir}/*.so.*

%files devel
%defattr(-,root,root)
%{_libdir}/*.so
%{_libdir}/*.a
%{_libdir}/pkgconfig/*.pc
# <unwind.h> does not get installed for REMOTE_ONLY targets - check it.
%{_includedir}/unwind.h
%{_includedir}/libunwind*.h


%changelog
* Sat Jul 13 2024 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.8.1-1
- new upstream release.

* Tue Sep 13 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.6.2-1
- new upstream release.
- dropped ldconfig scriptlets.

* Thu Feb 18 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.5.0-1
- new upstream release.

* Sun Feb 18 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.2.1-1
- new upstream release.
- dropped all patches.

* Wed Oct 24 2012 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.1-1
- update to 1.0.1

* Tue Dec  2 2008 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 0.98.6-2
- ExclusiveArch set to %%{ix86} x86_64 ia64

* Fri Nov 07 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 0.98.6-1
- new upstream release
- remove static libs

* Fri Oct 03 2008 Shu KONNO <owa@bg.wakwak.com> 0.98.5-1vl5
- applied new versioning policy

* Sat Jun 09 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 0.98.5
- initial build for Vine Linux