From 25e7ba8f11aad8f3f86f4ce2e996c39506ea3889 Mon Sep 17 00:00:00 2001 From: Graham Leggett Date: Mon, 27 Feb 2012 22:57:18 +0000 Subject: [PATCH] AIX: Add build scripts for AIX. Submitted by: Michael Felt git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@1294380 13f79535-47bb-0310-9956-ffa450edef68 --- build/aix/README | 38 ++++++++ build/aix/aixinfo | 16 ++++ build/aix/buildaix.ksh | 124 ++++++++++++++++++++++++ build/aix/mkinstallp.ksh | 200 +++++++++++++++++++++++++++++++++++++++ config.layout | 24 +++++ 5 files changed, 402 insertions(+) create mode 100644 build/aix/README create mode 100644 build/aix/aixinfo create mode 100755 build/aix/buildaix.ksh create mode 100755 build/aix/mkinstallp.ksh diff --git a/build/aix/README b/build/aix/README new file mode 100644 index 00000000000..470ce2be1c7 --- /dev/null +++ b/build/aix/README @@ -0,0 +1,38 @@ +The script buildaix.ksh will attempt to build a AIX installp fileset +out of a source tree for ASF project + +REQUIREMENTS: + Fileset Level State Type Description (Uninstaller) + ---------------------------------------------------------------------------- + bos.adt.insttools 5.3.7.2 C F Tool to Create installp + Packages + Fileset Level State Type Description (Uninstaller) + ---------------------------------------------------------------------------- + rpm.rte 3.0.5.41 C F RPM Package Manager + +Additional: +Preferred: download zlib sources and copy zlib.h and zconf.h to /opt/include +and, if configure cannot find them directly, add symbolic links from /usr/include to /opt/include + +To build a package, make sure you are in the root of the source tree, +and run: + +build/aix/buildaix.ksh + +An AIX fileset named $PKG.$NAME.$ARCH.$VERSION.I will be +created in the build/aix directory. the .template file created is also there. + +KNOWN issues: +on AIX libtool is known to have issues with the install command. +Some of these issues have been resolved by extracting the apr/apu utilities +from the projects (i.e. NOT using the embedded version) +In case of problems I recommend that you install the GNU 'install' program (part of coreutils) +If make DESTDIR=$TEMPDIR install command continues to fail, try 'make install' and then run +the buildaix.ksh command again + +TODO +Add Copyright display/banner +Add Apache LICENSE to fileset and require acceptance +Add special instructions for TCB - to ignore /etc/* /var/httpd/htdocs/* +Add _config_i scripts to setup autostart +Add _pre_i scripts to verify pre-requisites, required users/groups, etc. diff --git a/build/aix/aixinfo b/build/aix/aixinfo new file mode 100644 index 00000000000..58ac3a1d3e0 --- /dev/null +++ b/build/aix/aixinfo @@ -0,0 +1,16 @@ + +PKG="ASF" +NAME="httpd" +ARCH="powerpc" +VERSION="2.2.22" +CATEGORY="application" +VENDOR="Apache Software Foundation" +EMAIL="dev@httpd.apache.org" +VMMN=`build/get-version.sh mmn include/ap_mmn.h MODULE_MAGIC_NUMBER` +REVISION=`build/get-version.sh all include/ap_release.h AP_SERVER` +VERSION=`echo $REVISION | cut -d- -s -f1` +RELEASE=`echo $REVISION | cut -d- -s -f2` +if [ "x$VERSION" = "x" ]; then + VERSION=$REVISION + RELEASE=0 +fi diff --git a/build/aix/buildaix.ksh b/build/aix/buildaix.ksh new file mode 100755 index 00000000000..ec7c19eae90 --- /dev/null +++ b/build/aix/buildaix.ksh @@ -0,0 +1,124 @@ +#!/usr/bin/ksh +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# + +# buildaix.ksh: This script builds an AIX fileset of Apache httpd + +# if arguments - try to run fast +cmd=$0 + +export CFLAGS='-O2' + +lslpp -L bos.adt.insttools >/dev/null + [[ $? -ne 0 ]] && echo "must have bos.adt.insttools installed" && exit -1 + +apr_config=`which apr-1-config` +apu_config=`which apu-1-config` + +if [[ -z ${apr_config} && -z ${apu_config} ]] +then + export PATH=/opt/bin:${PATH} + apr_config=`which apr-1-config` + apu_config=`which apu-1-config` +fi + +while test $# -gt 0 +do + # Normalize + case "$1" in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case "$1" in + --with-apr=*) + apr_config=$optarg + ;; + esac + + case "$1" in + --with-apr-util=*) + apu_config=$optarg + ;; + esac + + shift + argc-- +done + +if [ ! -f "$apr_config" -a ! -f "$apr_config/configure.in" ]; then + echo "The apr source directory / apr-1-config could not be found" + echo "If available, install the ASF.apu.rte and ASF.apr.rte filesets" + echo "Usage: $cmd [--with-apr=[dir|file]] [--with-apr-util=[dir|file]]" + exit 1 +fi + +if [ ! -f "$apu_config" -a ! -f "$apu_config/configure.in" ]; then + echo "The apu source directory / apu-1-config could not be found" + echo "If available, install the ASF.apu.rte and ASF.apr.rte filesets" + echo "Usage: $cmd [--with-apr=[dir|file]] [--with-apr-util=[dir|file]]" + exit 1 +fi + +. build/aix/aixinfo +LAYOUT=AIX +TEMPDIR=/var/tmp/$USER/${NAME}.${VERSION} +rm -rf $TEMPDIR + +if [[ ! -e ./Makefile ]] # if Makefile exists go faster +then + echo "+ ./configure \n\ + --enable-layout=$LAYOUT \n\ + --with-apr=$apr_config \n\ + --with-apr-util=$apu_config \n\ + --with-mpm=worker \n\ + --enable-ssl \n\ + --enable-mods-shared=all > build/aix/configure.out" + ./configure \ + --enable-layout=$LAYOUT \ + --with-apr=$apr_config \ + --with-apr-util=$apu_config \ + --with-mpm=worker \ + --enable-ssl \ + --enable-mods-shared=all > build/aix/configure.out + [[ $? -ne 0 ]] && echo './configure' returned an error && exit -1 +else + echo $0: using existing Makefile + echo $0: run make distclean to get a standard AIX configure + echo + ls -l ./Makefile config.* + echo +fi + +echo "+ make > build/aix/make.out" +make > build/aix/make.out + [[ $? -ne 0 ]] && echo 'make' returned an error && exit -1 + +echo "+ make install DESTDIR=$TEMPDIR > build/aix/install.out" +make install DESTDIR=$TEMPDIR > build/aix/install.out + [[ $? -ne 0 ]] && echo 'make install' returned an error && exit -1 + +echo "+ build/aix/mkinstallp.ksh $TEMPDIR > build/aix/mkinstallp.out" +build/aix/mkinstallp.ksh $TEMPDIR > build/aix/mkinstallp.out + [[ $? -ne 0 ]] && echo mkinstallp.ksh returned an error && exit -1 + +rm -rf $TEMPDIR + +# list installable fileset(s) +echo ======================== +installp -d build/aix -L +echo ======================== diff --git a/build/aix/mkinstallp.ksh b/build/aix/mkinstallp.ksh new file mode 100755 index 00000000000..90e89ed5b7d --- /dev/null +++ b/build/aix/mkinstallp.ksh @@ -0,0 +1,200 @@ +#!/usr/bin/ksh +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# + +# minstallp.ksh # create an installp image of ${NAME} (defined in aixinfo) +# from TEMPDIR using mkinstallp (part of bos.adt.insttools) + +[[ $# == 0 ]] && echo $0: Syntax error && echo "Syntax: $0 " && exit -1 + +umask 022 +TEMPDIR=$1 +BASE=`pwd` +cd ${TEMPDIR} +[[ $? != 0 ]] && echo $0: ${TEMPDIR} -- bad directory && exit -1 + +# clean up side-effects from DEBUG passes - usr/local might be there as +# a circular link i.e. usr/local points at /usr/local +# as we are not using /usr/local for ASF packaging, remove it! +# mkinstallp seems to make usr/local -> /usr/local +[[ -f usr/local ]] && rm -f usr/local && echo removed unexpected usr/local !! +[[ -L usr/local ]] && rm -f usr/local && echo removed unexpected usr/local !! +[[ -d usr/local ]] && rm -rf usr/local && echo removed unexpected usr/local !! + +# use the aixinfo for PKG NAME VERSION etc labels +cd ${BASE} +. build/aix/aixinfo +# INFO=${BASE}/build/aix/.info +# mkdir -p $INFO +INFO=${BASE}/build/aix +template=${INFO}/${PKG}.${NAME}.${VERSION}.template +>$template + +# mkinstallp template definitions +# TODO: add AIX oslevel/uname information for package filename +package=$PKG +name=$NAME +vrmf=$VERSION +release=$RELEASE +descr="$NAME version ${VERSION} for $ARCH ${VENDOR}" + +# copy LICENSE information +# TODO: setup template so that license acceptance is required +# TODO: add Copyright Information for display during install +mkdir -p ${TEMPDIR}/usr/swlag/en_US +cp ${BASE}/LICENSE ${TEMPDIR}/usr/swlag/en_US/${PKG}.${NAME}.la + +cd ${TEMPDIR} +# remove files we do not want as "part" possibly +# left-over from a previous packaging +rm -rf .info lpp_name tmp usr/lpp +[[ $? -ne 0 ]] && echo $cmd: cleanup error && pwd && ls -ltr && exit -1 + +#if we are going to add extra symbolic links - do it now +[[ -r build/aix/aixlinks ]] && ksh build/aix/aixlinks + +# get the directory sizes in blocks +for d in etc opt var +do + if [[ -d $d/${NAME} ]] + then + set `du -s $d/${NAME}` + else + [[ -d $d ]] && set `du -s $d` + fi + # make sure the argument exists before using setting values + if [[ -d $d ]] + then + eval nm$d=/"$2" + let sz$d=$1 + fi +done + +files=./${NAME}.${VERSION} +cd ${TEMPDIR}/.. +find ${files} -type d -exec chmod og+rx {} \; +chmod -R go+r ${files} +chown -R 0.0 ${files} + +cat - <>$template +Package Name: ${PKG}.${NAME} +Package VRMF: ${VERSION}.${RELEASE} +Update: N +Fileset + Fileset Name: ${PKG}.${NAME}.rte + Fileset VRMF: ${VERSION}.${RELEASE} + Fileset Description: ${descr} + USRLIBLPPFiles + EOUSRLIBLPPFiles + Bosboot required: N + License agreement acceptance required: N + Name of license agreement: + Include license files in this package: N + Requisites: +EOF + +[[ $szetc -ne 0 ]] && echo " Upsize: ${nmetc} $szetc;" >> $template +[[ $szopt -ne 0 ]] && echo " Upsize: ${nmopt} $szopt;" >> $template +[[ $szvar -ne 0 ]] && echo " Upsize: ${nmvar} $szvar;" >> $template +echo " USRFiles" >> $template + +# USR part -- i.e. files in /usr and /opt +cd ${TEMPDIR}/.. +find ${files}/usr/swlag ${files}/opt \ + | sed -e s#^${files}## | sed -e "/^$/d" >>$template +echo " EOUSRFiles" >> $template + +if [[ $szetc -gt 0 || $szvar -gt 0 ]] +then +INSTROOT=${TEMPDIR}/usr/lpp/${PKG}.${NAME}/inst_root +mkdir -p ${INSTROOT} +cd ${TEMPDIR} +[[ $szetc -gt 0 ]] && find ./etc -type d | backup -if - | (cd ${INSTROOT}; restore -xqf -) >/dev/null +[[ $szvar -gt 0 ]] && find ./var -type d | backup -if - | (cd ${INSTROOT}; restore -xqf -) >/dev/null +cat - <>$template + ROOT Part: Y + ROOTFiles +EOF + +# ROOT part +cd ${TEMPDIR}/.. +find ${files}/etc ${files}/var \ + | sed -e s#^${files}## | sed -e "/^$/d" >>$template +else +# no ROOT parts to include +cat - <>$template + ROOT Part: N + ROOTFiles +EOF +fi +cat - <>$template + EOROOTFiles + Relocatable: N +EOFileset +EOF +# man pages as seperate fileset +cd ${TEMPDIR} +if [[ -d usr/share/man ]] +then + # manual pages, space required calculation + set `du -s usr/share/man` + szman=$1 + descr="$NAME ${VERSION} man pages ${VENDOR}" + cat - <>$template +Fileset + Fileset Name: ${PKG}.${NAME}.man.en_US + Fileset VRMF: ${VERSION}.${RELEASE} + Fileset Description: ${descr} + USRLIBLPPFiles + EOUSRLIBLPPFiles + Bosboot required: N + License agreement acceptance required: N + Name of license agreement: + Include license files in this package: N + Requisites: +EOF + + echo " Upsize: /usr/share/man ${szman};" >> $template + echo " USRFiles" >> $template + cd ${TEMPDIR}/.. + find ${files}/usr/share | sed -e s#^${files}## | sed -e "/^$/d" >>$template + cat - <>$template + EOUSRFiles + ROOT Part: N + ROOTFiles + EOROOTFiles + Relocatable: N +EOFileset +EOF +fi + +# use mkinstallp to create the fileset. result is in ${TEMPDIR}/tmp +# must actually sit in TEMPDIR for ROOT part processing to succeed +# also - need "empty" directories to exist, as they do not get copied +# in the inst_root part +cd ${TEMPDIR} +mkinstallp -d ${TEMPDIR} -T ${template} +[[ $? -ne 0 ]] && echo mkinstallp returned error status && exit -1 + +# copy package to build/aix +# create TOC +cp ${TEMPDIR}/tmp/$PKG.$NAME.$VERSION.0.bff ${BASE}/build/aix +cd ${BASE}/build/aix +rm -f $PKG.$NAME.$VERSION.$ARCH.I +mv $PKG.$NAME.$VERSION.0.bff $PKG.$NAME.$ARCH.$VERSION.I +rm -f .toc +inutoc . diff --git a/config.layout b/config.layout index 03cb8f5930a..79f7ab5752f 100644 --- a/config.layout +++ b/config.layout @@ -322,3 +322,27 @@ installbuilddir: ${prefix}/etc/apache2/build errordir: ${datadir}/error + +# AIX layout + + prefix: /opt/httpd + exec_prefix: /opt/httpd + bindir: ${exec_prefix}/bin + sbindir: ${exec_prefix}/sbin + libdir: ${exec_prefix}/lib + libexecdir: ${exec_prefix}/libexec + mandir: /usr/share/man + sysconfdir: /etc/httpd + datadir: /var/httpd + installbuilddir: ${datadir}/build + errordir: ${datadir}/error + htdocsdir: ${datadir}/htdocs + cgidir: ${datadir}/cgi-bin + iconsdir: ${prefix}/icons + manualdir: ${prefix}/manual + includedir: ${prefix}/include + localstatedir: /var/httpd + runtimedir: ${localstatedir}/run + logfiledir: ${localstatedir}/logs + proxycachedir: ${localstatedir}/proxy + -- 2.47.2