Following my yesterday's MySQL cross-compile (see previous post), becoming an addict I went on to build Apache.
OK, snake has already got an http server, but perhaps you want more.
I still have the SDK/cross-tools in $HOME/cnusers.
1. Build
=======
cd $HOME/cnusers
wget
http://mirrors.geoexpat.com/apache/httpd/httpd-2.2.14.tar.bz2
bunzip2 httpd-2.2.14.tar.bz2
tar xvf httpd-2.2.14.tar
cd httpd-2.2.14
The first build is *not* a cross-compile - I do this to get a couple of tools needed below.
./configure
make
cp ./srclib/pcre/dftables ../
cp ./server/gen_test_char ../
cd ..
Don't know if really needed, but cleanup completely:
rm -rf httpd-2.2.14
tar xvf httpd-2.2.14.tar
cd httpd-2.2.14
export PATH=$PATH:$HOME/cnusers/CNS2100-LSDK-6.8.2/CNS2100-LSDK-6.8.2/tools/arm-uclibc-3.4.6/bin
I expected to be able to use --host=arm-linux
in the 'configure' below, that fails, complaining about problems
building a test program. I couldn't see what the problem was, so I used
--host=arm-linux-uclibc. That then causes problems in expat/configure, which are overcome by doing this hack:
sed -i '2631s/\$host_alias/arm-linux/' ./srclib/apr-util/xml/expat/configure
sed -i '2632s/\$host_alias/arm-linux/' ./srclib/apr-util/xml/expat/configure
Setup where the build products will go:
mkdir install_dir
On Snake, I will install to /usb/sda1/apache.
There must be a better way of doing this, but the best I've come up with is:
sudo mkdir -p /usb/sda1/apache
sudo ln -s `pwd`/install_dir /usb/sda1/apache
./configure --host=arm-linux-uclibc LIBS=-lpthread apr_cv_process_shared_works=set ap_cv_void_ptr_lt_long=no ac_cv_sizeof_struct_iovec=8 apr_cv_tcp_nodelay_with_cork=yes ac_cv_func_setpgrp_void=no ac_cv_file__dev_zero=yes --prefix=/usb/sda1/apache
Without those odd looking parameters, configure will not succeed.
make
when it fails, complaining about dftables:
cp ../dftables ./srclib/pcre/dftables
make
when it fails, complaining about gen_test_char:
cp ../gen_test_char ./server/gen_test_char
make
make install
Results should now be in install_dir.
2. Install
=======
As per my MySQL post, the '$' commands are on Snake, otherwise on my desktop. $snake=IP of snake.
$ mkdir /usb/sda1/apache
cd install_dir
scp -r * root@$snake:/usb/sda1/apache/
The daemon user/group is used by apache (conf/httpd.conf).
$ adduser -g daemon daemon
Because Snake already runs a http process on port 80, edit conf/httpd.conf
Listen 81
3. Test
=======
From my desktop web browser: http://$snake:81 (replace $snake with your snake IP).
I'm going to try and resist doing any more of this for a while.