The online API documentation for APR has been my most useful resource while working on the Lua/APR binding but it leaves something to be desired when you're looking for a high level overview. The following online resources help in this regard:
Building APR on Windows can be a pain in the ass. It is meant to be done with Microsoft tools but fortunately these are freely available. Here are some notes I made in the process:
Install Microsoft Visual C++ Express. You only need the command line tools, the GUI isn't needed.
Install the Microsoft Platform SDK. The full SDK is over 1 GB but you only need the following:
Download the APR, APR-util, APR-iconv and libapreq2 archives (I used apr-1.4.2-win32-src.zip
, apr-util-1.3.9-win32-src.zip
, apr-iconv-1.2.1-win32-src-r2.zip
and libapreq2-2.13.tar.gz
) from apr.apache.org (you can get libapreq2 here). Unpack all archives to the same directory and rename the subdirectories to apr
, apr-util
and apr-iconv
(those three are build at the same time while libapreq2 is build separately).
The instructions about building APR on Windows don't work for me so this is where things get sketchy: Open a Windows SDK command prompt and navigate to the apr-util
directory. Inside this directory execute nmake -f Makefile.win buildall
. This doesn't work for me out of the box because of what's probably a bug in the APR-util makefile; I needed to replace apr_app
with aprapp
on lines 176 and 177 of Makefile.win
. After this change nmake
still exits with errors but nevertheless seems to build libapr-1.dll
and libaprutil-1.dll
...
You also have to build APREQ, last I tried this was a mess on Windows, I collected some notes at the bottom of this page.
The SQLite 3 driver is included in the Windows binaries but for the benefit of those who want to build the Apache Portable Runtime on Windows here are the steps involved:
Download the precompiled SQLite 3 binaries For Windows (273.98 KiB) and unpack the files somewhere.
Create sqlite3.lib
from sqlite3.def
(included in the precompiled binaries) using the command lib /machine:i386 /def:sqlite3.def
and copy sqlite3.lib
to apr-util-1.3.9/LibR
.
Download the corresponding source code distribution (1.20 MiB) and copy sqlite3.h
to apr-util-1.3.9/include
.
Build the driver in the Windows SDK command prompt using the command nmake /f apr_dbd_sqlite3.mak
.
To install the driver you can copy sqlite3.dll
and apr_dbd_sqlite3-1.dll
to Lua's installation directory.
libapreq2
on WindowsI wasted a few hours getting libapreq2
version 2.13 to build on Windows because of the following issues:
libapreq2.mak
is full of syntax errors.Eventually I decided to just rewrite the damned makefile and be done with it, enabling me to finally test the HTTP request parsing module on Windows (all tests passed the first time). I've included the customized makefile in the Lua/APR git repository.