Installing PhiloLogic on MacOSX Leopard

NOTE: the install notes for OS X Tiger install are basically good enough for Leopard:

These notes are another take on the process and assume starting from the ground up, going through the process from soup to nuts.

** What you'll need: developer tools; darwinports; fink; cpan; mysql; philologic **

PRELIMINARIES

First: download Xcode tools (we've been using Xcode 3.1.1) from Apple Developers Connection site or load them from the Leopard install DVD. The default install of System Tools and Unix Developer Tools should be sufficient.

At this point, you might as well install darwinports. Easiest at this moment in history to download the disk image from the darwinports website. After downloading it, execute the selfupdate from the command line:

sudo port -d selfupdate

You may need to go to MacPorts, which appears to the the new home of Darwin ports. If you do this, the update command should be:

sudo port -v selfupdate

Also, install fink. Doing so will automatically get you certain essential goodies, like gzip, and put them in the correct location. Once again, simple enough to do from a disk image. If you are trying on Snow Leopard (10.6), the fink installation will be from source, rather than from disk image.

Second: configure cpan so that you can get Unicode::String and various perl drivers for mysql. Crank up cpan with:

sudo perl -MCPAN -e shell

You might be able just to press enter through all the config questions, but if you want to install various programs you don't have, use darwinports. Don't knock yourself out: you probably don't need any of it.

While you're in the cpan shell, might as well get Unicode::String. The command:

cpan> install Unicode::String

Before installing the perl binders for mysql using cpan, I would go on to the next step and just install mysql using a downloaded disk image.

Third: install mysql. This bit is not hard: getting the perl binders installed is another matter. The OSXTigerInstall wiki page has lots of info about how difficult this can be and has different suggestions for getting it to install correctly. I'd recommend as a first step just downloading mysql straight from the source:

http://dev.mysql.com/downloads/mysql/5.0.html#macosx-dmg

For poggio, I grabbed Mac OS X 10.5 (x86_64).

Install all three items, the mysql package, the StartUpItem, and the MySQL.prefPane. The last two help get mysql running. Always a good thing.

Fourth: install those perl drivers with cpan. This is the problematic part -- I wish I could be definitive about this, but you can basically follow the various instructions on the wiki page. You're going to need Bundle::DBD::mysql and DBI. First, symlink this path:

sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql

Now, try to install. In the cpan shell:

force install Bundle::DBD::mysql

Do the same with DBI, either using the force command or not (not sure DBI is as problematic):

install DBI

You can check to see if they actually loaded correctly by issuing some commands from the command line:

perl

use DBD::mysql

<control-D>

perl

use DBI

<control-D>

If you get an error message, try, try again to load these guys, following the different suggestions on the wiki.

If you've been successful, at this point make symlinks for the mysql socket:

sudo mkdir -p /var/lib/mysql/

sudo ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock

Set up passwords and so forth on your own time. But for future reference, the command to set the pass for root is:

SET PASSWORD FOR root@localhost=PASSWORD('XXXXXXXXXX');

ARTFL specific set up for the philologic daemon:

create database philologic;

Then for the password:

grant all on philologic.* to 'philologic'@localhost identified by 'XXXXXXXX';

Fifth: I have been grabbing the following dependencies from darwinports:

gawk

agrep

Standard darwinports install command, gawk as example:

sudo port install gawk

Sixth: Follow the instructions on the wiki page to get dependencies from fink:

sudo fink install openssl openssl-dev openssl-shlibs

sudo fink install libgcrypt libgcrypt-shlibs

sudo fink install gdbm

CONFIGURING AND INSTALLING PHILOLOGIC

After all that, remember philologic???? Keep your eyes on the prize, me bucko!

This part of the guide borrows straight from the philologic wiki and Richard W's guide for configuring sort options on Leopard:

http://philologic.uchicago.edu/wiki/index.php/Patches#Patch:_Field-delimited_sort_Semantics_Broken_in_OSX_10.5

Once the Xcode tools and the other dependencies are installed, make some directories and set some paths:

mkdir /Library/WebServer/Documents/philologic

mkdir /Library/WebServer/CGI-Executables/philologic

Then, after finally downloading and unzipping philologic, in the philologic installation directory:

export CFLAGS="-I/sw/include -L/sw/lib"

export PATH=$PATH:/sw/bin:/opt/local/bin:/usr/local/bin

Look in INSTALLING to get the configure command for OS X. Ignore the caveat about OS X support. I've been using (single line):

./configure --with-cgi-path=/Library/WebServer/CGI-Executables/philo --with- cgi-url=/cgi-bin/philo --with-web-path=/Library/WebServer/Documents/ philologic --with-web-url=/philologic --with-init-d=$HOME --with-boot-init-d= $HOME --with-authuser-group=staff

You will notice messages about missing components. Eg:

checking for working aclocal-1.4... missing

....

checking for working automake-1.4... missing

Don't worry about any of that. As long as you have downloaded the developer tools and other dependencies, you should not have any problems. If you don't have those items installed, you get errors like:

checking for g++... no

checking for c++... no

checking for gpp... no

checking for aCC... no

checking for CC... no

checking for cxx... no

checking for cc++... no

checking for cl... no

checking for FCC... no

checking for KCC... no

checking for RCC... no

checking for xlC_r... no

checking for xlC... no

checking for C++ compiler default output file name... configure: error: C++ compiler cannot create executables

To install:

sudo make install

Next:

sudo mv /var/lib/philologic/goodies/OSX/NSERVER_OSX/NServer /Library/StartupItems/

sudo chmod +x /Library/StartupItems/NServer/NServer

Now, make all of Richard's sort fixes as presented on the wiki. Philo won't work or load without 'em!

In /var/lib/philologic/loader.xmake:

#SORTFLAGS= -T . -y +0 -1 +1 -2n +2 -3n +3 -4n +4 -5n +5 -6n +6 -7n +7 -8n

SORTFLAGS= -T . -k 1,1 -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8

in /var/lib/philologic/Makefile:

work/plain.files: bibliography

# ./utils/newdocs "TEXTS" | $(SORT) -n +0 -1 > $@

./utils/newdocs "TEXTS" | $(SORT) -n -k 1,1 > $@

And then in search3t, (AND search3torth), you need to make the following 5 edits.

around line 1806:

#open (SORTED, "| uniq -c | sort -nr +0 -1 > $PHILOTMP/generated.$$");

open (SORTED, "| uniq -c | sort -nr -k 1,1 > $PHILOTMP/generated.$$");

ca. 1950:

#open(MVOSORTED, "| sort -nr +0 -1 > $PHILOTMP/mvogenerated.$$");

open(MVOSORTED, "|sort -nr -k 1,1 > $PHILOTMP/mvogenerated.$$");

ca. 2025:

# open MVOSORTED, "| sort -nr +0 -1 >$PHILOTMP/mvogenerated.$$";

open MVOSORTED, "| sort -nr -k 1,1 > $PHILOTMP/mvogenerated.$$";

ca. 2119:

# open(MVOSORTED, "| sort -nr +0 -1 > $PHILOTMP/mvogenerated.$$");

open(MVOSORTED, "| sort -nr -k 1,1 > $PHILOTMP/mvogenerated.$$");

ca. 2404:

# open (SORTED, "| uniq -c | sort -nr +0 -1 > $PHILOTMP/generated.$$");

open (SORTED, "| uniq -c | sort -nr -k 1,1 > $PHILOTMP/generated.$$"

That's all.