openpkg/rpm-config.sh

Fri, 07 Sep 2012 19:08:07 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 07 Sep 2012 19:08:07 +0200
changeset 667
9dacbd1d1aa2
parent 13
cb59d6afeb61
permissions
-rw-r--r--

Correct build configuration in Solaris subdir, correct english grammar,
remove irrelevant strip notice, introduce custom CFLAG logic, facilitate
use of Solaris Studio compiler with needed build configuration
adjustments, conditionally build 64 bit position independent code,
and accommodate tun(7) in newer Solaris releases by renaming driver
and module from conflicting 'tun' to 'vtun'. These changes include
some nonstandard 'I give up' logic causing out of tree builds by
manipulating the PATH, for example.

michael@13 1 #!/bin/sh
michael@13 2 ##
michael@13 3 ## rpm-config -- OpenPKG RPM Library Build Utility
michael@428 4 ## Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
michael@13 5 ##
michael@428 6 ## This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
michael@428 7 ## All rights reserved. Licenses which grant limited permission to use,
michael@428 8 ## copy, modify and distribute this software are available from the
michael@428 9 ## OpenPKG GmbH.
michael@13 10 ##
michael@428 11 ## THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
michael@13 12 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@13 13 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@13 14 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@13 15 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@13 16 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@13 17 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@13 18 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@13 19 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@13 20 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@13 21 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@13 22 ## SUCH DAMAGE.
michael@13 23 ##
michael@13 24 ## rpm-config.sh: program
michael@13 25 ##
michael@13 26
michael@13 27 rpm_version="@l_version@"
michael@13 28 rpm_cc="@l_cc@"
michael@13 29 rpm_cppflags="@l_cppflags@"
michael@13 30 rpm_cflags="@l_cflags@"
michael@13 31 rpm_ldflags="@l_ldflags@"
michael@13 32 rpm_libs="@l_libs@"
michael@13 33
michael@13 34 usage="rpm-config"
michael@13 35 usage="$usage [--cc] [--cppflags] [--cflags] [--ldflags] [--libs]"
michael@13 36 usage="$usage [--help] [--version]"
michael@13 37 if [ $# -eq 0 ]; then
michael@13 38 echo "rpm-config:Error: Invalid option" 1>&2
michael@13 39 echo "rpm-config:Usage: $usage" 1>&2
michael@13 40 exit 1
michael@13 41 fi
michael@13 42
michael@13 43 output=''
michael@13 44 prev=''
michael@13 45 for option
michael@13 46 do
michael@13 47 if [ ".$prev" != . ]; then
michael@13 48 eval "$prev=\$option"
michael@13 49 prev=''
michael@13 50 continue
michael@13 51 fi
michael@13 52 case "$option" in
michael@13 53 -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
michael@13 54 *) optarg='' ;;
michael@13 55 esac
michael@13 56 case "$option" in
michael@13 57 --help|-h)
michael@13 58 echo "Usage: $usage"
michael@13 59 exit 0
michael@13 60 ;;
michael@13 61 --version|-v)
michael@13 62 echo "OpenPKG RPM $rpm_version"
michael@13 63 exit 0
michael@13 64 ;;
michael@13 65 --cc)
michael@13 66 output="$output $rpm_cc"
michael@13 67 ;;
michael@13 68 --cppflags)
michael@13 69 output="$output $rpm_cppflags"
michael@13 70 ;;
michael@13 71 --cflags)
michael@13 72 output="$output $rpm_cflags"
michael@13 73 ;;
michael@13 74 --ldflags)
michael@13 75 output="$output $rpm_ldflags"
michael@13 76 ;;
michael@13 77 --libs)
michael@13 78 output="$output $rpm_libs"
michael@13 79 ;;
michael@13 80 * )
michael@13 81 echo "rpm-config:Error: Invalid option" 1>&2
michael@13 82 echo "rpm-config:Usage: $usage" 1>&2
michael@13 83 exit 1;
michael@13 84 ;;
michael@13 85 esac
michael@13 86 done
michael@13 87 if [ ".$prev" != . ]; then
michael@13 88 echo "rpm-config:Error: missing argument to --`echo $prev | sed 's/_/-/g'`" 1>&2
michael@13 89 exit 1
michael@13 90 fi
michael@13 91
michael@13 92 if [ ".$output" != . ]; then
michael@13 93 echo "$output" | sed -e 's/^ *//' -e 's/ *$//'
michael@13 94 fi
michael@13 95

mercurial