SHA256
3
0
forked from pool/xz

Accepting request 1142678 from home:dspinella:branches:Base:System

- Build static library on SLE

OBS-URL: https://build.opensuse.org/request/show/1142678
OBS-URL: https://build.opensuse.org/package/show/Base:System/xz?expand=0&rev=143
This commit is contained in:
Danilo Spinella 2024-01-29 22:20:44 +00:00 committed by Git OBS Bridge
parent 7d3b6939e5
commit c5f484bb8b
2 changed files with 39 additions and 0 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Jan 29 21:36:02 UTC 2024 - Danilo Spinella <danilo.spinella@suse.com>
- Build static library on SLE
------------------------------------------------------------------- -------------------------------------------------------------------
Sun Jan 28 10:10:07 UTC 2024 - Dirk Müller <dmueller@suse.com> Sun Jan 28 10:10:07 UTC 2024 - Dirk Müller <dmueller@suse.com>

34
xz.spec
View File

@ -17,6 +17,11 @@
# avoid bootstrapping problem # avoid bootstrapping problem
%if 0%{?suse_version} == 1500
%bcond_without static
%else
%bcond_with static
%endif
%define _binary_payload w9.bzdio %define _binary_payload w9.bzdio
Name: xz Name: xz
Version: 5.4.6 Version: 5.4.6
@ -73,6 +78,17 @@ Obsoletes: lzma-alpha-devel < %{version}
This package contains the header files and libraries needed for This package contains the header files and libraries needed for
compiling programs using the LZMA library. 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 %prep
%autosetup %autosetup
@ -80,6 +96,15 @@ compiling programs using the LZMA library.
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects %global _lto_cflags %{_lto_cflags} -ffat-lto-objects
export CFLAGS="%{optflags} -D_REENTRANT -pipe -fPIE" export CFLAGS="%{optflags} -D_REENTRANT -pipe -fPIE"
export LDFLAGS="-Wl,-z,relro,-z,now -pie" 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 \ %configure \
--with-pic \ --with-pic \
--docdir=%{_docdir}/%{name} \ --docdir=%{_docdir}/%{name} \
@ -102,6 +127,9 @@ find %{buildroot} -type f -name "*.la" -delete -print
%find_lang %{name} --all-name --with-man %find_lang %{name} --all-name --with-man
install -Dpm 0755 %{SOURCE4} %{buildroot}%{_bindir}/xznew install -Dpm 0755 %{SOURCE4} %{buildroot}%{_bindir}/xznew
install -Dpm 0644 %{SOURCE5} %{buildroot}%{_mandir}/man1/xznew.1 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} rm -vf %{buildroot}%{_docdir}/%{name}/{COPYING,COPYING.GPLv2}
%post -n liblzma5 -p /sbin/ldconfig %post -n liblzma5 -p /sbin/ldconfig
@ -178,4 +206,10 @@ rm -vf %{buildroot}%{_docdir}/%{name}/{COPYING,COPYING.GPLv2}
%{_libdir}/liblzma.so %{_libdir}/liblzma.so
%{_libdir}/pkgconfig/liblzma.pc %{_libdir}/pkgconfig/liblzma.pc
%if %{with static}
%files static-devel
%defattr(-, root, root)
%{_libdir}/liblzma.a
%endif
%changelog %changelog