Installing the Darwin Calendar Server on FreeBSD

Posted by Roy Hooper Sat, 07 Jul 2007 23:10:00 GMT

I’ve been contemplating creating a hallway dashboard to replace the paper calendar and birthday list that hangs in the hallway. My wife’s not too thrilled by the idea, so I’ve got to make it look good, work well and be useful to be able to convince her it should get installed on the wall.

As one of its main functions will be as a Calendar and Events listing, I thought it would make sense to investigate the iCal server. It turns out that the underlying server is based on an open source project at Apple by the name of Darwin Calendar Server.

It has a fair number of dependencies… But they all looked pretty reasonable, so I decided to try it out on my household FreeBSD 6.0 server.

The requirements to make it run are:
  1. Python 2.4
  2. Zope Interface 3.1.0c1
  3. PyXML 0.8.4
  4. pyOpenSSL 0.6
  5. python-dateutil-1.0
  6. xattr 0.2 (Bob Ippolito’s implementation)
  7. pysqlite 2.2.2
  8. Twisted
  9. vObject
  10. PyKerberos
  11. PyOpenDirectory

Many of these are already available as ports:

  1. /usr/ports/lang/python
  2. /usr/ports/www/zope3
  3. /usr/ports/textproc/py-xml
  4. /usr/ports/security/py-openssl
  5. /usr/ports/devel/py-dateutil
  6. Needs to be built manually. It also depends on a version of setuptools that is higher than the current port. Get and install setuptools 0.6c6. Once you’ve installed those, get and install xattr-0.4.
  7. /usr/ports/databases/py-pysqlite22
  8. /usr/ports/devel/py-twisted
  9. /usr/ports/desktuil/py-vobject

The final two in the dependency list are available via the MacOS forge SVN server for Darwin Calendar Server. PyKerberos requires you have kerberos installed, but don’t need to have it configured. To get kerberos libraries on your FreeBSD system, install /usr/ports/security/krb5.

Next, create a directory to check out the calendar server into then:

svn co http://svn.calendarserver.org/repository/calendarserver/CalendarServer/trunk CalendarServer

You’re also going to need PyKerberos, but it won’t work as-is on FreeBSD. First we’ll fetch it to the current working directory:

svn co http://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk PyKerberos

Next you’re going to need to modify setup.py in PyKerberos slightly as well as fix the include path that is used for Python.h. First we’ll fix all the references:

perl -spi -e ’s{<Python/}{<};’ src/*

Next, add these two lines to setup.py just after the sources block:

library_dirs=['/usr/local/lib'],
include_dirs=['/usr/local/include'],

You’ll end up with a setup.py like this:

##
  1. Copyright© 2006-2007 Apple Inc. All rights reserved. #
  2. Licensed under the Apache License, Version 2.0 (the “License”);
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at #
  5. http://www.apache.org/licenses/LICENSE-2.0 #
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an “AS IS” BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License. #
  11. DRI: Cyrus Daboo, cdaboo@apple.com ##
from distutils.core import setup, Extension
import sys
import commands
setup (
    name = "kerberos",
    version = "1.0",
    description = "Kerberos high-level interface",
    ext_modules = [
        Extension(
            "kerberos",
            extra_link_args = commands.getoutput("krb5-config --libs gssapi").split(),
            extra_compile_args = commands.getoutput("krb5-config --cflags gssapi").split(),
            sources = [
                "src/kerberos.c",
                "src/kerberosbasic.c",
                "src/kerberosgss.c",
                "src/base64.c" 
            ],
            library_dirs=['/usr/local/lib'],
            include_dirs=['/usr/local/include'],
        ),
    ],
)

Finally, we’re ready to attempt to fire up the server for the first time, as per the instructions on the quickstart page.

Here too, unfortunately, we run into portability problems. The run script uses /bin/bash. You’ll need to install the bash port if you haven’t already, and then either modify the run script, or fire it up manually:

bash ./run -s

This will build the kerberos library we modified in the previous steps, among other things.

Once the above works (no output), you’re ready to configure things. Before you can launch the server, though, you’ll need to fix:

CalendarServer/bin/caldavd
CalendarServer/run

to use /usr/local/bin/bash

Enjoy.

Trackbacks

Use the following link to trackback from your own site:
http://blog.royhooper.ca/trackbacks?article_id=43