From 96a2115f6bc6e13cb23f325701157990821ce609 Mon Sep 17 00:00:00 2001 From: Tim Harder Date: Fri, 19 Aug 2016 21:38:56 -0400 Subject: app-arch/zopfli: respect CC, CXX, CFLAGS, CXXFLAGS, and LDFLAGS --- app-arch/zopfli/files/zopfli-1.0.1-makefile.patch | 44 +++++++++++++++++++ app-arch/zopfli/zopfli-1.0.1-r1.ebuild | 51 +++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 app-arch/zopfli/files/zopfli-1.0.1-makefile.patch create mode 100644 app-arch/zopfli/zopfli-1.0.1-r1.ebuild (limited to 'app-arch/zopfli') diff --git a/app-arch/zopfli/files/zopfli-1.0.1-makefile.patch b/app-arch/zopfli/files/zopfli-1.0.1-makefile.patch new file mode 100644 index 000000000000..8a5e87f3e897 --- /dev/null +++ b/app-arch/zopfli/files/zopfli-1.0.1-makefile.patch @@ -0,0 +1,44 @@ +--- zopfli-zopfli-1.0.1/Makefile ++++ zopfli-zopfli-1.0.1/Makefile +@@ -1,8 +1,10 @@ +-CC = gcc +-CXX = g++ ++CC ?= gcc ++CXX ?= g++ + +-CFLAGS = -W -Wall -Wextra -ansi -pedantic -lm -O2 +-CXXFLAGS = -W -Wall -Wextra -ansi -pedantic -O2 ++CFLAGS += -W -Wall -Wextra -ansi -pedantic ++CXXFLAGS += -W -Wall -Wextra -ansi -pedantic ++LIBS = -lm ++LDFLAGS += $(LIBS) + + ZOPFLILIB_SRC = src/zopfli/blocksplitter.c src/zopfli/cache.c\ + src/zopfli/deflate.c src/zopfli/gzip_container.c\ +@@ -20,22 +22,22 @@ + + # Zopfli binary + zopfli: +- $(CC) $(ZOPFLILIB_SRC) $(ZOPFLIBIN_SRC) $(CFLAGS) -o zopfli ++ $(CC) $(ZOPFLILIB_SRC) $(ZOPFLIBIN_SRC) $(CFLAGS) $(LDFLAGS) -o zopfli + + # Zopfli shared library + libzopfli: + $(CC) $(ZOPFLILIB_SRC) $(CFLAGS) -fPIC -c +- $(CC) $(ZOPFLILIB_OBJ) $(CFLAGS) -shared -Wl,-soname,libzopfli.so.1 -o libzopfli.so.1.0.1 ++ $(CC) $(ZOPFLILIB_OBJ) $(CFLAGS) $(LDFLAGS) -shared -Wl,-soname,libzopfli.so.1 -o libzopfli.so.1.0.1 + + # ZopfliPNG binary + zopflipng: + $(CC) $(ZOPFLILIB_SRC) $(CFLAGS) -c +- $(CXX) $(ZOPFLILIB_OBJ) $(LODEPNG_SRC) $(ZOPFLIPNGLIB_SRC) $(ZOPFLIPNGBIN_SRC) $(CFLAGS) -o zopflipng ++ $(CXX) $(ZOPFLILIB_OBJ) $(LODEPNG_SRC) $(ZOPFLIPNGLIB_SRC) $(ZOPFLIPNGBIN_SRC) $(CFLAGS) $(LDFLAGS) -o zopflipng + + # ZopfliPNG shared library + libzopflipng: + $(CC) $(ZOPFLILIB_SRC) $(CFLAGS) -fPIC -c +- $(CXX) $(ZOPFLILIB_OBJ) $(LODEPNG_SRC) $(ZOPFLIPNGLIB_SRC) $(CFLAGS) -fPIC --shared -Wl,-soname,libzopflipng.so.1 -o libzopflipng.so.1.0.0 ++ $(CXX) $(ZOPFLILIB_OBJ) $(LODEPNG_SRC) $(ZOPFLIPNGLIB_SRC) $(CFLAGS) $(LDFLAGS) -fPIC --shared -Wl,-soname,libzopflipng.so.1 -o libzopflipng.so.1.0.0 + + # Remove all libraries and binaries + clean: diff --git a/app-arch/zopfli/zopfli-1.0.1-r1.ebuild b/app-arch/zopfli/zopfli-1.0.1-r1.ebuild new file mode 100644 index 000000000000..554016d124e2 --- /dev/null +++ b/app-arch/zopfli/zopfli-1.0.1-r1.ebuild @@ -0,0 +1,51 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=6 + +inherit toolchain-funcs + +DESCRIPTION="Very good, but slow, deflate or zlib compression" +HOMEPAGE="https://github.com/google/zopfli/" +SRC_URI="https://github.com/google/zopfli/archive/${P}.tar.gz" + +S="${WORKDIR}/${PN}-${P}" + +LICENSE="Apache-2.0" +SLOT="0/1" +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux" + +DOCS=( CONTRIBUTORS README README.zopflipng ) + +PATCHES=( "${FILESDIR}"/${P}-makefile.patch ) + +# zopfli statically links libzopfli +# zopflipng statically links libzopflipng +# zopflipng also statically links an exact version of LodePNG (https://github.com/lvandeve/lodepng) +# As of version 1.0.1 neither of the binaries +# use the libraries we install. The libraries +# exist solely for use by external programs. + +src_compile() { + tc-export CC CXX + emake libzopfli + emake zopfli + + emake libzopflipng + emake zopflipng +} + +# The Makefile has no install phase +src_install() { + dolib.so libzopfli.so.${PV} + dosym libzopfli.so.${PV} /usr/$(get_libdir)/libzopfli.so.1 + + dobin ${PN} + + # This version was erroneously not bumped to match ${PV} + dolib.so libzopflipng.so.1.0.0 + dosym libzopflipng.so.1.0.0 /usr/$(get_libdir)/libzopflipng.so.1 + + dobin zopflipng +} -- cgit v1.2.3-65-gdbad