1#!/bin/sh 2# Licensed to the Apache Software Foundation (ASF) under one or more 3# contributor license agreements. See the NOTICE file distributed with 4# this work for additional information regarding copyright ownership. 5# The ASF licenses this file to You under the Apache License, Version 2.0 6# (the "License"); you may not use this file except in compliance with 7# the License. You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16# 17# 18 19# buildpkg.sh: This script builds a Solaris PKG from the source tree 20# provided. 21 22PREFIX=/usr/local 23TEMPDIR=/var/tmp/$USER/apr-util-root 24rm -rf $TEMPDIR 25 26apr_util_src_dir=. 27apr_src_dir=../apr 28expat_dir=/usr 29 30while test $# -gt 0 31do 32 # Normalize 33 case "$1" in 34 -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; 35 *) optarg= ;; 36 esac 37 38 case "$1" in 39 --with-apr=*) 40 apr_src_dir=$optarg 41 ;; 42 esac 43 44 case "$1" in 45 --with-apr-util=*) 46 apr_util_src_dir=$optarg 47 ;; 48 esac 49 50 case "$1" in 51 --with-expat=*) 52 expat_dir=$optarg 53 ;; 54 esac 55 56 shift 57done 58 59if [ -f "$apr_util_src_dir/configure.in" ]; then 60 cd $apr_util_src_dir 61else 62 echo "The apr-util source could not be found within $apr_util_src_dir" 63 echo "Usage: buildpkg [--with-apr=dir] [--with-apr-util=dir] [--with-expat=dir]" 64 exit 1 65fi 66 67if [ ! -f "$apr_src_dir/configure.in" ]; then 68 echo "The apr source could not be found within $apr_src_dir" 69 echo "Usage: buildpkg [--with-apr=dir] [--with-apr-util=dir] [--with-expat=dir]" 70 exit 1 71fi 72 73if [ ! -d "$expat_dir" ]; then 74 echo "The expat directory could not be found within $expat_dir" 75 echo "Usage: buildpkg [--with-apr=dir] [--with-apr-util=dir] [--with-expat=dir]" 76 exit 1 77fi 78 79./configure --prefix=$PREFIX --with-apr=$apr_src_dir \ 80 --with-ldap --with-expat=$expat_dir 81make 82make install DESTDIR=$TEMPDIR 83rm $TEMPDIR$PREFIX/lib/aprutil.exp 84. build/pkg/pkginfo 85cp build/pkg/pkginfo $TEMPDIR$PREFIX 86 87current=`pwd` 88cd $TEMPDIR$PREFIX 89echo "i pkginfo=./pkginfo" > prototype 90find . -print | grep -v ./prototype | grep -v ./pkginfo | pkgproto | awk '{print $1" "$2" "$3" "$4" root bin"}' >> prototype 91mkdir $TEMPDIR/pkg 92pkgmk -r $TEMPDIR$PREFIX -d $TEMPDIR/pkg 93 94cd $current 95pkgtrans -s $TEMPDIR/pkg $current/$NAME-$VERSION-$ARCH-local 96gzip $current/$NAME-$VERSION-$ARCH-local 97 98rm -rf $TEMPDIR 99 100