setup.py.mk: update pypi url
[unleashed-userland.git] / components / web / apache24 / Solaris / customization.sh
blobd0860831fcc12de62ae7862bd96937cf555033f3
1 #!/usr/bin/ksh93
4 # CDDL HEADER START
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.
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.
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]
21 # CDDL HEADER END
25 # Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
28 set -o errexit
30 PROTO=$1
31 MACH64=$2
33 CONFDIR=${PROTO}/etc/apache2/2.4
34 MODULES_32_CONF=${CONFDIR}/conf.d/modules-32.load
35 MODULES_64_CONF=${CONFDIR}/conf.d/modules-64.load
36 APACHECTL64=${PROTO}/usr/apache2/2.4/bin/${MACH64}/apachectl
37 APACHE_BUILD_DIR32=${PROTO}/usr/apache2/2.4/build
38 APACHE_BUILD_DIR64=${PROTO}/usr/apache2/2.4/build/${MACH64}
40 mkdir -p ${CONFDIR}/conf.d
41 mkdir -p ${CONFDIR}/samples-conf.d
42 mkdir -p ${PROTO}/lib/svc/method
44 cp Solaris/modules-32.load Solaris/modules-64.load ${CONFDIR}/conf.d
46 # Strip LoadModule directives from httpd.conf.
47 grep -v "^LoadModule " ${CONFDIR}/httpd.conf > ${CONFDIR}/original/httpd.conf
49 # Strip the 32-bit LoadModule directives from httpd.conf and put them in a
50 # separate file.
51 grep "^LoadModule " ${CONFDIR}/httpd.conf >> ${MODULES_32_CONF}
52 sed -f Solaris/loadmodules.sed ${MODULES_32_CONF} > ${MODULES_32_CONF}.new
53 mv ${MODULES_32_CONF}.new ${MODULES_32_CONF}
55 # Strip the 64-bit LoadModule directives from httpd.conf and put them in a
56 # separate file.
57 grep "^LoadModule " ${CONFDIR}/httpd.conf | sed -e "s;/;/64/;g" >> ${MODULES_64_CONF}
58 sed -f Solaris/loadmodules.sed ${MODULES_64_CONF} > ${MODULES_64_CONF}.new
59 mv ${MODULES_64_CONF}.new ${MODULES_64_CONF}
61 # Remove the bundled but disabled (by default) modules from modules-32.load,
62 # modules-64.load and create a sample .conf file for each of them.
63 for i in `sed -e 's/#.*//' -e '/^$/ d' Solaris/disabled-module.list`; do
64 sed -e '/LoadModule.*'${i}'.so/ d' ${MODULES_32_CONF} > ${MODULES_32_CONF}.new
65 mv ${MODULES_32_CONF}.new ${MODULES_32_CONF}
66 sed -e '/LoadModule.*'${i}'.so/ d' ${MODULES_64_CONF} > ${MODULES_64_CONF}.new
67 mv ${MODULES_64_CONF}.new ${MODULES_64_CONF}
68 module_name=`echo ${i} | sed -e 's/^mod_//'`
69 sed -e 's/::MODULE_NAME::/'${module_name}'/g' Solaris/sample-module.tmpl \
70 > ${CONFDIR}/samples-conf.d/${module_name}.conf
71 done
73 # Add MACH64 specific dir info into SMF method.
74 sed "s/::ISAINFO::/\/${MACH64}/" Solaris/http-apache24 > ${PROTO}/lib/svc/method/http-apache24
76 # Add "-D 64" argument into 64 bit apachectl (if it's not there yet).
77 grep OPTS_64 ${APACHECTL64} > /dev/null || ( sed -e '/^case $ACMD in/i\
78 OPTS_64="-D 64bit"\
79 HTTPD="$HTTPD $OPTS_64"\
80 ' ${APACHECTL64} > ${APACHECTL64}.new && mv ${APACHECTL64}.new ${APACHECTL64} )
82 # Since we are delivering mod_sed in separate package we don't want it in
83 # original httpd.conf file.
84 grep sed_module ${CONFDIR}/httpd.conf > /dev/null && \
85 grep -v sed_module ${CONFDIR}/httpd.conf > ${CONFDIR}/httpd.conf.new && \
86 mv ${CONFDIR}/httpd.conf.new ${CONFDIR}/httpd.conf
88 # Remove CBE specific paths for C compiler.
89 for i in ${APACHE_BUILD_DIR32}/config.nice \
90 ${APACHE_BUILD_DIR64}/config.nice \
91 ${APACHE_BUILD_DIR32}/config_vars.mk \
92 ${APACHE_BUILD_DIR64}/config_vars.mk;
94 sed -e '/^.*CC *=/s,/.*/,,' \
95 -e '/^.*CXX *=/s,/.*/,,' \
96 -e '/MKDEP *=/s,/.*/,,' \
97 -e '/\/configure/s,/.*/,.\/,' < ${i} > ${i}.new
98 mv ${i}.new ${i}
99 done
101 # 64 bit rules.mk and special.mk should refer also to 64 bit build files.
102 for i in ${APACHE_BUILD_DIR64}/rules.mk \
103 ${APACHE_BUILD_DIR64}/special.mk
105 sed -e "s/build\/config_vars/build\/${MACH64}\/config_vars/" \
106 -e "s/build\/rules/build\/${MACH64}\/rules/" \
107 -e "s/build\/instdso/build\/${MACH64}\/instdso/" < ${i} > ${i}.new
108 mv ${i}.new ${i}
109 done
110 exit 0