[exim] fyi, buillding libdkim on osx

Top Page
Delete this message
Reply to this message
Author: snowcrash+exim-users
Date:  
To: exim-users
Subject: [exim] fyi, buillding libdkim on osx
for those interested (ymmv!),

Alt-N's libdkim (http://libdkim.sourceforge.net/) currently does not
build cleanly on osx.

to get it working (and optionally link with an external,
other-than-apple's instance of openssl), a couple of fixes are
currently required. here's what seems to work on osx 10.4.10:


DL @ http://libdkim.sourceforge.net/ --> libdkim-1.0.14.zip
unzip libdkim-1.0.14.zip
cd libdkim/src

setenv CFLAGS "-c -DBIND_8_COMPAT -DOPENSSL_FIPS"
setenv LDFLAGS "-L/usr/local/ssl/lib -lcrypto"
setenv CPPFLAGS "-I/usr/local/ssl/include"

% vi Makefile
-------------------------------------------
       #else
-      CFLAGS  = -c
+      CFLAGS  = -c -DBIND_8_COMPAT -DOPENSSL_FIPS
       LFLAGS  =
-      LIBS    = -lcrypto
+      LIBS    = -L/usr/local/ssl/lib -lcrypto
       #endif


-      INCL    =  -I/usr/include
+      INCL    =  -I/usr/local/ssl/include


       libdkimtest : libdkim.a libdkimtest.o
-          g++ -olibdkimtest $(LFLAGS) \
+          g++ -o libdkimtest $(LFLAGS) \
-                 -L . libdkimtest.o $(LIBS) -ldkim
+                 -L. libdkimtest.o $(LIBS) -ldkim



       .cpp.o:
-          g++ $(CFLAGS) -c $<
+          g++ $(CFLAGS) $(INCL) -c $<


-------------------------------------------


% vi dkim.h
-------------------------------------------
@22:
       #ifdef WIN32
       #define DKIM_CALL WINAPI
       #else
       #define DKIM_CALL
+      #define MAKELONG(a,b) ((long)(((unsigned)(a) & 0xffff) |
(((unsigned)(b) &0xffff) << 16)))
       #endif
-------------------------------------------


% vi dkimsign.cpp
-------------------------------------------
@24:
       #ifdef WIN32
       #include <windows.h>
       #pragma warning( disable: 4786 )
       #pragma warning( disable: 4503 )
       #else
       #define _strnicmp strncasecmp
       #define _stricmp strcasecmp
+      #define LOWORD(l) ((unsigned)(l) & 0xffff)
+      #define HIWORD(l) ((unsigned)(l) >> 16)
       #endif
-------------------------------------------


make clean
make

resulting, finally, in,

  ls -al libdkim.a libdkimtest
    -rw-r--r-- 1 root wheel 362380 2007-06-25 10:33 libdkim.a
    -rwxr-xr-x 1 root wheel 243328 2007-06-25 10:33 libdkimtest


at some point, I'm hoping this will get folded into the actual
release; atm, it's not.

but, at least, now there's something 4 me to work with in/with exim on
osx ... assuming this *is* actually built 'right'. as yet, untested
:-/