# libtiff, http://www.libtiff.org

name=tiff
version=3.5.7
source=($name-v$version.tar.gz)

build() {
    cd $name-v$version
    echo | ./configure -with-GCOPTS="-O3 -march=i586 -fexpensive-optimizations" --prefix=/usr
    make
    mkdir -p $PKG/usr/lib
    mkdir -p $PKG/usr/bin
    mkdir -p $PKG/usr/include
    mkdir -p $PKG/usr/man/man1
    mkdir -p $PKG/usr/man/man3
    cd libtiff
    cp libtiff* $PKG/usr/lib
    ( cd $PKG/usr/lib ; rm -f libtiff.so.3 ; ln -sf libtiff.so.$version libtiff.so.3 )
    cp tiffconf.h tiff.h tiffvers.h tiffio.h $PKG/usr/include
    chmod 644 $PKG/usr/include/*
    chown root.root $PKG/usr/include/*
    rm -f $PKG/usr/lib/*.def
    chmod 644 $PKG/usr/lib/*
    chown root.root $PKG/usr/lib/*
    cd ../tools
    make install DESTDIR=$PKG
    cd ../man
    cp *.1 $PKG/usr/man/man1
    cp *.3t $PKG/usr/man/man3
    chmod 644 $PKG/usr/man/man1/*
    chmod 644 $PKG/usr/man/man3/*
    chown root.root $PKG/usr/man/man1/*
    chown root.root $PKG/usr/man/man3/*
    strip $PKG/usr/lib/*.so*
    strip $PKG/usr/bin/*
    gzip -9 $PKG/usr/man/man?/*
}
