Index: build/aix/buildaix.ksh
===================================================================
--- build/aix/buildaix.ksh	(revision 1616215)
+++ build/aix/buildaix.ksh	(working copy)
@@ -22,16 +22,27 @@
 cmd=$0
 
 export CFLAGS='-O2'
+err=0
+zflag=""
 
 lslpp -L bos.adt.insttools >/dev/null
  [[ $? -ne 0 ]] && echo "must have bos.adt.insttools installed" && exit -1
 
+[[ ! -e /usr/include/zlib.h && ! -e /opt/freeware/include/zlib.h && ! -e /opt/include/zlib.h ]] &&  \
+	[[ -e /opt/freeware/lib/libz.a ]] && \
+		CFLAGS=${CFLAGS}\ -I./build/aix/include && \
+		zflag=--with-z=`pwd`/build/aix && \
+		export LDFLAGS=${LDFLAGS}\ -L/opt/freeware/lib
+
+
+oPATH=$PATH
+export PATH=${PATH}:/opt/apr/bin
 apr_config=`which apr-1-config`
 apu_config=`which apu-1-config`
+export PATH=${oPATH}
 
-if [[ -z ${apr_config} && -z ${apu_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
@@ -81,14 +92,14 @@
 
 if [[ ! -e ./Makefile ]] # if Makefile exists go faster
 then
-	echo "+ ./configure \n\
+	echo "+ ./configure CFLAGS="${CFLAGS}" ${zflag} \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 \
+	./configure CFLAGS="${CFLAGS}" ${zflag} \
 		--enable-layout=$LAYOUT \
 		--with-apr=$apr_config \
 		--with-apr-util=$apu_config \
@@ -108,10 +119,28 @@
 make > build/aix/make.out
  [[ $? -ne 0 ]] && echo 'make' returned an error && exit -1
 
+# modify User/Group
+/usr/bin/ed <<EOF
+e ./docs/conf/httpd.conf
+/^User/s/daemon/httpd/p
+/^Group/s/daemon/httpd/p
+w
+q
+EOF
+
 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
 
+# copy auto start/stop in rc2.d
+echo mkdir -p $TEMPDIR/etc/rc.d/rc2.d
+mkdir -p $TEMPDIR/etc/rc.d/rc2.d
+(cd build/aix; find ./rc2.d | backup -if -) | (cd $TEMPDIR/etc/rc.d; restore -xqf -)
+mkdir -p ${TEMPDIR}/usr/sbin
+cd ${TEMPDIR}/usr/sbin
+ln -s ../../opt/httpd/sbin/apachectl apachectl
+cd -
+
 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
@@ -120,5 +149,5 @@
 
 # list installable fileset(s)
 echo ========================
-installp -d build/aix -L
+installp -d installp/ppc -L
 echo ========================
Index: build/aix/mkinstallp.ksh
===================================================================
--- build/aix/mkinstallp.ksh	(revision 1616215)
+++ build/aix/mkinstallp.ksh	(working copy)
@@ -50,13 +50,16 @@
 name=$NAME
 vrmf=$VERSION
 release=$RELEASE
-descr="$NAME version ${VERSION} for $ARCH ${VENDOR}"
+ts=`date -u +"%Y-%m-%d %H%M.%S"`
+descr="${ts} ${NAME}"
 
 # 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
+LARDIR=${TEMPDIR}/usr/swlag/${NAME}/${VERSION}/en_US
+LAR=/usr/swlag/${NAME}/${VERSION}/en_US/${NAME}.la
+mkdir -p ${LARDIR}/usr/swlag/${NAME}/${VERSION}/en_US
+/usr/bin/cp ${BASE}/LICENSE ${LARDIR}/${NAME}.la
 
 cd ${TEMPDIR}
 # remove files we do not want as "part" possibly
@@ -84,11 +87,29 @@
 	fi
 done
 
+# set package permissions - no/minimal other access
 files=./${NAME}.${VERSION}
 cd ${TEMPDIR}/..
+
+chmod -R g+r,o-w ${files}
 find ${files} -type d -exec chmod og+rx {} \;
-chmod -R go+r ${files}
-chown -R 0.0 ${files}
+
+# add r access for /usr/share /usr/*bin /usr/swlag and /opt/httpd/"others"
+chmod -R o+r ${files}/usr
+
+chmod -R o+r ${files}/opt/httpd/manual ${files}/opt/httpd/include ${files}/opt/httpd/icons
+
+# set user/owner to httpd:httpd (for tcb inventory, e.g.)
+lsgroup httpd >/dev/null
+[[ $? -ne 0 ]] && mkgroup -R files -a httpd
+lsuser httpd >/dev/null
+[[ $? -ne 0 ]] && mkuser -R files -a pgrp=httpd shell=/bin/false httpd
+chown -R httpd.httpd ${files}/var ${files}/opt ${files}/usr/share
+
+LIBCVRML=`lslpp -Lqc bos.rte.libc | awk -F: ' { print $3 } ' | awk -F. ' { print $1 "." $2 ".0.0" } '`
+CONFIG_PATH=${BASE}/build/aix/httpd.rte.config
+
+#  Name of license agreement: LAR./ASF.httpd/2.2.26/en_US/httpd.la
 
 cat - <<EOF >>$template
 Package Name: ${PKG}.${NAME}
@@ -99,12 +120,14 @@
   Fileset VRMF: ${VERSION}.${RELEASE}
   Fileset Description: ${descr}
   USRLIBLPPFiles
+  Configuration Script: ${CONFIG_PATH}
   EOUSRLIBLPPFiles
   Bosboot required: N
-  License agreement acceptance required: N
-  Name of license agreement: 
-  Include license files in this package: N
-  Requisites:
+  License agreement acceptance required: Y
+  Name of license agreement: LAR${LAR}
+  Include license files in this package: Y
+  License file path: LAF${LAR}
+  Requisites: *prereq bos.rte.libc ${LIBCVRML};
 EOF
 
 [[ $szetc -ne 0 ]] && echo "        Upsize: ${nmetc} $szetc;" >> $template
@@ -114,7 +137,7 @@
 
 # USR part -- i.e. files in /usr and /opt
 cd ${TEMPDIR}/..
-find ${files}/usr/swlag ${files}/opt \
+find ${files}/usr/*bin ${files}/usr/swlag ${files}/opt \
 	| sed -e s#^${files}## | sed -e "/^$/d" >>$template
 echo "  EOUSRFiles" >> $template
 
@@ -153,7 +176,7 @@
 	# manual pages, space required calculation
 	set `du -s usr/share/man`
 	szman=$1
-	descr="$NAME ${VERSION} man pages ${VENDOR}"
+	descr="${ts} ${NAME} man pages"
 	cat - <<EOF >>$template
 Fileset
   Fileset Name: ${PKG}.${NAME}.man.en_US
@@ -192,8 +215,9 @@
 
 # copy package to build/aix
 # create TOC
-cp ${TEMPDIR}/tmp/$PKG.$NAME.$VERSION.0.bff ${BASE}/build/aix
-cd ${BASE}/build/aix
+mkdir -p ${BASE}/installp/ppc
+cp ${TEMPDIR}/tmp/$PKG.$NAME.$VERSION.0.bff ${BASE}/installp/ppc
+cd ${BASE}/installp/ppc
 rm -f $PKG.$NAME.$VERSION.$ARCH.I
 mv $PKG.$NAME.$VERSION.0.bff $PKG.$NAME.$ARCH.$VERSION.I
 rm -f .toc
Index: build/aix/README
===================================================================
--- build/aix/README	(revision 1616215)
+++ build/aix/README	(working copy)
@@ -1,5 +1,9 @@
-The script buildaix.ksh will attempt to build a AIX installp fileset
-out of a source tree for ASF project
+The script buildaix.ksh will package Apache Software Foundation HTTPD
+as an AIX installp (or bff) package in the directory ./installp/ppc
+The script mkinstallp.ksh creates the template for the AIX commands
+/usr/sbin/mkinstallp and /usr/sbin/makebff.pl
+
+FYI: these scripts are also available in a more generic form - see below
 
 REQUIREMENTS:
   Fileset                      Level  State  Type  Description (Uninstaller)
@@ -10,9 +14,16 @@
   ----------------------------------------------------------------------------
   rpm.rte                   3.0.5.41    C     F    RPM Package Manager
 
-Additional:
+ZLIB aka libz
+This is normally installed during installation via rpm.rte.
+However, there are no include files installed, namely zlib.h and zconf.h
+The build script checks for these files in /usr/include; /opt/freeware/include and /opt/include
+If not found the flag -I ./build/aix/include is included
+
+Optional:
 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
+Or, install aixtools.zlib.rte (from http://dl.aixtools.rte/tools)
 
 To build a package, make sure you are in the root of the source tree,
 and run:
@@ -20,15 +31,25 @@
 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.
+created in the installp/ppc directory.
+The .template file created is stored in build/aix
 
-KNOWN issues:
-on AIX libtool is known to have issues with the install command.
+KNOWN issues with packaging on AIX
+on AIX the interaction of apr and libtool is known to have issues with
+the install command when installing to a alturnate directory (i.e. using DISTDIR).
 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
+from the projects (i.e. NOT using the embedded version). For buildaix.ksh depends
+on make to a DESTDIR so it seems the only solid recourse is to install coreutils.
+A working version is available at http://dl.aixtools.net/tools/aixtools.coreutils.powerpc.8.15.0.I
+
+Suggestions
+If make DESTDIR=$TEMPDIR install command continues to fail, try 'make install' normally
+and then run the build/aix/buildaix.ksh command again
+
+Also: the project buildaix on sourceforge or at http://dl.aixtools.net/tools
+has a generic buildaix. The generic version (/opt/bin/buildaix.ksh) calls the
+an application specific ./build/aix/buildaix.ksh one so you can get used to using
+the generic command: buildaix (/usr/bin/buildaix)
 
 TODO
 Add Copyright display/banner
@@ -36,3 +57,4 @@
 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.
+Add modify User/Group from daemon/daemon to httpd/httpd
Index: build/aix/aixinfo
===================================================================
--- build/aix/aixinfo	(revision 1616215)
+++ build/aix/aixinfo	(working copy)
@@ -1,8 +1,6 @@
-
 PKG="ASF"
 NAME="httpd"
-ARCH="powerpc"
-VERSION="2.2.22"
+ARCH="ppc"
 CATEGORY="application"
 VENDOR="Apache Software Foundation"
 EMAIL="dev@httpd.apache.org"
