Compiling Apache 2.2.9

rm -r ~/compile/httpd-2.2.9-unpacked
cd ~/compile && mkdir httpd-2.2.9-unpacked
tar xvzf httpd-2.2.9.tar.gz -C ./httpd-2.2.9-unpacked
cd ~/compile/httpd-2.2.9-unpacked/httpd-2.2.9

find . -type f \( -exec sed -i s/"\/usr\/bin\/bash"/"\/ffp\/bin\/bash"/ {} \; , -exec sed -i s/"\/usr\/bin\/sh"/"\/ffp\/bin\/sh"/ {} \; , -exec sed -i s/"\/usr\/bin\/env"/"\/ffp\/bin\/env"/ {} \; , -exec sed -i s/"\/bin\/bash"/"\/ffp\/bin\/bash"/ {} \; , -exec sed -i s/"\/bin\/sh"/"\/ffp\/bin\/sh"/ {} \; , -exec sed -i s/"\/bin\/env"/"\/ffp\/bin\/env"/ {} \; , -exec sed -i s/"\/ffp\/ffp\/"/"\/ffp\/"/ {} \; \)
./configure --help > ../configure.help.txt

De modificat in "configure.in" si "configure" (cauta: case $libtoolversion in):
  case $libtoolversion in
	  *1.[45]*)
		  SH_LIBTOOL='$(LIBTOOL)'
		  SHLTCFLAGS="-prefer-pic"
		  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
		  SHLTCFLAGS=""
		  LTCFLAGS=""
		  ;;
  esac

#start from here when rebuilding
cd ~/compile/httpd-2.2.9-unpacked/httpd-2.2.9
rm -r ../httpd-2.2.9-build
mkdir ../httpd-2.2.9-build
cd ../httpd-2.2.9-build
#export CFLAGS="-march=armv5te -mtune=xscale -mfloat-abi=soft -mfpu=vfp -mabi=aapcs-linux -lintl -Wall"
export LDFLAGS="-L/ffp/lib -lintl"
export CPPFLAGS="-I/ffp/include -I/ffp/include/readline"
export CXXFLAGS="-I/ffp/include -I/ffp/include/readline"
export CFLAGS="-march=armv5te -mtune=xscale -mfloat-abi=soft -mabi=aapcs-linux -O2 -lintl -Wall -D_APACHE_MPM_DIR=\"server/mpm/prefork\" -D_APR_HAS_SENDFILE -D_APR_HAS_MMAP -D_APR_HAVE_IPV6 -D_APR_USE_SYSVSEM_SERIALIZE -D_APR_USE_PTHREAD_SERIALIZE -D_SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D_APR_HAS_OTHER_CHILD -D_AP_HAVE_RELIABLE_PIPED_LOGS -D_DYNAMIC_MODULE_LIMIT=128 -D_HTTPD_ROOT=\"/ffp/opt/apache-2.2.9\" -D_SUEXEC_BIN=\"/ffp/opt/apache-2.2.9/bin/suexec\" -D_DEFAULT_PIDLOG=\"logs/httpd.pid\" -D_DEFAULT_SCOREBOARD=\"logs/apache_runtime_status\" -D_DEFAULT_LOCKFILE=\"logs/accept.lock\" -D_DEFAULT_ERRORLOG=\"logs/error_log\" -D_AP_TYPES_CONFIG_FILE=\"conf/mime.types\" -D_SERVER_CONFIG_FILE=\"conf/httpd.conf\""
#export CFLAGS="-march=armv5te -mfloat-abi=soft -mfpu=vfp -mabi=aapcs-linux -O2 -lintl -Wall -D_APACHE_MPM_DIR=\"server/mpm/prefork\" -D_APR_HAS_SENDFILE -D_APR_HAS_MMAP -D_APR_HAVE_IPV6 -D_APR_USE_SYSVSEM_SERIALIZE -D_APR_USE_PTHREAD_SERIALIZE -D_SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D_APR_HAS_OTHER_CHILD -D_AP_HAVE_RELIABLE_PIPED_LOGS -D_DYNAMIC_MODULE_LIMIT=128 -D_HTTPD_ROOT=\"/ffp/opt/apache-2.2.9\" -D_SUEXEC_BIN=\"/ffp/opt/apache-2.2.9/bin/suexec\" -D_DEFAULT_PIDLOG=\"logs/httpd.pid\" -D_DEFAULT_SCOREBOARD=\"logs/apache_runtime_status\" -D_DEFAULT_LOCKFILE=\"logs/accept.lock\" -D_DEFAULT_ERRORLOG=\"logs/error_log\" -D_AP_TYPES_CONFIG_FILE=\"conf/mime.types\" -D_SERVER_CONFIG_FILE=\"conf/httpd.conf\""

#firmware apache configuration + dav_svn
#../httpd-2.2.9/configure --prefix=/ffp/opt/apache-2.2.9-prefork --with-mpm=prefork --with-ssl=/ffp/opt/openssl-0.9.8y --enable-modules="authn_file authn_default authz_host authz_groupfile authz_user authz_default auth_basic include filter log_config env headers setenvif ssl http mime status autoindex asis cgi negotiation dir actions userdir alias" --enable-mods-shared="rewrite proxy proxy_httpd dav dav_fs dav_svn"

#configuration for a lot of shared libraries
../httpd-2.2.9/configure --prefix=/ffp/opt/apache-2.2.9 --enable-so --with-mpm=prefork --with-z=/ffp --with-pcre=/ffp --with-apr=/ffp --with-apr-util=/ffp --enable-mods-shared=all --enable-dav --enable-proxy --enable-proxy-ajp --enable-cgi --enable-rewrite --enable-ssl --with-ssl=/ffp/opt/openssl-0.9.8y --enable-cache --enable-file-cache --enable-disk-cache --enable-mem-cache

