# Description: CUPS - Common UNIX Printing System
# URL:         http://www.cups.org
# Maintainer:  Juergen Daubert, jue at crux dot nu
# Depends on:  acl tcp_wrappers libusb zlib

name=cups
version=2.1.0
release=1
source=(http://www.cups.org/software/$version/$name-$version-source.tar.bz2
        cups)

build () {
    cd $name-$version

    CC=cc CXX=c++ \
    ./configure --prefix=/usr \
                --sysconfdir=/etc \
                --libdir=/usr/lib \
                --mandir=/usr/man \
                --localstatedir=/var \
                --with-docdir=/usr/share/cups/doc \
                --with-logdir=/var/log/cups \
                --with-cups-user=daemon \
                --with-cups-group=lp \
                --with-languages="" \
                --without-{java,perl,php,python} \
                --without-rcdir \
                --with-optim="$CFLAGS" \
                --enable-tcp-wrappers \
                --enable-acl \
                --disable-{pam,dbus,avahi,systemd}

    make
    make BUILDROOT=$PKG install

    # conflict with cups-filters
    rm -r $PKG/usr/share/cups/{banners,data}
    
    # cleanup
    rm -rf $PKG/usr/share/{applications,icons}
    chmod 0755 $PKG/var/{cache,spool}   
    chmod -R +w $PKG

    # start script
    install -D -m 755 $SRC/cups $PKG/etc/rc.d/cups

    # blacklist usblp kernel module
    install -d $PKG/etc/modprobe.d
    echo 'blacklist usblp' > $PKG/etc/modprobe.d/cups.conf
}
