[crux-devel] use flags

heidi forum at heidi.linuxpl.com
Tue Aug 29 15:23:49 UTC 2006


hello
on first sorry for my English :)

I write something like gentoo's use flags but more simplest.
for example i need (or i like :) ) fluxbox witch imlib2 but i don't need
xinerama
if i wont add or delete some functionality  i  must  rewrite  Pkgfile  .

3 steps to change it :

1. add to /etc/pkgmk.conf
USE="nls imlib"

2. add function to pkgmk

if_use() {
    local TMP_USE=$1
    local RET_YES=$2
    local RET_NO=$3

    for U in $USE
    do
        if [ "$U" = "$TMP_USE" ]; then
            echo $RET_YES
            return
        fi
    done

    echo $RET_NO
}

3. Pkgfile
# Description: light windowmanager based on the original blackbox
# URL:         http://fluxbox.org
# Maintainer:
# Packager:
# Depends on:  x11 imlib2

deps="x11  $(if_use imlib2 imlib2) $(if_use xinerama xinerama)"

name=fluxbox
version=1.0rc2
release=1
source=(http://surfnet.dl.sourceforge.net/sourceforge/fluxbox/fluxbox-$version.tar.gz)

build() {
    cd $SRC/$name-$version
    ./configure \
        --prefix=/usr \
        $(if_use nls --enable-nls --disable-nls) \
        $(if_use imlib2 --enable-imlib2) \
        $(if_use xinerama --enable-xinerama --disable-xinerama)
    make
    make install DESTDIR=$PKG

}


and that's all folks :)
if_use <use_flags>  <arg_1>  <arg_2>
if use_flags exist in config then return arg_1 if not then arg_2
simple but powerful :)

and in variable deps we have all needed deps

What you thinking about it ?







More information about the crux-devel mailing list