You are not logged in.

#1 2006-01-26 00:04:46

elasticdog
Member
From: Washington, USA
Registered: 2005-05-02
Posts: 995
Website

Help with AUR's optipng PKGBUILD

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

#2 2006-01-26 01:05:04

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: Help with AUR's optipng PKGBUILD

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

#3 2006-01-26 15:56:34

elasticdog
Member
From: Washington, USA
Registered: 2005-05-02
Posts: 995
Website

Re: Help with AUR's optipng PKGBUILD

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

#4 2006-01-26 20:17:09

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: Help with AUR's optipng PKGBUILD

No problem. 8)
BTW, replace the libpng dependancy by a glibc dependancy.

Offline

#5 2006-01-27 00:10:52

elasticdog
Member
From: Washington, USA
Registered: 2005-05-02
Posts: 995
Website

Re: Help with AUR's optipng PKGBUILD

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

#6 2006-01-27 02:14:13

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: Help with AUR's optipng PKGBUILD

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. neutral

Offline

Board footer

Powered by FluxBB