22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin#!/bin/sh
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding# Licensed to the Apache Software Foundation (ASF) under one or more
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding# contributor license agreements. See the NOTICE file distributed with
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding# this work for additional information regarding copyright ownership.
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding# The ASF licenses this file to You under the Apache License, Version 2.0
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding# (the "License"); you may not use this file except in compliance with
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding# the License. You may obtain a copy of the License at
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin#
08cb74ca432a8c24e39f17dedce527e6a47b8001jerenkrantz# http://www.apache.org/licenses/LICENSE-2.0
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin#
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin# Unless required by applicable law or agreed to in writing, software
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin# distributed under the License is distributed on an "AS IS" BASIS,
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin# See the License for the specific language governing permissions and
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin# limitations under the License.
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin#
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin#
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin# buildpkg.sh: This script builds a Solaris PKG from the source tree
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin# provided.
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrinLAYOUT=Apache
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrinPREFIX=/usr/local/apache2
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrinTEMPDIR=/var/tmp/$USER/httpd-root
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrinrm -rf $TEMPDIR
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrinapr_config=`which apr-1-config`
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrinapu_config=`which apu-1-config`
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrinwhile test $# -gt 0
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrindo
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin # Normalize
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin case "$1" in
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin *) optarg= ;;
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin esac
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin case "$1" in
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin --with-apr=*)
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin apr_config=$optarg
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin ;;
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin esac
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin case "$1" in
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin --with-apr-util=*)
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin apu_config=$optarg
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin ;;
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin esac
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin shift
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrindone
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin
7f0324120039aae80561410da14aa9086c65b601minfrinif [ ! -f "$apr_config" -a ! -f "$apr_config/configure.in" ]; then
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin echo "The apr source directory / apr-1-config could not be found"
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin echo "Usage: buildpkg [--with-apr=[dir|file]] [--with-apr-util=[dir|file]]"
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin exit 1
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrinfi
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin
7f0324120039aae80561410da14aa9086c65b601minfrinif [ ! -f "$apu_config" -a ! -f "$apu_config/configure.in" ]; then
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin echo "The apu source directory / apu-1-config could not be found"
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin echo "Usage: buildpkg [--with-apr=[dir|file]] [--with-apr-util=[dir|file]]"
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin exit 1
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrinfi
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin./configure --enable-layout=$LAYOUT \
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin --with-apr=$apr_config \
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin --with-apr-util=$apu_config \
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin --enable-mods-shared=all \
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin --with-devrandom \
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin --with-ldap --enable-ldap --enable-authnz-ldap \
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin --enable-cache --enable-disk-cache --enable-mem-cache \
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin --enable-ssl --with-ssl \
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin --enable-deflate --enable-cgid \
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin --enable-proxy --enable-proxy-connect \
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin --enable-proxy-http --enable-proxy-ftp
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrinmake
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrinmake install DESTDIR=$TEMPDIR
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin. build/pkg/pkginfo
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrincp build/pkg/pkginfo $TEMPDIR$PREFIX
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrincurrent=`pwd`
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrincd $TEMPDIR$PREFIX
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrinecho "i pkginfo=./pkginfo" > prototype
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrinfind . -print | grep -v ./prototype | grep -v ./pkginfo | pkgproto | awk '{print $1" "$2" "$3" "$4" root bin"}' >> prototype
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrinmkdir $TEMPDIR/pkg
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrinpkgmk -r $TEMPDIR$PREFIX -d $TEMPDIR/pkg
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrincd $current
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrinpkgtrans -s $TEMPDIR/pkg $current/$NAME-$VERSION-$ARCH-local
22dda44322067379eeba28d7ec7fc833cb04c0dfminfringzip $current/$NAME-$VERSION-$ARCH-local
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrinrm -rf $TEMPDIR
22dda44322067379eeba28d7ec7fc833cb04c0dfminfrin