Home | History | Annotate | Download | only in apr-1.3
      1 #!/usr/bin/ksh93
      2 
      3 #
      4 # CDDL HEADER START
      5 #
      6 # The contents of this file are subject to the terms of the
      7 # Common Development and Distribution License (the "License").
      8 # You may not use this file except in compliance with the License.
      9 #
     10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     11 # or http://www.opensolaris.org/os/licensing.
     12 # See the License for the specific language governing permissions
     13 # and limitations under the License.
     14 #
     15 # When distributing Covered Code, include this CDDL HEADER in each
     16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     17 # If applicable, add the following below this CDDL HEADER, with the
     18 # fields enclosed by brackets "[]" replaced with your own identifying
     19 # information: Portions Copyright [yyyy] [name of copyright owner]
     20 #
     21 # CDDL HEADER END
     22 #
     23 
     24 #
     25 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
     26 # Use is subject to license terms.
     27 #
     28 #ident	"@(#)install-apr-64	1.3	09/03/02 SMI"
     29 #
     30 
     31 set -o errexit
     32 
     33 . ${SRC}/tools/install.subr
     34 . ${SRC}/cmd/apr/apr-1.3/apr.build.env
     35 
     36 # functions - search for "START HERE" to find start of control flow
     37 
     38 post_process() {
     39     cd ${LIBDIR}
     40     for i in *.so
     41     do
     42         chmod u+w ${i}
     43         ${SRC}/tools/post_process_so ${i}
     44         chmod u-w ${i}
     45     done
     46 }
     47 
     48 cleanup_crud() {
     49     cd ${LIBDIR}
     50     rm *.la
     51 }
     52 
     53 fix_perms() {
     54     cd ${PREFIX}
     55     APDIRS="bin build include lib"
     56     find ${APDIRS} -type d -exec chmod 755 {} \;
     57     find ${APDIRS} -type f -exec chmod 555 {} \;
     58 
     59     cd ${INCLUDEDIR}
     60     find . -type f -exec chmod 644 {} \;
     61 }
     62 
     63 # create soft link to the utility in ${BINDIR} from /usr/bin/$MACH64
     64 # e.g.,  /usr/bin/amd64/apr-1-config --> /usr/apr/1.3/bin/amd64/apr-1-config
     65 # Also, create symlink "64" to $ISA directory
     66 # e.g., /usr/apr/1.3/bin/64 -> amd64
     67 create_sym_links() {
     68     cd ${BINDIR}
     69     _install L ../../${APR_DIR_PREFIX}/bin/${MACH64}/apr-1-config ${ROOT}/usr/bin/${MACH64}/apr-1-config
     70 
     71     cd ${PREFIX}
     72     for i in `ls -p`; do
     73         if test -d "${i}/${MACH64}"; then
     74             _install L ${MACH64} ${i}/64
     75         fi
     76     done
     77 }
     78 
     79 # replace build environment specific paths 
     80 replace_build_path() {
     81     for dirs in ${BINDIR} ${BUILDDIR}; do
     82         cd ${dirs}
     83         for i in `ls -Lp | grep -v '/$'`; do
     84             sed -e "s;${ROOT};;g" \
     85                 -e "s;-M ${MAPFILE_NOEXSTK} ;;g" \
     86                 -e "s;${SPRO_VROOT}/bin/;;g" \
     87                 -e "s;${APR_SRC_DIR64};${APR_USR_PREFIX};g" < ${i} > ${i}.tmp
     88             cp -f ${i}.tmp ${i}
     89             rm -f ${i}.tmp
     90         done
     91     done
     92 }
     93 
     94 # START HERE - actual script processing starts here
     95 
     96 TOP=`pwd`
     97 
     98 PREFIX=${ROOT}${APR_USR_PREFIX}
     99 INCLUDEDIR=${PREFIX}/include
    100 BINDIR=${PREFIX}/bin/${MACH64}
    101 BUILDDIR=${PREFIX}/build/${MACH64}
    102 LIBDIR=${PREFIX}/lib/${MACH64}
    103 APR_SRC_DIR64=${TOP}/${APR_DIR64}
    104 
    105 post_process
    106 cleanup_crud
    107 replace_build_path
    108 
    109 # all installation should be done before this point, so the functions
    110 # that fixup permissions can get everything that is installed.
    111 fix_perms
    112 create_sym_links
    113 
    114 exit 0
    115