Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > main-release > by-pkgid > d4a6745d7fbd92dfb64dce5e91e08f80 > files > 291

lib64meanwhile1-doc-1.0.2-1mdv2008.1.x86_64.rpm


#! /bin/sh


CC=x86_64-mandriva-linux-gnu-gcc
PKG_CONFIG=/usr/bin/pkg-config


function build() {
    if (echo "$1" | grep '\.c$' > /dev/null) ; then
        SAMPLE=$(echo "$1" | sed 's/\.c$//')
        SOURCE="$1"
    else
        SAMPLE="$1"
        SOURCE="${SAMPLE}.c"
    fi

    if test -z "$SOURCE" ; then
	echo "please specify a target to build"
	return 1

    elif test ! -f "$SOURCE" ; then
	echo "file not found: $SOURCE"
	return 1
    fi

    PKG_CONFIG_PATH="$PKG_CONFIG_PATH":/usr/lib/pkgconfig
    export PKG_CONFIG_PATH

    CFLAGS=`$PKG_CONFIG --libs --cflags glib-2.0 meanwhile`

    "$CC" $CFLAGS -o "$SAMPLE" "$SOURCE"
    return $?
}


build $1