# slocate, http://slocate.trakker.ca

name=slocate
version=3.1
release=1
source=(http://slocate.trakker.ca/files/$name-$version.tar.gz slocate)

build() {
    cd $name-$version
    sed -i "s|/usr/local|/usr|g" Makefile
    sed -i "s|-O2|$CFLAGS|" src/Makefile
    make
    mkdir -p $PKG/usr/bin $PKG/etc $PKG/usr/share/man/man1 \
	     $PKG/var/lib/slocate $PKG/etc/cron/daily
    touch slocate.db
    install -d -m 0750 -g slocate $PKG/var/lib/slocate
    install -m 0640 -g slocate slocate.db $PKG/var/lib/slocate/slocate.db
    install -m 2755 -g slocate src/slocate $PKG/usr/bin/slocate
    install -m 0755 ../slocate $PKG/etc/cron/daily/slocate
    install -m 0644 doc/slocate.1 $PKG/usr/share/man/man1
#   install -m 0644 doc/updatedb.1 $PKG/usr/share/man/man1
    install -m 0644 debian/updatedb.conf $PKG/etc/updatedb.conf
    sed -i "s|smbfs|smbfs cifs|" $PKG/etc/updatedb.conf
    ln -sf slocate $PKG/usr/bin/locate
    ln -sf slocate.1.gz $PKG/usr/share/man/man1/locate.1.gz
}
