[packages/lz4] install shared/static lib

glen glen at pld-linux.org
Sun Oct 6 18:49:34 CEST 2013


commit e2b4d9252bf37f38b7ebc3000d9a4a471b2891c4
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Sun Oct 6 19:48:38 2013 +0300

    install shared/static lib

 lz4.spec | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 57 insertions(+), 12 deletions(-)
---
diff --git a/lz4.spec b/lz4.spec
index 548f4a7..7c35785 100644
--- a/lz4.spec
+++ b/lz4.spec
@@ -1,4 +1,4 @@
-%define		rel	0.1
+%define		rel	1
 %define		svnrev	106
 Summary:	Hash-based Predictive Lempel-Ziv compressor
 Name:		lz4
@@ -9,6 +9,7 @@ Group:		Libraries
 Source0:	https://dl.dropboxusercontent.com/u/59565338/LZ4/%{name}-r%{svnrev}.tar.gz
 # Source0-md5:	4d071aaecd42dd383dd58c5a7577663b
 URL:		http://fastcompression.blogspot.com/p/lz4.html
+BuildRequires:	cmake
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -29,33 +30,77 @@ text files.
 This subpackage contains libraries and header files for developing
 applications that want to make use of liblz4.
 
+%package static
+Summary:	Static %{name} library
+Summary(pl.UTF-8):	Statyczna biblioteka %{name}
+Group:		Development/Libraries
+Requires:	%{name}-devel = %{version}-%{release}
+
+%description static
+Static %{name} library.
+
+%description static -l pl.UTF-8
+Statyczna biblioteka %{name}.
+
 %prep
 %setup -qn %{name}-r%{svnrev}
-%{__sed} -i -e 's,CFLAGS=,CFLAGS=$(OPTFLAGS) ,' Makefile
 
 %build
-%{__make} \
-	CC="%{__cc}" \
-	OPTFLAGS="%{rpmcflags}"
+cd cmake
+%cmake \
+	-DBUILD_SHARED_LIBS=TRUE \
+	.
+
+%{__make}
 
 %install
 rm -rf $RPM_BUILD_ROOT
-%{__make} install \
-	PREFIX=$RPM_BUILD_ROOT%{_prefix}
+# all available build systems suck in some way:
+# 1) make-based installed creates only man and exe (no library, no headers)
+#
+# 2) cmake based build system creates lib and exe (no man pages), and names
+# executable based on arch (!), installs headers, but the SONAME is filled
+# incorrectly: liblz4.so.0.0
+
+# so forget all that and just install from spec
+install -d $RPM_BUILD_ROOT{%{_bindir},%{_libdir},%{_mandir}/man1,%{_includedir}}
+
+# shared lib
+install -p cmake/liblz4.so.0.* $RPM_BUILD_ROOT%{_libdir}/liblz4.so.0.0.%{svnrev}
+ln -s $(basename $RPM_BUILD_ROOT%{_libdir}/liblz4.so.0.*) $RPM_BUILD_ROOT%{_libdir}/liblz4.so
+/sbin/ldconfig -n $RPM_BUILD_ROOT%{_libdir}
+
+# static lib
+cp -p cmake/liblz4.a $RPM_BUILD_ROOT%{_libdir}
+
+# headers
+cp -a {lz4,lz4hc}.h $RPM_BUILD_ROOT%{_includedir}
+
+# binary
+install -p cmake/lz4c* $RPM_BUILD_ROOT%{_bindir}/lz4
+
+# man page
+cp -p lz4.1 $RPM_BUILD_ROOT%{_mandir}/man1
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%post	-p /sbin/ldconfig
+%postun	-p /sbin/ldconfig
+
 %files
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_bindir}/lz4
 %{_mandir}/man1/lz4.1*
-
-%if 0
-%{_libdir}/liblz4-*.so
+%attr(755,root,root) %{_libdir}/liblz4.so.*.*.*
+%ghost %{_libdir}/liblz4.so.0.0
 
 %files devel
 %defattr(644,root,root,755)
-%{_includedir}/lz4*.h
+%{_includedir}/lz4.h
+%{_includedir}/lz4hc.h
 %{_libdir}/liblz4.so
-%endif
+
+%files static
+%defattr(644,root,root,755)
+%{_libdir}/liblz4.a
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/lz4.git/commitdiff/e2b4d9252bf37f38b7ebc3000d9a4a471b2891c4



More information about the pld-cvs-commit mailing list