openpkg/rpm-config.sh

changeset 13
cb59d6afeb61
child 428
f880f219c566
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/openpkg/rpm-config.sh	Tue Jan 06 23:40:39 2009 +0100
     1.3 @@ -0,0 +1,96 @@
     1.4 +#!/bin/sh
     1.5 +##
     1.6 +##  rpm-config -- OpenPKG RPM Library Build Utility
     1.7 +##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
     1.8 +##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
     1.9 +##
    1.10 +##  Permission to use, copy, modify, and distribute this software for
    1.11 +##  any purpose with or without fee is hereby granted, provided that
    1.12 +##  the above copyright notice and this permission notice appear in all
    1.13 +##  copies.
    1.14 +##
    1.15 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    1.16 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    1.17 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    1.18 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    1.19 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.20 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.21 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    1.22 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    1.23 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    1.24 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    1.25 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.26 +##  SUCH DAMAGE.
    1.27 +##
    1.28 +##  rpm-config.sh: program
    1.29 +##
    1.30 +
    1.31 +rpm_version="@l_version@"
    1.32 +rpm_cc="@l_cc@"
    1.33 +rpm_cppflags="@l_cppflags@"
    1.34 +rpm_cflags="@l_cflags@"
    1.35 +rpm_ldflags="@l_ldflags@"
    1.36 +rpm_libs="@l_libs@"
    1.37 +
    1.38 +usage="rpm-config"
    1.39 +usage="$usage [--cc] [--cppflags] [--cflags] [--ldflags] [--libs]"
    1.40 +usage="$usage [--help] [--version]"
    1.41 +if [ $# -eq 0 ]; then
    1.42 +    echo "rpm-config:Error: Invalid option" 1>&2
    1.43 +    echo "rpm-config:Usage: $usage" 1>&2
    1.44 +    exit 1
    1.45 +fi
    1.46 +
    1.47 +output=''
    1.48 +prev=''
    1.49 +for option
    1.50 +do
    1.51 +    if [ ".$prev" != . ]; then
    1.52 +        eval "$prev=\$option"
    1.53 +        prev=''
    1.54 +        continue
    1.55 +    fi
    1.56 +    case "$option" in
    1.57 +        -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
    1.58 +           *) optarg='' ;;
    1.59 +    esac
    1.60 +    case "$option" in
    1.61 +        --help|-h)
    1.62 +            echo "Usage: $usage"
    1.63 +            exit 0
    1.64 +            ;;
    1.65 +        --version|-v)
    1.66 +            echo "OpenPKG RPM $rpm_version"
    1.67 +            exit 0
    1.68 +            ;;
    1.69 +        --cc)
    1.70 +            output="$output $rpm_cc"
    1.71 +            ;;
    1.72 +        --cppflags)
    1.73 +            output="$output $rpm_cppflags"
    1.74 +            ;;
    1.75 +        --cflags)
    1.76 +            output="$output $rpm_cflags"
    1.77 +            ;;
    1.78 +        --ldflags)
    1.79 +            output="$output $rpm_ldflags"
    1.80 +            ;;
    1.81 +        --libs)
    1.82 +            output="$output $rpm_libs"
    1.83 +            ;;
    1.84 +        * )
    1.85 +            echo "rpm-config:Error: Invalid option" 1>&2
    1.86 +            echo "rpm-config:Usage: $usage" 1>&2
    1.87 +            exit 1;
    1.88 +            ;;
    1.89 +    esac
    1.90 +done
    1.91 +if [ ".$prev" != . ]; then
    1.92 +    echo "rpm-config:Error: missing argument to --`echo $prev | sed 's/_/-/g'`" 1>&2
    1.93 +    exit 1
    1.94 +fi
    1.95 +
    1.96 +if [ ".$output" != . ]; then
    1.97 +    echo "$output" | sed -e 's/^ *//' -e 's/ *$//'
    1.98 +fi
    1.99 +

mercurial