Skip to content

Commit

Permalink
Re-add zlib as a dependency
Browse files Browse the repository at this point in the history
Some builds of libpng don't have zlib baked in
  • Loading branch information
kornelski committed May 10, 2013
1 parent f309d1b commit e7b3b39
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@ BIN ?= pngquant
PREFIX ?= /usr/local
BINPREFIX = $(PREFIX)/bin

# Alternatively, build libpng in this directory:
# Alternatively, build libpng and zlib in these directories:
CUSTOMLIBPNG ?= ../libpng
CUSTOMZLIB ?= ../zlib

CFLAGSOPT ?= -DNDEBUG -O3 -fstrict-aliasing -ffast-math -funroll-loops -fomit-frame-pointer -ffinite-math-only

CFLAGS ?= -Wall -Wno-unknown-pragmas -I. -I$(CUSTOMLIBPNG) -I/usr/local/include/ -I/usr/include/ -I/usr/X11/include/ $(CFLAGSOPT)
CFLAGS ?= -Wall -Wno-unknown-pragmas -I. -I$(CUSTOMLIBPNG) -I$(CUSTOMZLIB) -I/usr/local/include/ -I/usr/include/ -I/usr/X11/include/ $(CFLAGSOPT)
CFLAGS += -std=c99 $(CFLAGSADD)

LDFLAGS ?= -L$(CUSTOMLIBPNG) -L/usr/local/lib/ -L/usr/lib/ -L/usr/X11/lib/
LDFLAGS += -lpng -lm lib/libimagequant.a $(LDFLAGSADD)
LDFLAGS ?= -L$(CUSTOMLIBPNG) -L$(CUSTOMZLIB) -L/usr/local/lib/ -L/usr/lib/ -L/usr/X11/lib/
LDFLAGS += -lpng -lz -lm lib/libimagequant.a $(LDFLAGSADD)

OBJS = pngquant.o rwpng.o
COCOA_OBJS = rwpng_cocoa.o
Expand Down
2 changes: 2 additions & 0 deletions pngquant.spec
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ License: BSD
URL: http://pngquant.org
Source0: https://github.com/pornel/improved-pngquant/tarball/%{version}
BuildRequires: libpng-devel%{?_isa} >= 1.2.46-1
BuildRequires: zlib-devel%{?_isa} >= 1.2.3-1
BuildRequires: gcc%{?_isa} >= 4.2-1
Requires: libpng%{?_isa} >= 1.2.46-1
Requires: zlib%{?isa} >= 1.2.3-1

%description
pngquant converts 24/32-bit RGBA PNG images to 8-bit palette with
Expand Down

3 comments on commit e7b3b39

@jamesstout
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I was wondering why zlib was linked. I can't get it to build linking to the custom zlib at the moment...

@kornelski
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On OS X linking to libz didn't seem necessary (my libpng is linked with libz somehow?), but I needed to link it explicitly for Debian.

It is a pain. I wonder whether it should use pkg-config to get paths/flags or move to autotools?

@jamesstout
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needs something .. I spent a while trying Makefiles, then tried a script: https://gist.github.com/jamesstout/6026155

Please sign in to comment.