#nohup /ffp/bin/make -C ~/compile/httpd-2.2.9-unpacked/httpd-2.2.9-build V=1 &
nohup /ffp/bin/make -C ~/compile/httpd-2.2.9-unpacked/httpd-2.2.9-build &
renice -14 `pidof cc1plus` -p `pidof make` -p `pidof as`
tail -f nohup.out
#make install DESTDIR=/ffp/opt/apache-2.2.9/
#Running make -n permits previewing the build process, as it prints out all the commands that would be triggered by a make, without actually executing them.
#make -n install	
rm -r /ffp/opt/apache-2.2.9
make install
#/ffp/opt/apache-2.2.9/bin/apxs -q sbindir -> daca afiseaza si /ffp/opt/apache-2.2.9/bin atunci e ok 
sed -i s/"User daemon"/"User nobody"/ /ffp/opt/apache-2.2.9/conf/httpd.conf
sed -i s/"Group daemon"/"Group nobody"/ /ffp/opt/apache-2.2.9/conf/httpd.conf
mkdir /ffp/opt/apache-2.2.9/conf-original
cp -r /ffp/opt/apache-2.2.9/conf/* /ffp/opt/apache-2.2.9/conf-original

#diff -r -i -b -B --brief /ffp/opt/apache-2.2.9-19.08.2014/modules/ /ffp/opt/apache-2.2.9/modules/ > diff.txt
cp -v /ffp/opt/svn185/libexec/mod_authz_svn.so /ffp/opt/apache-2.2.9/modules/
cp -v /ffp/opt/svn185/libexec/mod_dav_svn.so /ffp/opt/apache-2.2.9/modules/
ls -dl ~/NSA310-backups/*apache-modules*
cp -v ~/NSA310-backups/2014-08-19\ apache-modules/*.so /ffp/opt/apache-2.2.9/modules/
cp -v ~/NSA310-backups/2014-08-19\ apache-modules/passwords /ffp/opt/apache-2.2.9/
ls -dl ~/NSA310-backups/*pagespeed*
cp -v ~/NSA310-backups/2014-10-15\ pagespeed\ trunk/*.so /ffp/opt/apache-2.2.9/modules/

#tar cfJv apache-2.2.9.txz /ffp/opt/apache-2.2.9 -> simply archive
rm -r ~/temp/apache-2.2.9
mkdir -p ~/temp/apache-2.2.9/ffp/opt/
cp -r /ffp/opt/apache-2.2.9 ~/temp/apache-2.2.9/ffp/opt/
rm ~/temp/apache-2.2.9/ffp/opt/apache-2.2.9/passwords
cd ~/temp/apache-2.2.9
#makepkg apache version buildnumber
#package as ffp package
makepkg apache 2.2.9 1
cp -v /tmp/apache-2.2.9-arm-1.txz ~/ffp_0.7_armv5

#How does it work ?
#For example in order to make SVN to work you'll need to start firmware-apache-httpd (instead of the newly compiled httpd) with a similar configuration:
#SVN (dav) modules order is important: dav_svn_module before authz_svn_module.
LoadFile	/ffp/lib/ld-uClibc.so.0
LoadFile	/ffp/lib/libc.so.0
LoadModule	dav_module 			/ffp/opt/apache-2.2.9-prefork/modules/mod_dav.so
LoadFile	/ffp/lib/libapr-1.so.0
LoadFile	/ffp/lib/libintl.so.8
#I have no idea why libmagic.so.1 is required by mod_dav_svn.so.
LoadFile	/ffp/lib/libmagic.so.1
LoadFile	/ffp/lib/libsqlite3-3.7.17.so.0
LoadFile	/ffp/lib/libcrypt.so.0
LoadFile	/ffp/lib/libm.so.0
LoadFile	/ffp/lib/libdl.so.0
LoadFile	/ffp/lib/librt.so.0
LoadModule	dav_svn_module 		/ffp/opt/subversion-1.8.5/libexec/mod_dav_svn.so
LoadModule	authz_svn_module 	/ffp/opt/subversion-1.8.5/libexec/mod_authz_svn.so
#The main idea is to find which libraries are needed at runtime and then to include them whith LoadFile directive.
#In order to find required libraries you'll use:
#	ldd -d /ffp/opt/apache-2.2.9-prefork/modules/mod_dav.so
#or
#	readelf -d /ffp/opt/apache-2.2.9-prefork/modules/mod_dav.so

#For other modules you'll have to follow the approach above in order to find the required libraries.

#The SVN + firmware-apache configuration:
#You'll need to have "AuthZyxelSkipPattern /svnrepository ..." in /etc/service_conf/httpd.conf.
#Append the below configuration before </VirtualHost> in /etc/service_conf/http_zld.conf.
#Create /ffp/etc/svnrepository-auth.htpasswd and /ffp/etc/svnrepository-authz files (read subversion documentation).
<Location /svnrepository>
	Header set X-UA-Compatible "IE=edge"
	DAV svn
	SVNParentPath /e-data/SVNRepoLinux
	SVNListParentPath on
	AuthName "Subversion repository"
	AuthType Basic
	AuthUserFile /ffp/etc/svnrepository-auth.htpasswd
	Require valid-user
	SVNPathAuthz on
	AuthzSVNAccessFile /ffp/etc/svnrepository-authz
</Location>
#Browse to https://your-firmware-apache-host/svnrepository/ in order to see your SVN repositories.

Leave a Reply

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