Wed Oct 27 12:23:06 2004

Building and Installing AxKit on OS X

For now see http://www.kings-of-chaos.de/~bboksa/axkit_macosx.html->

Introduction

This document might contain errors, please feel free to fix them.

The following tutorial will show you how to build apache and AxKit on Mac OS X. It was tested with Mac OS X 10.2 (Jaguar) and comes with no warranty. Use it at your own risk.

Everything you will see here is not new and no big secret, it is just a compilation of all the stuff, that was quite hard for me to find out. It is not polished, not the best thing to do it and it shows that I am not an expert for all that compilation stuff. But hey, it works (and least it worked for me). You have to have some basic knowledge about installing software and Perl-Modules using the CPAN module.

The tutorial is split up into five parts:

  1. Before we start
  2. Building apache with mod_perl and mod_ssl
  3. Building AxKit
  4. Configuring apache for AxKit
  5. Test your AxKit-Installation (external link)

Before we start

Changing the default compiler

The default compiler coming with Mac OS X 10.2 (gcc 3.1) is kind of buggy with the new system, this is why we change it back to gcc 2.95 with the following command (thanks do Spider from #de.mac, IRCnet).

sudo gcc_select 2

Handling downloads

When downloading files I assume you put them into /usr/local/src and untar/ungzip them (which can be done from the shell with the following command).

tar xvfz *filename*

Building apache with mod_perl and mod_ssl

In this section we will build apache with mod_perl and mod_ssl statically compiled in.

Downloads

Before we can start you have to download the following software:

Installation

gdbm

cd /usr/local/src/gdbm-*version*
sudo cp /usr/share/libtool/config* 
sudo ./configure
sudo make
sudo make install
sudo ln -s /usr/local/lib/libgdbm.a /usr/local/lib/libdbm.a

mod_perl

Predependencies
sudo mv /usr/bin/head /tmp

sudo perl -MCPAN -e 'shell'
cpan> install HTML::Parser
cpan> install LWP

sudo mv /usr/bin/get /usr/local/bin/lwp-get
sudo mv /usr/bin/head /usr/local/bin/lwp-head 
sudo mv /usr/bin/post /usr/local/bin/lwp-post

sudo mv /tmp/head /usr/bin
Installation
cd /usr/local/src/mod_perl-*version*
sudo perl Makefile.PL EVERYTHING=1 USE_APACI=1 PREP_HTTPD=1 DO_HTTPD=1
sudo make
sudo make install

openssl

cd openssl-*version*
sudo ./config
sudo make
sudo make test

mod_ssl

cd /usr/local/src/mod_ssl-*version*
sudo ./configure \
  --with-apache=/usr/local/src/apache_*version* \
  --with-ssl=/usr/local/src/openssl-*version*

apache

cd /usr/local/src/apache_*version*
setenv SSL_BASE /usr/local/src/openssl-*version*
sudo ./configure \
  --enable-module=most \
  --enable-shared=max \
  --activate-module=src/modules/perl/libperl.a \
  --enable-module=perl \
  --enable-module=ssl \
  --disable-shared=perl \
  --disable-shared=ssl \
  --disable-rule=EXPAT
sudo make
sudo make certificate TYPE=test
sudo make install

Building AxKit

This part shows you how to build AxKit and install the Perl-Predependencies for it.

Downloads

Before we can start you have to download the following software:

Installation

libiconv

cd /usr/local/src/libiconv-*version*
sudo ./configure
sudo make
sudo make check
sudo make install

expat

cd /usr/local/src/expat-*version*
sudo ./configure
sudo make
sudo make install

libghttp

cd /usr/local/src/libghttp-*version*
sudo ./configure
sudo make
sudo make install

libxml2

Simple Patch for libxml2-2.4.24:

The idea behind the patch is to add "-flat_namespace". It comes from Nyk Cowham.

*** configure.orig      Sun Sep 15 00:53:23 2002
--- configure   Sun Sep 15 00:56:51 2002
***************
*** 3784,3790 ****
      # FIXME: Relying on posixy $() will cause problems for
      #        cross-compilation, but unfortunately the echo tests do not
      #        yet detect zsh echo's removal of \ escapes.
!     archive_cmds='$CC $(test .$module = .yes && echo -bundle || echo \
-dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linkopts \
-install_name $rpath/$soname $(test -n "$verstring" -a x$verstring != x0.0 && \
echo $verstring)'
      # We need to add '_' to the symbols in $export_symbols first
      #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
      hardcode_direct=yes
--- 3784,3790 ----
      # FIXME: Relying on posixy $() will cause problems for
      #        cross-compilation, but unfortunately the echo tests do not
      #        yet detect zsh echo's removal of \ escapes.
!     archive_cmds='$CC $(test .$module = .yes && echo -bundle || echo \
-dynamiclib) $allow_undefined_flag -flat_namespace -o $lib $libobjs \
$deplibs$linkopts -install_name $rpath/$soname $(test -n "$verstring" -a \
x$verstring != x0.0 && echo $verstring)'
      # We need to add '_' to the symbols in $export_symbols first
      #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
      hardcode_direct=yes
Installation
cd /usr/local/src/libxml2-*version*
setenv LDFLAGS "-flat_namespace -undefined suppress"
sudo ./configure --with-zlib=/usr --prefix=/usr/local
sudo make
sudo make check
sudo make install

libxslt

Simple Patch for libxslt-1.0.20:

The idea behind the patch is to add "-flat_namespace". It comes from Nyk Cowham.

*** configure.orig      Sun Sep 15 01:25:47 2002
--- configure   Sun Sep 15 01:26:28 2002
***************
*** 3584,3590 ****
      # FIXME: Relying on posixy $() will cause problems for
      #        cross-compilation, but unfortunately the echo tests do not
      #        yet detect zsh echo's removal of \ escapes.
!     archive_cmds='$CC $(test .$module = .yes && echo -bundle || echo \
-dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linkopts \
-install_name $rpath/$soname $(test -n "$verstring" -a x$verstring != x0.0 && \
echo $verstring)'
      # We need to add '_' to the symbols in $export_symbols first
      #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
      hardcode_direct=yes
--- 3584,3590 ----
      # FIXME: Relying on posixy $() will cause problems for
      #        cross-compilation, but unfortunately the echo tests do not
      #        yet detect zsh echo's removal of \ escapes.
!     archive_cmds='$CC $(test .$module = .yes && echo -bundle || echo \
-dynamiclib) $allow_undefined_flag -flat_namespace -o $lib $libobjs \
$deplibs$linkopts -install_name $rpath/$soname $(test -n "$verstring" -a \
x$verstring != x0.0 && echo $verstring)'
      # We need to add '_' to the symbols in $export_symbols first
      #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
      hardcode_direct=yes
Installation
cd /usr/local/src/libxml2-*version*
setenv LDFLAGS "-flat_namespace -undefined suppress"
sudo ./configure --with-zlib=/usr --prefix=/usr/local
sudo make
sudo make check
sudo make install

sablotron

Simple Patch for Sablot-0.96:

The idea behind the patch is to add "-flat_namespace". It comes from Nyk Cowham.

*** configure.orig      Sun Sep 15 11:32:21 2002
--- configure   Sun Sep 15 11:32:58 2002
***************
*** 3326,3332 ****
      # FIXME: Relying on posixy $() will cause problems for
      #        cross-compilation, but unfortunately the echo tests do not
      #        yet detect zsh echo's removal of \ escapes.
!     archive_cmds='$CC $(test .$module = .yes && echo -bundle || echo \
-dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linkopts \
-install_name $rpath/$soname $(test -n "$verstring" -a x$verstring != x0.0 && \
echo $verstring)'
      # We need to add '_' to the symbols in $export_symbols first
      #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
      hardcode_direct=yes
--- 3326,3332 ----
      # FIXME: Relying on posixy $() will cause problems for
      #        cross-compilation, but unfortunately the echo tests do not
      #        yet detect zsh echo's removal of \ escapes.
!     archive_cmds='$CC $(test .$module = .yes && echo -bundle || echo \
-dynamiclib) $allow_undefined_flag -flat_namespace -o $lib $libobjs \
$deplibs$linkopts -install_name $rpath/$soname $(test -n "$verstring" -a \
x$verstring != x0.0 && echo $verstring)'
      # We need to add '_' to the symbols in $export_symbols first
      #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
      hardcode_direct=yes
Patch for 0.96

Execute the follwing commands if you use Sablot 0.96:

cd /usr/local/src/Sablot-*version*
sudo curl -O http://download-2.gingerall.cz/download/sablot/Sablot-0.96.1.patch
sudo patch -p2 < Sablot-0.96.1.patch
Installation
cd /usr/local/src/Sablot-*version*
setenv LDFLAGS "-flat_namespace -undefined suppress"
sudo ./configure --with-zlib=/usr --prefix=/usr/local
sudo make
sudo make check
sudo make install

Perl-Modules

The following commands need to be executed to install the predependecies for AxKit. Any errors occuring (for libs not found) can be ignored, they will be corrected later

sudo perl -MCPAN -e shell

cpan> install Error
cpan> install Apache::Request
cpan> install XML::Parser
cpan> install XML::XPath
cpan> install HTTP::GHTTP
cpan> install XML::Sablotron
cpan> install XML::LibXML
cpan> install XML::LibXSLT
cpan> install Apache::Filter

Install the Perl-Module with an explicit link to the libraries/includes.

cd ~/.cpan/build/XML-Parser-*version*
sudo perl Makefile.PL \
  EXPATLIBPATH=/usr/local/lib \
  EXPATINCPATH=/usr/local/inc
sudo make
sudo make test
sudo make install

Install the Perl-Module with an explicit link to the libraries/includes.

cd ~/.cpan/build/XML-Sablotron-0.90/
sudo perl Makefile.PL \
  EXPATLIBPATH=/usr/local/lib \
  EXPATINCPATH=/usr/local/inc \
  SABLOTLIBPATH=/usr/local/lib \
  SABLOTINCPATH=/usr/local/inc
sudo make
sudo make test
sudo make install

The final step. Install AxKit.

sudo perl -MCPAN -e shell

cpan> install AxKit

Configuring apache for AxKit

Configuring apache for AxKit is very easy, it is just a matter of adding some lines to your httpd.conf (/etc/httpd/httpd.conf). This would affect the whole server.

If you just want to modify your user configuration you have to modify /etc/httpd/users/*username*.conf. Put the directives between <Directory "/Users/*username*/Sites/"> and </Directory>.

Configuration directives four your httpd.conf

PerlModule AxKit
AddHandler axkit .xml
AddHandler axkit .xsp
AddHandler axkit .dkb

AxAddStyleMap application/x-xpathscript Apache::AxKit::Language::XPathScript
AxAddStyleMap text/xsl Apache::AxKit::Language::Sablot

AxDebugLevel 10
PerlSetVar AxXPSInterpolate 1

Edit This Page / Show Page History /