You are not logged in.
I just adopted <code>optipng</code> (a png optimizing program, like pngcrush) which was orphaned in the AUR, and I'm trying to update it to the newest version. I don't think the original PKGBUILD is correct in it's implementation...
The question I have is that the source file includes the source for both <code>zlib</code> and <code>libpng</code> with it, but obviously I'd like it to not compile and install those, just the plain optipng stuff.
Here's the PKGBUILD posted by the old maintainer: PKGBUILD
...and here's what I've got so far:
pkgname=optipng
pkgver=0.5
pkgrel=1
pkgdesc="OptiPNG is a PNG optimizer that recompresses the image files to a smaller size, without losing any information."
url="http://www.cs.toronto.edu/~cosmin/pngtech/optipng/"
license=""
depends=('libpng')
source=(http://www.cs.toronto.edu/~cosmin/pngtech/$pkgname/$pkgname-$pkgver.tar.gz)
md5sums=('3964fdf24e6de62fc994850c548dd13f')
build() {
cd $startdir/src/$pkgname-$pkgver/src
cp scripts/gcc.mak Makefile
make || return 1
mkdir -p $startdir/pkg/usr/bin
cp $pkgname $startdir/pkg/usr/bin
}
I'd love to learn more about compiling by hand, but I have no idea what flags to pass in order to not compile those other libraries, any help is extremely appreciated. If it helps, here's the contents of the <code>gcc.mak</code> file which is apparently what the old maintainer used as the Makefile:
# Makefile for OptiPNG
# gcc (generic)
#
# Usage: make -f scripts/gcc.mak
CC = gcc
LD = $(CC)
RM = rm -f
CFLAGS = -O2 -Wall
LDFLAGS = -s
OPTIPNG = optipng$(EXE)
ZLIB = libz.a
PNGLIB = libpng.a
PNGXLIB = pngxtern.a
ZMAK = Makefile
PNGMAK = scripts/makefile.gcc
PNGXMAK = scripts/gcc.mak
ZDIR = ../lib/zlib
PNGDIR = ../lib/libpng
PNGXDIR = ../lib/pngxtern
BACKHERE = ../../src
OBJS = optipng.o opngio.o opngreduc.o cbitset.o osys.o
LIBS = $(PNGXDIR)/$(PNGXLIB) $(PNGDIR)/$(PNGLIB) $(ZDIR)/$(ZLIB)
$(OPTIPNG): $(OBJS) $(LIBS)
$(LD) -o $(OPTIPNG) $(LDFLAGS) $(OBJS) $(LIBS)
.c.o:
$(CC) -c $(CFLAGS) -I$(ZDIR) -I$(PNGDIR) -I$(PNGXDIR) $*.c
optipng.o : optipng.c opng.h osys.h cbitset.h cexcept.h
opngio.o : opngio.c opng.h
opngreduc.o: opngreduc.c opng.h
cbitset.o : cbitset.c cbitset.h
osys.o : osys.c osys.h
$(PNGXDIR)/$(PNGXLIB): $(ZDIR)/$(ZLIB) $(PNGDIR)/$(PNGLIB)
cd $(PNGXDIR);
$(MAKE) -f $(PNGXMAK) $(PNGXLIB);
cd $(BACKHERE)
$(PNGDIR)/$(PNGLIB): $(ZDIR)/$(ZLIB)
cd $(PNGDIR);
$(MAKE) -f $(PNGMAK) $(PNGLIB);
cd $(BACKHERE)
$(ZDIR)/$(ZLIB):
cd $(ZDIR);
./configure;
$(MAKE) -f $(ZMAK) $(ZLIB);
cd $(BACKHERE)
clean:
$(RM) $(OPTIPNG) $(OBJS)
cd $(PNGXDIR);
$(MAKE) -f $(PNGXMAK) clean;
cd $(BACKHERE)
cd $(PNGDIR);
$(MAKE) -f $(PNGMAK) clean;
cd $(BACKHERE)
cd $(ZDIR);
$(MAKE) -f $(ZMAK) clean;
cd $(BACKHERE)
Offline
This PKGBUILD is OK. It only installs the optipng binary. The reason of the libpng/zlib source is that optipng need these specific (modified?) versions. However, they are not installed, just statically linked in the executable.
Also, you can replace:
cp scripts/gcc.mak Makefile
make || return 1
mkdir -p $startdir/pkg/usr/bin
cp $pkgname $startdir/pkg/usr/bin
by:
make -f scripts/gcc.mak || return 1
install -D -m755 optipng $startdir/pkg/usr/bin/optipng
Offline
Thanks for checking it out Snowman...you guys are the best! I'll have to read up and practice on compiling stuff by hand...gotta learn sooner or later.
Offline
No problem. 8)
BTW, replace the libpng dependancy by a glibc dependancy.
Offline
Yeah, I figured that after you said the other libraries were statically linked. At first, I didn't understand why the original maintainer had done it that way.
Probably another stupid question, but, is stating <code>glibc</code> really necessary as a dependancy since everyone should have it considering it's included in Current -> Base? Or is it just good practice to have it in there?
Offline
Usually, it is not necessary to put packages from base in the depends/makedepends. However, some packages in the official repo have glibc as depends. Most of these are packages have no other depends. I would guess that the glibc depends is to prevent an empty depends field.
Offline