Initial import after review
This commit is contained in:
parent
6ecd875a8f
commit
e91cf9341a
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/*.tar.gz
|
1
sources
Normal file
1
sources
Normal file
@ -0,0 +1 @@
|
||||
SHA512 (xxhash-0.6.3.tar.gz) = 5b11009ecf142725c642be55e9072792709bd40d8674f30afdc13f9b9fd6936ea69e683c7b9df212b5126f9ba3925969fc0b65bb5518506b501bb339d3a29372
|
178
xxhash-lib.patch
Normal file
178
xxhash-lib.patch
Normal file
@ -0,0 +1,178 @@
|
||||
From bc32865a237f15cd4aaaa010b4f6a4f2fae71367 Mon Sep 17 00:00:00 2001
|
||||
From: Yann Collet <cyan@fb.com>
|
||||
Date: Thu, 14 Sep 2017 09:44:34 -0700
|
||||
Subject: [PATCH] make : added lib target
|
||||
|
||||
make install now also installs static and dynamic libraries
|
||||
---
|
||||
.gitignore | 6 ++++
|
||||
Makefile | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++-----------
|
||||
2 files changed, 82 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/.gitignore b/.gitignore
|
||||
index 6e41348..36639c6 100644
|
||||
--- a/.gitignore
|
||||
+++ b/.gitignore
|
||||
@@ -1,3 +1,9 @@
|
||||
+# objects
|
||||
+*.o
|
||||
+
|
||||
+# libraries
|
||||
+libxxhash.*
|
||||
+
|
||||
# Executables
|
||||
xxh32sum
|
||||
xxh64sum
|
||||
diff --git a/Makefile b/Makefile
|
||||
index f1b4238..98f6048 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -25,9 +25,12 @@
|
||||
# ################################################################
|
||||
|
||||
# Version numbers
|
||||
-LIBVER_MAJOR:=`sed -n '/define XXH_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < xxhash.h`
|
||||
-LIBVER_MINOR:=`sed -n '/define XXH_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < xxhash.h`
|
||||
-LIBVER_PATCH:=`sed -n '/define XXH_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < xxhash.h`
|
||||
+LIBVER_MAJOR_SCRIPT:=`sed -n '/define XXH_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < xxhash.h`
|
||||
+LIBVER_MINOR_SCRIPT:=`sed -n '/define XXH_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < xxhash.h`
|
||||
+LIBVER_PATCH_SCRIPT:=`sed -n '/define XXH_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < xxhash.h`
|
||||
+LIBVER_MAJOR := $(shell echo $(LIBVER_MAJOR_SCRIPT))
|
||||
+LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT))
|
||||
+LIBVER_PATCH := $(shell echo $(LIBVER_PATCH_SCRIPT))
|
||||
LIBVER := $(LIBVER_MAJOR).$(LIBVER_MINOR).$(LIBVER_PATCH)
|
||||
|
||||
CFLAGS ?= -O3
|
||||
@@ -46,21 +49,61 @@ else
|
||||
EXT =
|
||||
endif
|
||||
|
||||
+# OS X linker doesn't support -soname, and use different extension
|
||||
+# see : https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryDesignGuidelines.html
|
||||
+ifeq ($(shell uname), Darwin)
|
||||
+ SHARED_EXT = dylib
|
||||
+ SHARED_EXT_MAJOR = $(LIBVER_MAJOR).$(SHARED_EXT)
|
||||
+ SHARED_EXT_VER = $(LIBVER).$(SHARED_EXT)
|
||||
+ SONAME_FLAGS = -install_name $(LIBDIR)/libxxhash.$(SHARED_EXT_MAJOR) -compatibility_version $(LIBVER_MAJOR) -current_version $(LIBVER)
|
||||
+else
|
||||
+ SONAME_FLAGS = -Wl,-soname=libxxhash.$(SHARED_EXT).$(LIBVER_MAJOR)
|
||||
+ SHARED_EXT = so
|
||||
+ SHARED_EXT_MAJOR = $(SHARED_EXT).$(LIBVER_MAJOR)
|
||||
+ SHARED_EXT_VER = $(SHARED_EXT).$(LIBVER)
|
||||
+endif
|
||||
+
|
||||
+LIBXXH = libxxhash.$(SHARED_EXT_VER)
|
||||
+
|
||||
+
|
||||
.PHONY: default
|
||||
-default: xxhsum
|
||||
+default: lib xxhsum
|
||||
|
||||
.PHONY: all
|
||||
-all: xxhsum xxhsum32 xxhsum_inlinedXXH
|
||||
+all: lib xxhsum xxhsum32 xxhsum_inlinedXXH
|
||||
|
||||
xxhsum32: CFLAGS += -m32
|
||||
xxhsum xxhsum32: xxhash.c xxhsum.c
|
||||
- $(CC) $(FLAGS) $^ -o $@$(EXT)
|
||||
+ $(CC) $(FLAGS) $^ -o $@$(EXT)
|
||||
ln -sf $@ xxh32sum
|
||||
ln -sf $@ xxh64sum
|
||||
|
||||
xxhsum_inlinedXXH: xxhsum.c
|
||||
$(CC) $(FLAGS) -DXXH_PRIVATE_API $^ -o $@$(EXT)
|
||||
|
||||
+
|
||||
+# library
|
||||
+
|
||||
+libxxhash.a: ARFLAGS = rcs
|
||||
+libxxhash.a: xxhash.o
|
||||
+ @echo compiling static library
|
||||
+ @$(AR) $(ARFLAGS) $@ $^
|
||||
+
|
||||
+$(LIBXXH): LDFLAGS += -shared -fPIC
|
||||
+$(LIBXXH): xxhash.c
|
||||
+ @echo compiling dynamic library $(LIBVER)
|
||||
+ @$(CC) $(FLAGS) $^ $(LDFLAGS) $(SONAME_FLAGS) -o $@
|
||||
+ @echo creating versioned links
|
||||
+ @ln -sf $@ libxxhash.$(SHARED_EXT_MAJOR)
|
||||
+ @ln -sf $@ libxxhash.$(SHARED_EXT)
|
||||
+
|
||||
+libxxhash : $(LIBXXH)
|
||||
+
|
||||
+lib: libxxhash.a libxxhash
|
||||
+
|
||||
+
|
||||
+# tests
|
||||
+
|
||||
.PHONY: test
|
||||
test: xxhsum
|
||||
# stdin
|
||||
@@ -154,7 +197,8 @@ test-all: clean all namespaceTest test test32 test-xxhsum-c clean-xxhsum-c \
|
||||
armtest clangtest gpptest c90test test-mem usan staticAnalyze
|
||||
|
||||
clean: clean-xxhsum-c
|
||||
- @$(RM) -f core *.o xxhsum$(EXT) xxhsum32$(EXT) xxhsum_inlinedXXH$(EXT) xxh32sum xxh64sum
|
||||
+ @$(RM) core *.o libxxhash.*
|
||||
+ @$(RM) xxhsum$(EXT) xxhsum32$(EXT) xxhsum_inlinedXXH$(EXT) xxh32sum xxh64sum
|
||||
@echo cleaning completed
|
||||
|
||||
|
||||
@@ -170,6 +214,10 @@ DESTDIR ?=
|
||||
prefix ?= /usr/local
|
||||
PREFIX ?= $(prefix)
|
||||
exec_prefix ?= $(PREFIX)
|
||||
+libdir ?= $(exec_prefix)/lib
|
||||
+LIBDIR ?= $(libdir)
|
||||
+includedir ?= $(PREFIX)/include
|
||||
+INCLUDEDIR ?= $(includedir)
|
||||
bindir ?= $(exec_prefix)/bin
|
||||
BINDIR ?= $(bindir)
|
||||
datarootdir ?= $(PREFIX)/share
|
||||
@@ -193,8 +241,15 @@ INSTALL_DATA ?= $(INSTALL) -m 644
|
||||
|
||||
|
||||
.PHONY: install
|
||||
-install: xxhsum
|
||||
- @echo Installing binaries
|
||||
+install: lib xxhsum
|
||||
+ @echo Installing libxxhash
|
||||
+ @$(INSTALL_DATA) libxxhash.a $(DESTDIR)$(LIBDIR)
|
||||
+ @$(INSTALL_PROGRAM) $(LIBXXH) $(DESTDIR)$(LIBDIR)
|
||||
+ @ln -sf $(LIBXXH) $(DESTDIR)$(LIBDIR)/libxxhash.$(SHARED_EXT_MAJOR)
|
||||
+ @ln -sf $(LIBXXH) $(DESTDIR)$(LIBDIR)/libxxhash.$(SHARED_EXT)
|
||||
+ @$(INSTALL) -d -m 755 $(DESTDIR)$(INCLUDEDIR) # includes
|
||||
+ @$(INSTALL_DATA) xxhash.h $(DESTDIR)$(INCLUDEDIR)
|
||||
+ @echo Installing xxhsum
|
||||
@$(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR)/ $(DESTDIR)$(MANDIR)/
|
||||
@$(INSTALL_PROGRAM) xxhsum $(DESTDIR)$(BINDIR)/xxhsum
|
||||
@ln -sf xxhsum $(DESTDIR)$(BINDIR)/xxh32sum
|
||||
@@ -203,16 +258,21 @@ install: xxhsum
|
||||
@$(INSTALL_DATA) xxhsum.1 $(DESTDIR)$(MANDIR)/xxhsum.1
|
||||
@ln -sf xxhsum.1 $(DESTDIR)$(MANDIR)/xxh32sum.1
|
||||
@ln -sf xxhsum.1 $(DESTDIR)$(MANDIR)/xxh64sum.1
|
||||
- @echo xxhsum installation completed
|
||||
+ @echo xxhash installation completed
|
||||
|
||||
.PHONY: uninstall
|
||||
uninstall:
|
||||
- $(RM) $(DESTDIR)$(BINDIR)/xxh32sum
|
||||
- $(RM) $(DESTDIR)$(BINDIR)/xxh64sum
|
||||
- $(RM) $(DESTDIR)$(BINDIR)/xxhsum
|
||||
- $(RM) $(DESTDIR)$(MANDIR)/xxh32sum.1
|
||||
- $(RM) $(DESTDIR)$(MANDIR)/xxh64sum.1
|
||||
- $(RM) $(DESTDIR)$(MANDIR)/xxhsum.1
|
||||
+ @$(RM) $(DESTDIR)$(LIBDIR)/libxxhash.a
|
||||
+ @$(RM) $(DESTDIR)$(LIBDIR)/libxxhash.$(SHARED_EXT)
|
||||
+ @$(RM) $(DESTDIR)$(LIBDIR)/libxxhash.$(SHARED_EXT_MAJOR)
|
||||
+ @$(RM) $(DESTDIR)$(LIBDIR)/$(LIBXXH)
|
||||
+ @$(RM) $(DESTDIR)$(INCLUDEDIR)/xxhash.h
|
||||
+ @$(RM) $(DESTDIR)$(BINDIR)/xxh32sum
|
||||
+ @$(RM) $(DESTDIR)$(BINDIR)/xxh64sum
|
||||
+ @$(RM) $(DESTDIR)$(BINDIR)/xxhsum
|
||||
+ @$(RM) $(DESTDIR)$(MANDIR)/xxh32sum.1
|
||||
+ @$(RM) $(DESTDIR)$(MANDIR)/xxh64sum.1
|
||||
+ @$(RM) $(DESTDIR)$(MANDIR)/xxhsum.1
|
||||
@echo xxhsum successfully uninstalled
|
||||
|
||||
endif
|
24
xxhash-libdir.patch
Normal file
24
xxhash-libdir.patch
Normal file
@ -0,0 +1,24 @@
|
||||
From 7080470ed35aa1450c2b3b52320778e41bc7d3a3 Mon Sep 17 00:00:00 2001
|
||||
From: Mattias Ellert <mattias.ellert@physics.uu.se>
|
||||
Date: Wed, 18 Oct 2017 10:25:54 +0200
|
||||
Subject: [PATCH] Create library directory before installing files in it
|
||||
|
||||
---
|
||||
Makefile | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 845e892..c352b51 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -248,6 +248,7 @@ INSTALL_DATA ?= $(INSTALL) -m 644
|
||||
.PHONY: install
|
||||
install: lib xxhsum
|
||||
@echo Installing libxxhash
|
||||
+ @$(INSTALL) -d -m 755 $(DESTDIR)$(LIBDIR)
|
||||
@$(INSTALL_DATA) libxxhash.a $(DESTDIR)$(LIBDIR)
|
||||
@$(INSTALL_PROGRAM) $(LIBXXH) $(DESTDIR)$(LIBDIR)
|
||||
@ln -sf $(LIBXXH) $(DESTDIR)$(LIBDIR)/libxxhash.$(SHARED_EXT_MAJOR)
|
||||
--
|
||||
2.13.6
|
||||
|
82
xxhash.spec
Normal file
82
xxhash.spec
Normal file
@ -0,0 +1,82 @@
|
||||
Name: xxhash
|
||||
Version: 0.6.3
|
||||
Release: 2%{?dist}
|
||||
Summary: Extremely fast hash algorithm
|
||||
|
||||
# The source for the library (xxhash.c and xxhash.h) is BSD
|
||||
# The source for the command line tool (xxhsum.c) is GPLv2+
|
||||
License: BSD and GPLv2+
|
||||
URL: http://www.xxhash.com/
|
||||
Source0: https://github.com/Cyan4973/xxHash/archive/v%{version}/%{name}-%{version}.tar.gz
|
||||
# Build library - backport from upstream git (commit bc32865)
|
||||
Patch0: %{name}-lib.patch
|
||||
# Create libdir - backport from upstream git (commit 7080470)
|
||||
Patch1: %{name}-libdir.patch
|
||||
|
||||
%description
|
||||
xxHash is an Extremely fast Hash algorithm, running at RAM speed
|
||||
limits. It successfully completes the SMHasher test suite which
|
||||
evaluates collision, dispersion and randomness qualities of hash
|
||||
functions. Code is highly portable, and hashes are identical on all
|
||||
platforms (little / big endian).
|
||||
|
||||
%package libs
|
||||
Summary: Extremely fast hash algorithm - library
|
||||
License: BSD
|
||||
|
||||
%description libs
|
||||
xxHash is an Extremely fast Hash algorithm, running at RAM speed
|
||||
limits. It successfully completes the SMHasher test suite which
|
||||
evaluates collision, dispersion and randomness qualities of hash
|
||||
functions. Code is highly portable, and hashes are identical on all
|
||||
platforms (little / big endian).
|
||||
|
||||
%package devel
|
||||
Summary: Extremely fast hash algorithm - development files
|
||||
License: BSD
|
||||
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
|
||||
|
||||
%description devel
|
||||
Development files for the xxhash library
|
||||
|
||||
%prep
|
||||
%setup -q -n xxHash-%{version}
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
|
||||
%build
|
||||
make %{?_smp_mflags} CFLAGS="%{optflags}" MOREFLAGS="%{?__global_ldflags}"
|
||||
|
||||
%install
|
||||
make install DESTDIR=%{buildroot} PREFIX=%{_prefix} LIBDIR=%{_libdir}
|
||||
rm %{buildroot}/%{_libdir}/libxxhash.a
|
||||
|
||||
%check
|
||||
make test
|
||||
make test-xxhsum-c
|
||||
|
||||
%post libs -p /sbin/ldconfig
|
||||
%postun libs -p /sbin/ldconfig
|
||||
|
||||
%files
|
||||
%{_bindir}/xxh*sum
|
||||
%{_mandir}/man1/xxh*sum.1*
|
||||
%license LICENSE
|
||||
%doc README.md
|
||||
|
||||
%files libs
|
||||
%{_libdir}/libxxhash.so.*
|
||||
%license LICENSE
|
||||
%doc README.md
|
||||
|
||||
%files devel
|
||||
%{_includedir}/xxhash.h
|
||||
%{_libdir}/libxxhash.so
|
||||
|
||||
%changelog
|
||||
* Thu Oct 19 2017 Mattias Ellert <mattias.ellert@physics.uu.se> - 0.6.3-2
|
||||
- Correct License tag (command line tool is GPLv2+)
|
||||
- Adjust Source tag to get a more descriptive tarfile name
|
||||
|
||||
* Wed Oct 18 2017 Mattias Ellert <mattias.ellert@physics.uu.se> - 0.6.3-1
|
||||
- Initial packaging
|
Loading…
Reference in New Issue
Block a user