forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
app-arch/zopfli: respect CC, CXX, CFLAGS, CXXFLAGS, and LDFLAGS
- Loading branch information
Showing
2 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |