]> err.no Git - sope/commitdiff
Add patches from SOGo
authorroot <root@metetch.tfheen.linpro.no>
Fri, 2 May 2008 07:25:56 +0000 (09:25 +0200)
committerroot <root@metetch.tfheen.linpro.no>
Fri, 2 May 2008 08:16:57 +0000 (08:16 +0000)
debian/patches/00list
debian/patches/01_sope-patchset-r1619.dpatch [new file with mode: 0755]
debian/patches/02_sope-gsmake2.dpatch [new file with mode: 0755]

index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..a0aa294f0ea768633f3aecd9624415dc35f9a9b2 100644 (file)
@@ -0,0 +1,2 @@
+01_sope-patchset-r1619
+02_sope-gsmake2
diff --git a/debian/patches/01_sope-patchset-r1619.dpatch b/debian/patches/01_sope-patchset-r1619.dpatch
new file mode 100755 (executable)
index 0000000..1059905
--- /dev/null
@@ -0,0 +1,1948 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 01_sope-patchset-r1619.dpatch by  <root@metetch.tfheen.linpro.no>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+@DPATCH@
+diff -urNad SOPE~/sope-appserver/NGObjWeb/DAVPropMap.plist SOPE/sope-appserver/NGObjWeb/DAVPropMap.plist
+--- SOPE~/sope-appserver/NGObjWeb/DAVPropMap.plist     2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/DAVPropMap.plist      2008-05-02 08:49:09.000000000 +0200
+@@ -120,17 +120,21 @@
+   "{http://ucb.openoffice.org/dav/props/}IsRemoveable"  = isOOoRemoveable;
+   "{http://ucb.openoffice.org/dav/props/}IsVolume"      = isOOoVolume;
+   "{http://ucb.openoffice.org/dav/props/}TargetURL"     = davOOoTargetURL;
+-
++  
+   /* WebDAV ACL */
+   "{DAV:}current-user-privilege-set" = davCurrentUserPrivilegeSet;
+   /* CalDAV */
++  "{urn:ietf:params:xml:ns:caldav}calendar-data" = davCalendarData;
++  "{urn:ietf:params:xml:ns:caldav}calendar-description" = davDescription;
+   "{urn:ietf:params:xml:ns:caldav}calendar-home-set" = davCalendarHomeSet;
++  "{urn:ietf:params:xml:ns:caldav}calendar-user-address-set" = davCalendarUserAddressSet;
++  "{urn:ietf:params:xml:ns:caldav}schedule-inbox-URL" = davCalendarScheduleInboxURL;
++  "{urn:ietf:params:xml:ns:caldav}schedule-outbox-URL" = davCalendarScheduleOutboxURL;
+   "{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set" =
+      davCalendarComponentSet;
+   "{urn:ietf:params:xml:ns:caldav}supported-calendar-data" =
+      davSupportedCalendarDataTypes;
+-  "{urn:ietf:params:xml:ns:caldav}calendar-description" = davDescription;
+   /* CardDAV */
+   "{urn:ietf:params:xml:ns:carddav}supported-address-data" =
+diff -urNad SOPE~/sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h SOPE/sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h
+--- SOPE~/sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h    2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.h     2008-05-02 08:49:09.000000000 +0200
+@@ -41,7 +41,8 @@
+   WOAssociation *pageName;
+   WOAssociation *actionClass;
+   WOAssociation *directActionName;
+-  
++  WOAssociation *isAbsolute;
++
+   BOOL          sidInUrl;
+   /* 'ivar' associations */
+diff -urNad SOPE~/sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m SOPE/sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m
+--- SOPE~/sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m    2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m     2008-05-02 08:49:09.000000000 +0200
+@@ -216,6 +216,12 @@
+       assocCount++;
+     }
+   }
++  if (count > 0) {
++    if ((self->isAbsolute = OWGetProperty(_config, @"absolute"))) {
++      count--;
++      assocCount++;
++    }
++  }
+   
+   self->rest = _config;
+   
+diff -urNad SOPE~/sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m SOPE/sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m
+--- SOPE~/sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m        2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/DynamicElements/_WOComplexHyperlink.m 2008-05-02 08:49:09.000000000 +0200
+@@ -41,6 +41,7 @@
+   WOAssociation *string;
+   WOAssociation *target;
+   WOAssociation *disabled;
++  WOAssociation *isAbsolute;
+   WOElement     *template;
+   
+   /* new in WO4: */
+@@ -360,6 +361,7 @@
+ {
+   if ((self = [super initWithName:_name hyperlinkInfo:_info template:_t])) {
+     self->href = _info->href;
++    self->isAbsolute = _info->isAbsolute;
+   }
+   return self;
+ }
+@@ -375,8 +377,11 @@
+   // TODO: we need a binding to disable rewriting!
+   NSRange r;
++  if ([[self->isAbsolute valueInContext:_ctx] boolValue] == YES)
++    return NO;
++
+   r.length = [_s length];
+-  
++
+   /* do not rewrite pure fragment URLs */
+   if (r.length > 0 && [_s characterAtIndex:0] == '#')
+     return NO;
+diff -urNad SOPE~/sope-appserver/NGObjWeb/GNUmakefile.postamble SOPE/sope-appserver/NGObjWeb/GNUmakefile.postamble
+--- SOPE~/sope-appserver/NGObjWeb/GNUmakefile.postamble        2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/GNUmakefile.postamble 2008-05-02 08:49:09.000000000 +0200
+@@ -23,14 +23,20 @@
+ # install makefiles
+-after-install ::
+-      $(MKDIRS) $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/Additional/
+-      $(INSTALL_DATA) ngobjweb.make $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/Additional/ngobjweb.make
++after-install :: $(DESTDIR)/$(GNUSTEP_MAKEFILES)/Additional/ngobjweb.make
+ ifneq ($(GNUSTEP_MAKE_VERSION),1.3.0)
+-after-install ::
++after-install :: $(DESTDIR)/$(GNUSTEP_MAKEFILES)/woapp.make $(DESTDIR)/$(GNUSTEP_MAKEFILES)/wobundle.make
++endif
++
++$(DESTDIR)/$(GNUSTEP_MAKEFILES)/Additional/ngobjweb.make: ngobjweb.make
++      $(MKDIRS) $(DESTDIR)/$(GNUSTEP_MAKEFILES)/Additional/
++      $(INSTALL_DATA) ngobjweb.make $(DESTDIR)/$(GNUSTEP_MAKEFILES)/Additional/ngobjweb.make
++
++$(DESTDIR)/$(GNUSTEP_MAKEFILES)/woapp.make: woapp-gs.make
+       $(INSTALL_DATA) woapp-gs.make    \
+-              $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/woapp.make
++              $(DESTDIR)/$(GNUSTEP_MAKEFILES)/woapp.make
++
++$(DESTDIR)/$(GNUSTEP_MAKEFILES)/wobundle.make: wobundle-gs.make
+       $(INSTALL_DATA) wobundle-gs.make \
+-              $(INSTALL_ROOT_DIR)/$(GNUSTEP_MAKEFILES)/wobundle.make
+-endif
++              $(DESTDIR)/$(GNUSTEP_MAKEFILES)/wobundle.make
+diff -urNad SOPE~/sope-appserver/NGObjWeb/SoObjects/SoObject.m SOPE/sope-appserver/NGObjWeb/SoObjects/SoObject.m
+--- SOPE~/sope-appserver/NGObjWeb/SoObjects/SoObject.m 2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/SoObjects/SoObject.m  2008-05-02 08:49:09.000000000 +0200
+@@ -39,22 +39,34 @@
+ static int debugLookup  = -1;
+ static int debugBaseURL = -1;
+ static int useRelativeURLs = -1;
++static int redirectInitted = -1;
++static NSURL *redirectURL = nil;
++
+ static void _initialize(void) {
++  NSString *url;
++  NSUserDefaults *ud;
++
++  ud = [NSUserDefaults standardUserDefaults];
++
+   if (debugLookup == -1) {
+-    debugLookup = [[NSUserDefaults standardUserDefaults]
+-                                 boolForKey:@"SoDebugKeyLookup"] ? 1 : 0;
++    debugLookup = [ud boolForKey:@"SoDebugKeyLookup"] ? 1 : 0;
+     NSLog(@"Note(SoObject): SoDebugKeyLookup is enabled!");
+   }
+   if (debugBaseURL == -1) {
+-    debugBaseURL = [[NSUserDefaults standardUserDefaults]
+-                                   boolForKey:@"SoDebugBaseURL"] ? 1 : 0;
++    debugBaseURL = [ud boolForKey:@"SoDebugBaseURL"] ? 1 : 0;
+     NSLog(@"Note(SoObject): SoDebugBaseURL is enabled!");
+   }
+   if (useRelativeURLs == -1) {
+-    useRelativeURLs = [[NSUserDefaults standardUserDefaults]
+-                                     boolForKey:@"WOUseRelativeURLs"] ?1:0;
++    useRelativeURLs = [ud boolForKey:@"WOUseRelativeURLs"] ?1:0;
+     NSLog(@"Note(SoObject): relative base URLs are enabled.");
+   }
++  if (redirectInitted == -1) {
++    url = [ud stringForKey:@"WOApplicationRedirectURL"];
++    if ([url length]) {
++      redirectURL = [[NSURL alloc] initWithString: url];
++    }
++    redirectInitted = 1;
++  }
+ }
+ /* classes */
+@@ -318,56 +330,61 @@
+   
+   rq = [_ctx request];
+   ms = [[NSMutableString alloc] initWithCapacity:128];
++
++  if (redirectURL) {
++    [ms appendString: [redirectURL absoluteString]];
++  }
++  else {  
++    if (!useRelativeURLs) {
++      port = [[rq headerForKey:@"x-webobjects-server-port"] intValue];
+   
+-  if (!useRelativeURLs) {
+-    port = [[rq headerForKey:@"x-webobjects-server-port"] intValue];
+-  
+-    /* this is actually a bug in Apache */
+-    if (port == 0) {
+-      static BOOL didWarn = NO;
+-      if (!didWarn) {
+-      [self warnWithFormat:@"(%s:%i): got an empty port from Apache!",
+-              __PRETTY_FUNCTION__, __LINE__];
+-      didWarn = YES;
++      /* this is actually a bug in Apache */
++      if (port == 0) {
++      static BOOL didWarn = NO;
++      if (!didWarn) {
++        [self warnWithFormat:@"(%s:%i): got an empty port from Apache!",
++              __PRETTY_FUNCTION__, __LINE__];
++        didWarn = YES;
++      }
++      port = 80;
+       }
+-      port = 80;
+-    }
+   
+-    if ((tmp = [rq headerForKey:@"host"]) != nil) { 
+-      /* check whether we have a host header with port */
+-      if ([tmp rangeOfString:@":"].length == 0)
+-      tmp = nil;
+-    }
+-    if (tmp != nil) { /* we have a host header with port */
+-      isHTTPS = 
+-      [[rq headerForKey:@"x-webobjects-server-url"] hasPrefix:@"https"];
+-      [ms appendString:isHTTPS ? @"https://" : @"http://"]; 
+-      [ms appendString:tmp];
+-    }
+-    else if ((tmp = [rq headerForKey:@"x-webobjects-server-url"]) != nil) {
+-      /* sometimes the URL is just wrong! (suggests port 80) */
+-      if ([tmp hasSuffix:@":0"] && [tmp length] > 2) { // TODO: bad bad bad
+-      [self warnWithFormat:@"%s: got incorrect URL from Apache: '%@'",
+-            __PRETTY_FUNCTION__, tmp];
+-      tmp = [tmp substringToIndex:([tmp length] - 2)];
++      if ((tmp = [rq headerForKey:@"host"]) != nil) { 
++      /* check whether we have a host header with port */
++      if ([tmp rangeOfString:@":"].length == 0)
++        tmp = nil;
+       }
+-      else if ([tmp hasSuffix:@":443"] && [tmp hasPrefix:@"http://"]) {
+-      /* see OGo bug #1435, Debian Apache hack */
+-      [self warnWithFormat:@"%s: got 'http' protocol but 443 port, "
+-            @"assuming Debian/Apache bug (OGo #1435): '%@'",
+-            __PRETTY_FUNCTION__, tmp];
+-      tmp = [tmp substringWithRange:NSMakeRange(4, [tmp length] - 4 - 4)];
+-      tmp = [@"https" stringByAppendingString:tmp];
++      if (tmp != nil) { /* we have a host header with port */
++      isHTTPS = 
++        [[rq headerForKey:@"x-webobjects-server-url"] hasPrefix:@"https"];
++      [ms appendString:isHTTPS ? @"https://" : @"http://"]; 
++      [ms appendString:tmp];
+       }
+-      [ms appendString:tmp];
+-    }
+-    else {
+-      // TODO: isHTTPS always no in this case?
+-      [ms appendString:isHTTPS ? @"https://" : @"http://"]; 
++      else if ((tmp = [rq headerForKey:@"x-webobjects-server-url"]) != nil) {
++      /* sometimes the URL is just wrong! (suggests port 80) */
++      if ([tmp hasSuffix:@":0"] && [tmp length] > 2) { // TODO: bad bad bad
++        [self warnWithFormat:@"%s: got incorrect URL from Apache: '%@'",
++              __PRETTY_FUNCTION__, tmp];
++        tmp = [tmp substringToIndex:([tmp length] - 2)];
++      }
++      else if ([tmp hasSuffix:@":443"] && [tmp hasPrefix:@"http://"]) {
++        /* see OGo bug #1435, Debian Apache hack */
++        [self warnWithFormat:@"%s: got 'http' protocol but 443 port, "
++              @"assuming Debian/Apache bug (OGo #1435): '%@'",
++              __PRETTY_FUNCTION__, tmp];
++        tmp = [tmp substringWithRange:NSMakeRange(4, [tmp length] - 4 - 4)];
++        tmp = [@"https" stringByAppendingString:tmp];
++      }
++      [ms appendString:tmp];
++      }
++      else {
++      // TODO: isHTTPS always no in this case?
++      [ms appendString:isHTTPS ? @"https://" : @"http://"]; 
+   
+-      [ms appendString:[rq headerForKey:@"x-webobjects-server-name"]];
+-      if ((isHTTPS ? (port != 443) : (port != 80)) && port != 0)
+-      [ms appendFormat:@":%i", port];
++      [ms appendString:[rq headerForKey:@"x-webobjects-server-name"]];
++      if ((isHTTPS ? (port != 443) : (port != 80)) && port != 0)
++        [ms appendFormat:@":%i", port];
++      }
+     }
+   }
+   
+diff -urNad SOPE~/sope-appserver/NGObjWeb/WOContext.m SOPE/sope-appserver/NGObjWeb/WOContext.m
+--- SOPE~/sope-appserver/NGObjWeb/WOContext.m  2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/WOContext.m   2008-05-02 08:49:09.000000000 +0200
+@@ -64,11 +64,13 @@
+ static BOOL     testNSURLs           = NO;
+ static BOOL     newCURLStyle         = NO;
+ static NSString *WOApplicationSuffix = nil;
++static NSURL    *redirectURL         = nil;
+ + (void)initialize {
+   static BOOL    didInit = NO;
+   NSUserDefaults *ud;
+   NSString       *cn;
++  NSString       *url;
+   if (didInit) return;
+@@ -91,6 +93,9 @@
+   debugCursor         = [ud boolForKey:@"WODebugCursor"] ? 1 : 0;
+   debugComponentAwake = [ud boolForKey:@"WODebugComponentAwake"];
+   WOApplicationSuffix = [[ud stringForKey:@"WOApplicationSuffix"] copy];
++  url                 = [ud stringForKey:@"WOApplicationRedirectURL"];
++  if (url != nil)
++    redirectURL       = [NSURL URLWithString: url];
+ }
+ + (id)contextWithRequest:(WORequest *)_r {
+@@ -503,6 +508,11 @@
+     return nil;
+   }
+   
++  if (redirectURL) {
++    // Use URL from user defaults (WOApplicationRedirectURL)
++    return redirectURL;
++  }
++  
+   if ((serverURL = [rq headerForKey:@"x-webobjects-server-url"]) == nil) {
+     if ((host = [rq headerForKey:@"host"]))
+       serverURL = [@"http://" stringByAppendingString:host];
+diff -urNad SOPE~/sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m SOPE/sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m
+--- SOPE~/sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m    2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m     2008-05-02 08:49:09.000000000 +0200
+@@ -32,6 +32,7 @@
+ #include <NGObjWeb/WOCookie.h>
+ #include <NGExtensions/NSData+gzip.h>
+ #include <NGHttp/NGHttp.h>
++#include <NGMime/NGMimeType.h>
+ #include "common.h"
+ #include <string.h>
+@@ -1042,6 +1043,12 @@
+ - (void)parser:(NGMimePartParser *)_parser didParseHeader:(NGHashMap *)_header {
+ }
++- (NGMimeType *)parser:(id)_parser
++  contentTypeOfPart:(id<NGMimePart>)_part
++{
++  return [NGMimeType mimeType: @"text/plain; charset=utf-8"];
++}
++
+ @end /* WOHttpAdaptor */
+ @implementation WOCoreApplication(SimpleParserSelection)
+diff -urNad SOPE~/sope-appserver/NGObjWeb/WebDAV/SaxDAVHandler.m SOPE/sope-appserver/NGObjWeb/WebDAV/SaxDAVHandler.m
+--- SOPE~/sope-appserver/NGObjWeb/WebDAV/SaxDAVHandler.m       2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/WebDAV/SaxDAVHandler.m        2008-05-02 08:49:09.000000000 +0200
+@@ -655,6 +655,7 @@
+       if (self->responses == nil)
+       self->responses = [[NSMutableArray alloc] initWithCapacity:64];
+     }
++
+     break;
+   case 'n':
+diff -urNad SOPE~/sope-appserver/mod_ngobjweb/GNUmakefile SOPE/sope-appserver/mod_ngobjweb/GNUmakefile
+--- SOPE~/sope-appserver/mod_ngobjweb/GNUmakefile      2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-appserver/mod_ngobjweb/GNUmakefile       2008-05-02 08:49:09.000000000 +0200
+@@ -82,7 +82,7 @@
+ CFLAGS  = -Wall -I. -fPIC \
+       $(APXS_CFLAGS) $(APR_CFLAGS) \
+-      $(APXS_INCLUDE_DIRS) $(APR_INCLUDE_DIRS)
++      $(APXS_INCLUDE_DIRS) $(APR_INCLUDE_DIRS) -O0 -ggdb
+ LDFLAGS = $(APXS_LDFLAGS) $(APR_LDFLAGS) -shared -fPIC
+ LDLIBS  = $(APXS_LIBS) $(APR_LIBS)
+diff -urNad SOPE~/sope-appserver/mod_ngobjweb/NGBufferedDescriptor.c SOPE/sope-appserver/mod_ngobjweb/NGBufferedDescriptor.c
+--- SOPE~/sope-appserver/mod_ngobjweb/NGBufferedDescriptor.c   2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-appserver/mod_ngobjweb/NGBufferedDescriptor.c    2008-05-02 08:49:09.000000000 +0200
+@@ -23,6 +23,7 @@
+ #include <unistd.h>
+ #include <string.h>
+ #include <stdio.h>
++#include "common.h"
+ #include "NGBufferedDescriptor.h"
+ // returns the number of bytes which where read from the buffer
+diff -urNad SOPE~/sope-appserver/mod_ngobjweb/config.c SOPE/sope-appserver/mod_ngobjweb/config.c
+--- SOPE~/sope-appserver/mod_ngobjweb/config.c 2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-appserver/mod_ngobjweb/config.c  2008-05-02 08:49:09.000000000 +0200
+@@ -21,7 +21,7 @@
+ #include "common.h"
+-//#define LOG_CONFIG 1
++#define LOG_CONFIG 0
+ static char *_makeString(char *buf, char *str, int max) {
+   if (buf == NULL)
+diff -urNad SOPE~/sope-appserver/mod_ngobjweb/handler.c SOPE/sope-appserver/mod_ngobjweb/handler.c
+--- SOPE~/sope-appserver/mod_ngobjweb/handler.c        2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-appserver/mod_ngobjweb/handler.c 2008-05-02 08:49:09.000000000 +0200
+@@ -646,7 +646,10 @@
+  writeErrorHandler:
+   if (writeError == 1) {
+-    if (toApp) NGBufferedDescriptor_free(toApp);
++    if (toApp) {
++      NGBufferedDescriptor_free(toApp);
++      toApp = NULL;
++    }
+     
+     ap_log_error(__FILE__, __LINE__, APLOG_ERR, 0, r->server,
+                  "socket write error during transfer of HTTP header section");
+@@ -659,7 +662,10 @@
+     if (!NGBufferedDescriptor_safeWrite(toApp,
+                                         requestBody,
+                                         requestContentLength)) {
+-      if (toApp) NGBufferedDescriptor_free(toApp);
++      if (toApp) {
++      NGBufferedDescriptor_free(toApp);
++      toApp = NULL;
++      }
+       ap_log_error(__FILE__, __LINE__, APLOG_ERR, 0, r->server,
+                    "couldn't transfer HTTP req body to app server (%i bytes)",
+                    contentLength);
+@@ -677,7 +683,10 @@
+   /* read response line */
+   
+   if (!NGScanResponseLine(toApp, NULL, &statusCode, NULL)) {
+-    if (toApp) NGBufferedDescriptor_free(toApp);
++    if (toApp) {
++      NGBufferedDescriptor_free(toApp);
++      toApp = NULL;
++    }
+     ap_log_error(__FILE__, __LINE__, APLOG_ERR, 0, r->server,
+                  "error during reading of response line ..");
+     return 500;
+@@ -716,13 +725,8 @@
+       }
+       // read whole response
+-      if (!NGBufferedDescriptor_safeRead(toApp, buffer, contentLength)) {
+-        if (toApp != NULL) { NGBufferedDescriptor_free(toApp); toApp = NULL; }
+-      }
++      NGBufferedDescriptor_safeRead(toApp, buffer, contentLength);
+-      // close connection to app
+-      if (toApp != NULL) { NGBufferedDescriptor_free(toApp); toApp = NULL; }
+-      
+       ap_log_error(__FILE__, __LINE__, APLOG_INFO, 0, r->server,
+                    "send response (size=%i)",
+                    contentLength);
+@@ -736,15 +740,14 @@
+       int result = 0;
+       int writeCount = 0;
+-      do {
+-        result = NGBufferedDescriptor_read(toApp, buffer, sizeof(buffer));
+-        if (result > 0) {
+-          ap_rwrite(buffer, result, r);
+-          ap_rflush(r);
+-          writeCount += result;
+-        }
++      while ((result = NGBufferedDescriptor_read(toApp,
++                                               buffer,
++                                               sizeof(buffer))
++            > 0)) {
++      ap_rwrite(buffer, result, r);
++      ap_rflush(r);
++      writeCount += result;
+       }
+-      while (result > 0);
+       if (HEAVY_LOG && (writeCount > 0)) {
+         ap_log_error(__FILE__, __LINE__, APLOG_INFO, 0, r->server,
+@@ -753,7 +756,13 @@
+       }
+     }
+   }
+-  
++
++  // close connection to app
++  if (toApp) {
++    NGBufferedDescriptor_free(toApp);
++    toApp = NULL;
++  }
++
+   return OK;
+ }
+diff -urNad SOPE~/sope-core/NGExtensions/EOExt.subproj/EOGlobalID+Ext.m SOPE/sope-core/NGExtensions/EOExt.subproj/EOGlobalID+Ext.m
+--- SOPE~/sope-core/NGExtensions/EOExt.subproj/EOGlobalID+Ext.m        2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-core/NGExtensions/EOExt.subproj/EOGlobalID+Ext.m 2008-05-02 08:49:09.000000000 +0200
+@@ -19,6 +19,7 @@
+   02111-1307, USA.
+ */
++#import <Foundation/NSString.h>
+ #import <EOControl/EOGlobalID.h>
+ #import <Foundation/NSString.h>
+diff -urNad SOPE~/sope-core/NGExtensions/FdExt.subproj/NSString+Encoding.m SOPE/sope-core/NGExtensions/FdExt.subproj/NSString+Encoding.m
+--- SOPE~/sope-core/NGExtensions/FdExt.subproj/NSString+Encoding.m     2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-core/NGExtensions/FdExt.subproj/NSString+Encoding.m      2008-05-02 08:49:09.000000000 +0200
+@@ -140,8 +140,12 @@
+ #ifdef __linux__
++#if __BYTE_ORDER == __LITTLE_ENDIAN
+ static NSString *unicharEncoding = @"UCS-2LE";
+ #else
++static NSString *unicharEncoding = @"UCS-2BE";
++#endif /* __BYTE_ORDER */
++#else
+ static NSString *unicharEncoding = @"UCS-2-INTERNAL";
+ #endif
+ static int IconvLogEnabled = -1;
+@@ -149,21 +153,12 @@
+ static void checkDefaults(void) {
+   NSUserDefaults *ud;
+   
+-  if (IconvLogEnabled != -1) 
+-    return;
+-  ud = [NSUserDefaults standardUserDefaults];
+-  IconvLogEnabled = [ud boolForKey:@"IconvLogEnabled"]?1:0;
++  if (IconvLogEnabled == -1) {
++    ud = [NSUserDefaults standardUserDefaults];
++    IconvLogEnabled = [ud boolForKey:@"IconvLogEnabled"]?1:0;
+-#ifdef __linux__
+-  if (NSHostByteOrder() == NS_BigEndian) {
+-    NSLog(@"Note: using UCS-2 big endian on Linux.");
+-    unicharEncoding = @"UCS-2BE";
+-  }
+-  else {
+-    NSLog(@"Note: using UCS-2 little endian on Linux.");
+-    unicharEncoding = @"UCS-2LE";
++    NSLog(@"Note: using '%@' on Linux.", unicharEncoding);
+   }
+-#endif
+ }
+ static char *iconv_wrapper(id self, char *_src, unsigned _srcLen,
+diff -urNad SOPE~/sope-gdl1/Oracle8/OracleAdaptorChannel.m SOPE/sope-gdl1/Oracle8/OracleAdaptorChannel.m
+--- SOPE~/sope-gdl1/Oracle8/OracleAdaptorChannel.m     2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-gdl1/Oracle8/OracleAdaptorChannel.m      2008-05-02 08:49:09.000000000 +0200
+@@ -30,6 +30,7 @@
+ #import <NGExtensions/NSObject+Logs.h>
++static BOOL debugOn = NO;
+ //
+ //
+ //
+@@ -41,10 +42,19 @@
+ @implementation OracleAdaptorChannel (Private)
+--  (void) _cleanup
+++ (void) initialize
++{
++  NSUserDefaults *ud;
++
++  ud = [NSUserDefaults standardUserDefaults];
++  debugOn = [ud boolForKey: @"OracleAdaptorDebug"];
++}
++
++- (void) _cleanup
+ {
+   column_info *info;
+   int c;
++  sword result;
+   [_resultSetProperties removeAllObjects];
+@@ -58,11 +68,29 @@
+       // so we just free the value instead.
+       if (info->value)
+       {
+-        if (OCIDescriptorFree((dvoid *)info->value, (ub4)OCI_DTYPE_LOB) != OCI_SUCCESS)
++        if (info->type == SQLT_CLOB
++            || info->type == SQLT_BLOB
++            || info->type == SQLT_BFILEE
++            || info->type == SQLT_CFILEE)
++          {
++            result = OCIDescriptorFree((dvoid *)info->value, (ub4) OCI_DTYPE_LOB);
++            if (result != OCI_SUCCESS)
++              {
++                NSLog (@"value was not a LOB descriptor");
++                abort();
++              }
++          }
++        else
+           free(info->value);
+         info->value = NULL;
+       }
+-       free(info);
++      else
++      {
++        NSLog (@"trying to free an already freed value!");
++        abort();
++      }
++      free(info);
++
+       [_row_buffer removeObjectAtIndex: c];
+     }
+@@ -231,6 +259,9 @@
+   [self _cleanup];
++  if (debugOn)
++    [self logWithFormat: @"expression: %@", theExpression];
++
+   if (!theExpression || ![theExpression length])
+     {
+       [NSException raise: @"OracleInvalidExpressionException"
+@@ -302,7 +333,9 @@
+       // We read the maximum width of a column
+       info->max_width = 0;
+       status = OCIAttrGet((dvoid*)param, (ub4)OCI_DTYPE_PARAM, (dvoid*)&(info->max_width), (ub4 *)0, (ub4)OCI_ATTR_DATA_SIZE, (OCIError *)_oci_err);
+-      
++
++      if (debugOn)
++      NSLog(@"name: %s, type: %d", cname, info->type);
+       attribute = [EOAttribute attributeWithOracleType: info->type  name: cname  length: clen  width: info->max_width];
+       [_resultSetProperties addObject: attribute];
+diff -urNad SOPE~/sope-gdl1/Oracle8/OracleAdaptorChannelController.m SOPE/sope-gdl1/Oracle8/OracleAdaptorChannelController.m
+--- SOPE~/sope-gdl1/Oracle8/OracleAdaptorChannelController.m   2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-gdl1/Oracle8/OracleAdaptorChannelController.m    2008-05-02 08:49:09.000000000 +0200
+@@ -31,6 +31,8 @@
+ #import <Foundation/Foundation.h>
+ #import <GDLAccess/EOSQLExpression.h>
++static BOOL debugOn = NO;
++
+ //
+ //
+ //
+@@ -48,6 +50,14 @@
+ //
+ @implementation OracleAdaptorChannelController
+++ (void) initialize
++{
++  NSUserDefaults *ud;
++
++  ud = [NSUserDefaults standardUserDefaults];
++  debugOn = [ud boolForKey: @"OracleAdaptorDebug"];
++}
++
+ - (EODelegateResponse) adaptorChannel: (id) theChannel
+                         willInsertRow: (NSMutableDictionary *) theRow
+                             forEntity: (EOEntity *) theEntity
+@@ -56,7 +66,8 @@
+   NSArray *keys;
+   int i, c;
+-  NSLog(@"willInsertRow: %@ %@", [theRow description], [theEntity description]);
++  if (debugOn)
++    NSLog(@"willInsertRow: %@ %@", [theRow description], [theEntity description]);
+   s = AUTORELEASE([[NSMutableString alloc] init]);
+@@ -101,7 +112,8 @@
+   NSArray *keys;
+   int i, c;
+-  NSLog(@"willUpdatetRow: %@ %@", [theRow description], [theQualifier description]);
++  if (debugOn)
++    NSLog(@"willUpdateRow: %@ %@", [theRow description], [theQualifier description]);
+   s = AUTORELEASE([[NSMutableString alloc] init]);
+diff -urNad SOPE~/sope-gdl1/PostgreSQL/PostgreSQL72Channel.m SOPE/sope-gdl1/PostgreSQL/PostgreSQL72Channel.m
+--- SOPE~/sope-gdl1/PostgreSQL/PostgreSQL72Channel.m   2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-gdl1/PostgreSQL/PostgreSQL72Channel.m    2008-05-02 08:49:09.000000000 +0200
+@@ -713,6 +713,39 @@
+   return ms;
+ }
++/* GCSEOAdaptorChannel protocol */
++static NSString *sqlFolderFormat = (@"CREATE TABLE %@ (\n"    \
++                                  @"  c_name VARCHAR (256) NOT NULL,\n"
++                                  @"  c_content VARCHAR (100000) NOT NULL,\n"
++                                  @"  c_creationdate INT4 NOT NULL,\n"
++                                  @"  c_lastmodified INT4 NOT NULL,\n"
++                                  @"  c_version INT4 NOT NULL,\n"
++                                  @"  c_deleted INT4 NULL\n"
++                                  @")");
++static NSString *sqlFolderACLFormat = (@"CREATE TABLE %@ (\n" \
++                                     @"  c_uid VARCHAR (256) NOT NULL,\n"
++                                     @"  c_object VARCHAR (256) NOT NULL,\n"
++                                     @"  c_role VARCHAR (80) NOT NULL\n"
++                                     @")");
++
++- (NSException *) createGCSFolderTableWithName: (NSString *) tableName
++{
++  NSString *sql;
++
++  sql = [NSString stringWithFormat: sqlFolderFormat, tableName];
++
++  return [self evaluateExpressionX: sql];
++}
++
++- (NSException *) createGCSFolderACLTableWithName: (NSString *) tableName
++{
++  NSString *sql;
++
++  sql = [NSString stringWithFormat: sqlFolderACLFormat, tableName];
++
++  return [self evaluateExpressionX: sql];
++}
++
+ @end /* PostgreSQL72Channel */
+ @implementation PostgreSQL72Channel(PrimaryKeyGeneration)
+diff -urNad SOPE~/sope-mime/NGImap4/NGImap4Connection.m SOPE/sope-mime/NGImap4/NGImap4Connection.m
+--- SOPE~/sope-mime/NGImap4/NGImap4Connection.m        2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-mime/NGImap4/NGImap4Connection.m 2008-05-02 08:49:09.000000000 +0200
+@@ -381,7 +381,7 @@
+   
+   if (debugCache) [self logWithFormat:@"  no folders cached yet .."];
+   
+-  result = [[self client] list:(onlyFetchInbox ? @"INBOX" : @"*")
++  result = [[self client] list:(onlyFetchInbox ? @"INBOX" : @"")
+                         pattern:@"*"];
+   if (![[result valueForKey:@"result"] boolValue]) {
+     [self errorWithFormat:@"Could not list mailbox hierarchy!"];
+diff -urNad SOPE~/sope-mime/NGImap4/NGImap4ResponseNormalizer.m SOPE/sope-mime/NGImap4/NGImap4ResponseNormalizer.m
+--- SOPE~/sope-mime/NGImap4/NGImap4ResponseNormalizer.m        2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-mime/NGImap4/NGImap4ResponseNormalizer.m 2008-05-02 08:49:09.000000000 +0200
+@@ -648,14 +648,13 @@
+   enumerator = [_flags objectEnumerator];
+   cnt = 0;
+   while ((obj = [enumerator nextObject])) {
+-    if (![obj isNotEmpty])
+-      continue;
+-    
+-    if (![[obj substringToIndex:1] isEqualToString:@"\\"])
+-      continue;
+-
+-    objs[cnt] = [obj substringFromIndex:1];
+-    cnt++;
++    if ([obj isNotEmpty]) {
++      if ([obj hasPrefix:@"\\"])
++      objs[cnt] = [obj substringFromIndex:1];
++      else
++      objs[cnt] = obj;
++      cnt++;
++    }
+   }
+   result = [NSArray arrayWithObjects:objs count:cnt];
+   if (objs) free(objs);
+diff -urNad SOPE~/sope-mime/NGImap4/NGImap4ResponseParser.m SOPE/sope-mime/NGImap4/NGImap4ResponseParser.m
+--- SOPE~/sope-mime/NGImap4/NGImap4ResponseParser.m    2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-mime/NGImap4/NGImap4ResponseParser.m     2008-05-02 08:49:09.000000000 +0200
+@@ -84,6 +84,8 @@
+ static NSDictionary *_parseMultipartBody(NGImap4ResponseParser *self,
+                                        BOOL isBodyStructure);
++static NSArray *_parseLanguages();
++
+ static NSString *_parseBodyString(NGImap4ResponseParser *self,
+                                   BOOL _convertString);
+ static NSString *_parseBodyDecodeString(NGImap4ResponseParser *self,
+@@ -111,6 +113,7 @@
+ static NSNumber *_parseUnsigned(NGImap4ResponseParser *self);
+ static NSString *_parseUntil(NGImap4ResponseParser *self, char _c);
+ static NSString *_parseUntil2(NGImap4ResponseParser *self, char _c1, char _c2);
++static BOOL _endsWithCQuote(NSString *_string);
+ static __inline__ NSException *_consumeIfMatch
+   (NGImap4ResponseParser *self, unsigned char _m);
+@@ -649,12 +652,35 @@
+ }
+ - (NSString *)_parseQuotedString {
++  NSMutableString *quotedString;
++  NSString *tmpString;
++  BOOL stop;
++
+   /* parse a quoted string, eg '"' */
+   if (_la(self, 0) == '"') {
+     _consume(self, 1);
+-    return _parseUntil(self, '"');
++    quotedString = [NSMutableString string];
++    stop = NO;
++    while (!stop) {
++      tmpString = _parseUntil(self, '"');
++      [quotedString appendString: tmpString];
++      if(_endsWithCQuote(tmpString)) {
++      [quotedString deleteSuffix: @"\\"];
++      [quotedString appendString: @"\""];
++      }
++      else {
++      stop = YES;
++      }
++    }
+   }
+-  return nil;
++  else {
++    quotedString = nil;
++  }
++
++  [quotedString replaceString:@"?=\t=?"
++              withString:@"?==?"];
++
++  return quotedString;
+ }
+ - (void)_consumeOptionalSpace {
+   if (_la(self, 0) == ' ') _consume(self, 1);
+@@ -1185,7 +1211,7 @@
+   route   = [self _parseQuotedStringOrNIL]; [self _consumeOptionalSpace];
+   mailbox = [self _parseQuotedStringOrNIL]; [self _consumeOptionalSpace];
+   host    = [self _parseQuotedStringOrNIL]; [self _consumeOptionalSpace];
+-  
++
+   if (_la(self, 0) != ')') {
+     [self logWithFormat:@"WARNING: IMAP4 envelope "
+           @"address not properly closed (c0=%c,c1=%c): %@",
+@@ -1197,6 +1223,7 @@
+   address = [[NGImap4EnvelopeAddress alloc] initWithPersonalName:pname
+                                           sourceRoute:route mailbox:mailbox
+                                           host:host];
++
+   return address;
+ }
+@@ -1594,8 +1621,11 @@
+     if (_decode)
+       data = [data decodeQuotedPrintableValueOfMIMEHeaderField:nil];
+     
+-    return [[[StrClass alloc] initWithData:data encoding:encoding]
+-                            autorelease];
++    if ([data isKindOfClass: [NSString class]])
++      return (NSString *) data;
++    else
++      return [[[StrClass alloc] initWithData:data encoding:encoding]
++             autorelease];
+   }
+   else {
+     str = _parseUntil2(self, ' ', ')');
+@@ -1620,13 +1650,35 @@
+   return str;
+ }
+-
+ static NSString *_parseBodyString(NGImap4ResponseParser *self,
+                                   BOOL _convertString)
+ {
+   return _parseBodyDecodeString(self, _convertString, NO /* no decode */);
+ }
++static NSArray *_parseLanguages(NGImap4ResponseParser *self) {
++  NSMutableArray *languages;
++  NSString *language;
++
++  languages = [NSMutableArray array];
++  if (_la(self, 0) == '(') {
++    while (_la(self, 0) != ')') {
++      _consume(self,1);
++      language = _parseBodyString(self, YES);
++      if ([language length])
++      [languages addObject: language];
++    }
++    _consume(self,1);
++  }
++  else {
++    language = _parseBodyString(self, YES);
++    if ([language length])
++      [languages addObject: language];
++  }
++
++  return languages;
++}
++
+ static NSDictionary *_parseBodyParameterList(NGImap4ResponseParser *self)
+ {
+   NSMutableDictionary *list;
+@@ -1646,7 +1698,7 @@
+       _consumeIfMatch(self, ' ');
+       value = _parseBodyDecodeString(self, YES, YES);
+-      [list setObject:value forKey:[key lowercaseString]];
++      if (value) [list setObject:value forKey:[key lowercaseString]];
+     }
+     _consumeIfMatch(self, ')');
+   }
+@@ -1734,10 +1786,11 @@
+                     *encoding, *bodysize;
+   NSDictionary        *parameterList;
+   NSMutableDictionary *dict;
++  NSArray           *languages;
+   type = [_parseBodyString(self, YES) lowercaseString];
+   _consumeIfMatch(self, ' ');
+-  subtype = _parseBodyString(self, YES);
++  subtype = [_parseBodyString(self, YES) lowercaseString];
+   _consumeIfMatch(self, ' ');
+   parameterList = _parseBodyParameterList(self);
+   _consumeIfMatch(self, ' ');
+@@ -1762,7 +1815,8 @@
+     _consumeIfMatch(self, ' ');
+     [dict setObject:_parseBodyString(self, YES) forKey:@"lines"];
+   }
+-  else if ([type isEqualToString:@"message"]) {
++  else if ([type isEqualToString:@"message"]
++         && [subtype isEqualToString:@"rfc822"]) {
+     if (_la(self, 0) != ')') {
+       _consumeIfMatch(self, ' ');
+       _consumeIfMatch(self, '(');
+@@ -1805,14 +1859,9 @@
+             forKey: @"disposition"];
+       if (_la(self, 0) != ')') {
+         _consume(self,1);
+-        if (_la(self, 0) == '(') {
+-          [dict setObject: _parseBodyParameterList(self)
+-                forKey: @"language"];
+-        }
+-        else {
+-          [dict setObject: _parseBodyString(self, YES)
+-                forKey: @"language"];
+-        }
++        languages = _parseLanguages(self);
++        if ([languages count])
++          [dict setObject: languages forKey: @"languages"];
+         if (_la(self, 0) != ')') {
+           _consume(self,1);
+           [dict setObject: _parseBodyString(self, YES)
+@@ -1829,6 +1878,7 @@
+ static NSDictionary *_parseMultipartBody(NGImap4ResponseParser *self,
+                                        BOOL isBodyStructure) {
+   NSMutableArray *parts;
++  NSArray      *languages;
+   NSString       *kind;
+   NSMutableDictionary *dict;
+@@ -1854,14 +1904,9 @@
+             forKey: @"disposition"];
+       if (_la(self, 0) != ')') {
+         _consume(self,1);
+-        if (_la(self, 0) == '(') {
+-          [dict setObject: _parseBodyParameterList(self)
+-                forKey: @"language"];
+-        }
+-        else {
+-          [dict setObject: _parseBodyString(self, YES)
+-                forKey: @"language"];
+-        }
++        languages = _parseLanguages(self);
++        if ([languages count])
++          [dict setObject: languages forKey: @"languages"];
+         if (_la(self, 0) != ')') {
+           _consume(self,1);
+           [dict setObject: _parseBodyString(self, YES)
+@@ -2170,6 +2215,21 @@
+   }
+ }
++static BOOL _endsWithCQuote(NSString *_string){
++  unsigned int quoteSlashes;
++  int pos;
++
++  quoteSlashes = 0;
++  pos = [_string length] - 1;
++  while (pos > -1
++       && [_string characterAtIndex: pos] == '\\') {
++    quoteSlashes++;
++    pos--;
++  }
++
++  return ((quoteSlashes % 2) == 1);
++}
++
+ - (NSException *)exceptionForFailedMatch:(unsigned char)_match
+   got:(unsigned char)_avail
+ {
+diff -urNad SOPE~/sope-mime/NGMail/NGMimeMessageGenerator.m SOPE/sope-mime/NGMail/NGMimeMessageGenerator.m
+--- SOPE~/sope-mime/NGMail/NGMimeMessageGenerator.m    2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-mime/NGMail/NGMimeMessageGenerator.m     2008-05-02 08:49:09.000000000 +0200
+@@ -86,37 +86,40 @@
+   char         *des    = NULL;
+   unsigned int cnt;
+   BOOL         doEnc;
+-  NSString     *str;
++//   NSString     *str;
+   // TODO: this s***s big time!
+-
+-#if APPLE_Foundation_LIBRARY || NeXT_Foundation_LIBRARY
+-  str = [[NSString alloc] initWithData:_data
+-                          encoding:NSISOLatin1StringEncoding];
+-#else
+-  str = [[NSString alloc] initWithData:_data
+-                          encoding:NSISOLatin9StringEncoding];
+-#endif
+-  str = [str autorelease];
+-  
+-  bytes  = [str cString];
+-  length = [str cStringLength];
++//   NSLog (@"class: '%@'", NSStringFromClass ([_data class]));
++// #if APPLE_Foundation_LIBRARY || NeXT_Foundation_LIBRARY
++//   str = [[NSString alloc] initWithData:_data
++//                           encoding:NSISOLatin1StringEncoding];
++//   str = [str autorelease];
+   
++// #else
++//   str = [[NSString alloc] initWithData:_data
++//                           encoding:NSISOLatin9StringEncoding];
++// #endif
++//   bytes  = [str cString];
++//   length = [str cStringLength];
++
++  bytes = [_data bytes];
++  length = [_data length];
++
+   /* check whether we need to encode */
+-  
+-  for (cnt = 0, doEnc = NO; cnt < length; cnt++) {
+-    if ((unsigned char)bytes[cnt] > 127) {
++  cnt = 0;
++  doEnc = NO;
++  while (!doEnc && cnt < length)
++    if ((unsigned char)bytes[cnt] > 127)
+       doEnc = YES;
+-      break;
+-    }
+-  }
+-  
++    else
++      cnt++;
++
+   if (!doEnc)
+     return _data;
+   
+   /* encode quoted printable */
+   {
+-    char        iso[]     = "=?iso-8859-15?q?";
++    char        iso[]     = "=?utf-8?q?";
+     unsigned    isoLen    = 16;
+     char        isoEnd[]  = "?=";
+     unsigned    isoEndLen = 2;
+diff -urNad SOPE~/sope-mime/NGMail/NGSmtpClient.m SOPE/sope-mime/NGMail/NGSmtpClient.m
+--- SOPE~/sope-mime/NGMail/NGSmtpClient.m      2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-mime/NGMail/NGSmtpClient.m       2008-05-02 08:49:09.000000000 +0200
+@@ -24,6 +24,82 @@
+ #include "NGSmtpReplyCodes.h"
+ #include "common.h"
++//
++// Useful extension that comes from Pantomime which is also
++// released under the LGPL.
++//
++@interface NSMutableData (DataCleanupExtension)
++
++- (NSRange) rangeOfCString: (const char *) theCString;
++- (NSRange) rangeOfCString: (const char *) theCString
++                options: (unsigned int) theOptions
++                  range: (NSRange) theRange;
++@end
++
++@implementation NSMutableData (DataCleanupExtension)
++
++- (NSRange) rangeOfCString: (const char *) theCString
++{
++  return [self rangeOfCString: theCString
++             options: 0
++             range: NSMakeRange(0,[self length])];
++}
++
++-(NSRange) rangeOfCString: (const char *) theCString
++                options: (unsigned int) theOptions
++                  range: (NSRange) theRange
++{
++  const char *b, *bytes;
++  int i, len, slen;
++  
++  if (!theCString)
++    {
++      return NSMakeRange(NSNotFound,0);
++    }
++  
++  bytes = [self bytes];
++  len = [self length];
++  slen = strlen(theCString);
++  
++  b = bytes;
++  
++  if (len > theRange.location + theRange.length)
++    {
++      len = theRange.location + theRange.length;
++    }
++
++  if (theOptions == NSCaseInsensitiveSearch)
++    {
++      i = theRange.location;
++      b += i;
++      
++      for (; i <= len-slen; i++, b++)
++      {
++        if (!strncasecmp(theCString,b,slen))
++          {
++            return NSMakeRange(i,slen);
++          }
++      }
++    }
++  else
++    {
++      i = theRange.location;
++      b += i;
++      
++      for (; i <= len-slen; i++, b++)
++      {
++        if (!memcmp(theCString,b,slen))
++          {
++            return NSMakeRange(i,slen);
++          }
++      }
++    }
++  
++  return NSMakeRange(NSNotFound,0);
++}
++
++@end
++
+ @interface NGSmtpClient(PrivateMethods)
+ - (void)_fetchExtensionInfo;
+ @end
+@@ -429,7 +505,9 @@
+ - (BOOL)sendData:(NSData *)_data {
+   NGSmtpResponse *reply = nil;
+-  
++  NSMutableData *cleaned_data;
++  NSRange r1, r2;
++
+   [self requireState:NGSmtpState_TRANSACTION];
+   reply = [self sendCommand:@"DATA"];
+@@ -441,11 +519,54 @@
+     }
+     [self->text flush];
++    cleaned_data = [NSMutableData dataWithData: _data];
++
++    //
++    // According to RFC 2821 section 4.5.2, we must check for the character
++    // sequence "<CRLF>.<CRLF>"; any occurrence have its period duplicated
++    // to avoid data transparency.
++    //
++    // The following code was copied from Pantomime (and also the one
++    // that strips Bcc: headers from the mail's content)
++    //
++    r1 = [cleaned_data rangeOfCString: "\r\n."];
++    
++    while (r1.location != NSNotFound)
++      {
++      [cleaned_data replaceBytesInRange: r1  withBytes: "\r\n.."  length: 4];
++      
++      r1 = [cleaned_data rangeOfCString: "\r\n."
++                         options: 0 
++                         range: NSMakeRange(NSMaxRange(r1)+1, [cleaned_data length]-NSMaxRange(r1)-1)];
++      }
++    
++    //
++    // We now look for the Bcc: header. If it is present, we remove it.
++    // Some servers, like qmail, do not remove it automatically.
++    //
++    r1 = [cleaned_data rangeOfCString: "\r\n\r\n"];
++    r1 = [cleaned_data rangeOfCString: "\r\nBcc: "
++                     options: 0
++                     range: NSMakeRange(0,r1.location-1)];
++    
++    if (r1.location != NSNotFound)
++      {
++      // We search for the first \r\n AFTER the Bcc: header and
++      // replace the whole thing with \r\n.
++      r2 = [cleaned_data rangeOfCString: "\r\n"
++                         options: 0
++                         range: NSMakeRange(NSMaxRange(r1)+1,[cleaned_data length]-NSMaxRange(r1)-1)];
++      [cleaned_data replaceBytesInRange: NSMakeRange(r1.location, NSMaxRange(r2)-r1.location)
++                    withBytes: "\r\n"
++                    length: 2];
++      }
++    
++    
+     if (self->isDebuggingEnabled)
+-      [NGTextErr writeFormat:@"C: data(%i bytes) ..\n", [_data bytes]];
++      [NGTextErr writeFormat:@"C: data(%i bytes) ..\n", [cleaned_data length]];
+     
+-    [self->connection safeWriteBytes:[_data bytes] count:[_data length]];
+-    [self->connection safeWriteBytes:".\r\n" count:3];
++    [self->connection safeWriteBytes:[cleaned_data bytes] count:[cleaned_data length]];
++    [self->connection safeWriteBytes:"\r\n.\r\n" count:5];
+     [self->connection flush];
+     reply = [self receiveReply];
+diff -urNad SOPE~/sope-mime/NGMime/GNUmakefile.preamble SOPE/sope-mime/NGMime/GNUmakefile.preamble
+--- SOPE~/sope-mime/NGMime/GNUmakefile.preamble        2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-mime/NGMime/GNUmakefile.preamble 2008-05-02 08:49:09.000000000 +0200
+@@ -5,6 +5,11 @@
+       -DLIBRARY_MINOR_VERSION=${MINOR_VERSION} \
+       -DLIBRARY_SUBMINOR_VERSION=${SUBMINOR_VERSION} \
++ifeq ($(patsubstr GNU/%,glibc,$(shell uname -o)),glibc)
++ADDITIONAL_CPPFLAGS += \
++        -DHAVE_STRNDUP
++endif
++
+ NGMime_INCLUDE_DIRS += \
+       -I.. -I../..                    \
+       -I../../sope-core/NGStreams/    \
+diff -urNad SOPE~/sope-mime/NGMime/NGMimeAddressHeaderFieldGenerator.m SOPE/sope-mime/NGMime/NGMimeAddressHeaderFieldGenerator.m
+--- SOPE~/sope-mime/NGMime/NGMimeAddressHeaderFieldGenerator.m 2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-mime/NGMime/NGMimeAddressHeaderFieldGenerator.m  2008-05-02 08:49:09.000000000 +0200
+@@ -130,8 +130,13 @@
+     
+     if (doEnc) {
+       /* FIXME - better use UTF8 encoding! */
++#if NeXT_Foundation_LIBRARY
+       unsigned char iso[]     = "=?iso-8859-15?q?";
+       unsigned      isoLen    = 16;
++#else
++      unsigned char iso[]     = "=?utf-8?q?";
++      unsigned      isoLen    = 10;
++#endif
+       unsigned char isoEnd[]  = "?=";
+       unsigned      isoEndLen = 2;
+       unsigned      desLen;
+@@ -141,10 +146,10 @@
+       {
+         NSData *data;
+-#if APPLE_Foundation_LIBRARY || NeXT_Foundation_LIBRARY
++#if NeXT_Foundation_LIBRARY
+         data = [tmp dataUsingEncoding:NSISOLatin1StringEncoding];
+ #else
+-        data = [tmp dataUsingEncoding:NSISOLatin9StringEncoding];
++        data = [tmp dataUsingEncoding:NSUTF8StringEncoding];
+ #endif
+         bufLen  = [data length];
+diff -urNad SOPE~/sope-mime/NGMime/NGMimeBodyParser.m SOPE/sope-mime/NGMime/NGMimeBodyParser.m
+--- SOPE~/sope-mime/NGMime/NGMimeBodyParser.m  2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-mime/NGMime/NGMimeBodyParser.m   2008-05-02 08:49:09.000000000 +0200
+@@ -67,7 +67,10 @@
+   if (_data == nil) return nil;
+   
+   ctype = [_part contentType];
+-  
++  if (!ctype
++      && [_d respondsToSelector: @selector(parser:contentTypeOfPart:)])
++    ctype = [_d parser: self contentTypeOfPart: _part];
++
+   if (![ctype isKindOfClass:[NGMimeType class]])
+     ctype = [NGMimeType mimeType:[ctype stringValue]];
+   
+diff -urNad SOPE~/sope-mime/NGMime/NGMimeBodyPart.m SOPE/sope-mime/NGMime/NGMimeBodyPart.m
+--- SOPE~/sope-mime/NGMime/NGMimeBodyPart.m    2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-mime/NGMime/NGMimeBodyPart.m     2008-05-02 08:49:09.000000000 +0200
+@@ -31,18 +31,6 @@
+   return 2;
+ }
+-static NGMimeType *defaultType = nil;
+-
+-+ (void)initialize {
+-  static BOOL isInitialized = NO;
+-  if (!isInitialized) {
+-    isInitialized = YES;
+-    
+-    defaultType =
+-      [[NGMimeType mimeType:@"text/plain; charset=us-ascii"] retain];
+-  }
+-}
+-  
+ + (id)bodyPartWithHeader:(NGHashMap *)_header {
+   return [[[self alloc] initWithHeader:_header] autorelease];
+ }
+@@ -156,13 +144,12 @@
+   if (!Fields)
+     Fields = (NGMimeHeaderNames *)[NGMimePartParser headerFieldNames];
+   
+-  
+   type = [self->header objectForKey:Fields->contentType];
+   
+   if (![type isKindOfClass:[NGMimeType class]])
+     type = [NGMimeType mimeType:[type stringValue]];
+   
+-  return (type != nil ? type : (id)defaultType);
++  return type;
+ }
+ - (NSString *)contentId {
+diff -urNad SOPE~/sope-mime/NGMime/NGMimeContentDispositionHeaderFieldGenerator.m SOPE/sope-mime/NGMime/NGMimeContentDispositionHeaderFieldGenerator.m
+--- SOPE~/sope-mime/NGMime/NGMimeContentDispositionHeaderFieldGenerator.m      2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-mime/NGMime/NGMimeContentDispositionHeaderFieldGenerator.m       2008-05-02 08:49:09.000000000 +0200
+@@ -49,80 +49,70 @@
+   
+   // TODO: move the stuff below to some NSString or NSData category?
+   
+-  data = [NSMutableData dataWithCapacity:64];
++  data = [NSMutableData dataWithCapacity: 64];
+   tmp  = [field type];
+   [data appendBytes:[tmp cString] length:[tmp length]];
+   tmp = [field filename];
+   if (tmp != nil) {
+     [data appendBytes:"; " length:2];
+     [data appendBytes:"filename=\"" length:10];
+-    {
+-      unsigned char *ctmp;
+-      int  cnt, len;
+-      BOOL doEnc;
+-      
+-      // TODO: unicode?
+-      len  = [tmp cStringLength];
+-      ctmp = malloc(len + 3);
+-      [tmp getCString:(char *)ctmp]; ctmp[len] = '\0';
+-      cnt  = 0;
+-      doEnc = NO;
+-      while (cnt < len) {
+-        if ((unsigned char)ctmp[cnt] > 127) {
+-          doEnc = YES;
+-          break;
+-        }
+-        cnt++;
+-      }
+-      if (doEnc) {
+-        char        iso[]     = "=?iso-8859-15?q?";
+-        unsigned    isoLen    = 16;
+-        char        isoEnd[]  = "?=";
+-        unsigned    isoEndLen = 2;
+-        unsigned    desLen;
+-        char        *des;
+-      
+-        if (ctmp) free(ctmp);
+-        {
+-          NSData *data;
++    
++    NSData *d;
++    unsigned char* bytes;
++    unsigned length;
++    int  cnt;
++    BOOL doEnc;
+-#if APPLE_Foundation_LIBRARY || NeXT_Foundation_LIBRARY
+-          data = [tmp dataUsingEncoding:NSISOLatin1StringEncoding];
+-#else
+-          data = [tmp dataUsingEncoding:NSISOLatin9StringEncoding];
+-#endif
++    //d = [tmp dataUsingEncoding: NSUTF8StringEncoding];
++    //bytes = [d bytes];
++    //length = [d length];
++    bytes = [tmp cStringUsingEncoding: NSUTF8StringEncoding];
++    length = strlen(bytes);
++    
++    cnt = 0;
++    doEnc = NO;
++    while (cnt < length) {
++      if ((unsigned char)bytes[cnt] > 127) {
++      doEnc = YES;
++      break;
++      }
++      cnt++;
++    }
+-          len  = [data length];
+-          ctmp =  malloc(len+1);
+-          [data getBytes:ctmp];  ctmp[len] = '\0';
+-        }
+-          
+-        desLen = len * 3 + 20;
+-        des    = calloc(desLen + 10, sizeof(char));
+-      
+-        memcpy(des, ctmp, cnt);
+-        memcpy(des + cnt, iso, isoLen);
+-        desLen =
+-        NGEncodeQuotedPrintableMime((unsigned char *)ctmp + cnt, len - cnt,
+-                                    (unsigned char *)des + cnt + isoLen,
+-                                    desLen - cnt - isoLen);
+-        if ((int)desLen != -1) {
+-          memcpy(des + cnt + isoLen + desLen, isoEnd, isoEndLen);
+-          [data appendBytes:des length:(cnt + isoLen + desLen + isoEndLen)];
+-        }
+-        else {
++    if (doEnc)
++      {
++      char        iso[]     = "=?utf-8?q?";
++      unsigned    isoLen    = 10;
++      char        isoEnd[]  = "?=";
++      unsigned    isoEndLen = 2;
++      int    desLen;
++      char        *des;
++      
++      desLen = length * 3 + 20;
++      
++      des = calloc(desLen + 2, sizeof(char));
++      
++      memcpy(des, iso, isoLen);
++      desLen = NGEncodeQuotedPrintableMime((unsigned char *)bytes, length,
++                                           (unsigned char *)(des + isoLen),
++                                           desLen - isoLen);
++      if (desLen != -1) {
++        memcpy(des + isoLen + desLen, isoEnd, isoEndLen);
++        [data appendBytes:des length:(isoLen + desLen + isoEndLen)];
++      }
++      else {
+           [self logWithFormat:@"WARNING(%s:%i): An error occour during "
+               @"quoted-printable decoding",
+                 __PRETTY_FUNCTION__, __LINE__];
+-        }
+-        if (des) free(des);
++        if (des != NULL) free(des);
++      }
+       }
+-      else {
+-        [data appendBytes:ctmp length:len];
++    else
++      {
++      [data appendBytes:[tmp cString] length:[tmp length]];
+       }
+-    }
+-      //      [data appendBytes:[tmp cString] length:[tmp length]];
+-      [data appendBytes:"\"" length:1];
++
++    [data appendBytes:"\"" length:1];
+   }
+   return data;
+ }
+diff -urNad SOPE~/sope-mime/NGMime/NGMimeHeaderFieldGeneratorSet.m SOPE/sope-mime/NGMime/NGMimeHeaderFieldGeneratorSet.m
+--- SOPE~/sope-mime/NGMime/NGMimeHeaderFieldGeneratorSet.m     2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-mime/NGMime/NGMimeHeaderFieldGeneratorSet.m      2008-05-02 08:49:09.000000000 +0200
+@@ -77,6 +77,7 @@
+     [rfc822Set setGenerator:gen forField:@"bcc"];
+     [rfc822Set setGenerator:gen forField:Fields->from];
+     [rfc822Set setGenerator:gen forField:@"reply-to"];
++    [rfc822Set setGenerator:gen forField:@"in-reply-to"];
+     [rfc822Set setGenerator:gen forField:@"Disposition-Notification-To"];
+   }
+   
+diff -urNad SOPE~/sope-mime/NGMime/NGMimePartParser.h SOPE/sope-mime/NGMime/NGMimePartParser.h
+--- SOPE~/sope-mime/NGMime/NGMimePartParser.h  2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-mime/NGMime/NGMimePartParser.h   2008-05-02 08:49:09.000000000 +0200
+@@ -117,6 +117,7 @@
+     BOOL parserParseRawBodyDataOfPart:1;
+     BOOL parserBodyParserForPart:1;
+     BOOL parserDecodeBodyOfPart:1;
++    BOOL parserContentTypeOfPart:1;
+   } delegateRespondsTo;
+   
+@@ -275,6 +276,9 @@
+ - (id<NGMimeBodyParser>)parser:(NGMimePartParser *)_parser
+   bodyParserForPart:(id<NGMimePart>)_part;
++- (NGMimeType *)parser:(id)_parser
++  contentTypeOfPart:(id<NGMimePart>)_part;
++
+ @end /* NSObject(NGMimePartParserDelegate) */
+ @interface NSObject(NGMimePartParser)
+diff -urNad SOPE~/sope-mime/NGMime/NGMimePartParser.m SOPE/sope-mime/NGMime/NGMimePartParser.m
+--- SOPE~/sope-mime/NGMime/NGMimePartParser.m  2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-mime/NGMime/NGMimePartParser.m   2008-05-02 08:49:09.000000000 +0200
+@@ -227,7 +227,7 @@
+ }
+ + (NSStringEncoding)defaultHeaderFieldEncoding {
+-  return NSISOLatin1StringEncoding;
++  return NSUTF8StringEncoding;
+ }
+ - (id)valueOfHeaderField:(NSString *)_name data:(id)_data {
+@@ -1091,7 +1091,10 @@
+   id<NGMimeBodyParser> bodyParser   = nil;
+   
+   ctype = [_p contentType];
+-  
++  if (!ctype
++      && self->delegateRespondsTo.parserContentTypeOfPart)
++    ctype = [self->delegate parser: self contentTypeOfPart: _p];
++
+   contentType = ([ctype isKindOfClass:[NGMimeType class]])
+     ? ctype
+     : [NGMimeType mimeType:[ctype stringValue]];
+diff -urNad SOPE~/sope-mime/NGMime/NGMimeRFC822DateHeaderFieldParser.m SOPE/sope-mime/NGMime/NGMimeRFC822DateHeaderFieldParser.m
+--- SOPE~/sope-mime/NGMime/NGMimeRFC822DateHeaderFieldParser.m 2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-mime/NGMime/NGMimeRFC822DateHeaderFieldParser.m  2008-05-02 08:49:09.000000000 +0200
+@@ -19,88 +19,45 @@
+   02111-1307, USA.
+ */
++#ifdef HAVE_STRNDUP
++#define _GNU_SOURCE 1
++#endif
++
++#include <string.h>
++
+ #include "NGMimeHeaderFieldParser.h"
+ #include "NGMimeHeaderFields.h"
+ #include "NGMimeUtilities.h"
+ #include "common.h"
+-#include <string.h>
++
++#ifndef HAVE_STRNDUP
++char *strndup(const char *str, size_t len)
++{
++  char *dup = (char *)malloc(len+1);
++  if (dup) {
++    strncpy(dup,str,len);
++    dup[len]= '\0';
++  }
++  return dup;
++}
++#endif
+ @implementation NGMimeRFC822DateHeaderFieldParser
+-static Class CalDateClass = Nil;
+-static NSTimeZone *gmt   = nil;
+-static NSTimeZone *gmt01 = nil;
+-static NSTimeZone *gmt02 = nil;
+-static NSTimeZone *gmt03 = nil;
+-static NSTimeZone *gmt04 = nil;
+-static NSTimeZone *gmt05 = nil;
+-static NSTimeZone *gmt06 = nil;
+-static NSTimeZone *gmt07 = nil;
+-static NSTimeZone *gmt08 = nil;
+-static NSTimeZone *gmt09 = nil;
+-static NSTimeZone *gmt10 = nil;
+-static NSTimeZone *gmt11 = nil;
+-static NSTimeZone *gmt12 = nil;
+-static NSTimeZone *gmt0530 = nil;
+-static NSTimeZone *gmtM01 = nil;
+-static NSTimeZone *gmtM02 = nil;
+-static NSTimeZone *gmtM03 = nil;
+-static NSTimeZone *gmtM04 = nil;
+-static NSTimeZone *gmtM05 = nil;
+-static NSTimeZone *gmtM06 = nil;
+-static NSTimeZone *gmtM07 = nil;
+-static NSTimeZone *gmtM08 = nil;
+-static NSTimeZone *gmtM09 = nil;
+-static NSTimeZone *gmtM10 = nil;
+-static NSTimeZone *gmtM11 = nil;
+-static NSTimeZone *gmtM12 = nil;
+-static NSTimeZone *gmtM13 = nil;
+-static NSTimeZone *gmtM14 = nil;
+-static NSTimeZone *met    = nil;
++static NSTimeZone *gmt = nil;
++static NSTimeZone *met = nil;
+ + (int)version {
+   return 2;
+ }
++
+ + (void)initialize {
+   static BOOL didInit = NO;
+-  Class TzClass;
+   if (didInit) return;
+   didInit = YES;
+   
+-  CalDateClass = [NSCalendarDate class];
+-  
+-  /* timezones which were actually used in a maillist mailbox */
+-  TzClass = [NSTimeZone class];
+-  gmt    = [[TzClass timeZoneWithName:@"GMT"] retain];
+-  met    = [[TzClass timeZoneWithName:@"MET"] retain];
+-  gmt01  = [[TzClass timeZoneForSecondsFromGMT:  1 * (60 * 60)] retain];
+-  gmt02  = [[TzClass timeZoneForSecondsFromGMT:  2 * (60 * 60)] retain];
+-  gmt03  = [[TzClass timeZoneForSecondsFromGMT:  3 * (60 * 60)] retain];
+-  gmt04  = [[TzClass timeZoneForSecondsFromGMT:  4 * (60 * 60)] retain];
+-  gmt05  = [[TzClass timeZoneForSecondsFromGMT:  5 * (60 * 60)] retain];
+-  gmt06  = [[TzClass timeZoneForSecondsFromGMT:  6 * (60 * 60)] retain];
+-  gmt07  = [[TzClass timeZoneForSecondsFromGMT:  7 * (60 * 60)] retain];
+-  gmt08  = [[TzClass timeZoneForSecondsFromGMT:  8 * (60 * 60)] retain];
+-  gmt09  = [[TzClass timeZoneForSecondsFromGMT:  9 * (60 * 60)] retain];
+-  gmt10  = [[TzClass timeZoneForSecondsFromGMT: 10 * (60 * 60)] retain];
+-  gmt11  = [[TzClass timeZoneForSecondsFromGMT: 11 * (60 * 60)] retain];
+-  gmt12  = [[TzClass timeZoneForSecondsFromGMT: 12 * (60 * 60)] retain];
+-  gmtM01 = [[TzClass timeZoneForSecondsFromGMT: -1 * (60 * 60)] retain];
+-  gmtM02 = [[TzClass timeZoneForSecondsFromGMT: -2 * (60 * 60)] retain];
+-  gmtM03 = [[TzClass timeZoneForSecondsFromGMT: -3 * (60 * 60)] retain];
+-  gmtM04 = [[TzClass timeZoneForSecondsFromGMT: -4 * (60 * 60)] retain];
+-  gmtM05 = [[TzClass timeZoneForSecondsFromGMT: -5 * (60 * 60)] retain];
+-  gmtM06 = [[TzClass timeZoneForSecondsFromGMT: -6 * (60 * 60)] retain];
+-  gmtM07 = [[TzClass timeZoneForSecondsFromGMT: -7 * (60 * 60)] retain];
+-  gmtM08 = [[TzClass timeZoneForSecondsFromGMT: -8 * (60 * 60)] retain];
+-  gmtM09 = [[TzClass timeZoneForSecondsFromGMT: -9 * (60 * 60)] retain];
+-  gmtM10 = [[TzClass timeZoneForSecondsFromGMT:-10 * (60 * 60)] retain];
+-  gmtM11 = [[TzClass timeZoneForSecondsFromGMT:-11 * (60 * 60)] retain];
+-  gmtM12 = [[TzClass timeZoneForSecondsFromGMT:-12 * (60 * 60)] retain];
+-  gmtM13 = [[TzClass timeZoneForSecondsFromGMT:-13 * (60 * 60)] retain];
+-  gmtM14 = [[TzClass timeZoneForSecondsFromGMT:-14 * (60 * 60)] retain];
+-  
+-  gmt0530 = [[TzClass timeZoneForSecondsFromGMT:5 * (60*60) + (30*60)] retain];
++  gmt = [[NSTimeZone timeZoneWithName:@"GMT"] retain];
++  met = [[NSTimeZone timeZoneWithName:@"MET"] retain];
+ }
+ /* 
+@@ -147,162 +104,110 @@
+   }
+ }
+-static NSTimeZone *parseTimeZone(unsigned char *s, unsigned int len) {
++static int offsetFromTZAbbreviation(const char **p) {
++  NSString *abbreviation;
++  NSTimeZone *offsetTZ;
++  unsigned int length;
++
++  length = 0;
++  while (isalpha(*(*p+length)))
++    length++;
++  abbreviation = [[NSString alloc] initWithBytes: *p
++                                 length: length - 1
++                                 encoding: NSASCIIStringEncoding];
++  offsetTZ = [NSTimeZone timeZoneWithAbbreviation: abbreviation];
++  [abbreviation release];
++  *p += length;
++
++  return [offsetTZ secondsFromGMT];
++}
++
++static inline char *digitsString(const char *string) {
++  const char *p;
++  unsigned int len;
++
++  p = string;
++  while (!isdigit(*p))
++    p++;
++  len = 0;
++  while (isdigit(*(p + len)))
++    len++;
++
++  return strndup(p, len);
++}
++ 
++static NSTimeZone *parseTimeZone(const char *s, unsigned int len) {
+   /*
+     WARNING: failed to parse RFC822 timezone: '+0530' \
+              (value='Tue, 13 Jul 2004 21:39:28 +0530')
+     TODO: this is because libFoundation doesn't accept 'GMT+0530' as input.
+   */
+-  char       *p = (char *)s;
++  char *newString, *digits;
++  const char *p;
+   NSTimeZone *tz;
+-  NSString   *ts;
+-  
+-  if (len == 0) 
+-    return nil;
+-  
+-  if (*s == '+' || *s == '-') {
+-    if (len == 3) {
+-      if (p[1] == '0' && p[2] == '0') // '+00' or '-00'
+-      return gmt;
+-      if (*s == '+') {
+-      if (p[1] == '0' && p[2] == '1') // '+01'
+-        return gmt01;
+-      if (p[1] == '0' && p[2] == '2') // '+02'
+-        return gmt02;
+-      }
+-    }
+-    else if (len == 5) {
+-      if (p[3] == '0' && p[4] == '0' && p[1] == '0') { // '?0x00'
+-      if (p[2] == '0') // '+0000'
+-        return gmt;
+-      
+-      if (*s == '+') {
+-        if (p[2] == '1') return gmt01; // '+0100'
+-        if (p[2] == '2') return gmt02; // '+0200'
+-        if (p[2] == '3') return gmt03; // '+0300'
+-        if (p[2] == '4') return gmt04; // '+0400'
+-        if (p[2] == '5') return gmt05; // '+0500'
+-        if (p[2] == '6') return gmt06; // '+0600'
+-        if (p[2] == '7') return gmt07; // '+0700'
+-        if (p[2] == '8') return gmt08; // '+0800'
+-        if (p[2] == '9') return gmt09; // '+0900'
+-      }
+-      else if (*s == '-') {
+-          if (p[2] == '1') return gmtM01; // '-0100'
+-          if (p[2] == '2') return gmtM02; // '-0200'
+-          if (p[2] == '3') return gmtM03; // '-0300'
+-        if (p[2] == '4') return gmtM04; // '-0400'
+-        if (p[2] == '5') return gmtM05; // '-0500'
+-        if (p[2] == '6') return gmtM06; // '-0600'
+-        if (p[2] == '7') return gmtM07; // '-0700'
+-        if (p[2] == '8') return gmtM08; // '-0800'
+-        if (p[2] == '9') return gmtM09; // '-0900'
+-      }
+-      }
+-      else if (p[3] == '0' && p[4] == '0' && p[1] == '1') { // "?1x00"
+-        if (*s == '+') {
+-          if (p[2] == '0') return gmt10; // '+1000'
+-          if (p[2] == '1') return gmt11; // '+1100'
+-          if (p[2] == '2') return gmt12; // '+1200'
+-        }
+-        else if (*s == '-') {
+-          if (p[2] == '0') return gmtM10; // '-1000'
+-          if (p[2] == '1') return gmtM11; // '-1100'
+-          if (p[2] == '2') return gmtM12; // '-1200'
+-          if (p[2] == '3') return gmtM13; // '-1300'
+-          if (p[2] == '4') return gmtM14; // '-1400'
+-        }
+-      }
+-      
+-      /* special case for GMT+0530 */
+-      if (strncmp((char *)s, "+0530", 5) == 0)
+-      return gmt0530;
+-    }
+-    else if (len == 7) {
+-      /*
+-        "MultiMail" submits timezones like this: 
+-          "Tue, 9 Mar 2004 9:43:00 -05-500",
+-        don't know what the "-500" trailer is supposed to mean? Apparently 
+-        Thunderbird just uses the "-05", so do we.
+-      */
+-      
+-      if (isdigit(p[1]) && isdigit(p[2]) && (p[3] == '-'||p[3] == '+')) {
+-        unsigned char tmp[8];
+-        
+-        strncpy((char *)tmp, p, 3);
+-        tmp[3] = '0';
+-        tmp[4] = '0';
+-        tmp[5] = '\0';
+-        return parseTimeZone(tmp, 5);
+-      }
+-    }
+-  }
+-  else if (*s == '0') {
+-    if (len == 2) { // '00'
+-      if (p[1] == '0') return gmt;
+-      if (p[1] == '1') return gmt01;
+-      if (p[1] == '2') return gmt02;
+-    }
+-    else if (len == 4) {
+-      if (p[2] == '0' && p[3] == '0') { // '0x00'
+-      if (p[1] == '0') return gmt;
+-      if (p[1] == '1') return gmt01;
+-      if (p[1] == '2') return gmt02;
+-      }
+-    }
+-  }
+-  else if (len == 3) {
+-    if (strcasecmp((char *)s, "GMT") == 0) return gmt;
+-    if (strcasecmp((char *)s, "UTC") == 0) return gmt;
+-    if (strcasecmp((char *)s, "MET") == 0) return met;
+-    if (strcasecmp((char *)s, "CET") == 0) return met;
+-  }
+-  
+-  if (isalpha(*s)) {
+-    ts = [[NSString alloc] initWithCString:(char *)s length:len];
++  unsigned int hours, minutes, seconds, remaining;
++  int sign;
++
++  sign = 1;
++  hours = 0;
++  minutes = 0;
++  seconds = 0;
++
++  newString = strndup(s, len);
++  p = newString;
++
++  if (isalpha(*p))
++    seconds = offsetFromTZAbbreviation(&p);
++  while (isspace(*p))
++    p++;
++  while (*p == '+' || *p == '-') {
++    if (*p == '-')
++      sign = -sign;
++    p++;
+   }
+-  else {
+-    char buf[len + 5];
+-    
+-    buf[0] = 'G'; buf[1] = 'M'; buf[2] = 'T';
+-    if (*s == '+' || *s == '-') {
+-      strcpy(&(buf[3]), (char *)s);
+-    }
+-    else {
+-      buf[3] = '+';
+-      strcpy(&(buf[4]), (char *)s);
+-    }
+-    ts = [[NSString alloc] initWithCString:buf];
++  digits = digitsString(p);
++  p = digits;
++  remaining = strlen(p);
++  switch(remaining) {
++  case 6: /* hhmmss */
++    seconds += (10 * (*(p + remaining - 2) - 48)
++              + *(p + remaining - 1) - 48);
++  case 4: /* hhmm */
++    hours += 10 * (*p - 48);
++    p++;
++  case 3: /* hmm */
++    hours += (*p - 48);
++    p++;
++    minutes += 10 * (*p - 48) + *(p + 1) - 48;
++    break;
++  case 2: /* hh */
++    hours += 10 * (*p - 48) + *(p + 1) - 48;
++    break;
++  default:
++    NSLog (@"%s: cannot parse time notation '%s'", p);
+   }
+-#if 1
+-  NSLog(@"%s: RFC822 TZ Parser: expensive: '%@'", __PRETTY_FUNCTION__, ts);
+-#endif
+-  tz = [NSTimeZone timeZoneWithAbbreviation:ts];
+-  [ts release];
++  free(digits);
++
++  seconds += sign * (3600 * hours + 60 * minutes);
++  tz = [NSTimeZone timeZoneForSecondsFromGMT: seconds];
++  free(newString);
++
+   return tz;
+ }
+ - (id)parseValue:(id)_data ofHeaderField:(NSString *)_field {
+   // TODO: use UNICODE
+   NSCalendarDate *date       = nil;
+-  unsigned char  buf[256];
+-  unsigned char  *bytes = buf, *pe;
++  unsigned char  *bytes, *pe;
+   unsigned       length = 0;
+   NSTimeZone     *tz = nil;
+   char  dayOfMonth, monthOfYear, hour, minute, second;
+   short year;
+   BOOL  flag;
+-  
+-  if ((length = [_data cStringLength]) > 254) {
+-    [self logWithFormat:
+-          @"header field value to large for date parsing: '%@'(%i)",
+-          _data, length];
+-    length = 254;
+-  }
+-  
+-  [_data getCString:(char *)buf maxLength:length];
+-  buf[length] = '\0';
+-  
++
++  length = [_data lengthOfBytesUsingEncoding: NSASCIIStringEncoding];
++  bytes = [_data cStringUsingEncoding: NSASCIIStringEncoding];
++
+   /* remove leading chars (skip to first digit, the day of the month) */
+   while (length > 0 && (!isdigit(*bytes))) {
+     bytes++;
+@@ -312,7 +217,7 @@
+   if (length == 0) {
+     NSLog(@"WARNING(%s): empty value for header field %@ ..",
+           __PRETTY_FUNCTION__, _field);
+-    return [CalDateClass date];
++    return [NSCalendarDate date];
+   }
+   
+   // TODO: should be a category on NSCalendarDate
+@@ -435,7 +340,7 @@
+   for (pe = bytes; isalnum(*pe) || *pe == '-' || *pe == '+'; pe++)
+     ;
+   *pe = '\0';
+-  if ((tz = parseTimeZone(bytes, (pe - bytes))) == nil) {
++  if ((tz = parseTimeZone((const char *) bytes, (pe - bytes))) == nil) {
+     [self logWithFormat:
+             @"WARNING: failed to parse RFC822 timezone: '%s' (value='%@')",
+           bytes, _data];
+@@ -444,9 +349,9 @@
+   
+   /* construct and return */
+  finished:  
+-  date = [CalDateClass dateWithYear:year month:monthOfYear day:dayOfMonth
+-                     hour:hour minute:minute second:second
+-                     timeZone:tz];
++  date = [NSCalendarDate dateWithYear:year month:monthOfYear day:dayOfMonth
++                       hour:hour minute:minute second:second
++                       timeZone:tz];
+   if (date == nil) goto failed;
+ #if 0  
+diff -urNad SOPE~/sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.h SOPE/sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.h
+--- SOPE~/sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.h       2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.h        2008-05-02 08:49:09.000000000 +0200
+@@ -19,6 +19,8 @@
+   02111-1307, USA.
+ */
++#include <libxml/encoding.h>
++
+ #include <SaxObjC/SaxXMLReader.h>
+ #include <SaxObjC/SaxLexicalHandler.h>
+ #include <SaxObjC/SaxDeclHandler.h>
+@@ -34,7 +36,7 @@
+ @interface libxmlHTMLSAXDriver : NSObject < SaxXMLReader >
+ {
+-  id<NSObject,SaxContentHandler> contentHandler;
++  NSObject<SaxContentHandler> *contentHandler;
+   id<NSObject,SaxDTDHandler>     dtdHandler;
+   id<NSObject,SaxErrorHandler>   errorHandler;
+   id<NSObject,SaxEntityResolver> entityResolver;
+diff -urNad SOPE~/sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.m SOPE/sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.m
+--- SOPE~/sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.m       2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-xml/libxmlSAXDriver/libxmlHTMLSAXDriver.m        2008-05-02 08:49:09.000000000 +0200
+@@ -30,6 +30,12 @@
+ #include <libxml/HTMLparser.h>
+ #include <libxml/HTMLtree.h>
++@interface NSObject (contentHandlerExtensions) <SaxContentHandler>
++
++- (xmlCharEncoding) contentEncoding;
++
++@end
++
+ @interface libxmlHTMLSAXDriver(PrivateMethods)
+ - (void)tearDownParser;
+@@ -194,10 +200,10 @@
+   return self->entityResolver;
+ }
+-- (void)setContentHandler:(id<NSObject,SaxContentHandler>)_handler {
++- (void)setContentHandler:(NSObject <NSObject,SaxContentHandler> *)_handler {
+   ASSIGN(self->contentHandler, _handler);
+ }
+-- (id<NSObject,SaxContentHandler>)contentHandler {
++- (NSObject <NSObject,SaxContentHandler> *)contentHandler {
+   return self->contentHandler;
+ }
+@@ -205,6 +211,7 @@
+ - (void)setupParserWithDocumentPath:(NSString *)_path {
+   xmlSAXHandler sax;
++  xmlCharEncoding charEncoding;
+   
+   if (self->ctxt != NULL) {
+     NSLog(@"WARNING(%s): HTML parser context already setup !",
+@@ -223,14 +230,18 @@
+           __PRETTY_FUNCTION__, self, activeDriver);
+   }
+   activeDriver = self;
+-  
++
++  if ([self->contentHandler respondsToSelector: @selector (contentEncoding)])
++    charEncoding = [self->contentHandler contentEncoding];
++  else
++    charEncoding = XML_CHAR_ENCODING_8859_1;
++
+   self->ctxt = htmlCreatePushParserCtxt(&sax             /* sax      */,
+                                         NULL /*self*/    /* userdata */,
+                                         NULL             /* chunk    */,
+                                         0                /* chunklen */,
+                                         [_path cString]  /* filename */,
+-                                        XML_CHAR_ENCODING_8859_1
+-                                        /* encoding */);
++                                      charEncoding /* encoding */);
+   self->doc = NULL;
+ }
+ - (void)tearDownParser {
diff --git a/debian/patches/02_sope-gsmake2.dpatch b/debian/patches/02_sope-gsmake2.dpatch
new file mode 100755 (executable)
index 0000000..b12272a
--- /dev/null
@@ -0,0 +1,3066 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 02_sope-gsmake2.dpatch by  <root@metetch.tfheen.linpro.no>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+@DPATCH@
+diff -urNad SOPE~/GNUmakefile SOPE/GNUmakefile
+--- SOPE~/GNUmakefile  2008-05-02 08:04:11.000000000 +0200
++++ SOPE/GNUmakefile   2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ./config.make
++include ./config.make
+ ifeq ($(GNUSTEP_MAKEFILES),)
+@@ -35,8 +35,6 @@
+ include $(GNUSTEP_MAKEFILES)/aggregate.make
+ -include $(GNUSTEP_MAKEFILES)/GNUmakefile.postamble
+-include ./Version
+-
+ endif
+ distclean ::
+diff -urNad SOPE~/configure SOPE/configure
+--- SOPE~/configure    2008-05-02 08:04:11.000000000 +0200
++++ SOPE/configure     2008-05-02 08:50:46.000000000 +0200
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ #
+ # Note: When adding make options to this script, ensure that the source still
+@@ -15,8 +15,9 @@
+ ARG_NOCREATE=0
+ ARG_PREFIX=""
+ ARG_FRAMEWORK_DIR=""
+-ARG_GSMAKE="$GNUSTEP_MAKEFILES"
++ARG_GSMAKE=`gnustep-config --variable=GNUSTEP_MAKEFILES`
+ ARG_CFGMAKE="$PWD/config.make"
++ARG_FHSMAKE="$PWD/fhs-postinstall.make"
+ ARG_WITH_GNUSTEP=0
+ ARG_WITH_DEBUG=1
+ ARG_WITH_STRIP=1
+@@ -30,12 +31,20 @@
+ INTERNAL_MAKEDIR="${SOPE_SRCDIR}/.gsmake"
+ USES_INTERNAL_MAKE=no
++# detect GNU make, needed at least on *BSD
++make -v 2>/dev/null | grep GNU >/dev/null 2>/dev/null
++if [ $? -eq 0 ];then
++  MAKE=make
++else
++  MAKE=gmake
++fi
++
+ # TODO: add pg_config, mysql_config etc!
+ LINK_SYSLIBDIRS="-L/usr/local/pgsql/lib -L/usr/local/lib -L/usr/lib"
+ # ******************** usage ********************
+-function usage() {
++usage() {
+   cat <<_ACEOF
+ \`configure' configures a GNUstep-make based sourcetree for installation.
+@@ -66,7 +75,7 @@
+ # ******************** running ********************
+-function printParas() {
++printParas() {
+   echo "Configuration:"
+   if test $ARG_BEQUIET  = 1; then echo "  will be quite.";  fi
+   if test $ARG_NOCREATE = 1; then echo "  won't create files"; fi
+@@ -97,7 +106,7 @@
+   echo ""
+ }
+-function warnOnFHSPrefix() {
++warnOnFHSPrefix() {
+   cat <<_ACEOFWARN
+ Warning: you are configuring for a non standard FHS style prefix.
+          prefix: $ARG_PREFIX
+@@ -114,7 +123,7 @@
+ _ACEOFWARN
+ }
+-function setupInternalGSMake() {
++setupInternalGSMake() {
+   if test -f ${INTERNAL_MAKEDIR}/Library/Makefiles/GNUstep.sh; then
+     ARG_GSMAKE="${INTERNAL_MAKEDIR}/Library/Makefiles/"
+     ARG_IS_FHS=1
+@@ -149,7 +158,7 @@
+       --with-library-combo="${SETUP_COMBO}"
+     echo -n ".. install .."
+-    make install >>${pregsmdir}/${SETUP_LOGNAME}
++    $MAKE install >>${pregsmdir}/${SETUP_LOGNAME}
+     
+     ARG_GSMAKE="${INTERNAL_MAKEDIR}/Library/Makefiles/"
+     ARG_IS_FHS=1
+@@ -174,7 +183,7 @@
+   fi
+ }
+-function validateGNUstepArgs() {
++validateGNUstepArgs() {
+   # GNUstep make
+   if test "x$ARG_GSMAKE" = "x"; then
+     if test -f $HOME/OGoRoot/Library/Makefiles/GNUstep.sh; then
+@@ -203,7 +212,7 @@
+   fi
+ }
+-function setupAppleArgs() {
++setupAppleArgs() {
+   ARG_WITH_STRIP=0
+   if test "x${USES_INTERNAL_MAKE}" = "no"; then
+     ARG_WITH_GNUSTEP=1
+@@ -218,7 +227,7 @@
+   #fi
+ }
+-function validateArgs() {
++validateArgs() {
+   # validate prefix (could be better?)
+   case "x$ARG_PREFIX" in
+     "x/usr/local"|"x/usr/local/")
+@@ -273,7 +282,7 @@
+   fi
+ }
+-function printGNUstepSetup() {
++printGNUstepSetup() {
+   echo "GNUstep environment:"
+   echo "  system: ${GNUSTEP_SYSTEM_ROOT}"
+   echo "  local:  ${GNUSTEP_LOCAL_ROOT}"
+@@ -285,11 +294,11 @@
+   echo ""
+ }
+-function cfgwrite() {
++cfgwrite() {
+   echo "$1" >> $ARG_CFGMAKE
+ }
+-function genConfigMake() {
++genConfigMake() {
+   # we ignore the following vars also patches by gstep-make:
+   #   PATH
+   #   DYLD_LIBRARY_PATH
+@@ -303,6 +312,8 @@
+   echo "# GNUstep environment configuration" > $ARG_CFGMAKE
+   cfgwrite "#   created by: '$CFG_ARGS'"
+   cfgwrite ""
++  cfgwrite "SOPE_ROOT=`pwd`"
++  cfgwrite "include \${SOPE_ROOT}/Version"
+   
+   cfgwrite "# Note: you can override any option as a 'make' parameter, eg:"
+   cfgwrite "#         make debug=yes"
+@@ -313,7 +324,27 @@
+   #cfgwrite " @echo Local GNUstep config.make is active"
+   #cfgwrite ""
+   
+-  # TODO: should be also write a GNUSTEP_INSTALLATION_DIR / BUNDLE_INSTALL_DIR?
++  # Note: GNUSTEP_TARGET_CPU is not yet available (set by common.make), so we
++  #       only have environment variables
++  # Note: we can't set SYSTEM_LIB_DIR in this location, it gets overridden by
++  #       common.make
++  UNAME=`uname`
++  if [ "X${UNAME}" = "XLinux" ];then
++    UNAME=`uname -p`
++    if [ ${UNAME} = x86_64 -o ${UNAME} = sparc64 -o ${UNAME} = ppc64 ];then
++      cfgwrite "CGS_LIBDIR_NAME:=lib64"
++    else
++      cfgwrite "CGS_LIBDIR_NAME:=lib"
++    fi
++  else
++    cfgwrite "CGS_LIBDIR_NAME:=lib"
++  fi
++  cfgwrite "ifneq (\$(FHS_INSTALL_ROOT),)"
++  cfgwrite "CONFIGURE_FHS_INSTALL_LIBDIR:=\$(FHS_INSTALL_ROOT)/\$(CGS_LIBDIR_NAME)/"
++  cfgwrite "CONFIGURE_SYSTEM_LIB_DIR += -L\$(CONFIGURE_FHS_INSTALL_LIBDIR)"
++  cfgwrite "endif"
++  cfgwrite "GNUSTEP_INSTALLATION_DOMAIN:=LOCAL"
++  cfgwrite "CONFIGURE_SYSTEM_LIB_DIR += -L/usr/\$(CGS_LIBDIR_NAME)/"
+   
+   
+   if test "x$ARG_FRAMEWORK_DIR" != "x"; then
+@@ -325,13 +356,38 @@
+     cfgwrite "# configured for FHS install"
+     cfgwrite "FHS_INSTALL_ROOT:=$ARG_PREFIX"
+     cfgwrite ""
++    cfgwrite "SOPE_SYSLIBDIR=\${DESTDIR}\${FHS_INSTALL_ROOT}/\$(CGS_LIBDIR_NAME)"
++    cfgwrite "SOPE_LIBDIR=\${SOPE_SYSLIBDIR}/sope-\${MAJOR_VERSION}.\${MINOR_VERSION}"
++    cfgwrite "SOPE_SYSSHAREDIR=\${DESTDIR}\${FHS_INSTALL_ROOT}/share"
++    cfgwrite "SOPE_SHAREDIR=\${SOPE_SYSSHAREDIR}/sope-\${MAJOR_VERSION}.\${MINOR_VERSION}"
++    cfgwrite "SOPE_DBADAPTORS=\${SOPE_LIBDIR}/dbadaptors"
++    cfgwrite "SOPE_PRODUCTS=\${SOPE_LIBDIR}/products"
++    cfgwrite "SOPE_SAXDRIVERS=\${SOPE_LIBDIR}/saxdrivers"
++    cfgwrite "SOPE_WOXBUILDERS=\${SOPE_LIBDIR}/wox-builders"
++    cfgwrite "SOPE_NGOBJWEB=\${SOPE_SHAREDIR}/ngobjweb"
++    cfgwrite "SOPE_SAXMAPPINGS=\${SOPE_SHAREDIR}/saxmappings"
++    cfgwrite "SOPE_TOOLS=\${DESTDIR}\${FHS_INSTALL_ROOT}/bin"
++    cfgwrite "SOPE_ADMIN_TOOLS=\${DESTDIR}\${FHS_INSTALL_ROOT}/sbin"
++    cfgwrite ""
+   else
+     cfgwrite "# configured for GNUstep install"
++    cfgwrite ""
++    cfgwrite "SOPE_SYSLIBDIR=\${GNUSTEP_LIBRARIES}"
++    cfgwrite "SOPE_LIBDIR=\${GNUSTEP_LIBRARY}"
++    cfgwrite "SOPE_DBADAPTORS=\${SOPE_LIBDIR}/GDLAdaptors-\${MAJOR_VERSION}.\${MINOR_VERSION}"
++    cfgwrite "SOPE_PRODUCTS=\${SOPE_LIBDIR}/SoProducts-\${MAJOR_VERSION}.\${MINOR_VERSION}"
++    cfgwrite "SOPE_SAXDRIVERS=\${SOPE_LIBDIR}/SaxDrivers-\${MAJOR_VERSION}.\${MINOR_VERSION}"
++    cfgwrite "SOPE_NGOBJWEB=\${GNUSTEP_RESOURCES}/NGObjWeb"
++    cfgwrite "SOPE_WOXBUILDERS=\${GNUSTEP_LIBRARY}/WOxElemBuilders-\${MAJOR_VERSION}.\${MINOR_VERSION}"
++    cfgwrite "SOPE_SAXMAPPINGS=\${GNUSTEP_LIBRARY}/SaxMappings"
++    cfgwrite "SOPE_TOOLS=\${GNUSTEP_TOOLS}"
++    cfgwrite "SOPE_ADMIN_TOOLS=\${GNUSTEP_ADMIN_TOOLS}"
+   fi
+   
+   if test $ARG_WITH_DEBUG = 1; then
+     cfgwrite "# configured to produce debugging code";
+     cfgwrite "debug:=yes"
++
+   else
+     cfgwrite "# configured to produce non-debugging code";
+     cfgwrite "debug:=no"
+@@ -358,29 +414,9 @@
+   done
+   cfgwrite "LIBRARY_COMBO=$LIBRARY_COMBO"
+   cfgwrite ""
+-  
+-  # Note: GNUSTEP_TARGET_CPU is not yet available (set by common.make), so we
+-  #       only have environment variables
+-  # Note: we can't set SYSTEM_LIB_DIR in this location, it gets overridden by
+-  #       common.make
+-  cfgwrite "ifeq (\$(findstring _64, \$(GNUSTEP_HOST_CPU)), _64)"
+-  cfgwrite "CONFIGURE_64BIT:=yes"
+-  cfgwrite "CGS_LIBDIR_NAME:=lib64"
+-  cfgwrite "else"
+-  cfgwrite "CGS_LIBDIR_NAME:=lib"
+-  cfgwrite "endif"
+-
+-  cfgwrite "ifneq (\$(FHS_INSTALL_ROOT),)"
+-  cfgwrite "CONFIGURE_FHS_INSTALL_LIBDIR:=\$(FHS_INSTALL_ROOT)/\$(CGS_LIBDIR_NAME)/"
+-  cfgwrite "CONFIGURE_SYSTEM_LIB_DIR += -L\$(CONFIGURE_FHS_INSTALL_LIBDIR)"
+-  cfgwrite "endif"
+-  cfgwrite "CONFIGURE_SYSTEM_LIB_DIR += -L/usr/\$(CGS_LIBDIR_NAME)/"
+-  
+-  cfgwrite "# avoid a gstep-make warning"
+-  cfgwrite "PATH:=\$(GNUSTEP_SYSTEM_ROOT)/Tools:\$(PATH)"
+ }
+-function checkLinking() {
++checkLinking() {
+   # library-name => $1, type => $2
+   local oldpwd=$PWD
+   local tmpdir=".configure-test-$$"
+@@ -388,18 +424,26 @@
+   mkdir $tmpdir
+   cd $tmpdir
+   cp ../maintenance/dummytool.c .
++
++  for LIB in $1;do
++    LIBS="$LIBS -l${LIB}"
++  done
+   
+   tmpmake="GNUmakefile"
+-  echo  >$tmpmake "include ../config.make"
++  echo  >$tmpmake "-include ../config.make"
+   echo >>$tmpmake "include \$(GNUSTEP_MAKEFILES)/common.make"
+   echo >>$tmpmake "CTOOL_NAME           := linktest"
+   echo >>$tmpmake "linktest_C_FILES := dummytool.c"
+-  echo >>$tmpmake "linktest_TOOL_LIBS  += -l$1"
++  echo >>$tmpmake "ifeq (\$(findstring openbsd, \$(GNUSTEP_HOST_OS)), openbsd)"
++  echo >>$tmpmake "linktest_TOOL_LIBS  += $LIBS -liconv"
++  echo >>$tmpmake "else"
++  echo >>$tmpmake "linktest_TOOL_LIBS  += $LIBS"
++  echo >>$tmpmake "endif"
+   echo >>$tmpmake "SYSTEM_LIB_DIR += \$(CONFIGURE_SYSTEM_LIB_DIR)"
+   echo >>$tmpmake "SYSTEM_LIB_DIR      += ${LINK_SYSLIBDIRS}"
+   echo >>$tmpmake "include \$(GNUSTEP_MAKEFILES)/ctool.make"
+   
+-  make -s messages=yes -f $tmpmake linktest >out.log 2>err.log
++  $MAKE -s messages=yes -f $tmpmake linktest >out.log 2>err.log
+   LINK_RESULT=$?
+   
+   if test $LINK_RESULT = 0; then
+@@ -420,18 +464,22 @@
+   rm -rf $tmpdir
+ }
+-function checkDependencies() {
++checkDependencies() {
+   cfgwrite ""
+   cfgwrite "# library dependencies"
+   checkLinking "xml2"        optional;
+   checkLinking "ldap"        optional;
+-  checkLinking "ssl"         required; # TODO: make optional
++  if [ `uname` = "OpenBSD" ];then
++    checkLinking "ssl crypto"  required; # TODO: make optional
++  else
++    checkLinking "ssl"         required; # TODO: make optional
++  fi
+   checkLinking "pq"          optional;
+   checkLinking "sqlite3"     optional;
+   checkLinking "mysqlclient" optional;
+ }
+-function runIt() {
++runIt() {
+   if test $ARG_BEQUIET != 1; then
+     printParas;
+   fi
+@@ -459,11 +507,11 @@
+ # ******************** options ********************
+-function extractFuncValue() {
++extractFuncValue() {
+   VALUE="`echo "$1" | sed "s/[^=]*=//g"`"
+ }
+-function processOption() {
++processOption() {
+   case "x$1" in
+     "x--help"|"x-h")
+       usage;
+@@ -518,7 +566,7 @@
+ # load GNUstep environment
+ validateGNUstepArgs
+ # first we load the GNUstep.sh environment
+-source $DARG_GNUSTEP_SH
++. $DARG_GNUSTEP_SH
+ if test $ARG_BEQUIET != 1; then
+   printGNUstepSetup;
+ fi
+diff -urNad SOPE~/sope-appserver/GNUmakefile SOPE/sope-appserver/GNUmakefile
+--- SOPE~/sope-appserver/GNUmakefile   2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/GNUmakefile    2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../config.make
++include ../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ PACKAGE_NAME=sope-appserver
+@@ -13,7 +13,8 @@
+       WOXML           \
+       SoOFS           \
+       NGXmlRpc        \
+-      WEPrototype
++      WEPrototype     \
++      mod_ngobjweb
+ ifeq ($(frameworks),yes)
+@@ -38,4 +39,4 @@
+ # package
+ macosx-pkg :: all
+-      ../maintenance/make-osxpkg.sh sope-appserver
++      ../maintenance/make-osxpkg.sh $(PACKAGE_NAME)
+diff -urNad SOPE~/sope-appserver/NGObjWeb/Associations/GNUmakefile SOPE/sope-appserver/NGObjWeb/Associations/GNUmakefile
+--- SOPE~/sope-appserver/NGObjWeb/Associations/GNUmakefile     2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/Associations/GNUmakefile      2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ SUBPROJECT_NAME = Associations
+diff -urNad SOPE~/sope-appserver/NGObjWeb/DynamicElements/GNUmakefile SOPE/sope-appserver/NGObjWeb/DynamicElements/GNUmakefile
+--- SOPE~/sope-appserver/NGObjWeb/DynamicElements/GNUmakefile  2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/DynamicElements/GNUmakefile   2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ SUBPROJECT_NAME = DynamicElements
+diff -urNad SOPE~/sope-appserver/NGObjWeb/GNUmakefile SOPE/sope-appserver/NGObjWeb/GNUmakefile
+--- SOPE~/sope-appserver/NGObjWeb/GNUmakefile  2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/GNUmakefile   2008-05-02 08:50:46.000000000 +0200
+@@ -1,11 +1,9 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include ../common.make
+ include ./Version
+-GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_LOCAL_ROOT)
+-
+ ifneq ($(frameworks),yes)
+ LIBRARY_NAME   = libNGObjWeb
+ else
+@@ -14,15 +12,12 @@
+ ifneq ($(frameworks),yes)
+-ifeq ($(FHS_INSTALL_ROOT),)
+-RESOURCES_DIR = $(GNUSTEP_RESOURCES)/NGObjWeb
+-else
+-RESOURCES_DIR = $(FHS_INSTALL_ROOT)/share/sope-$(MAJOR_VERSION).$(MINOR_VERSION)/ngobjweb
+-endif
++RESOURCES_DIR = $(SOPE_NGOBJWEB)/
+ endif
+ libNGObjWeb_PCH_FILE = common.h
+-libNGObjWeb_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libNGObjWeb_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libNGObjWeb_INSTALL_DIR=$(SOPE_SYSLIBDIR)
+ libNGObjWeb_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
+ libNGObjWeb_SUBPROJECTS = \
+@@ -40,7 +35,7 @@
+ libNGObjWeb_RESOURCES = \
+       Defaults.plist          \
+       Languages.plist         \
+-      DAVPropMap.plist        \
++      DAVPropMap.plist        
+ FHS_MANPAGES += \
+       sope-ngobjweb-defaults.5        \
+@@ -167,7 +162,7 @@
+ BUNDLE_NAME      = SoCore
+ BUNDLE_EXTENSION = .sxp
+-BUNDLE_INSTALL_DIR = $(GNUSTEP_INSTALLATION_DIR)/Library/SoProducts-$(MAJOR_VERSION).$(MINOR_VERSION)/
++BUNDLE_INSTALL_DIR = $(SOPE_PRODUCTS)/
+ SoCore_PCH_FILE        = common.h
+ SoCore_OBJC_FILES      = SoCoreProduct.m
+@@ -190,6 +185,9 @@
+ # building
+ -include GNUmakefile.preamble
++ifneq ($(FHS_INSTALL_ROOT),)
++GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include
++endif
+ ifneq ($(frameworks),yes)
+ include $(GNUSTEP_MAKEFILES)/library.make
+ else
+@@ -198,4 +196,3 @@
+ include $(GNUSTEP_MAKEFILES)/bundle.make
+ include $(GNUSTEP_MAKEFILES)/tool.make
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-appserver/NGObjWeb/GNUmakefile.preamble SOPE/sope-appserver/NGObjWeb/GNUmakefile.preamble
+--- SOPE~/sope-appserver/NGObjWeb/GNUmakefile.preamble 2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/GNUmakefile.preamble  2008-05-02 08:50:46.000000000 +0200
+@@ -50,9 +50,6 @@
+       $(foreach dir,$(DEP_DIRS),-F$(GNUSTEP_BUILD_DIR)/$(dir))
+ endif
+-SYSTEM_LIB_DIR += $(CONFIGURE_SYSTEM_LIB_DIR)
+-
+-
+ # dependencies
+ ifneq ($(frameworks),yes)
+@@ -85,6 +82,7 @@
+       $(sope-mime-libs)       \
+       $(sope-core-libs)       \
+       $(sope-xml-libs)
++wod_INSTALL_DIR = $(SOPE_TOOLS)
+ SoCore_BUNDLE_LIBS += \
+       $(sope-ngobjweb-libs)   \
+       $(sope-mime-libs)       \
+@@ -94,7 +92,7 @@
+ # platform specific settings
+-ifneq ($(findstring openbsd3, $(GNUSTEP_TARGET_OS)), openbsd3)
++ifneq ($(findstring openbsd, $(GNUSTEP_TARGET_OS)), openbsd)
+ # OpenBSD does not require libcrypt
+ ifneq ($(findstring darwin, $(GNUSTEP_TARGET_OS)), darwin)
+ # and neither does MacOSX? ...
+@@ -116,6 +114,6 @@
+ libNGObjWeb_LIBRARIES_DEPEND_UPON += -lFoundationExt
+ endif
+-ifeq ($(findstring openbsd3, $(GNUSTEP_TARGET_OS)), openbsd3)
++ifeq ($(findstring openbsd, $(GNUSTEP_TARGET_OS)), openbsd)
+ wod_TOOL_LIBS += -liconv
+ endif
+diff -urNad SOPE~/sope-appserver/NGObjWeb/NGHttp/GNUmakefile SOPE/sope-appserver/NGObjWeb/NGHttp/GNUmakefile
+--- SOPE~/sope-appserver/NGObjWeb/NGHttp/GNUmakefile   2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/NGHttp/GNUmakefile    2008-05-02 08:50:46.000000000 +0200
+@@ -1,10 +1,8 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+-GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_LOCAL_ROOT)
+-
+ SUBPROJECT_NAME = NGHttp
+ NGHttp_PCH_FILE = common.h
+@@ -37,5 +35,8 @@
+       NGUrlFormCoder.m                \
+ -include GNUmakefile.preamble
++ifneq ($(FHS_INSTALL_ROOT),)
++GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include
++endif
+ include $(GNUSTEP_MAKEFILES)/subproject.make
+ -include GNUmakefile.postamble
+diff -urNad SOPE~/sope-appserver/NGObjWeb/SoObjects/GNUmakefile SOPE/sope-appserver/NGObjWeb/SoObjects/GNUmakefile
+--- SOPE~/sope-appserver/NGObjWeb/SoObjects/GNUmakefile        2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/SoObjects/GNUmakefile 2008-05-02 08:50:46.000000000 +0200
+@@ -1,7 +1,7 @@
+ # GNUstep makefile
+--include ../../../config.make
+ include ../subdirs.make
++include ../../../config.make
+ SUBPROJECT_NAME = SoObjects
+diff -urNad SOPE~/sope-appserver/NGObjWeb/SoObjects/GNUmakefile.preamble SOPE/sope-appserver/NGObjWeb/SoObjects/GNUmakefile.preamble
+--- SOPE~/sope-appserver/NGObjWeb/SoObjects/GNUmakefile.preamble       2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/SoObjects/GNUmakefile.preamble        2008-05-02 08:50:46.000000000 +0200
+@@ -1,5 +1,7 @@
+ # compilation settings
++include ../../../config.make
++
+ ADDITIONAL_INCLUDE_DIRS += -I../WebDAV/
+ ADDITIONAL_CPPFLAGS += -DCOMPILING_NGOBJWEB=1 -DCOMPILE_FOR_GNUSTEP=1
+@@ -10,6 +12,6 @@
+ ADDITIONAL_CPPFLAGS += -DFHS_INSTALL_ROOT=\@\"$(FHS_INSTALL_ROOT)\"
+ endif
+-ifeq ($(CONFIGURE_64BIT),yes)
+-ADDITIONAL_CPPFLAGS += -DCONFIGURE_64BIT=1
++ifneq ($(CGS_LIBDIR_NAME),)
++ADDITIONAL_CPPFLAGS += -DCGS_LIBDIR_NAME=\@\"$(CGS_LIBDIR_NAME)\"
+ endif
+diff -urNad SOPE~/sope-appserver/NGObjWeb/SoObjects/SoProductLoader.m SOPE/sope-appserver/NGObjWeb/SoObjects/SoProductLoader.m
+--- SOPE~/sope-appserver/NGObjWeb/SoObjects/SoProductLoader.m  2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/SoObjects/SoProductLoader.m   2008-05-02 08:50:46.000000000 +0200
+@@ -74,6 +74,14 @@
+ }
+ - (void)_addGNUstepSearchPathesToArray:(NSMutableArray *)ma {
++#if GNUSTEP_BASE_LIBRARY
++  NSEnumerator *libraryPaths;
++  NSString *directory;
++
++  libraryPaths = [NSStandardLibraryPaths() objectEnumerator];
++  while ((directory = [libraryPaths nextObject]))
++    [ma addObject: [directory stringByAppendingPathComponent: self->productDirectoryName]];
++#else
+   NSDictionary *env;
+   id tmp;
+   
+@@ -97,6 +105,7 @@
+     [self logWithFormat:@"%s: empty library search path !", 
+         __PRETTY_FUNCTION__];
+   }
++#endif
+ }
+ - (void)_addFHSPathesToArray:(NSMutableArray *)ma {
+diff -urNad SOPE~/sope-appserver/NGObjWeb/SoObjects/SoProductRegistry.m SOPE/sope-appserver/NGObjWeb/SoObjects/SoProductRegistry.m
+--- SOPE~/sope-appserver/NGObjWeb/SoObjects/SoProductRegistry.m        2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/SoObjects/SoProductRegistry.m 2008-05-02 08:50:46.000000000 +0200
+@@ -231,7 +231,7 @@
+   
+   fm = [NSFileManager defaultManager];
+   pi = [NSProcessInfo processInfo];
+-  
++#if ! GNUSTEP_BASE_LIBRARY  
+ #if COCOA_Foundation_LIBRARY && !COMPILE_FOR_GNUSTEP
+   /* 
+      TODO: (like COMPILE_FOR_GNUSTEP)
+@@ -250,12 +250,9 @@
+   pathes = [[pathes stringValue] componentsSeparatedByString:@":"];
+   relPath = @"Library/";
+ #endif
+-  
+-  [self debugWithFormat:@"scanning for products ..."];
+-  
+   relPath = [relPath stringByAppendingFormat:@"SoProducts-%i.%i/",
+                         SOPE_MAJOR_VERSION, SOPE_MINOR_VERSION];
+-  
++  [self debugWithFormat:@"scanning for products ..."];
+   for (i = 0; i < [pathes count]; i++) {
+     NSString *lPath;
+     BOOL     isDir;
+@@ -271,6 +268,37 @@
+     [self debugWithFormat:@"  directory %@", lPath];
+     [self scanForProductsInDirectory:lPath];
+   }
++#else
++  NSEnumerator *libraryPaths;
++  NSString *directory;
++  NSMutableArray *tmppath;
++
++  libraryPaths = [NSStandardLibraryPaths() objectEnumerator];
++  tmppath = [[NSMutableArray alloc] init];
++  while ((directory = [libraryPaths nextObject]))
++    [tmppath addObject: [directory stringByAppendingPathComponent: 
++              [NSString stringWithFormat:@"SoProducts-%i.%i/",
++              SOPE_MAJOR_VERSION, SOPE_MINOR_VERSION]]];
++  pathes = [tmppath mutableCopy];
++  [self debugWithFormat:@"scanning for products ..."];
++  for (i = 0; i < [pathes count]; i++) {
++    NSString *lPath;
++    BOOL     isDir;
++    
++    lPath = [pathes objectAtIndex:i];
++    [self debugWithFormat:@"  scan: %@", lPath];
++    
++    if (![fm fileExistsAtPath:lPath isDirectory:&isDir])
++      continue;
++    if (!isDir)
++      continue;
++    
++    [self debugWithFormat:@"  directory %@", lPath];
++    [self scanForProductsInDirectory:lPath];
++  }
++  [tmppath release];
++#endif
++
+ #if COCOA_Foundation_LIBRARY
+   /* look in wrapper places */
+@@ -282,8 +310,8 @@
+   /* look into FHS pathes */
+   
+   relPath = [NSString stringWithFormat:
+-#if CONFIGURE_64BIT
+-                      @"lib64/sope-%i.%i/products/",
++#ifdef CGS_LIBDIR_NAME
++                      [CGS_LIBDIR_NAME stringByAppendingString:@"/sope-%i.%i/products/"],
+ #else
+                       @"lib/sope-%i.%i/products/",
+ #endif
+diff -urNad SOPE~/sope-appserver/NGObjWeb/Templates/GNUmakefile SOPE/sope-appserver/NGObjWeb/Templates/GNUmakefile
+--- SOPE~/sope-appserver/NGObjWeb/Templates/GNUmakefile        2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/Templates/GNUmakefile 2008-05-02 08:50:46.000000000 +0200
+@@ -1,7 +1,7 @@
+ # GNUmakefile makefile
+--include ../../../config.make
+ include ../subdirs.make
++include ../../../config.make
+ SUBPROJECT_NAME = Templates
+diff -urNad SOPE~/sope-appserver/NGObjWeb/Templates/GNUmakefile.preamble SOPE/sope-appserver/NGObjWeb/Templates/GNUmakefile.preamble
+--- SOPE~/sope-appserver/NGObjWeb/Templates/GNUmakefile.preamble       2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/Templates/GNUmakefile.preamble        2008-05-02 08:50:46.000000000 +0200
+@@ -6,6 +6,6 @@
+ ADDITIONAL_CPPFLAGS += -DFHS_INSTALL_ROOT=\@\"$(FHS_INSTALL_ROOT)\"
+ endif
+-ifeq ($(CONFIGURE_64BIT),yes)
+-ADDITIONAL_CPPFLAGS += -DCONFIGURE_64BIT=1
++ifneq ($(CGS_LIBDIR_NAME),)
++ADDITIONAL_CPPFLAGS += -DCGS_LIBDIR_NAME=\@\"$(CGS_LIBDIR_NAME)\"
+ endif
+diff -urNad SOPE~/sope-appserver/NGObjWeb/Templates/WOApplication+Builders.m SOPE/sope-appserver/NGObjWeb/Templates/WOApplication+Builders.m
+--- SOPE~/sope-appserver/NGObjWeb/Templates/WOApplication+Builders.m   2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/Templates/WOApplication+Builders.m    2008-05-02 08:50:46.000000000 +0200
+@@ -76,7 +76,7 @@
+   
+   fm = [NSFileManager defaultManager];
+   pi = [NSProcessInfo processInfo];
+-  
++#if ! GNUSTEP_BASE_LIBRARY  
+ #if COCOA_Foundation_LIBRARY
+   /* 
+      TODO: (like COMPILE_FOR_GNUSTEP)
+@@ -121,16 +121,43 @@
+     [self debugWithFormat:@"  directory %@", lPath];
+     [self scanForBuilderBundlesInDirectory:lPath];
+   }
++#else
++ NSEnumerator *libraryPaths;
++  NSString *directory;
++ NSMutableArray *tmppathes;
++
++  libraryPaths = [NSStandardLibraryPaths() objectEnumerator];
++  tmppathes = [[NSMutableArray alloc] init];
++  while ((directory = [libraryPaths nextObject]))
++    [tmppathes addObject: [directory stringByAppendingPathComponent: 
++              [NSString stringWithFormat:@"WOxElemBuilders-%i.%i/", 
++                      SOPE_MAJOR_VERSION, SOPE_MINOR_VERSION]]];
++  pathes = [tmppathes mutableCopy];
++  for (i = 0; i < [pathes count]; i++) {
++    NSString *lPath;
++    BOOL     isDir;
++    
++    lPath = [pathes objectAtIndex:i];
++    if (![fm fileExistsAtPath:lPath isDirectory:&isDir])
++      continue;
++    if (!isDir)
++      continue;
++    
++    [self debugWithFormat:@"  directory %@", lPath];
++    [self scanForBuilderBundlesInDirectory:lPath];
++  }
++  [tmppathes release];
++#endif
+   
+   /* look into FHS pathes */
+   
+   relPath = [NSString stringWithFormat:
+-#if CONFIGURE_64BIT
+-                      @"lib/sope-%i.%i/wox-builders/",
++#ifdef CGS_LIBDIR_NAME
++      [CGS_LIBDIR_NAME stringByAppendingString:@"/sope-%i.%i/wox-builders/"],
+ #else
+-                      @"lib64/sope-%i.%i/wox-builders/",
++      @"lib/sope-%i.%i/wox-builders/",
+ #endif
+-                        SOPE_MAJOR_VERSION, SOPE_MINOR_VERSION];
++        SOPE_MAJOR_VERSION, SOPE_MINOR_VERSION];
+   pathes = [NSArray arrayWithObjects:
+ #ifdef FHS_INSTALL_ROOT
+                     [FHS_INSTALL_ROOT stringByAppendingString:relPath],
+diff -urNad SOPE~/sope-appserver/NGObjWeb/WOCoreApplication+Bundle.m SOPE/sope-appserver/NGObjWeb/WOCoreApplication+Bundle.m
+--- SOPE~/sope-appserver/NGObjWeb/WOCoreApplication+Bundle.m   2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/WOCoreApplication+Bundle.m    2008-05-02 08:50:46.000000000 +0200
+@@ -50,8 +50,6 @@
+   }
+   else {
+     NSDictionary *env;
+-    NSEnumerator *e;
+-    id tmp;
+     
+     env = [[NSProcessInfo processInfo] environment];
+     
+@@ -67,7 +65,20 @@
+     bp = @"/System/Library";
+     bp = [bp stringByAppendingPathComponent:_domain];
+     [chkPathes addObject:bp];
++#elif GNUSTEP_BASE_LIBRARY
++    NSEnumerator *libraryPaths;
++    NSString *directory;
++
++    libraryPaths = [NSStandardLibraryPaths() objectEnumerator];
++    while ((directory = [libraryPaths nextObject])) {
++      directory = [directory stringByAppendingPathComponent:_domain];
++      if ([chkPathes containsObject:directory]) continue;
++      [chkPathes addObject:directory];
++
++    }
+ #else
++    NSEnumerator *e;
++    id tmp;
+     if ((tmp = [env objectForKey:@"GNUSTEP_PATHPREFIX_LIST"]) == nil)
+       tmp = [env objectForKey:@"GNUSTEP_PATHLIST"];
+     tmp = [tmp componentsSeparatedByString:@":"];
+diff -urNad SOPE~/sope-appserver/NGObjWeb/WOCoreApplication.m SOPE/sope-appserver/NGObjWeb/WOCoreApplication.m
+--- SOPE~/sope-appserver/NGObjWeb/WOCoreApplication.m  2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/WOCoreApplication.m   2008-05-02 08:50:46.000000000 +0200
+@@ -730,9 +730,15 @@
+                      [self sopeMajorVersion], [self sopeMinorVersion]];
+ }
+ + (NGResourceLocator *)ngobjwebResourceLocator {
++#if GNUSTEP_BASE_LIBRARY
++  return [NGResourceLocator resourceLocatorForGNUstepPath:
++                              @"Libraries/Resources/NGObjWeb"
++                            fhsPath:[self ngobjwebShareDirectorySubPath]];
++#else
+   return [NGResourceLocator resourceLocatorForGNUstepPath:
+                               @"Library/Libraries/Resources/NGObjWeb"
+                             fhsPath:[self ngobjwebShareDirectorySubPath]];
++#endif
+ }
+ + (NSArray *)resourcesSearchPathes {
+diff -urNad SOPE~/sope-appserver/NGObjWeb/WOHttpAdaptor/GNUmakefile SOPE/sope-appserver/NGObjWeb/WOHttpAdaptor/GNUmakefile
+--- SOPE~/sope-appserver/NGObjWeb/WOHttpAdaptor/GNUmakefile    2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/WOHttpAdaptor/GNUmakefile     2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ SUBPROJECT_NAME = WOHttpAdaptor
+diff -urNad SOPE~/sope-appserver/NGObjWeb/WebDAV/GNUmakefile SOPE/sope-appserver/NGObjWeb/WebDAV/GNUmakefile
+--- SOPE~/sope-appserver/NGObjWeb/WebDAV/GNUmakefile   2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/WebDAV/GNUmakefile    2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include ../../Version
+ include ../Version
+ include $(GNUSTEP_MAKEFILES)/common.make
+diff -urNad SOPE~/sope-appserver/NGObjWeb/woapp-gs.make SOPE/sope-appserver/NGObjWeb/woapp-gs.make
+--- SOPE~/sope-appserver/NGObjWeb/woapp-gs.make        2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/woapp-gs.make 2008-05-02 08:50:46.000000000 +0200
+@@ -103,7 +103,7 @@
+ # Determine the application directory extension
+ WOAPP_EXTENSION = woa
+-GNUSTEP_WOAPPS = $(GNUSTEP_INSTALLATION_DIR)/WOApps
++GNUSTEP_WOAPPS = $(GNUSTEP_WEB_APPS)
+ .PHONY: internal-woapp-all_ \
+         internal-woapp-install_ \
+@@ -372,8 +372,9 @@
+ internal-woapp-install_::
+       @($(MKINSTALLDIRS) $(GNUSTEP_WOAPPS); \
+-      rm -rf $(GNUSTEP_WOAPPS)/$(WOAPP_DIR_NAME); \
+-      $(TAR) chf - --exclude=CVS --exclude=.svn --to-stdout $(WOAPP_DIR_NAME) | (cd $(GNUSTEP_WOAPPS); $(TAR) xf -))
++      if [ -e $(GNUSTEP_WOAPPS)/$(WOAPP_DIR_NAME) ]; then rm -rf $(GNUSTEP_WOAPPS)/$(WOAPP_DIR_NAME); fi; \
++#     $(TAR) chf - --exclude=CVS --exclude=.svn --to-stdout $(WOAPP_DIR_NAME) | (cd $(GNUSTEP_WOAPPS); $(TAR) xf -))
++      cp -LR $(WOAPP_DIR_NAME) $(GNUSTEP_WOAPPS)
+ ifneq ($(CHOWN_TO),)
+       $(CHOWN) -R $(CHOWN_TO) $(GNUSTEP_WOAPPS)/$(WOAPP_DIR_NAME)
+ endif
+diff -urNad SOPE~/sope-appserver/NGObjWeb/wobundle-gs.make SOPE/sope-appserver/NGObjWeb/wobundle-gs.make
+--- SOPE~/sope-appserver/NGObjWeb/wobundle-gs.make     2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/NGObjWeb/wobundle-gs.make      2008-05-02 08:50:46.000000000 +0200
+@@ -85,7 +85,7 @@
+ endif
+ ifeq ($(WOBUNDLE_INSTALL_DIR),)
+-WOBUNDLE_INSTALL_DIR = $(GNUSTEP_INSTALLATION_DIR)/Libraries
++WOBUNDLE_INSTALL_DIR = $(GNUSTEP_WEB_APPS)
+ endif
+ # The name of the bundle is in the BUNDLE_NAME variable.
+ # The list of languages the bundle is localized in are in xxx_LANGUAGES
+@@ -287,8 +287,10 @@
+       @$(MKDIRS) $@
+ internal-wobundle-install_:: $(WOBUNDLE_INSTALL_DIR) shared-instance-headers-install
+-      rm -rf $(WOBUNDLE_INSTALL_DIR)/$(WOBUNDLE_DIR_NAME); \
+-      $(TAR) chf - --exclude=CVS --exclude=.svn --to-stdout $(WOBUNDLE_DIR_NAME) | (cd $(WOBUNDLE_INSTALL_DIR); $(TAR) xf -)
++#     rm -rf $(WOBUNDLE_INSTALL_DIR)/$(WOBUNDLE_DIR_NAME); \
++#     $(TAR) chf - --exclude=CVS --exclude=.svn --to-stdout $(WOBUNDLE_DIR_NAME) | (cd $(WOBUNDLE_INSTALL_DIR); $(TAR) xf -)
++      if [ -e $(WOBUNDLE_INSTALL_DIR)/$(WOBUNDLE_DIR_NAME) ]; then rm -rf $(WOBUNDLE_INSTALL_DIR)/$(WOBUNDLE_DIR_NAME); fi; \
++      cp -LR $(WOBUNDLE_DIR_NAME) $(WOBUNDLE_INSTALL_DIR)
+ ifneq ($(CHOWN_TO),)
+       $(CHOWN) -R $(CHOWN_TO) $(WOBUNDLE_INSTALL_DIR)/$(WOBUNDLE_DIR_NAME)
+ endif
+diff -urNad SOPE~/sope-appserver/NGXmlRpc/GNUmakefile SOPE/sope-appserver/NGXmlRpc/GNUmakefile
+--- SOPE~/sope-appserver/NGXmlRpc/GNUmakefile  2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/NGXmlRpc/GNUmakefile   2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ include ../Version
+ include ./Version
+@@ -12,7 +12,8 @@
+ endif
+ libNGXmlRpc_PCH_FILE = common.h
+-libNGXmlRpc_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libNGXmlRpc_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libNGXmlRpc_INSTALL_DIR=$(SOPE_SYSLIBDIR)
+ libNGXmlRpc_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
+ libNGXmlRpc_HEADER_FILES_DIR         = .
+@@ -65,6 +66,9 @@
+ # building
+ -include GNUmakefile.preamble
++ifneq ($(FHS_INSTALL_ROOT),)
++GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include
++endif
+ ifneq ($(frameworks),yes)
+ include $(GNUSTEP_MAKEFILES)/library.make
+ else
+@@ -72,4 +76,3 @@
+ endif
+ include $(GNUSTEP_MAKEFILES)/tool.make
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-appserver/SoOFS/GNUmakefile SOPE/sope-appserver/SoOFS/GNUmakefile
+--- SOPE~/sope-appserver/SoOFS/GNUmakefile     2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/SoOFS/GNUmakefile      2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ include ../Version
+ include ./Version
+@@ -14,7 +14,8 @@
+ libSoOFS_PCH_FILE = common.h
+-libSoOFS_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libSoOFS_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libSoOFS_INSTALL_DIR=$(SOPE_SYSLIBDIR)
+ libSoOFS_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
+ libSoOFS_HEADER_FILES_DIR         = .
+@@ -75,7 +76,7 @@
+ BUNDLE_NAME      = SoOFS
+ BUNDLE_EXTENSION = .sxp
+-BUNDLE_INSTALL_DIR = $(GNUSTEP_INSTALLATION_DIR)/Library/SoProducts-$(MAJOR_VERSION).$(MINOR_VERSION)/
++BUNDLE_INSTALL_DIR = $(SOPE_PRODUCTS)/
+ SoOFS_OBJC_FILES       = SoOFSProduct.m
+ SoOFS_RESOURCE_FILES   = product.plist Version
+@@ -91,9 +92,13 @@
+ TOOL_NAME = $(SOPED_NAME)
+ $(SOPED_NAME)_OBJC_FILES = sope.m
++$(SOPED_NAME)_INSTALL_DIR = $(SOPE_ADMIN_TOOLS)
+ -include GNUmakefile.preamble
++ifneq ($(FHS_INSTALL_ROOT),)
++GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include
++endif
+ ifneq ($(frameworks),yes)
+ include $(GNUSTEP_MAKEFILES)/library.make
+ include $(GNUSTEP_MAKEFILES)/bundle.make
+@@ -102,4 +107,3 @@
+ endif
+ include $(GNUSTEP_MAKEFILES)/tool.make
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-appserver/SoOFS/GNUmakefile.preamble SOPE/sope-appserver/SoOFS/GNUmakefile.preamble
+--- SOPE~/sope-appserver/SoOFS/GNUmakefile.preamble    2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/SoOFS/GNUmakefile.preamble     2008-05-02 08:50:46.000000000 +0200
+@@ -76,17 +76,9 @@
+       $(foreach dir,$(DEP_DIRS),-F$(GNUSTEP_BUILD_DIR)/$(dir))
+ endif
+-ifeq ($(findstring _64, $(GNUSTEP_TARGET_CPU)), _64)
+-SYSTEM_LIB_DIR += -L/usr/local/lib64 -L/usr/lib64
+-else
+-SYSTEM_LIB_DIR += -L/usr/local/lib -L/usr/lib
+-endif
+-
+-
+-
+ # platform specific settings
+-ifneq ($(findstring openbsd3, $(GNUSTEP_TARGET_OS)), openbsd3)
++ifneq ($(findstring openbsd, $(GNUSTEP_TARGET_OS)), openbsd)
+ # OpenBSD does not require libcrypt
+ ifneq ($(findstring darwin, $(GNUSTEP_TARGET_OS)), darwin)
+ # and neither does MacOSX? ...
+@@ -94,6 +86,6 @@
+ endif
+ endif
+-ifeq ($(findstring openbsd3, $(GNUSTEP_TARGET_OS)), openbsd3)
++ifeq ($(findstring openbsd, $(GNUSTEP_TARGET_OS)), openbsd)
+ $(SOPED_NAME)_TOOL_LIBS += -liconv
+ endif
+diff -urNad SOPE~/sope-appserver/WEExtensions/GNUmakefile SOPE/sope-appserver/WEExtensions/GNUmakefile
+--- SOPE~/sope-appserver/WEExtensions/GNUmakefile      2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/WEExtensions/GNUmakefile       2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ include ../Version
+ include ./Version
+@@ -11,7 +11,7 @@
+ BUNDLE_NAME      = WEExtensions
+ BUNDLE_EXTENSION = .wox
+-BUNDLE_INSTALL_DIR = $(GNUSTEP_INSTALLATION_DIR)/Library/WOxElemBuilders-$(MAJOR_VERSION).$(MINOR_VERSION)/
++BUNDLE_INSTALL_DIR = $(SOPE_WOXBUILDERS)/
+ else
+ FRAMEWORK_NAME = WEExtensions
+@@ -99,6 +99,9 @@
+ # building
+ -include GNUmakefile.preamble
++ifneq ($(FHS_INSTALL_ROOT),)
++GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include
++endif
+ ifneq ($(frameworks),yes)
+ include $(GNUSTEP_MAKEFILES)/library.make
+ include $(GNUSTEP_MAKEFILES)/bundle.make
+@@ -106,4 +109,3 @@
+ include $(GNUSTEP_MAKEFILES)/framework.make
+ endif
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-appserver/WEExtensions/GNUmakefile.preamble SOPE/sope-appserver/WEExtensions/GNUmakefile.preamble
+--- SOPE~/sope-appserver/WEExtensions/GNUmakefile.preamble     2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/WEExtensions/GNUmakefile.preamble      2008-05-02 08:50:46.000000000 +0200
+@@ -21,7 +21,8 @@
+         cp ../bundle-info.plist .)
+ endif
+-libWEExtensions_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libWEExtensions_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libWEExtensions_INSTALL_DIR=$(SOPE_SYSLIBDIR)
+ libWEExtensions_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
+diff -urNad SOPE~/sope-appserver/WEExtensions/WEResourceManager.m SOPE/sope-appserver/WEExtensions/WEResourceManager.m
+--- SOPE~/sope-appserver/WEExtensions/WEResourceManager.m      2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/WEExtensions/WEResourceManager.m       2008-05-02 08:50:46.000000000 +0200
+@@ -53,28 +53,43 @@
+ + (NSString *)gsTemplatesSubpath {
+   NSString *p;
+-  
+   p = [[WOApplication application] gsTemplatesDirectoryName];
++#if ! GNUSTEP_BASE_LIBRARY  
++  // for GNUSTEP_BASE_LIBRARY this is already there in rootPathesInGNUstep
+   p = [@"Library/" stringByAppendingString:p];
++#endif
+   return p;
+ }
+ + (NSString *)gsWebSubpath {
+   NSString *p;
+   
+   p = [[WOApplication application] gsWebDirectoryName];
++#if ! GNUSTEP_BASE_LIBRARY  
++  // for GNUSTEP_BASE_LIBRARY this is already there in rootPathesInGNUstep
+   p = [@"Library/" stringByAppendingString:p];
++#endif
+   return p;
+ }
+ /* locate resource directories */
+ + (NSArray *)rootPathesInGNUstep {
+-  NSDictionary *env;
+   id tmp;
+-  
++#if GNUSTEP_BASE_LIBRARY
++  NSEnumerator *libraryPaths;
++  NSString *directory;
++
++  tmp = [[NSMutableArray alloc] init];
++  libraryPaths = [NSStandardLibraryPaths() objectEnumerator];
++  while ((directory = [libraryPaths nextObject]))
++    [tmp addObject: directory];
++  return tmp;
++#else  
++  NSDictionary *env;
+   env = [[NSProcessInfo processInfo] environment];
+   if ((tmp = [env objectForKey:@"GNUSTEP_PATHPREFIX_LIST"]) == nil)
+     tmp = [env objectForKey:@"GNUSTEP_PATHLIST"];
++#endif
+   
+   return [tmp componentsSeparatedByString:@":"];
+ }
+@@ -95,9 +110,17 @@
+   NSMutableArray *ma;
+   BOOL           isDir;
+   id tmp;
+-
+   fm  = [NSFileManager defaultManager];
+   ma  = [NSMutableArray arrayWithCapacity:8];
++
++#ifdef GNUSTEP_BASE_LIBRARY
++  NSEnumerator *libraryPaths;
++  NSString *directory;
++
++  libraryPaths = [NSStandardLibraryPaths() objectEnumerator];
++  while ((directory = [libraryPaths nextObject]))
++    [ma addObject: [directory stringByAppendingPathComponent: _name]];
++#else
+   
+   e = [[self rootPathesInGNUstep] objectEnumerator];
+   while ((tmp = [e nextObject]) != nil) {
+@@ -115,6 +138,7 @@
+     
+     [ma addObject:tmp];
+   }
++#endif
+   /* hack in FHS pathes */
+   
+diff -urNad SOPE~/sope-appserver/WEExtensions/WETableView/GNUmakefile SOPE/sope-appserver/WEExtensions/WETableView/GNUmakefile
+--- SOPE~/sope-appserver/WEExtensions/WETableView/GNUmakefile  2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/WEExtensions/WETableView/GNUmakefile   2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ SUBPROJECT_NAME = WETableView
+diff -urNad SOPE~/sope-appserver/WEPrototype/GNUmakefile SOPE/sope-appserver/WEPrototype/GNUmakefile
+--- SOPE~/sope-appserver/WEPrototype/GNUmakefile       2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/WEPrototype/GNUmakefile        2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ include ../Version
+ include ./Version
+@@ -10,7 +10,7 @@
+ BUNDLE_NAME      = WEPrototype
+ BUNDLE_EXTENSION = .wox
+-BUNDLE_INSTALL_DIR = $(GNUSTEP_INSTALLATION_DIR)/Library/WOxElemBuilders-$(MAJOR_VERSION).$(MINOR_VERSION)/
++BUNDLE_INSTALL_DIR = $(SOPE_WOXBUILDERS)/
+ else
+ FRAMEWORK_NAME = WEPrototype
+ endif
+@@ -46,6 +46,9 @@
+ # building
+ -include GNUmakefile.preamble
++ifneq ($(FHS_INSTALL_ROOT),)
++GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include
++endif
+ ifneq ($(frameworks),yes)
+ include $(GNUSTEP_MAKEFILES)/library.make
+ include $(GNUSTEP_MAKEFILES)/bundle.make
+@@ -53,4 +56,3 @@
+ include $(GNUSTEP_MAKEFILES)/framework.make
+ endif
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-appserver/WEPrototype/GNUmakefile.preamble SOPE/sope-appserver/WEPrototype/GNUmakefile.preamble
+--- SOPE~/sope-appserver/WEPrototype/GNUmakefile.preamble      2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/WEPrototype/GNUmakefile.preamble       2008-05-02 08:50:46.000000000 +0200
+@@ -1,4 +1,4 @@
+-# compiler flags
++# GNUstep makefile
+ SOPE_ROOT=../..
+@@ -21,7 +21,8 @@
+       -I$(SOPE_ROOT)/sope-xml
+-libWEPrototype_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libWEPrototype_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libWEPrototype_INSTALL_DIR=$(SOPE_SYSLIBDIR)
+ libWEPrototype_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
+ libWEPrototype_LIBRARIES_DEPEND_UPON += \
+diff -urNad SOPE~/sope-appserver/WEPrototype/doc/GNUmakefile SOPE/sope-appserver/WEPrototype/doc/GNUmakefile
+--- SOPE~/sope-appserver/WEPrototype/doc/GNUmakefile   2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/WEPrototype/doc/GNUmakefile    2008-05-02 08:50:46.000000000 +0200
+@@ -2,7 +2,7 @@
+ SOPE_ROOT=../../..
+--include $(SOPE_ROOT)/config.make
++include $(SOPE_ROOT)/config.make
+ include $(SOPE_ROOT)/Version
+ include ../Version
+diff -urNad SOPE~/sope-appserver/WOExtensions/GNUmakefile SOPE/sope-appserver/WOExtensions/GNUmakefile
+--- SOPE~/sope-appserver/WOExtensions/GNUmakefile      2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/WOExtensions/GNUmakefile       2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ include ../Version
+ include ./Version
+@@ -9,7 +9,7 @@
+ LIBRARY_NAME     = libWOExtensions
+ BUNDLE_NAME      = WOExtensions
+ BUNDLE_EXTENSION = .wox
+-BUNDLE_INSTALL_DIR = $(GNUSTEP_INSTALLATION_DIR)/Library/WOxElemBuilders-$(MAJOR_VERSION).$(MINOR_VERSION)/
++BUNDLE_INSTALL_DIR = $(SOPE_WOXBUILDERS)/
+ else
+ FRAMEWORK_NAME = WOExtensions
+@@ -71,6 +71,9 @@
+ # building
+ -include GNUmakefile.preamble
++ifneq ($(FHS_INSTALL_ROOT),)
++GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include
++endif
+ ifneq ($(frameworks),yes)
+ include $(GNUSTEP_MAKEFILES)/library.make
+ include $(GNUSTEP_MAKEFILES)/bundle.make
+@@ -78,4 +81,3 @@
+ include $(GNUSTEP_MAKEFILES)/framework.make
+ endif
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-appserver/WOExtensions/GNUmakefile.preamble SOPE/sope-appserver/WOExtensions/GNUmakefile.preamble
+--- SOPE~/sope-appserver/WOExtensions/GNUmakefile.preamble     2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/WOExtensions/GNUmakefile.preamble      2008-05-02 08:50:46.000000000 +0200
+@@ -12,7 +12,8 @@
+       -I$(SOPE_ROOT)/sope-xml
+-libWOExtensions_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libWOExtensions_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libWOExtensions_INSTALL_DIR=$(SOPE_SYSLIBDIR)
+ libWOExtensions_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
+diff -urNad SOPE~/sope-appserver/WOXML/GNUmakefile SOPE/sope-appserver/WOXML/GNUmakefile
+--- SOPE~/sope-appserver/WOXML/GNUmakefile     2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/WOXML/GNUmakefile      2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include ../common.make
+ include ../Version
+ include ./Version
+@@ -15,6 +15,7 @@
+ libWOXML_PCH_FILE = common.h
+ libWOXML_HEADER_FILES_DIR         = .
+ libWOXML_HEADER_FILES_INSTALL_DIR = /WOXML
++libWOXML_INSTALL_DIR=$(SOPE_SYSLIBDIR)
+ libWOXML_HEADER_FILES += \
+@@ -42,10 +43,12 @@
+ # building
+ -include GNUmakefile.preamble
++ifneq ($(FHS_INSTALL_ROOT),)
++GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include
++endif
+ ifneq ($(frameworks),yes)
+ include $(GNUSTEP_MAKEFILES)/library.make
+ else
+ include $(GNUSTEP_MAKEFILES)/framework.make
+ endif
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-appserver/WOXML/GNUmakefile.preamble SOPE/sope-appserver/WOXML/GNUmakefile.preamble
+--- SOPE~/sope-appserver/WOXML/GNUmakefile.preamble    2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/WOXML/GNUmakefile.preamble     2008-05-02 08:50:46.000000000 +0200
+@@ -2,7 +2,7 @@
+ SOPE_ROOT=../..
+-libWOXML_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libWOXML_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
+ libWOXML_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
+ libWOXML_INCLUDE_DIRS += -I. -I..
+diff -urNad SOPE~/sope-appserver/common.make SOPE/sope-appserver/common.make
+--- SOPE~/sope-appserver/common.make   2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/common.make    2008-05-02 08:50:46.000000000 +0200
+@@ -4,8 +4,6 @@
+ include ../Version
+ -include ./Version
+-GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_LOCAL_ROOT)
+-
+ ADDITIONAL_CPPFLAGS += -pipe -Wall -Wno-protocol
+ ADDITIONAL_INCLUDE_DIRS += \
+diff -urNad SOPE~/sope-appserver/samples/CoreDataBlog/GNUmakefile SOPE/sope-appserver/samples/CoreDataBlog/GNUmakefile
+--- SOPE~/sope-appserver/samples/CoreDataBlog/GNUmakefile      2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/samples/CoreDataBlog/GNUmakefile       2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ WOAPP_NAME = CoreDataBlog
+diff -urNad SOPE~/sope-appserver/samples/GNUmakefile SOPE/sope-appserver/samples/GNUmakefile
+--- SOPE~/sope-appserver/samples/GNUmakefile   2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/samples/GNUmakefile    2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ SUBPROJECTS += \
+diff -urNad SOPE~/sope-appserver/samples/HelloForm/GNUmakefile SOPE/sope-appserver/samples/HelloForm/GNUmakefile
+--- SOPE~/sope-appserver/samples/HelloForm/GNUmakefile 2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/samples/HelloForm/GNUmakefile  2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ WOAPP_NAME = HelloForm
+diff -urNad SOPE~/sope-appserver/samples/HelloWorld/GNUmakefile SOPE/sope-appserver/samples/HelloWorld/GNUmakefile
+--- SOPE~/sope-appserver/samples/HelloWorld/GNUmakefile        2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/samples/HelloWorld/GNUmakefile 2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ WOAPP_NAME = HelloWorld
+diff -urNad SOPE~/sope-appserver/samples/SoCookieAuth/GNUmakefile SOPE/sope-appserver/samples/SoCookieAuth/GNUmakefile
+--- SOPE~/sope-appserver/samples/SoCookieAuth/GNUmakefile      2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/samples/SoCookieAuth/GNUmakefile       2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ WOAPP_NAME = SoCookieAuth
+diff -urNad SOPE~/sope-appserver/samples/TestPages/GNUmakefile SOPE/sope-appserver/samples/TestPages/GNUmakefile
+--- SOPE~/sope-appserver/samples/TestPages/GNUmakefile 2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/samples/TestPages/GNUmakefile  2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ WOAPP_NAME = TestPages
+diff -urNad SOPE~/sope-appserver/samples/TestPrototype/GNUmakefile SOPE/sope-appserver/samples/TestPrototype/GNUmakefile
+--- SOPE~/sope-appserver/samples/TestPrototype/GNUmakefile     2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/samples/TestPrototype/GNUmakefile      2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ WOAPP_NAME = TestPrototype
+diff -urNad SOPE~/sope-appserver/samples/WOxExtTest/GNUmakefile SOPE/sope-appserver/samples/WOxExtTest/GNUmakefile
+--- SOPE~/sope-appserver/samples/WOxExtTest/GNUmakefile        2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/samples/WOxExtTest/GNUmakefile 2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ WOAPP_NAME = WOxExtTest
+diff -urNad SOPE~/sope-appserver/samples/davpropget/GNUmakefile SOPE/sope-appserver/samples/davpropget/GNUmakefile
+--- SOPE~/sope-appserver/samples/davpropget/GNUmakefile        2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/samples/davpropget/GNUmakefile 2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ TOOL_NAME = davpropget
+diff -urNad SOPE~/sope-appserver/samples/iCalPortal/GNUmakefile SOPE/sope-appserver/samples/iCalPortal/GNUmakefile
+--- SOPE~/sope-appserver/samples/iCalPortal/GNUmakefile        2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/samples/iCalPortal/GNUmakefile 2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ WOAPP_NAME = iCalPortal
+diff -urNad SOPE~/sope-appserver/samples/iCalPortal/GNUmakefile.preamble SOPE/sope-appserver/samples/iCalPortal/GNUmakefile.preamble
+--- SOPE~/sope-appserver/samples/iCalPortal/GNUmakefile.preamble       2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/samples/iCalPortal/GNUmakefile.preamble        2008-05-02 08:50:46.000000000 +0200
+@@ -7,7 +7,9 @@
+       -lEOControl     \
+       -lXmlRpc -lDOM -lSaxObjC
+ else
++ifneq ($(findstring openbsd, $(GNUSTEP_TARGET_OS)), openbsd)
+ ADDITIONAL_TOOL_LIBS += -lcrypt
+ endif
++endif
+ SYSTEM_LIB_DIR += -L/usr/local/lib -L/usr/lib
+diff -urNad SOPE~/sope-appserver/samples/iCalPortal/Pages/GNUmakefile SOPE/sope-appserver/samples/iCalPortal/Pages/GNUmakefile
+--- SOPE~/sope-appserver/samples/iCalPortal/Pages/GNUmakefile  2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/samples/iCalPortal/Pages/GNUmakefile   2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../../config.make
++include ../../../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ SUBPROJECT_NAME = Pages
+diff -urNad SOPE~/sope-appserver/samples/iCalPortal/WebDAV/GNUmakefile SOPE/sope-appserver/samples/iCalPortal/WebDAV/GNUmakefile
+--- SOPE~/sope-appserver/samples/iCalPortal/WebDAV/GNUmakefile 2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/samples/iCalPortal/WebDAV/GNUmakefile  2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../../config.make
++include ../../../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ SUBPROJECT_NAME = DAV
+diff -urNad SOPE~/sope-appserver/samples/parsedav/GNUmakefile SOPE/sope-appserver/samples/parsedav/GNUmakefile
+--- SOPE~/sope-appserver/samples/parsedav/GNUmakefile  2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/samples/parsedav/GNUmakefile   2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ TOOL_NAME = parsedav
+diff -urNad SOPE~/sope-appserver/samples/xmlrpc/GNUmakefile SOPE/sope-appserver/samples/xmlrpc/GNUmakefile
+--- SOPE~/sope-appserver/samples/xmlrpc/GNUmakefile    2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-appserver/samples/xmlrpc/GNUmakefile     2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ TOOL_NAME = \
+diff -urNad SOPE~/sope-core/EOControl/GNUmakefile SOPE/sope-core/EOControl/GNUmakefile
+--- SOPE~/sope-core/EOControl/GNUmakefile      2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-core/EOControl/GNUmakefile       2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include ../common.make
+ ifneq ($(frameworks),yes)
+@@ -11,7 +11,8 @@
+ libEOControl_PCH_FILE = common.h
+ libEOControl_DLL_DEF = libEOControl.def
+-libEOControl_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libEOControl_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libEOControl_INSTALL_DIR=$(SOPE_SYSLIBDIR)
+ libEOControl_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
+ libEOControl_HEADER_FILES_DIR         = .
+@@ -73,10 +74,12 @@
+ # building
+ -include GNUmakefile.preamble
++ifneq ($(FHS_INSTALL_ROOT),)
++GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include
++endif
+ ifneq ($(frameworks),yes)
+ include $(GNUSTEP_MAKEFILES)/library.make
+ else
+ include $(GNUSTEP_MAKEFILES)/framework.make
+ endif
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-core/EOCoreData/GNUmakefile SOPE/sope-core/EOCoreData/GNUmakefile
+--- SOPE~/sope-core/EOCoreData/GNUmakefile     2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-core/EOCoreData/GNUmakefile      2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include ../common.make
+ ifneq ($(frameworks),yes)
+@@ -10,7 +10,8 @@
+ endif
+ libEOCoreData_PCH_FILE = common.h
+-libEOCoreData_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libEOCoreData_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libEOCoreData_INSTALL_DIR=$(SOPE_SYSLIBDIR)
+ libEOCoreData_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
+ libEOCoreData_HEADER_FILES_DIR         = .
+@@ -67,10 +68,12 @@
+ # building
+ -include GNUmakefile.preamble
++ifneq ($(FHS_INSTALL_ROOT),)
++GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include
++endif
+ ifneq ($(frameworks),yes)
+ include $(GNUSTEP_MAKEFILES)/library.make
+ else
+ include $(GNUSTEP_MAKEFILES)/framework.make
+ endif
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-core/GNUmakefile SOPE/sope-core/GNUmakefile
+--- SOPE~/sope-core/GNUmakefile        2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-core/GNUmakefile 2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../config.make
++include ../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ PACKAGE_NAME=sope-core
+@@ -32,4 +32,4 @@
+ # package
+ macosx-pkg :: all
+-      ../maintenance/make-osxpkg.sh sope-core
++      ../maintenance/make-osxpkg.sh $(PACKAGE_NAME)
+diff -urNad SOPE~/sope-core/NGExtensions/EOExt.subproj/GNUmakefile SOPE/sope-core/NGExtensions/EOExt.subproj/GNUmakefile
+--- SOPE~/sope-core/NGExtensions/EOExt.subproj/GNUmakefile     2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-core/NGExtensions/EOExt.subproj/GNUmakefile      2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include ../../common.make
+ SUBPROJECT_NAME = EOExt
+diff -urNad SOPE~/sope-core/NGExtensions/FdExt.subproj/GNUmakefile SOPE/sope-core/NGExtensions/FdExt.subproj/GNUmakefile
+--- SOPE~/sope-core/NGExtensions/FdExt.subproj/GNUmakefile     2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-core/NGExtensions/FdExt.subproj/GNUmakefile      2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include ../../common.make
+ SUBPROJECT_NAME = FdExt
+diff -urNad SOPE~/sope-core/NGExtensions/GNUmakefile SOPE/sope-core/NGExtensions/GNUmakefile
+--- SOPE~/sope-core/NGExtensions/GNUmakefile   2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-core/NGExtensions/GNUmakefile    2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include ../common.make
+ ifneq ($(frameworks),yes)
+@@ -11,7 +11,8 @@
+ libNGExtensions_PCH_FILE = common.h
+ libNGExtensions_DLL_DEF = libNGExtensions.def
+-libNGExtensions_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libNGExtensions_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libNGExtensions_INSTALL_DIR=$(SOPE_SYSLIBDIR)
+ libNGExtensions_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
+ libNGExtensions_HEADER_FILES_DIR       = ./NGExtensions
+@@ -157,10 +158,12 @@
+ # building
+ -include GNUmakefile.preamble
++ifneq ($(FHS_INSTALL_ROOT),)
++GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include
++endif
+ ifneq ($(frameworks),yes)
+ include $(GNUSTEP_MAKEFILES)/library.make
+ else
+ include $(GNUSTEP_MAKEFILES)/framework.make
+ endif
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-core/NGExtensions/NGBundleManager.m SOPE/sope-core/NGExtensions/NGBundleManager.m
+--- SOPE~/sope-core/NGExtensions/NGBundleManager.m     2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-core/NGExtensions/NGBundleManager.m      2008-05-02 08:50:46.000000000 +0200
+@@ -332,10 +332,7 @@
+ }
+ - (void)_addGNUstepPathsToPathArray:(NSMutableArray *)_paths {
+-#if !GNUSTEP
+-#else
+-  // TODO: whats that supposed to do?
+-  // TODO: replace with proper path locator function!
++  /* Old code for old gstep-make and gstep-base.  */
+   NSDictionary *env;
+   NSString     *p;
+   unsigned     i, count;
+@@ -355,7 +352,19 @@
+       
+     if (p) [self->bundleSearchPaths addObject:p];
+   }
+-#endif
++   
++  /* New code for new gstep-make and gstep-base.  */
++  tmp = NSStandardLibraryPaths();
++  {
++    NSEnumerator *e = [tmp objectEnumerator];
++    while ((tmp = [e nextObject]) != nil) {
++      tmp = [tmp stringByAppendingPathComponent:@"Bundles"];
++      if ([self->bundleSearchPaths containsObject:tmp])
++      continue;
++      
++      [self->bundleSearchPaths addObject:tmp];
++    }
++  }
+ }
+ - (void)_setupBundleSearchPathes {
+diff -urNad SOPE~/sope-core/NGExtensions/NGExtensions/NGResourceLocator.h SOPE/sope-core/NGExtensions/NGExtensions/NGResourceLocator.h
+--- SOPE~/sope-core/NGExtensions/NGExtensions/NGResourceLocator.h      2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-core/NGExtensions/NGExtensions/NGResourceLocator.h       2008-05-02 08:50:46.000000000 +0200
+@@ -52,23 +52,54 @@
+     int reserved:29;
+   } flags;
+ }
+-
++/* The 'GNUstepPath' is a string describing the required path.  This
++ * is the relative location of the path in a standard GNUstep
++ * hierarchy when a standard GNUstep hierarchy is being used; but if
++ * gnustep-base (which supports arbitrary filesystem layouts) is being
++ * used, the path is heuristically mapped to the standard paths
++ * accepted by NSSearchPathForDirectoriesInDomains using the following
++ * logic:
++ *
++ *  "Library/WebApplications" --> GSWebApplicationsDirectory
++ *  "Library/Libraries"       --> GSLibrariesDirectory
++ *  "Tools"                   --> GSToolsDirectory
++ *  "Tools/Admin"             --> GSAdminToolsDirectory
++ *  "Applications"            --> GSApplicationsDirectory
++ *  "Applications/Admin"      --> GSAdminApplicationsDirectory
++ *  "Library/xxx"             --> NSLibraryDirectory/xxx
++ *  "yyy"                     --> NSLibraryDirectory/yyy
++ *  
++ * In the last two cases 'xxx' and 'yyy' are arbitrary strings/paths
++ * that don't match anything else.  Eg, if you create an
++ * NGResourceLocators to look up files in "Library/Resources" you will
++ * get one that looks them up in NSLibraryDirectory/Resources (which
++ * means a list of directories containing
++ * GNUSTEP_USER_LIBRARY/Resources, GNUSTEP_LOCAL_LIBRARY/Resources,
++ * GNUSTEP_NETWORK_LIBRARY/Resources,
++ * GNUSTEP_SYSTEM_LIBRARY/Resources).
++ */
+ + (id)resourceLocatorForGNUstepPath:(NSString *)_path fhsPath:(NSString *)_fhs;
+ - (id)initWithGNUstepPath:(NSString *)_path fhsPath:(NSString *)_fhs;
+ /* resource pathes */
++/* It's not a good idea to access these directly if you want portable
++ * code.  More logical to use directly the 'operations' lookup methods
++ * below which encapsulate all the internal filesystem details.
++ */
+ - (NSArray *)gsRootPathes;  /* GNUSTEP_PATHPREFIX_LIST or MacOSX */
+ - (NSArray *)fhsRootPathes;
+ - (NSArray *)searchPathes;
+ /* operations */
++/* These are public and work across all types of filesystems, it's how you find resources.  */
+ - (NSString *)lookupFileWithName:(NSString *)_name;
+ - (NSString *)lookupFileWithName:(NSString *)_name extension:(NSString *)_ext;
+ - (NSArray *)lookupAllFilesWithExtension:(NSString *)_ext
+   doReturnFullPath:(BOOL)_withPath;
++/* End public */
+ @end
+diff -urNad SOPE~/sope-core/NGExtensions/NGLogging.subproj/GNUmakefile SOPE/sope-core/NGExtensions/NGLogging.subproj/GNUmakefile
+--- SOPE~/sope-core/NGExtensions/NGLogging.subproj/GNUmakefile 2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-core/NGExtensions/NGLogging.subproj/GNUmakefile  2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include ../../common.make
+ SUBPROJECT_NAME = NGLogging
+diff -urNad SOPE~/sope-core/NGExtensions/NGResourceLocator.m SOPE/sope-core/NGExtensions/NGResourceLocator.m
+--- SOPE~/sope-core/NGExtensions/NGResourceLocator.m   2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-core/NGExtensions/NGResourceLocator.m    2008-05-02 08:50:46.000000000 +0200
+@@ -43,7 +43,11 @@
+   return self;
+ }
+ - (id)init {
++#if GNUSTEP_BASE_LIBRARY
++  return [self initWithGNUstepPath:@"Resources" fhsPath:@"share"];
++#else
+   return [self initWithGNUstepPath:@"Library/Resources" fhsPath:@"share"];
++#endif
+ }
+ - (void)dealloc {
+@@ -93,19 +97,30 @@
+   NSString *p;
+   
+   ma = [NSMutableArray arrayWithCapacity:6];
+-  
+-  e = ([self->gsSubPath length] > 0)
+-    ? [[self gsRootPathes] objectEnumerator]
+-    : (NSEnumerator *)nil;
+-  while ((p = [e nextObject]) != nil) {
+-    p = [p stringByAppendingPathComponent:self->gsSubPath];
+-    if ([ma containsObject:p])
+-      continue;
++
++  if ([self->gsSubPath length] > 0) {
+     
+-    if (![self->fileManager fileExistsAtPath:p])
+-      continue;
++#if GNUSTEP_BASE_LIBRARY
++    NSString *directory;
+-    [ma addObject:p];
++    e = [NSStandardLibraryPaths() objectEnumerator];
++    while ((directory = [e nextObject]))
++      [ma addObject: [directory stringByAppendingPathComponent:self->gsSubPath]];
++#else
++
++    /* Old hack using GNUSTEP_PATHLIST.  Should be removed at some point.  */
++    e = [[self gsRootPathes] objectEnumerator];
++    while ((p = [e nextObject]) != nil) {
++      p = [p stringByAppendingPathComponent:self->gsSubPath];
++      if ([ma containsObject:p])
++      continue;
++      
++      if (![self->fileManager fileExistsAtPath:p])
++      continue;
++      
++      [ma addObject:p];
++    }
++#endif
+   }
+   
+   e = ([self->fhsSubPath length] > 0)
+diff -urNad SOPE~/sope-core/NGExtensions/NGRuleEngine.subproj/GNUmakefile SOPE/sope-core/NGExtensions/NGRuleEngine.subproj/GNUmakefile
+--- SOPE~/sope-core/NGExtensions/NGRuleEngine.subproj/GNUmakefile      2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-core/NGExtensions/NGRuleEngine.subproj/GNUmakefile       2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include ../../common.make
+ SUBPROJECT_NAME = NGRuleEngine
+diff -urNad SOPE~/sope-core/NGExtensions/XmlExt.subproj/GNUmakefile SOPE/sope-core/NGExtensions/XmlExt.subproj/GNUmakefile
+--- SOPE~/sope-core/NGExtensions/XmlExt.subproj/GNUmakefile    2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-core/NGExtensions/XmlExt.subproj/GNUmakefile     2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include ../../common.make
+ SUBPROJECT_NAME = XmlExt
+diff -urNad SOPE~/sope-core/NGStreams/GNUmakefile SOPE/sope-core/NGStreams/GNUmakefile
+--- SOPE~/sope-core/NGStreams/GNUmakefile      2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-core/NGStreams/GNUmakefile       2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include ../common.make
+ include ./Version
+@@ -12,7 +12,8 @@
+ libNGStreams_PCH_FILE                 = common.h
+ libNGStreams_DLL_DEF                  = libNGStreams.def
+-libNGStreams_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libNGStreams_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libNGStreams_INSTALL_DIR=$(SOPE_SYSLIBDIR)
+ libNGStreams_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
+ libNGStreams_HEADER_FILES_DIR         = NGStreams
+@@ -106,10 +107,12 @@
+ # building
+ -include GNUmakefile.preamble
++ifneq ($(FHS_INSTALL_ROOT),)
++GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include
++endif
+ ifneq ($(frameworks),yes)
+ include $(GNUSTEP_MAKEFILES)/library.make
+ else
+ include $(GNUSTEP_MAKEFILES)/framework.make
+ endif
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-core/NGStreams/GNUmakefile.preamble SOPE/sope-core/NGStreams/GNUmakefile.preamble
+--- SOPE~/sope-core/NGStreams/GNUmakefile.preamble     2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-core/NGStreams/GNUmakefile.preamble      2008-05-02 08:50:46.000000000 +0200
+@@ -38,7 +38,11 @@
+ endif
+ ifeq ($(findstring _64, $(GNUSTEP_TARGET_CPU)), _64)
++ifeq ($(findstring openbsd, $(GNUSTEP_TARGET_OS)), openbsd)
++SYSTEM_LIB_DIR += -L/usr/local/lib -L/usr/lib
++else
+ SYSTEM_LIB_DIR += -L/usr/local/lib64 -L/usr/lib64
++endif
+ else
+ SYSTEM_LIB_DIR += -L/usr/local/lib -L/usr/lib
+ endif
+diff -urNad SOPE~/sope-core/common.make SOPE/sope-core/common.make
+--- SOPE~/sope-core/common.make        2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-core/common.make 2008-05-02 08:50:46.000000000 +0200
+@@ -6,8 +6,6 @@
+ include $(SKYROOT)/Version
+ -include ./Version
+-GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_LOCAL_ROOT)
+-
+ ADDITIONAL_CPPFLAGS += -pipe -Wall -Wno-protocol
+ ifeq ($(reentrant),yes)
+ ADDITIONAL_CPPFLAGS += -D_REENTRANT=1
+diff -urNad SOPE~/sope-core/samples/GNUmakefile SOPE/sope-core/samples/GNUmakefile
+--- SOPE~/sope-core/samples/GNUmakefile        2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-core/samples/GNUmakefile 2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ TOOL_NAME = \
+@@ -36,4 +36,3 @@
+ -include GNUmakefile.preamble
+ include $(GNUSTEP_MAKEFILES)/tool.make
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-gdl1/FrontBase2/GNUmakefile SOPE/sope-gdl1/FrontBase2/GNUmakefile
+--- SOPE~/sope-gdl1/FrontBase2/GNUmakefile     2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-gdl1/FrontBase2/GNUmakefile      2008-05-02 08:50:46.000000000 +0200
+@@ -22,7 +22,7 @@
+ # If not, write to the Free Software Foundation,
+ # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ CAN_COMPILE_FB = \
+@@ -30,8 +30,6 @@
+ ifeq ($(CAN_COMPILE_FB),yes)
+-GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_LOCAL_ROOT)
+-
+ BUNDLE_NAME = FrontBase2
+ FrontBase2_OBJC_FILES = \
+@@ -51,7 +49,7 @@
+ FrontBase2_RESOURCE_FILES  = Info.plist Version
+ BUNDLE_INSTALL     = FrontBase2
+-BUNDLE_INSTALL_DIR = $(GNUSTEP_SYSTEM_ROOT)/Libraries/Adaptors
++BUNDLE_INSTALL_DIR = $(SOPE_DBADAPTORS)/
+ # Use .gdladaptor as the bundle extension
+ BUNDLE_EXTENSION = .gdladaptor
+diff -urNad SOPE~/sope-gdl1/GDLAccess/EOAdaptor.h SOPE/sope-gdl1/GDLAccess/EOAdaptor.h
+--- SOPE~/sope-gdl1/GDLAccess/EOAdaptor.h      2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-gdl1/GDLAccess/EOAdaptor.h       2008-05-02 08:50:46.000000000 +0200
+@@ -62,11 +62,14 @@
+ + (id)adaptorWithModel:(EOModel *)aModel;
+ + (id)adaptorWithName:(NSString *)aName;
+ + (id)adaptorForURL:(id)_url;
+++ (NSString *)libraryDriversSubDir;
+ - (id)initWithName:(NSString *)aName;
+ /* Getting an adaptor's name */
+ - (NSString*)name;
++/* Get the library subdir name */
++
+ /* Setting connection information */
+ - (void)setConnectionDictionary:(NSDictionary*)aDictionary;
+ - (NSDictionary*)connectionDictionary;
+diff -urNad SOPE~/sope-gdl1/GDLAccess/EOAdaptor.m SOPE/sope-gdl1/GDLAccess/EOAdaptor.m
+--- SOPE~/sope-gdl1/GDLAccess/EOAdaptor.m      2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-gdl1/GDLAccess/EOAdaptor.m       2008-05-02 08:50:46.000000000 +0200
+@@ -53,14 +53,23 @@
+ + (NSArray *)adaptorSearchPathes {
+   // TODO: add support for Cocoa
+   static NSArray *searchPathes = nil;
+-  NSDictionary   *env;
+   NSMutableArray *ma;
+   id             tmp;
+   if (searchPathes != nil) return searchPathes;
+-  env = [[NSProcessInfo processInfo] environment];
+   ma  = [NSMutableArray arrayWithCapacity:8];
++
++#if GNUSTEP_BASE_LIBRARY
++  NSEnumerator *libraryPaths;
++  NSString *directory, *suffix;
++  suffix = [self libraryDriversSubDir];
++  libraryPaths = [NSStandardLibraryPaths() objectEnumerator];
++  while ((directory = [libraryPaths nextObject]))
++    [ma addObject: [directory stringByAppendingPathComponent: suffix]];
++#else
++  NSDictionary   *env;
++  env = [[NSProcessInfo processInfo] environment];
+   
+   if ((tmp = [env objectForKey:@"GNUSTEP_PATHPREFIX_LIST"]) == nil)
+     tmp = [env objectForKey:@"GNUSTEP_PATHLIST"];
+@@ -79,10 +88,11 @@
+       [ma addObject:tmp];
+     }
+   }
++#endif
+   
+   tmp = [NSString stringWithFormat:
+-#if CONFIGURE_64BIT
+-                  @"/lib64/sope-%i.%i/dbadaptors",
++#ifdef CGS_LIBDIR_NAME
++                  [CGS_LIBDIR_NAME stringByAppendingString:@"/sope-%i.%i/dbadaptors"],
+ #else
+                   @"/lib/sope-%i.%i/dbadaptors",
+ #endif
+@@ -92,9 +102,8 @@
+   [ma addObject:[FHS_INSTALL_ROOT stringByAppendingPathComponent:tmp]];
+ #endif
+-  [ma addObject:[@"/usr/local" stringByAppendingString:tmp]];
+-  [ma addObject:[@"/usr" stringByAppendingString:tmp]];
+-  
++  [ma addObject:[@"/usr/local/" stringByAppendingString:tmp]];
++  [ma addObject:[@"/usr/" stringByAppendingString:tmp]];
+   searchPathes = [ma copy];
+   if ([searchPathes count] == 0)
+     NSLog(@"%s: empty library search path !", __PRETTY_FUNCTION__);
+@@ -213,6 +222,11 @@
+   return _scheme;
+ }
+++ (NSString *)libraryDriversSubDir {
++  return [NSString stringWithFormat:@"GDLAdaptors-%i.%i",
++                     GDL_MAJOR_VERSION, GDL_MINOR_VERSION];
++}
++
+ - (NSDictionary *)connectionDictionaryForNSURL:(NSURL *)_url {
+   /*
+     "Database URLs"
+diff -urNad SOPE~/sope-gdl1/GDLAccess/FoundationExt/GNUmakefile SOPE/sope-gdl1/GDLAccess/FoundationExt/GNUmakefile
+--- SOPE~/sope-gdl1/GDLAccess/FoundationExt/GNUmakefile        2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-gdl1/GDLAccess/FoundationExt/GNUmakefile 2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ include ../../Version
+ include ../Version
+diff -urNad SOPE~/sope-gdl1/GDLAccess/GNUmakefile SOPE/sope-gdl1/GDLAccess/GNUmakefile
+--- SOPE~/sope-gdl1/GDLAccess/GNUmakefile      2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-gdl1/GDLAccess/GNUmakefile       2008-05-02 08:50:46.000000000 +0200
+@@ -1,12 +1,10 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include ../common.make
+ -include ../Version
+ -include ./Version
+-GNUSTEP_INSTALLATION_DIR = ${GNUSTEP_LOCAL_ROOT}
+-
+ ifneq ($(frameworks),yes)
+ LIBRARY_NAME = libGDLAccess
+ else
+@@ -14,7 +12,8 @@
+ endif
+ libGDLAccess_PCH_FILE = common.h
+-libGDLAccess_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libGDLAccess_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libGDLAccess_INSTALL_DIR=$(SOPE_SYSLIBDIR)
+ libGDLAccess_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
+ libGDLAccess_DLL_DEF = libGDLAccess.def
+@@ -123,6 +122,8 @@
+ connect-EOAdaptor_OBJC_FILES = connect-EOAdaptor.m
+ load-EOAdaptor_PCH_FILE      = common.h
+ connect-EOAdaptor_PCH_FILE   = common.h
++load-EOAdaptor_INSTALL_DIR    = $(SOPE_TOOLS)/
++connect-EOAdaptor_INSTALL_DIR = $(SOPE_TOOLS)/
+ # framework support
+@@ -136,6 +137,9 @@
+ # building
+ -include GNUmakefile.preamble
++ifneq ($(FHS_INSTALL_ROOT),)
++GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include
++endif
+ ifneq ($(frameworks),yes)
+ include $(GNUSTEP_MAKEFILES)/library.make
+ else
+@@ -143,4 +147,3 @@
+ endif
+ include $(GNUSTEP_MAKEFILES)/tool.make
+ -include GNUmakefile.postamble
+-include fhs.make
+diff -urNad SOPE~/sope-gdl1/GDLAccess/GNUmakefile.preamble SOPE/sope-gdl1/GDLAccess/GNUmakefile.preamble
+--- SOPE~/sope-gdl1/GDLAccess/GNUmakefile.preamble     2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-gdl1/GDLAccess/GNUmakefile.preamble      2008-05-02 08:50:46.000000000 +0200
+@@ -21,14 +21,9 @@
+       -I$(SOPE_ROOT)/sope-core/NGExtensions/
+-# Parameters for EOAdaptor lookup
+-
+-ifneq ($(FHS_INSTALL_ROOT),)
+-ADDITIONAL_CPPFLAGS += -DFHS_INSTALL_ROOT=\@\"$(FHS_INSTALL_ROOT)\"
+-endif
+-ifeq ($(CONFIGURE_64BIT),yes)
+-ADDITIONAL_CPPFLAGS += -DCONFIGURE_64BIT=1
++ifneq ($(CGS_LIBDIR_NAME),)
++ADDITIONAL_CPPFLAGS += -DCGS_LIBDIR_NAME=\@\"$(CGS_LIBDIR_NAME)\"
+ endif
+diff -urNad SOPE~/sope-gdl1/GDLAccess/common.h SOPE/sope-gdl1/GDLAccess/common.h
+--- SOPE~/sope-gdl1/GDLAccess/common.h 2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-gdl1/GDLAccess/common.h  2008-05-02 08:50:46.000000000 +0200
+@@ -42,7 +42,7 @@
+ #import <Foundation/NSZone.h>
+ #import <Foundation/Foundation.h>
+-#if !(COCOA_Foundation_LIBRARY || NeXT_Foundation_LIBRARY)
++#if !(COCOA_Foundation_LIBRARY || NeXT_Foundation_LIBRARY || GNUSTEP_BASE_LIBRARY)
+ #  import <Foundation/NSUtilities.h>
+ #endif
+diff -urNad SOPE~/sope-gdl1/GNUmakefile SOPE/sope-gdl1/GNUmakefile
+--- SOPE~/sope-gdl1/GNUmakefile        2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-gdl1/GNUmakefile 2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../config.make
++include ../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ PACKAGE_NAME=sope-gdl1
+diff -urNad SOPE~/sope-gdl1/MySQL/GNUmakefile SOPE/sope-gdl1/MySQL/GNUmakefile
+--- SOPE~/sope-gdl1/MySQL/GNUmakefile  2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-gdl1/MySQL/GNUmakefile   2008-05-02 08:50:46.000000000 +0200
+@@ -22,7 +22,7 @@
+ # If not, write to the Free Software Foundation,
+ # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ include ../Version
+ include ./Version
+@@ -67,4 +67,3 @@
+ include $(GNUSTEP_MAKEFILES)/tool.make
+ endif
+ -include GNUmakefile.postamble
+-include fhs.make
+diff -urNad SOPE~/sope-gdl1/MySQL/GNUmakefile.preamble SOPE/sope-gdl1/MySQL/GNUmakefile.preamble
+--- SOPE~/sope-gdl1/MySQL/GNUmakefile.preamble 2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-gdl1/MySQL/GNUmakefile.preamble  2008-05-02 08:50:46.000000000 +0200
+@@ -27,7 +27,7 @@
+ ifeq ($(frameworks),yes)
+ BUNDLE_INSTALL_DIR := $(FRAMEWORK_INSTALL_DIR)/GDLAccess.framework/Resources/GDLAdaptors/
+ else
+-BUNDLE_INSTALL_DIR = $(GNUSTEP_INSTALLATION_DIR)/Library/GDLAdaptors-$(MAJOR_VERSION).$(MINOR_VERSION)/
++BUNDLE_INSTALL_DIR = $(SOPE_DBADAPTORS)/
+ endif
+diff -urNad SOPE~/sope-gdl1/Oracle8/GNUmakefile SOPE/sope-gdl1/Oracle8/GNUmakefile
+--- SOPE~/sope-gdl1/Oracle8/GNUmakefile        2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-gdl1/Oracle8/GNUmakefile 2008-05-02 08:50:46.000000000 +0200
+@@ -19,7 +19,7 @@
+ #  License along with this library; if not, write to the Free Software
+ #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ #
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ include ../Version
+ include ./Version
+@@ -51,7 +51,7 @@
+ ifeq ($(frameworks),yes)
+ BUNDLE_INSTALL_DIR := $(FRAMEWORK_INSTALL_DIR)/GDLAccess.framework/Resources/GDLAdaptors/
+ else
+-BUNDLE_INSTALL_DIR = $(GNUSTEP_INSTALLATION_DIR)/Library/GDLAdaptors-$(MAJOR_VERSION).$(MINOR_VERSION)/
++BUNDLE_INSTALL_DIR = $(SOPE_DBADAPTORS)/
+ endif
+ Oracle8_OBJC_FILES = \
+diff -urNad SOPE~/sope-gdl1/PostgreSQL/GNUmakefile SOPE/sope-gdl1/PostgreSQL/GNUmakefile
+--- SOPE~/sope-gdl1/PostgreSQL/GNUmakefile     2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-gdl1/PostgreSQL/GNUmakefile      2008-05-02 08:50:46.000000000 +0200
+@@ -22,7 +22,7 @@
+ # If not, write to the Free Software Foundation,
+ # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ include ../Version
+ include ./Version
+@@ -70,4 +70,3 @@
+ include $(GNUSTEP_MAKEFILES)/bundle.make
+ #include $(GNUSTEP_MAKEFILES)/tool.make
+ -include GNUmakefile.postamble
+-include fhs.make
+diff -urNad SOPE~/sope-gdl1/PostgreSQL/GNUmakefile.preamble SOPE/sope-gdl1/PostgreSQL/GNUmakefile.preamble
+--- SOPE~/sope-gdl1/PostgreSQL/GNUmakefile.preamble    2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-gdl1/PostgreSQL/GNUmakefile.preamble     2008-05-02 08:50:46.000000000 +0200
+@@ -27,7 +27,7 @@
+ ifeq ($(frameworks),yes)
+ BUNDLE_INSTALL_DIR := $(FRAMEWORK_INSTALL_DIR)/GDLAccess.framework/Resources/GDLAdaptors/
+ else
+-BUNDLE_INSTALL_DIR = $(GNUSTEP_INSTALLATION_DIR)/Library/GDLAdaptors-$(MAJOR_VERSION).$(MINOR_VERSION)/
++BUNDLE_INSTALL_DIR = $(SOPE_DBADAPTORS)/
+ endif
+diff -urNad SOPE~/sope-gdl1/SQLite3/GNUmakefile SOPE/sope-gdl1/SQLite3/GNUmakefile
+--- SOPE~/sope-gdl1/SQLite3/GNUmakefile        2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-gdl1/SQLite3/GNUmakefile 2008-05-02 08:50:46.000000000 +0200
+@@ -22,7 +22,7 @@
+ # If not, write to the Free Software Foundation,
+ # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ include ../Version
+ include ./Version
+@@ -67,4 +67,3 @@
+ include $(GNUSTEP_MAKEFILES)/tool.make
+ endif
+ -include GNUmakefile.postamble
+-include fhs.make
+diff -urNad SOPE~/sope-gdl1/SQLite3/GNUmakefile.preamble SOPE/sope-gdl1/SQLite3/GNUmakefile.preamble
+--- SOPE~/sope-gdl1/SQLite3/GNUmakefile.preamble       2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-gdl1/SQLite3/GNUmakefile.preamble        2008-05-02 08:50:46.000000000 +0200
+@@ -27,7 +27,7 @@
+ ifeq ($(frameworks),yes)
+ BUNDLE_INSTALL_DIR := $(FRAMEWORK_INSTALL_DIR)/GDLAccess.framework/Resources/GDLAdaptors/
+ else
+-BUNDLE_INSTALL_DIR = $(GNUSTEP_INSTALLATION_DIR)/Library/GDLAdaptors-$(MAJOR_VERSION).$(MINOR_VERSION)/
++BUNDLE_INSTALL_DIR = $(SOPE_DBADAPTORS)/
+ endif
+diff -urNad SOPE~/sope-ical/GNUmakefile SOPE/sope-ical/GNUmakefile
+--- SOPE~/sope-ical/GNUmakefile        2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-ical/GNUmakefile 2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../config.make
++include ../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ PACKAGE_NAME=sope-ical
+diff -urNad SOPE~/sope-ical/NGiCal/GNUmakefile SOPE/sope-ical/NGiCal/GNUmakefile
+--- SOPE~/sope-ical/NGiCal/GNUmakefile 2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-ical/NGiCal/GNUmakefile  2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ include ./Version
+@@ -14,7 +14,8 @@
+ libNGiCal_PCH_FILE = common.h
+ libNGiCal_HEADER_FILES_DIR         = .
+ libNGiCal_HEADER_FILES_INSTALL_DIR = /NGiCal
+-libNGiCal_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libNGiCal_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libNGiCal_INSTALL_DIR=$(SOPE_SYSLIBDIR)
+ libNGiCal_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
+ libNGiCal_HEADER_FILES =              \
+@@ -107,10 +108,12 @@
+ # building
+ -include GNUmakefile.preamble
++ifneq ($(FHS_INSTALL_ROOT),)
++GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include
++endif
+ ifneq ($(frameworks),yes)
+ include $(GNUSTEP_MAKEFILES)/library.make
+ else
+ include $(GNUSTEP_MAKEFILES)/framework.make
+ endif
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-ical/NGiCal/GNUmakefile.postamble SOPE/sope-ical/NGiCal/GNUmakefile.postamble
+--- SOPE~/sope-ical/NGiCal/GNUmakefile.postamble       2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-ical/NGiCal/GNUmakefile.postamble        2008-05-02 08:50:46.000000000 +0200
+@@ -1,10 +1,6 @@
+ # compilation settings
+-ifeq ($(FHS_INSTALL_ROOT),)
+-MAPDIR="$(GNUSTEP_INSTALLATION_DIR)/Library/SaxMappings/"
+-else
+-MAPDIR="$(FHS_INSTALL_ROOT)/share/sope-$(MAJOR_VERSION).$(MINOR_VERSION)/saxmappings/"
+-endif
++MAPDIR="$(SOPE_SAXMAPPINGS)/"
+ mappings-dir ::
+       $(MKDIRS) $(MAPDIR)
+diff -urNad SOPE~/sope-ical/samples/GNUmakefile SOPE/sope-ical/samples/GNUmakefile
+--- SOPE~/sope-ical/samples/GNUmakefile        2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-ical/samples/GNUmakefile 2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ TOOL_NAME = icalparsetest icalds vcf2xml vcfparsetest ievalrrule
+@@ -14,4 +14,3 @@
+ -include GNUmakefile.preamble
+ include $(GNUSTEP_MAKEFILES)/tool.make
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-ical/versitSaxDriver/GNUmakefile SOPE/sope-ical/versitSaxDriver/GNUmakefile
+--- SOPE~/sope-ical/versitSaxDriver/GNUmakefile        2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-ical/versitSaxDriver/GNUmakefile 2008-05-02 08:50:46.000000000 +0200
+@@ -1,13 +1,13 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ -include ../../Version
+ -include ./Version
+ BUNDLE_NAME        = versitSaxDriver
+ BUNDLE_EXTENSION   = .sax
+-BUNDLE_INSTALL_DIR = $(GNUSTEP_INSTALLATION_DIR)/Library/SaxDrivers-$(MAJOR_VERSION).$(MINOR_VERSION)/
++BUNDLE_INSTALL_DIR = $(SOPE_SAXDRIVERS)/
+ versitSaxDriver_PRINCIPAL_CLASS = VSSaxDriver
+@@ -24,4 +24,3 @@
+ -include GNUmakefile.preamble
+ include $(GNUSTEP_MAKEFILES)/bundle.make
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-ldap/GNUmakefile SOPE/sope-ldap/GNUmakefile
+--- SOPE~/sope-ldap/GNUmakefile        2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-ldap/GNUmakefile 2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../config.make
++include ../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ PACKAGE_NAME=sope-ldap
+diff -urNad SOPE~/sope-ldap/NGLdap/GNUmakefile SOPE/sope-ldap/NGLdap/GNUmakefile
+--- SOPE~/sope-ldap/NGLdap/GNUmakefile 2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-ldap/NGLdap/GNUmakefile  2008-05-02 08:50:46.000000000 +0200
+@@ -1,11 +1,9 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ include ./Version
+-GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_LOCAL_ROOT)
+-
+ ifneq ($(frameworks),yes)
+ LIBRARY_NAME = libNGLdap
+ else
+@@ -15,7 +13,8 @@
+ libNGLdap_PCH_FILE = common.h
+ libNGLdap_HEADER_FILES_DIR         = .
+ libNGLdap_HEADER_FILES_INSTALL_DIR = /NGLdap
+-libNGLdap_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libNGLdap_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libNGLdap_INSTALL_DIR=$(SOPE_SYSLIBDIR)
+ libNGLdap_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
+ libNGLdap_HEADER_FILES = \
+@@ -61,10 +60,12 @@
+ # building
+ -include GNUmakefile.preamble
++ifneq ($(FHS_INSTALL_ROOT),)
++GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include
++endif
+ ifneq ($(frameworks),yes)
+ include $(GNUSTEP_MAKEFILES)/library.make
+ else
+ include $(GNUSTEP_MAKEFILES)/framework.make
+ endif
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-ldap/samples/GNUmakefile SOPE/sope-ldap/samples/GNUmakefile
+--- SOPE~/sope-ldap/samples/GNUmakefile        2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-ldap/samples/GNUmakefile 2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ TOOL_NAME = \
+@@ -9,8 +9,11 @@
+       ldapchkpwd      \
+ ldapls_OBJC_FILES      = ldapls.m
++ldapls_INSTALL_DIR     = $(SOPE_TOOLS)/
+ ldap2dsml_OBJC_FILES   = ldap2dsml.m
++ldap2dsml_INSTALL_DIR  = $(SOPE_TOOLS)/
+ ldapchkpwd_OBJC_FILES  = ldapchkpwd.m
++ldapchkpwd_INSTALL_DIR         = $(SOPE_TOOLS)/
+ #TOOL_NAME = #pwd-check
+ #pwd-check_OBJC_FILES = pwd-check.m
+@@ -19,4 +22,3 @@
+ -include GNUmakefile.preamble
+ include $(GNUSTEP_MAKEFILES)/tool.make
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-mime/GNUmakefile SOPE/sope-mime/GNUmakefile
+--- SOPE~/sope-mime/GNUmakefile        2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-mime/GNUmakefile 2008-05-02 08:50:46.000000000 +0200
+@@ -1,11 +1,9 @@
+ # GNUstep makefile
+--include ../config.make
++include ../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ include ./Version
+-GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_LOCAL_ROOT)
+-
+ ifneq ($(frameworks),yes)
+ LIBRARY_NAME = libNGMime
+ else
+@@ -14,7 +12,8 @@
+ libNGMime_HEADER_FILES_DIR         = .
+ libNGMime_HEADER_FILES_INSTALL_DIR = /NGMime
+-libNGMime_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libNGMime_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libNGMime_INSTALL_DIR=$(SOPE_SYSLIBDIR)
+ libNGMime_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
+ ifneq ($(frameworks),yes)
+@@ -35,6 +34,9 @@
+ # building
+ -include GNUmakefile.preamble
++ifneq ($(FHS_INSTALL_ROOT),)
++GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include
++endif
+ ifneq ($(frameworks),yes)
+ include $(GNUSTEP_MAKEFILES)/library.make
+ else
+@@ -42,7 +44,6 @@
+ include $(GNUSTEP_MAKEFILES)/aggregate.make
+ endif
+ -include GNUmakefile.postamble
+--include fhs.make
+ # package
+diff -urNad SOPE~/sope-mime/NGImap4/GNUmakefile SOPE/sope-mime/NGImap4/GNUmakefile
+--- SOPE~/sope-mime/NGImap4/GNUmakefile        2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-mime/NGImap4/GNUmakefile 2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ include ../Version
+@@ -63,7 +63,10 @@
+       NGImap4MailboxInfo.m            \
+       NGImap4ConnectionManager.m      \
+--include GNUmakefile.preamble
++include GNUmakefile.preamble
++ifneq ($(FHS_INSTALL_ROOT),)
++GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include
++endif
+ ifneq ($(frameworks),yes)
+ include $(GNUSTEP_MAKEFILES)/subproject.make
+ else
+diff -urNad SOPE~/sope-mime/NGMail/GNUmakefile SOPE/sope-mime/NGMail/GNUmakefile
+--- SOPE~/sope-mime/NGMail/GNUmakefile 2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-mime/NGMail/GNUmakefile  2008-05-02 08:50:46.000000000 +0200
+@@ -1,10 +1,8 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+-GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_LOCAL_ROOT)
+-
+ ifneq ($(frameworks),yes)
+ SUBPROJECT_NAME = NGMail
+ else
+@@ -55,6 +53,9 @@
+       NSData+MimeQP.m         \
+ -include GNUmakefile.preamble
++ifneq ($(FHS_INSTALL_ROOT),)
++GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include
++endif
+ ifneq ($(frameworks),yes)
+ include $(GNUSTEP_MAKEFILES)/subproject.make
+ else
+diff -urNad SOPE~/sope-mime/NGMime/GNUmakefile SOPE/sope-mime/NGMime/GNUmakefile
+--- SOPE~/sope-mime/NGMime/GNUmakefile 2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-mime/NGMime/GNUmakefile  2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ include ../Version
+@@ -76,5 +76,8 @@
+       NGMimeRfc822BodyGenerator.m                     \
+ -include GNUmakefile.preamble
++ifneq ($(FHS_INSTALL_ROOT),)
++GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include
++endif
+ include $(GNUSTEP_MAKEFILES)/subproject.make
+ -include GNUmakefile.postamble
+diff -urNad SOPE~/sope-mime/NGMime/GNUmakefile.preamble SOPE/sope-mime/NGMime/GNUmakefile.preamble
+--- SOPE~/sope-mime/NGMime/GNUmakefile.preamble        2008-05-02 08:04:18.000000000 +0200
++++ SOPE/sope-mime/NGMime/GNUmakefile.preamble 2008-05-02 08:50:46.000000000 +0200
+@@ -5,6 +5,15 @@
+       -DLIBRARY_MINOR_VERSION=${MINOR_VERSION} \
+       -DLIBRARY_SUBMINOR_VERSION=${SUBMINOR_VERSION} \
++ifeq ($(patsubstr GNU/%,glibc,$(shell uname -o)),glibc)
++ADDITIONAL_CPPFLAGS += \
++        -DHAVE_STRNDUP
++endif
++
++ifneq ($(findstring openbsd, $(GNUSTEP_TARGET_OS)), openbsd)
++      ADDITIONAL_CPPFLAGS += -DHAVE_STRNDUP
++endif
++
+ NGMime_INCLUDE_DIRS += \
+       -I.. -I../..                    \
+       -I../../sope-core/NGStreams/    \
+diff -urNad SOPE~/sope-mime/samples/GNUmakefile SOPE/sope-mime/samples/GNUmakefile
+--- SOPE~/sope-mime/samples/GNUmakefile        2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-mime/samples/GNUmakefile 2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ TOOL_NAME = \
+@@ -14,16 +14,24 @@
+       imapcontest     \
+ imapquota_OBJC_FILES     = ImapQuotaTool.m ImapTool.m imapquota.m
++imapquota_INSTALL_DIR  = $(SOPE_TOOLS)
+ imapacl_OBJC_FILES       = ImapQuotaTool.m ImapTool.m imapacl.m
++imapctl_INSTALL_DIR    = $(SOPE_TOOLS)
+ imapget_OBJC_FILES       = ImapTool.m imapget.m
++imapget_INSTALL_DIR    = $(SOPE_TOOLS)
+ imap_tool_OBJC_FILES     = imap_tool.m
++imap_tool_INSTALL_DIR  = $(SOPE_TOOLS)
+ mime2xml_OBJC_FILES      = Mime2XmlTool.m mime2xml.m
++mime2xml_INSTALL_DIR   = $(SOPE_TOOLS)
+ imapls_OBJC_FILES        = ImapTool.m ImapListTool.m imapls.m
++imapls_INSTALL_DIR     = $(SOPE_TOOLS)
+ test_qpdecode_OBJC_FILES = test_qpdecode.m
++test_qpdecode_INSTALL_DIR= $(SOPE_TOOLS)
+ sievetool_OBJC_FILES   = sievetool.m
++sievetool_INSTALL_DIR  = $(SOPE_TOOLS)
+ imapcontest_OBJC_FILES         = imapcontest.m
++imapcontest_INSTALL_DIR        = $(SOPE_TOOLS)
+ -include GNUmakefile.preamble
+ include $(GNUSTEP_MAKEFILES)/tool.make
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-xml/ChangeLogSaxDriver/GNUmakefile SOPE/sope-xml/ChangeLogSaxDriver/GNUmakefile
+--- SOPE~/sope-xml/ChangeLogSaxDriver/GNUmakefile      2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-xml/ChangeLogSaxDriver/GNUmakefile       2008-05-02 08:50:46.000000000 +0200
+@@ -1,13 +1,13 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ -include ../../Version
+ -include ./Version
+ BUNDLE_NAME        = ChangeLogSaxDriver
+ BUNDLE_EXTENSION   = .sax
+-BUNDLE_INSTALL_DIR = $(GNUSTEP_INSTALLATION_DIR)/Library/SaxDrivers-$(MAJOR_VERSION).$(MINOR_VERSION)/
++BUNDLE_INSTALL_DIR = ${SOPE_SAXDRIVERS}/
+ ChangeLogSaxDriver_OBJC_FILES =               \
+       ChangeLogSaxDriver.m            \
+@@ -20,4 +20,3 @@
+ -include GNUmakefile.preamble
+ include $(GNUSTEP_MAKEFILES)/bundle.make
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-xml/DOM/GNUmakefile SOPE/sope-xml/DOM/GNUmakefile
+--- SOPE~/sope-xml/DOM/GNUmakefile     2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-xml/DOM/GNUmakefile      2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include ../common.make
+ ifneq ($(frameworks),yes)
+@@ -98,10 +98,12 @@
+ # building
+ -include GNUmakefile.preamble
++ifneq ($(FHS_INSTALL_ROOT),)
++GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include
++endif
+ ifneq ($(frameworks),yes)
+ include $(GNUSTEP_MAKEFILES)/library.make
+ else
+ include $(GNUSTEP_MAKEFILES)/framework.make
+ endif
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-xml/DOM/GNUmakefile.preamble SOPE/sope-xml/DOM/GNUmakefile.preamble
+--- SOPE~/sope-xml/DOM/GNUmakefile.preamble    2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-xml/DOM/GNUmakefile.preamble     2008-05-02 08:50:46.000000000 +0200
+@@ -1,10 +1,13 @@
+ # compilation settings
++include ./Version
++
+ libDOM_HEADER_FILES_DIR         = .
+ libDOM_HEADER_FILES_INSTALL_DIR = /DOM
+-libDOM_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libDOM_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libDOM_INSTALL_DIR=$(SOPE_SYSLIBDIR)
+ libDOM_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
+-DOM_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++DOM_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
+ DOM_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
+diff -urNad SOPE~/sope-xml/GNUmakefile SOPE/sope-xml/GNUmakefile
+--- SOPE~/sope-xml/GNUmakefile 2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-xml/GNUmakefile  2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../config.make
++include ../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ PACKAGE_NAME=sope-xml
+diff -urNad SOPE~/sope-xml/STXSaxDriver/ExtraSTX/GNUmakefile SOPE/sope-xml/STXSaxDriver/ExtraSTX/GNUmakefile
+--- SOPE~/sope-xml/STXSaxDriver/ExtraSTX/GNUmakefile   2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-xml/STXSaxDriver/ExtraSTX/GNUmakefile    2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../../config.make
++include ../../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ SUBPROJECT_NAME = ExtraSTX
+diff -urNad SOPE~/sope-xml/STXSaxDriver/GNUmakefile SOPE/sope-xml/STXSaxDriver/GNUmakefile
+--- SOPE~/sope-xml/STXSaxDriver/GNUmakefile    2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-xml/STXSaxDriver/GNUmakefile     2008-05-02 08:50:46.000000000 +0200
+@@ -1,13 +1,13 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ include ../Version
+ include ./Version
+ BUNDLE_NAME        = STXSaxDriver
+ BUNDLE_EXTENSION   = .sax
+-BUNDLE_INSTALL_DIR = $(GNUSTEP_INSTALLATION_DIR)/Library/SaxDrivers-$(SOPE_MAJOR_VERSION).$(SOPE_MINOR_VERSION)/
++BUNDLE_INSTALL_DIR = $(SOPE_SAXDRIVERS)
+ STXSaxDriver_PCH_FILE = common.h
+@@ -24,4 +24,3 @@
+ -include GNUmakefile.preamble
+ include $(GNUSTEP_MAKEFILES)/bundle.make
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-xml/STXSaxDriver/Model/GNUmakefile SOPE/sope-xml/STXSaxDriver/Model/GNUmakefile
+--- SOPE~/sope-xml/STXSaxDriver/Model/GNUmakefile      2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-xml/STXSaxDriver/Model/GNUmakefile       2008-05-02 08:50:46.000000000 +0200
+@@ -6,7 +6,7 @@
+ #  Date: 24 November 2003
+ #
+--include ../../../config.make
++include ../../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ SUBPROJECT_NAME = Model
+diff -urNad SOPE~/sope-xml/SaxObjC/GNUmakefile SOPE/sope-xml/SaxObjC/GNUmakefile
+--- SOPE~/sope-xml/SaxObjC/GNUmakefile 2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-xml/SaxObjC/GNUmakefile  2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include ../common.make
+ ifneq ($(frameworks),yes)
+@@ -56,10 +56,12 @@
+ # building
+ -include GNUmakefile.preamble
++ifneq ($(FHS_INSTALL_ROOT),)
++GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include
++endif
+ ifneq ($(frameworks),yes)
+ include $(GNUSTEP_MAKEFILES)/library.make
+ else
+ include $(GNUSTEP_MAKEFILES)/framework.make
+ endif
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-xml/SaxObjC/GNUmakefile.preamble SOPE/sope-xml/SaxObjC/GNUmakefile.preamble
+--- SOPE~/sope-xml/SaxObjC/GNUmakefile.preamble        2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-xml/SaxObjC/GNUmakefile.preamble 2008-05-02 08:50:46.000000000 +0200
+@@ -1,9 +1,12 @@
+ # compilation settings
++include ./Version
++
+ libSaxObjC_DLL_DEF      = libSaxObjC.def
+-libSaxObjC_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libSaxObjC_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libSaxObjC_INSTALL_DIR=$(SOPE_SYSLIBDIR)
+ libSaxObjC_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
+-SaxObjC_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++SaxObjC_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
+ SaxObjC_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
+ libSaxObjC_HEADER_FILES_DIR         = .
+@@ -48,8 +51,8 @@
+ ADDITIONAL_CPPFLAGS += -DFHS_INSTALL_ROOT=\@\"$(FHS_INSTALL_ROOT)\"
+ endif
+-ifeq ($(CONFIGURE_64BIT),yes)
+-ADDITIONAL_CPPFLAGS += -DCONFIGURE_64BIT=1
++ifneq ($(CGS_LIBDIR_NAME),)
++ADDITIONAL_CPPFLAGS += -DCGS_LIBDIR_NAME=\@\"$(CGS_LIBDIR_NAME)\"
+ endif
+ # Apple
+diff -urNad SOPE~/sope-xml/SaxObjC/SaxObjectModel.h SOPE/sope-xml/SaxObjC/SaxObjectModel.h
+--- SOPE~/sope-xml/SaxObjC/SaxObjectModel.h    2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-xml/SaxObjC/SaxObjectModel.h     2008-05-02 08:50:46.000000000 +0200
+@@ -34,6 +34,7 @@
+ + (id)modelWithName:(NSString *)_name;
+ + (id)modelWithContentsOfFile:(NSString *)_path;
+++ (NSString *)libraryDriversSubDir;
+ - (id)initWithDictionary:(NSDictionary *)_dict;
+diff -urNad SOPE~/sope-xml/SaxObjC/SaxObjectModel.m SOPE/sope-xml/SaxObjC/SaxObjectModel.m
+--- SOPE~/sope-xml/SaxObjC/SaxObjectModel.m    2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-xml/SaxObjC/SaxObjectModel.m     2008-05-02 08:50:46.000000000 +0200
+@@ -67,12 +67,12 @@
+   if (searchPathes == nil) {
+     NSMutableArray *ma;
+     NSDictionary   *env;
+-    id tmp;
+     
+     env = [[NSProcessInfo processInfo] environment];
+     ma  = [NSMutableArray arrayWithCapacity:6];
+ #if COCOA_Foundation_LIBRARY
++    id tmp;
+     tmp = NSSearchPathForDirectoriesInDomains(NSAllLibrariesDirectory,
+                                               NSAllDomainsMask,
+                                               YES);
+@@ -86,7 +86,16 @@
+           [ma addObject:tmp];
+       }
+     }
++#elif GNUSTEP_BASE_LIBRARY
++    NSEnumerator *libraryPaths;
++    NSString *directory, *suffix;
++
++    suffix = [self libraryDriversSubDir];
++    libraryPaths = [NSStandardLibraryPaths() objectEnumerator];
++    while ((directory = [libraryPaths nextObject]))
++      [ma addObject: [directory stringByAppendingPathComponent: suffix]];
+ #else
++    id tmp;
+     if ((tmp = [env objectForKey:@"GNUSTEP_PATHPREFIX_LIST"]) == nil)
+       tmp = [env objectForKey:@"GNUSTEP_PATHLIST"];
+     tmp = [tmp componentsSeparatedByString:@":"];
+@@ -122,6 +131,10 @@
+   return searchPathes;
+ }
+++ (NSString *)libraryDriversSubDir {
++  return [NSString stringWithFormat:@"SaxMappings"];
++}
++
+ + (id)modelWithName:(NSString *)_name {
+   NSFileManager *fileManager;
+   NSEnumerator  *pathes;
+diff -urNad SOPE~/sope-xml/SaxObjC/SaxXMLReaderFactory.m SOPE/sope-xml/SaxObjC/SaxXMLReaderFactory.m
+--- SOPE~/sope-xml/SaxObjC/SaxXMLReaderFactory.m       2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-xml/SaxObjC/SaxXMLReaderFactory.m        2008-05-02 08:50:46.000000000 +0200
+@@ -137,11 +137,19 @@
+ - (void)addSearchPathesForGNUstepEnv:(NSMutableArray *)ma {
+   /* for libFoundation */
+-  NSDictionary *env;
+-  NSEnumerator *e;
++#if GNUSTEP_BASE_LIBRARY
++NSEnumerator *libraryPaths;
++  NSString *directory, *suffix;
++
++  suffix = [self libraryDriversSubDir];
++  libraryPaths = [NSStandardLibraryPaths() objectEnumerator];
++  while ((directory = [libraryPaths nextObject]))
++    [ma addObject: [directory stringByAppendingPathComponent: suffix]];
++#else  
+   NSString *subdir;
++  NSEnumerator *e;
++  NSDictionary *env;
+   id tmp;
+-  
+   env = [[NSProcessInfo processInfo] environment];
+   
+   if ((tmp = [env objectForKey:@"GNUSTEP_PATHPREFIX_LIST"]) == nil)
+@@ -159,6 +167,7 @@
+     [ma addObject:tmp];
+   }
++#endif
+ }
+ - (NSArray *)saxReaderSearchPathes {
+@@ -182,8 +191,8 @@
+   /* FHS fallback */
+   
+   tmp = [[NSString alloc] initWithFormat:
+-#if CONFIGURE_64BIT
+-                          @"lib64/sope-%i.%i/saxdrivers/",
++#ifdef CGS_LIBDIR_NAME
++                          [CGS_LIBDIR_NAME stringByAppendingString:@"/sope-%i.%i/saxdrivers/"],
+ #else
+                           @"lib/sope-%i.%i/saxdrivers/",
+ #endif
+diff -urNad SOPE~/sope-xml/XmlRpc/GNUmakefile SOPE/sope-xml/XmlRpc/GNUmakefile
+--- SOPE~/sope-xml/XmlRpc/GNUmakefile  2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-xml/XmlRpc/GNUmakefile   2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include ../common.make
+ ifneq ($(frameworks),yes)
+@@ -43,10 +43,12 @@
+ -include GNUmakefile.preamble
++ifneq ($(FHS_INSTALL_ROOT),)
++GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include
++endif
+ ifneq ($(frameworks),yes)
+ include $(GNUSTEP_MAKEFILES)/library.make
+ else
+ include $(GNUSTEP_MAKEFILES)/framework.make
+ endif
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-xml/XmlRpc/GNUmakefile.preamble SOPE/sope-xml/XmlRpc/GNUmakefile.preamble
+--- SOPE~/sope-xml/XmlRpc/GNUmakefile.preamble 2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-xml/XmlRpc/GNUmakefile.preamble  2008-05-02 08:50:46.000000000 +0200
+@@ -1,10 +1,13 @@
+ # compilation settings
++include ./Version
++
+ libXmlRpc_HEADER_FILES_DIR         = .
+ libXmlRpc_HEADER_FILES_INSTALL_DIR = /XmlRpc
+-libXmlRpc_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libXmlRpc_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++libXmlRpc_INSTALL_DIR=$(SOPE_SYSLIBDIR)
+ libXmlRpc_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
+-XmlRpc_SOVERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
++XmlRpc_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
+ XmlRpc_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
+diff -urNad SOPE~/sope-xml/common.make SOPE/sope-xml/common.make
+--- SOPE~/sope-xml/common.make 2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-xml/common.make  2008-05-02 08:50:46.000000000 +0200
+@@ -1,12 +1,6 @@
+ # GNUstep makefile
+-SKYROOT=..
+-
+ include $(GNUSTEP_MAKEFILES)/common.make
+-include $(SKYROOT)/Version
+--include ./Version
+-
+-GNUSTEP_INSTALLATION_DIR = $(GNUSTEP_LOCAL_ROOT)
+ ADDITIONAL_CPPFLAGS += -pipe -Wall -Wno-protocol
+diff -urNad SOPE~/sope-xml/libxmlSAXDriver/GNUmakefile SOPE/sope-xml/libxmlSAXDriver/GNUmakefile
+--- SOPE~/sope-xml/libxmlSAXDriver/GNUmakefile 2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-xml/libxmlSAXDriver/GNUmakefile  2008-05-02 08:50:46.000000000 +0200
+@@ -1,13 +1,13 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ include ../Version
+ include ./Version
+ BUNDLE_NAME        = libxmlSAXDriver
+ BUNDLE_EXTENSION   = .sax
+-BUNDLE_INSTALL_DIR = $(GNUSTEP_INSTALLATION_DIR)/Library/SaxDrivers-$(MAJOR_VERSION).$(MINOR_VERSION)/
++BUNDLE_INSTALL_DIR = $(SOPE_SAXDRIVERS)
+ libxmlSAXDriver_PCH_FILE = common.h
+@@ -24,4 +24,3 @@
+ -include GNUmakefile.preamble
+ include $(GNUSTEP_MAKEFILES)/bundle.make
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-xml/pyxSAXDriver/GNUmakefile SOPE/sope-xml/pyxSAXDriver/GNUmakefile
+--- SOPE~/sope-xml/pyxSAXDriver/GNUmakefile    2008-05-02 08:04:12.000000000 +0200
++++ SOPE/sope-xml/pyxSAXDriver/GNUmakefile     2008-05-02 08:50:46.000000000 +0200
+@@ -1,17 +1,16 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ include ../Version
+ include ./Version
+ BUNDLE_NAME        = pyxSAXDriver
+ BUNDLE_EXTENSION   = .sax
+-BUNDLE_INSTALL_DIR = $(GNUSTEP_USER_ROOT)/Library/SaxDrivers-$(SOPE_MAJOR_VERSION).$(SOPE_MINOR_VERSION)/
++BUNDLE_INSTALL_DIR = ${SOPE_SAXDRIVERS}/
+ pyxSAXDriver_OBJC_FILES = pyxSAXDriver.m
+ -include GNUmakefile.preamble
+ include $(GNUSTEP_MAKEFILES)/bundle.make
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-xml/samples/GNUmakefile SOPE/sope-xml/samples/GNUmakefile
+--- SOPE~/sope-xml/samples/GNUmakefile 2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-xml/samples/GNUmakefile  2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ TOOL_NAME = \
+@@ -13,14 +13,20 @@
+       testqp          \
+ rss2plist1_OBJC_FILES = rss2plist1.m
++rss2plist1_INSTALL_DIR = $(SOPE_TOOLS)/
+ rss2plist2_OBJC_FILES = rss2plist2.m
++rss2plist2_INSTALL_DIR = $(SOPE_TOOLS)/
+ rssparse_OBJC_FILES   = rssparse.m
++rssparse_INSTALL_DIR = $(SOPE_TOOLS)/
+ saxxml_OBJC_FILES     = saxxml.m
++saxxml_INSTALL_DIR = $(SOPE_TOOLS)/
+ xmln_OBJC_FILES       = xmln.m
++xmln_INSTALL_DIR = $(SOPE_TOOLS)/
+ domxml_OBJC_FILES     = domxml.m
++domxml_INSTALL_DIR = $(SOPE_TOOLS)/
+ testqp_OBJC_FILES     = testqp.m
++testqp_INSTALL_DIR = $(SOPE_TOOLS)/
+ -include GNUmakefile.preamble
+ include $(GNUSTEP_MAKEFILES)/tool.make
+ -include GNUmakefile.postamble
+--include fhs.make
+diff -urNad SOPE~/sope-xml/samples/GNUmakefile.preamble SOPE/sope-xml/samples/GNUmakefile.preamble
+--- SOPE~/sope-xml/samples/GNUmakefile.preamble        2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-xml/samples/GNUmakefile.preamble 2008-05-02 08:50:46.000000000 +0200
+@@ -1,5 +1,6 @@
+ # compilation settings
++include ../../config.make
+ rss2plist1_PCH_FILE = common.h
+ rss2plist2_PCH_FILE = common.h
+@@ -42,8 +43,8 @@
+       $(foreach dir,$(DEP_DIRS),-F$(GNUSTEP_BUILD_DIR)/$(dir))
+ endif
+-ifeq ($(findstring _64, $(GNUSTEP_TARGET_CPU)), _64)
+-SYSTEM_LIB_DIR += -L/usr/local/lib64 -L/usr/lib64
++ifneq ($(CGS_LIBDIR_NAME),)
++SYSTEM_LIB_DIR += -L/usr/local/$(CGS_LIBDIR_NAME) -L/usr/$(CGS_LIBDIR_NAME)
+ else
+ SYSTEM_LIB_DIR += -L/usr/local/lib -L/usr/lib
+ endif
+diff -urNad SOPE~/sope-xml/samples/PlistSaxDriver/GNUmakefile SOPE/sope-xml/samples/PlistSaxDriver/GNUmakefile
+--- SOPE~/sope-xml/samples/PlistSaxDriver/GNUmakefile  2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sope-xml/samples/PlistSaxDriver/GNUmakefile   2008-05-02 08:50:46.000000000 +0200
+@@ -1,11 +1,11 @@
+ # GNUstep Makefile
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ BUNDLE_NAME        = PlistSaxDriver
+ BUNDLE_EXTENSION   = .sax
+-BUNDLE_INSTALL_DIR = $(GNUSTEP_USER_ROOT)/Library/Bundles
++BUNDLE_INSTALL_DIR = $(GNUSTEP_BUNDLES)
+ PlistSaxDriver_OBJC_FILES = \
+       PlistSaxDriver.m
+diff -urNad SOPE~/sopex/GNUmakefile SOPE/sopex/GNUmakefile
+--- SOPE~/sopex/GNUmakefile    2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sopex/GNUmakefile     2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../config.make
++include ../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ ifeq ($(FOUNDATION_LIB),apple)
+diff -urNad SOPE~/sopex/SOPEX/GNUmakefile SOPE/sopex/SOPEX/GNUmakefile
+--- SOPE~/sopex/SOPEX/GNUmakefile      2008-05-02 08:04:11.000000000 +0200
++++ SOPE/sopex/SOPEX/GNUmakefile       2008-05-02 08:50:46.000000000 +0200
+@@ -1,6 +1,6 @@
+ # GNUstep makefile
+--include ../../config.make
++include ../../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ include ./Version
+diff -urNad SOPE~/xmlrpc_call/GNUmakefile SOPE/xmlrpc_call/GNUmakefile
+--- SOPE~/xmlrpc_call/GNUmakefile      2008-05-02 08:04:11.000000000 +0200
++++ SOPE/xmlrpc_call/GNUmakefile       2008-05-02 08:50:46.000000000 +0200
+@@ -1,10 +1,11 @@
+ # GNUstep makefile
+--include ../config.make
++include ../config.make
+ include $(GNUSTEP_MAKEFILES)/common.make
+ include ../Version
+ TOOL_NAME = xmlrpc_call
++xmlrpc_call_INSTALL_DIR       = $(SOPE_TOOLS)
+ xmlrpc_call_PCH_FILE = common.h
+@@ -17,7 +18,6 @@
+ -include GNUmakefile.preamble
+ include $(GNUSTEP_MAKEFILES)/tool.make
+ -include GNUmakefile.postamble
+--include fhs.make
+ macosx-pkg ::
+       # do not build a pkg just for this tool
+diff -urNad SOPE~/xmlrpc_call/GNUmakefile.preamble SOPE/xmlrpc_call/GNUmakefile.preamble
+--- SOPE~/xmlrpc_call/GNUmakefile.preamble     2008-05-02 08:04:11.000000000 +0200
++++ SOPE/xmlrpc_call/GNUmakefile.preamble      2008-05-02 08:50:46.000000000 +0200
+@@ -1,5 +1,6 @@
+ # compilation settings
++include ../config.make
+ SOPE_ROOT=..
+ CORE_ROOT=$(SOPE_ROOT)/sope-core
+ APPSERVER_ROOT=$(SOPE_ROOT)/sope-appserver
+@@ -57,14 +58,13 @@
+       $(foreach dir,$(DEP_DIRS),-F$(GNUSTEP_BUILD_DIR)/$(dir))
+ endif
+-ifeq ($(findstring _64, $(GNUSTEP_TARGET_CPU)), _64)
+-SYSTEM_LIB_DIR += -L/usr/local/lib64 -L/usr/lib64
++ifneq ($(CGS_LIBDIR_NAME),)
++SYSTEM_LIB_DIR += -L/usr/local/$(CGS_LIBDIR_NAME) -L/usr/$(CGS_LIBDIR_NAME)
+ else
+ SYSTEM_LIB_DIR += -L/usr/local/lib -L/usr/lib
+ endif
+-
+ # OS dependend stuff
+-ifeq ($(findstring openbsd3, $(GNUSTEP_HOST_OS)), openbsd3)
++ifeq ($(findstring openbsd, $(GNUSTEP_HOST_OS)), openbsd)
+ xmlrpc_call_TOOL_LIBS += -liconv
+ endif