diff --git a/xz.changes b/xz.changes index fea96e3..b02f56a 100644 --- a/xz.changes +++ b/xz.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Jan 29 21:36:02 UTC 2024 - Danilo Spinella + +- Build static library on SLE + ------------------------------------------------------------------- Sun Jan 28 10:10:07 UTC 2024 - Dirk Müller diff --git a/xz.spec b/xz.spec index ac859c0..d190312 100644 --- a/xz.spec +++ b/xz.spec @@ -17,6 +17,11 @@ # avoid bootstrapping problem +%if 0%{?suse_version} == 1500 +%bcond_without static +%else +%bcond_with static +%endif %define _binary_payload w9.bzdio Name: xz Version: 5.4.6 @@ -73,6 +78,17 @@ Obsoletes: lzma-alpha-devel < %{version} This package contains the header files and libraries needed for compiling programs using the LZMA library. +%if %{with static} +%package static-devel +Summary: Static version of LZMA library +License: SUSE-Public-Domain +Group: Development/Libraries/C and C++ +Requires: lzma-devel = %{version} + +%description static-devel +Static library for the LZMA library +%endif + %prep %autosetup @@ -80,6 +96,15 @@ compiling programs using the LZMA library. %global _lto_cflags %{_lto_cflags} -ffat-lto-objects export CFLAGS="%{optflags} -D_REENTRANT -pipe -fPIE" export LDFLAGS="-Wl,-z,relro,-z,now -pie" +# Either we build it without pic enabled, or we build one at a time +%if %{with static} +%configure \ + --with-pic \ + --docdir=%{_docdir}/%{name} \ + --disable-shared CONFIG_SHELL=/bin/sh +%make_build +cp ./src/liblzma/.libs/liblzma.a liblzma.a +%endif %configure \ --with-pic \ --docdir=%{_docdir}/%{name} \ @@ -102,6 +127,9 @@ find %{buildroot} -type f -name "*.la" -delete -print %find_lang %{name} --all-name --with-man install -Dpm 0755 %{SOURCE4} %{buildroot}%{_bindir}/xznew install -Dpm 0644 %{SOURCE5} %{buildroot}%{_mandir}/man1/xznew.1 +%if %{with static} +install -Dpm 0644 liblzma.a %{buildroot}%{_libdir}/ +%endif rm -vf %{buildroot}%{_docdir}/%{name}/{COPYING,COPYING.GPLv2} %post -n liblzma5 -p /sbin/ldconfig @@ -178,4 +206,10 @@ rm -vf %{buildroot}%{_docdir}/%{name}/{COPYING,COPYING.GPLv2} %{_libdir}/liblzma.so %{_libdir}/pkgconfig/liblzma.pc +%if %{with static} +%files static-devel +%defattr(-, root, root) +%{_libdir}/liblzma.a +%endif + %changelog