Skip to content

Commit

Permalink
app-arch/zstd: version bump to 1.1.0, fix a a number of bugs:
Browse files Browse the repository at this point in the history
 - respect "$(get_libdir)"
 - introduce USE=static-libs, bug #593634
 - do not compile library a second time, bug #594514
 - respect CC, bug #593630
 - prefix support
 - keyword for x86

Package-Manager: portage-2.3.0
  • Loading branch information
tamiko committed Oct 3, 2016
1 parent 15d6cfa commit 08a6e00
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 0 deletions.
1 change: 1 addition & 0 deletions app-arch/zstd/Manifest
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
DIST zstd-1.0.0.tar.gz 593430 SHA256 197e6ef74da878cbf72844f38461bb18129d144fd5221b3598e973ecda6f5963 SHA512 ba7b1c993656fa220dd8d4c8cd6b7999b0d7b59b4290d7767063f6c4bfbb81e04b9d9890dea4d223d48082ab253159209d6187dc7b42cafc28ebc738bfa17ace WHIRLPOOL 129bd4fb25eddcb63054ce171cc1051feffcae914661ef7c96f0147edfcaf489f4affbd7940e72aa3d742bd89068cb5074e61634d3480f8c178838d4fb4bf46d
DIST zstd-1.1.0.tar.gz 716327 SHA256 61cbbd28ff78f658f0564c2ccc206ac1ac6abe7f2c65c9afdca74584a104ea51 SHA512 9fe72081d333b58d5c8f27f13bd01ab0d729984215b75690282770aa769aab6879b88177aa2b45d8ce2869bf1b360f3a828ca00aa3646a7cc57285a4e167d71f WHIRLPOOL f7e4eab8e7dada2dd0d3ab8eeba4f2b3f165476c4cacf1a609269cb8ed9bccd12c498f50e2aaf365d6c0167c0f2db2b6b6902a786ba98f169e4f0ea0b7ceacfe
79 changes: 79 additions & 0 deletions app-arch/zstd/files/zstd-1.1.0-fix_build_system.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
diff --git a/lib/Makefile b/lib/Makefile
index 4fb8ed9..ec5436d 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -63,17 +63,17 @@ all: clean libzstd

libzstd: $(ZSTD_FILES)
@echo compiling static library
- @$(CC) $(FLAGS) -c $^
- @$(AR) rcs [email protected] *.o
+ $(CC) $(FLAGS) -c $^
+ $(AR) rcs [email protected] *.o
@echo compiling dynamic library $(LIBVER)
- @$(CC) $(FLAGS) -shared $^ -fPIC $(SONAME_FLAGS) -o $@.$(SHARED_EXT_VER)
+ $(CC) $(FLAGS) -shared $^ -fPIC $(SONAME_FLAGS) -o $@.$(SHARED_EXT_VER)
@echo creating versioned links
- @ln -sf $@.$(SHARED_EXT_VER) $@.$(SHARED_EXT_MAJOR)
- @ln -sf $@.$(SHARED_EXT_VER) $@.$(SHARED_EXT)
+ ln -sf $@.$(SHARED_EXT_VER) $@.$(SHARED_EXT_MAJOR)
+ ln -sf $@.$(SHARED_EXT_VER) $@.$(SHARED_EXT)

