#!/usr/bin/ksh93
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "@(#)install-apr-util-32 1.2 09/03/02 SMI"
#
set -o errexit
. ${SRC}/tools/install.subr
. ${SRC}/cmd/apr-util/apr-util-1.3/apr-util.build.env
# functions - search for "START HERE" to find start of control flow
post_process() {
cd ${LIBDIR}
for i in *.so
do
chmod u+w ${i}
/usr/bin/ksh ${SRC}/tools/post_process_so.ksh ${i}
chmod u-w ${i}
done
}
cleanup_crud() {
for dirs in ${LIBDIR} ${LIBDIR}/apr-util-1
do
/usr/bin/rm -f ${dirs}/*.la
done
}
fix_perms() {
cd ${PREFIX}
APUDIRS="bin include lib"
find ${APUDIRS} -type d -exec chmod 755 {} \;
find ${APUDIRS} -type f -exec chmod 555 {} \;
cd ${INCLUDEDIR}
find . -type f -exec chmod 644 {} \;
}
# Install the APR-util manual generated using the doxygen
# tool. APR-util does not by default provide any documents
install_doc() {
if test ! -d ${DOCDIR}; then
mkdir ${DOCDIR}
fi
cd ${DOCDIR}
cat ${TOP}/Solaris/apr-util-1.3.docs.tar.gz | gunzip | tar xf -
}
# create soft link to the utility in ${BINDIR} from /usr/bin
# e.g., /usr/bin/apu-1-config --> /usr/apr-util/1.3/bin/apu-1-config
create_bin_link() {
cd ${BINDIR}
_install L ../${APR_UTIL_DIR_PREFIX}/bin/apu-1-config ${ROOT}/usr/bin/apu-1-config
}
# replace build environment specific paths
replace_build_path() {
cd ${BINDIR}
for i in `ls -Lp | grep -v '/$'`; do
sed -e "s;${ROOT};;g" \
-e "s;${APR_UTIL_SRC_DIR32};${APR_UTIL_USR_PREFIX};g" < ${i} > ${i}.tmp
cp -f ${i}.tmp ${i}
rm -f ${i}.tmp
done
}
# START HERE - actual script processing starts here
TOP=`pwd`
PREFIX=${ROOT}${APR_UTIL_USR_PREFIX}
INCLUDEDIR=${PREFIX}/include
BINDIR=${PREFIX}/bin
LIBDIR=${PREFIX}/lib
DOCDIR=${PREFIX}/manual
APR_UTIL_SRC_DIR32=${SRC}/cmd/apr-util/apr-util-${APR_UTIL_VERSION_DIR}/${APR_UTIL_DIR32}
post_process
cleanup_crud
install_doc
replace_build_path
# all installation should be done before this point, so the functions
# that fixup permissions can get everything that is installed.
fix_perms
create_bin_link
exit 0