CRM 114 on OS X

A quick note to my future self on getting CRM 114 to build and install on OS X.

First, download the latest tarball to a suitable location (/tmp will do). Explode the tarball and cd into the TRE library directory inside of it, currently tre-0.7.4. Next, run:

sudo ./configure --enable-static && make && make install

Once TRE is installed, run man agrep and marvel at the wonder that is agrep. Holy crap is that cool.

Next, edit the main CRM 114 Makefile. Comment out the line in the that reads:

LDFLAGS += -static

On OS X, dynamic library lookup is preferred and I wasn’t able to get static linking working anyway. Next, uncomment these lines:

CFLAGS += -I/usr/local/include
LDFLAGS += -L/usr/local/lib

But make sure that this line is still commented out:

#LIBS += -litnl -liconv

Otherwise you’ll be on a wild goose chase to find a package that includes a dynamic library for GNU gettext. Luckily, the entropy.ch php packages have such a beast, but to avoid more build path mucking than is absolutely necessaray, just make sure that -lintl isn’t in your GCC calls.

The last change is to modify the line that reads:

-lm -ltre -o crm114_tre

to omit the “-lm” flag. It should then read simply:

-ltre -o crm114_tre

At this point, it’s safe to build with:

sudo make clean && make && make install

Huzzah!

Update: A couple of final snags, aside from the various setup bits and bobs that aren’t automated). In order to actually process my spam/ham folders, it was necessary to patch crm114_config.h and rebuild. The substitution was:

//   default size of the data window: 8 megabytes.
// #define DEFAULT_DATA_WINDOW  8388608
#define DEFAULT_DATA_WINDOW 16777216

which ups the processing window for messages significantly. Also, it was necessaray, as per the comment in the file, to split up the first line of mailreaver.crm into 2 lines, like this:

#!/usr/bin/crm 
#    -( spam good cache dontstore stats_only outbound undo verbose maxprio minprio delprio)