clean:
- @rm -f core *.o *.a *.gcda *.$(SHARED_EXT) *.$(SHARED_EXT).* libzstd.pc
- @rm -f decompress/*.o
+ rm -f core *.o *.a *.gcda *.$(SHARED_EXT) *.$(SHARED_EXT).* libzstd.pc
+ rm -f decompress/*.o
@echo Cleaning library completed

#------------------------------------------------------------------------
@@ -83,22 +83,22 @@ ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU FreeBSD DragonFly
libzstd.pc:
libzstd.pc: libzstd.pc.in
@echo creating pkgconfig
- @sed -e 's|@PREFIX@|$(PREFIX)|' \
+ sed -e 's|@PREFIX@|$(PREFIX)|' \
-e 's|@LIBDIR@|$(LIBDIR)|' \
-e 's|@INCLUDEDIR@|$(INCLUDEDIR)|' \
-e 's|@VERSION@|$(VERSION)|' \
$< >$@

-install: libzstd libzstd.pc
- @install -d -m 755 $(DESTDIR)$(LIBDIR)/pkgconfig/ $(DESTDIR)$(INCLUDEDIR)/
- @install -m 755 libzstd.$(SHARED_EXT_VER) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT_VER)
- @cp -a libzstd.$(SHARED_EXT_MAJOR) $(DESTDIR)$(LIBDIR)
- @cp -a libzstd.$(SHARED_EXT) $(DESTDIR)$(LIBDIR)
- @cp -a libzstd.pc $(DESTDIR)$(LIBDIR)/pkgconfig/
- @install -m 644 libzstd.a $(DESTDIR)$(LIBDIR)/libzstd.a
- @install -m 644 zstd.h $(DESTDIR)$(INCLUDEDIR)/zstd.h
- @install -m 644 common/zbuff.h $(DESTDIR)$(INCLUDEDIR)/zbuff.h
- @install -m 644 dictBuilder/zdict.h $(DESTDIR)$(INCLUDEDIR)/zdict.h
+install: libzstd.pc
+ install -d -m 755 $(DESTDIR)$(LIBDIR)/pkgconfig/ $(DESTDIR)$(INCLUDEDIR)/
+ install -m 755 libzstd.$(SHARED_EXT_VER) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT_VER)
+ cp -a libzstd.$(SHARED_EXT_MAJOR) $(DESTDIR)$(LIBDIR)
+ cp -a libzstd.$(SHARED_EXT) $(DESTDIR)$(LIBDIR)
+ cp -a libzstd.pc $(DESTDIR)$(LIBDIR)/pkgconfig/
+ install -m 644 libzstd.a $(DESTDIR)$(LIBDIR)/libzstd.a
+ install -m 644 zstd.h $(DESTDIR)$(INCLUDEDIR)/zstd.h
+ install -m 644 common/zbuff.h $(DESTDIR)$(INCLUDEDIR)/zbuff.h
+ install -m 644 dictBuilder/zdict.h $(DESTDIR)$(INCLUDEDIR)/zdict.h
@echo zstd static and shared library installed

uninstall:
diff --git a/programs/Makefile b/programs/Makefile
index 6e78d0e..993d138 100644
--- a/programs/Makefile
+++ b/programs/Makefile
@@ -21,11 +21,7 @@ MANDIR = $(PREFIX)/share/man/man1

ZSTDDIR = ../lib

-ifeq ($(shell $(CC) -v 2>&1 | grep -c "gcc version "), 1)
-ALIGN_LOOP = -falign-loops=32
-else
ALIGN_LOOP =
-endif

CPPFLAGS= -I$(ZSTDDIR) -I$(ZSTDDIR)/common -I$(ZSTDDIR)/dictBuilder
CFLAGS ?= -O3
30 changes: 30 additions & 0 deletions app-arch/zstd/zstd-1.1.0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=6

DESCRIPTION="zstd fast compression library"
HOMEPAGE="http://facebook.github.io/zstd/"
SRC_URI="https://github.com/facebook/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="static-libs"

PATCHES=( "${FILESDIR}/${P}-fix_build_system.patch" )

src_compile() {
emake PREFIX="${EROOT}usr" LIBDIR="${EROOT}usr/$(get_libdir)" zstd
cd lib &&
emake PREFIX="${EROOT}usr" LIBDIR="${EROOT}usr/$(get_libdir)" libzstd
}

src_install() {
emake DESTDIR="${D}" \
PREFIX="${EROOT}usr" LIBDIR="${EROOT}usr/$(get_libdir)" install

! use static-libs &&
rm -f $ "${ED}usr/$(get_libdir)/libzstd.a"
}

0 comments on commit 08a6e00

Please sign in to comment.