Compiling Apache 2.2.29

#See for building environment, script and other things not defined here.
#Before starting you must declare the environment variables specified at the link above.

#building env vars (required when rebuilding too)
ls -l /tmp/$NEW_BUILD_NAME-*
ls -l ~/ffp_0.7_armv5/packages/$NEW_BUILD_NAME-*

#extract sources
rm -r ~/compile/httpd-2.2.29-unpacked
cd ~/compile && mkdir httpd-2.2.29-unpacked
tar xvzf httpd-2.2.29.tar.gz -C ./httpd-2.2.29-unpacked
cd ~/compile/httpd-2.2.29-unpacked/httpd-2.2.29

#If any additional problems related to libtool see below.
#Modify "" and "configure" (search for: "case $libtoolversion in"):
  case $libtoolversion in
		  LTCFLAGS="-prefer-non-pic -static"
		  //pedro: setez cumva SH_LIBTOOL
		  //SH_LIBTOOL='$(SHELL) $(top_builddir)/shlibtool $(LTFLAGS)' -> comenteaza (nu exista shlibtool)
		  SH_LIBTOOL='/ffp/lib/apr-1.4.8/build-1/libtool $(LTFLAGS)' -> to add

#Enable NPN
cd ~/compile/httpd-2.2.29-unpacked/httpd-2.2.29
wget -O npn.patch
#Modify npn.patch:
	Index: modules/ssl/ssl_engine_kernel.c
	--- modules/ssl/ssl_engine_kernel.c	(revision 1306012)
	+++ modules/ssl/ssl_engine_kernel.c	(working copy)
	@@ -29,5 +29,6 @@
									   time I was too famous.''
												 -- Unknown                */
	 #include "ssl_private.h"
	+#include "mod_ssl.h"
	 static void ssl_configure_env(request_rec *r, SSLConnRec *sslconn);
patch -p0 -i npn.patch

#Enable mod_fcgid
rm -r ~/compile/mod_fcgid
cd ~/compile/
svn checkout mod_fcgid
cp -r ~/compile/mod_fcgid/modules/fcgid ~/compile/httpd-2.2.29-unpacked/httpd-2.2.29/modules/

#Enable WebSocket with mod_proxy_wstunnel
cd ~/compile/httpd-2.2.29-unpacked/httpd-2.2.29
wget -O apache-2.2-wstunnel.patch
patch -p1 -i apache-2.2-wstunnel.patch
#cp -r httpd-2.2.29 httpd-2.2.29-fcgid-npn-wstunnel
#You may encounter some compilation error with version 2.2.22 and later similar to:
#modules/http/.libs/libmod_http.a(byterange_filter.o): In function `ap_set_byterange':
#byterange_filter.c:(.text+0x130d): undefined reference to `apr_array_clear'
#collect2: ld returned 1 exit status
#This is a known bug. A workaround consist in adding --with-included-apr to the configure options.

#configure new added modules (fcgid)
cd ~/compile/httpd-2.2.29-unpacked/httpd-2.2.29
~/ ffpg
~/ ffpg

#start from here when REBUILDING (only if not deleted ~/compile/httpd-2.2.29-unpacked/httpd-2.2.29)
cd ~/compile/httpd-2.2.29-unpacked/httpd-2.2.29
rm -r ../httpd-2.2.29-build
mkdir ../httpd-2.2.29-build

cd ~/compile/httpd-2.2.29-unpacked/httpd-2.2.29-build
../httpd-2.2.29/configure --help > ../
#../httpd-2.2.29/configure --prefix=/ffp/opt/apache-2.2.29-$APACHE_MPM --enable-mods-shared=all --with-apr=/ffp --with-apr-util=/ffp --with-pcre=/ffp --with-z=/ffp --with-ssl=/ffp --with-mpm=$APACHE_MPM --enable-fcgid
../httpd-2.2.29/configure --prefix=/ffp/opt/apache-2.2.29-$APACHE_MPM --enable-modules="log_config mime alias autoindex headers authz_host userdir env setenvif filter authn_file ssl actions dir negotiation auth_basic authz_default authz_user rewrite proxy proxy_http proxy_ajp dav dav_svn authz_svn expires deflate info dav_fs proxy_wstunnel" --enable-mods-shared="fcgid asis authn_default authz_groupfile cache cgi cgid disk_cache file_cache include mem_cache proxy_balancer proxy_connect proxy_ftp proxy_scgi status version" --with-pcre=/ffp --with-z=/ffp --with-ssl=/ffp --with-mpm=$APACHE_MPM --enable-fcgid

#prepare for FFP again
cd ~/compile/httpd-2.2.29-unpacked/httpd-2.2.29-build
~/ ffpg1
cd ~/compile/httpd-2.2.29-unpacked/httpd-2.2.29
~/ ffpg

cd ~/compile/httpd-2.2.29-unpacked/httpd-2.2.29-build
nohup /ffp/bin/make -C ~/compile/httpd-2.2.29-unpacked/httpd-2.2.29-build &
renice -6 `pidof cc1plus` -p `pidof make` -p `pidof as` -p `pidof ld` -p `pidof configure` -p `pidof cc1`
tail -f nohup.out

cd ~/compile/httpd-2.2.29-unpacked/httpd-2.2.29-build
#Running make -n install permits previewing the build process, as it prints out all 
#the commands that would be triggered by a make, without actually executing them.
cp -v /tmp/$NEW_BUILD_NAME-$NEW_BUILD_VER-arm-$NEW_BUILD_NR.txz ~/ffp_0.7_armv5/packages/
funpkg -q $NEW_BUILD_NAME
funpkg -i ~/ffp_0.7_armv5/packages/$NEW_BUILD_NAME-$NEW_BUILD_VER-arm-$NEW_BUILD_NR.txz

#copy additional modules
cd $HOME
sed -i s/"User daemon"/"User nobody"/ /ffp/opt/apache-2.2.29-$APACHE_MPM/conf/httpd.conf
sed -i s/"Group daemon"/"Group nobody"/ /ffp/opt/apache-2.2.29-$APACHE_MPM/conf/httpd.conf
mkdir /ffp/opt/apache-2.2.29-$APACHE_MPM/conf-original
cp -r /ffp/opt/apache-2.2.29-$APACHE_MPM/conf/* /ffp/opt/apache-2.2.29-$APACHE_MPM/conf-original
cp -v /ffp/libexec/ /ffp/opt/apache-2.2.29-$APACHE_MPM/modules/
cp -v /ffp/libexec/ /ffp/opt/apache-2.2.29-$APACHE_MPM/modules/
ls -dl ~/NSA310-backups/*apache-modules*
cp -v ~/NSA310-backups/2015-02-01\ apache-modules\ worker/*.so /ffp/opt/apache-2.2.29-$APACHE_MPM/modules/
ls -dl ~/NSA310-backups/*pagespeed*
cp -v ~/NSA310-backups/2015-01-23\ pagespeed\ trunk/*.so /ffp/opt/apache-2.2.29-$APACHE_MPM/modules/

#lists configured httpd modules:
#/usr/sbin/httpd -M -f /etc/service_conf/httpd.conf
#/ffp/opt/apache-2.2.29-worker/bin/httpd -M -f /etc/service_conf/xhttpd.conf
#lists built-in httpd modules:
#/usr/sbin/httpd -l
#/ffp/opt/apache-2.2.29-worker/bin/httpd -l

#owncloud, apache, php-zts and fcgid
#If fcgid is not a shared module (--enable-mods-shared) than after logging off 
#from owncloud you won't be able to login again (you'll have to restart apache).
#Does not have this problem when using php-non-zts.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.