From 5cbb04c91d8ca6bd5f267dc8daf1fc403f4ea867 Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Tue, 27 Oct 2020 23:16:32 -0300 Subject: [PATCH] Initial commit --- libnxz.so.patch | 31 ++++++++++++++++++++++ libnxz.spec | 69 +++++++++++++++++++++++++++++++++++++++++++++++++ rm-git.patch | 28 ++++++++++++++++++++ 3 files changed, 128 insertions(+) create mode 100644 libnxz.so.patch create mode 100644 libnxz.spec create mode 100644 rm-git.patch diff --git a/libnxz.so.patch b/libnxz.so.patch new file mode 100644 index 0000000..1040121 --- /dev/null +++ b/libnxz.so.patch @@ -0,0 +1,31 @@ +From 92e5664e863b8a84e4cf5673e75fbd0c0fc0a8f5 Mon Sep 17 00:00:00 2001 +From: Tulio Magno Quites Machado Filho +Date: Tue, 27 Oct 2020 22:02:12 -0300 +Subject: [PATCH] Install libnxz.so as symlink + +The symlink libnxz.so is important when developing programs that link +specifically to libnxz, i.e. via -lnxz. + +Signed-off-by: Tulio Magno Quites Machado Filho +--- + lib/Makefile | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/lib/Makefile b/lib/Makefile +index 3cb3a7c..5813c79 100644 +--- a/lib/Makefile ++++ b/lib/Makefile +@@ -36,7 +36,9 @@ clean: + install: $(STATICLIB) $(SHAREDLIB) + install -d $(LIBDIR) + install -m 755 $(SHAREDLIB) $(LIBDIR) +- install -m 755 $(SHAREDSONAMELIB) $(LIBDIR) ++ { cd $(LIBDIR); \ ++ ln -s $(SHAREDLIB) $(SHAREDSONAMELIB); \ ++ ln -s $(SHAREDLIB) $(LIBLINK); } + install -m 644 $(STATICLIB) $(LIBDIR) + + uninstall: +-- +2.25.4 + diff --git a/libnxz.spec b/libnxz.spec new file mode 100644 index 0000000..bae2004 --- /dev/null +++ b/libnxz.spec @@ -0,0 +1,69 @@ +Name: libnxz +Version: 0.61 +Release: 0%{?dist} +Summary: Zlib implementation for POWER processors +License: ASL 2.0 +Url: https://github.com/libnxz/power-gzip +BuildRequires: zlib-devel +Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz + +Patch0: rm-git.patch +Patch1: libnxz.so.patch + +# Be explicit about the soname in order to avoid unintentional changes. +%global soname libnxz.so.0.61 + +ExclusiveArch: ppc64le +BuildRequires: gcc + +%description +libnxz is a zlib-compatible library that uses the NX GZIP Engine available on +POWER9 or newer processors in order to provide a faster zlib/gzip compression +without using the general-purpose cores. + +%package devel +Summary: Development files for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +The %{name}-devel package contains header files for developing application that +use %{name}. + +%package static +Summary: Static library for %{name} development +Requires: %{name}-devel%{?_isa} = %{version}-%{release} + +%description static +The %{name}-static package contains static libraries for developing +application that use %{name}. + +%prep +%autosetup -p1 -n power-gzip-%{version} + +%build +%make_build FLG="-std=gnu11 %{build_cflags} " + +%check +# libnxz tests only work on P9 servers or newer, bare metal, with +# Linux >= 5.8. This combination is not guaranteed to have at build time, +# forcing us to disable the tests. + +%install +make install PREFIX="%{buildroot}%{_prefix}" LIBDIR="%{buildroot}%{_libdir}" + +%files +%{_libdir}/%{soname} +%{_libdir}/libnxz.so.0 +%license licenses/APACHE-2.0.txt +%doc README.md + +%files devel +%{_includedir}/libnxz.h +%{_libdir}/libnxz.so + +%files static +%{_libdir}/libnxz.a + +%changelog +* Tue Oct 27 2020 Tulio Magno Quites Machado Filho - 0.61-0 +- Initial packaging diff --git a/rm-git.patch b/rm-git.patch new file mode 100644 index 0000000..f5d04e3 --- /dev/null +++ b/rm-git.patch @@ -0,0 +1,28 @@ +From 9a6ff0c71ab6c06c660c760ad0acb9691655d1a0 Mon Sep 17 00:00:00 2001 +From: Tulio Magno Quites Machado Filho +Date: Tue, 27 Oct 2020 21:42:38 -0300 +Subject: [PATCH] Stop depending on git when building + +Replace the git command with the current version. + +Signed-off-by: Tulio Magno Quites Machado Filho +--- + lib/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/Makefile b/lib/Makefile +index cc996dc..3cb3a7c 100644 +--- a/lib/Makefile ++++ b/lib/Makefile +@@ -5,7 +5,7 @@ SRCS = nx_inflate.c nx_deflate.c nx_zlib.c nx_crc.c nx_dht.c nx_dhtgen.c nx_dht_ + OBJS = nx_inflate.o nx_deflate.o nx_zlib.o nx_crc.o nx_dht.o nx_dhtgen.o nx_dht_builtin.o \ + nx_adler32.o gzip_vas.o nx_compress.o nx_uncompr.o crc32_ppc.o crc32_ppc_asm.o nx_utils.o + +-VERSION ?= $(shell git describe --tags | cut -d - -f 1,2 | tr - . | cut -c 2-) ++VERSION ?= 0.61 + SOVERSION = $(shell echo $(VERSION) | cut -d . -f 1) + PACKAGENAME = libnxz + STATICLIB = $(PACKAGENAME).a +-- +2.25.4 +