Subject: [PATCH] textproc/xerces-c on OS X
To: None <tech-pkg@NetBSD.org>
From: Idar Tollefsen <idart@performancedesign.no>
List: tech-pkg
Date: 04/10/2005 03:20:26
This is a multi-part message in MIME format.
--------------010108090904000900070409
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hello,

I've attached a patch against textproc/xerces-c/Makefile that makes it 
build on OS X.

The first problem was checking ${LOWER_OPSYS} against "Darwin" and 
"SunOS". That has been changed to just ${OPSYS} so as to actually match 
the values it's tested against.

The second problem was the net accessor, which on OS X should be 
"native", not "socket".

The package was originally configured without threading support. I've 
changed this to be dce threads on AIX, HP-UX and Solaris, sproc on IRIX 
and pthread on all other platforms. This isn't really necessary to make 
it build on OS X, but simply configuring it without threads isn't 
enough. If you look at 
http://xml.apache.org/xerces-c/build-winunix.html, under "Building 
Xerces-C++ as a single-threaded library on Unix platforms", additional 
steps are required of you want to disable threading. It looked simpler 
to just set the threading model according to the configuration instructions.

The last change is to set the transcoder to "native". If left to it's 
own devices, it will choose "IconvGNU", which isn't a valid alternative 
on OS X. Looking at the source, OS X seems to only accept "native" or 
"icu". I confess to not being intimately familiar with pkgsrc, so I'm 
not quite sure whether the code that was already there (now the .else 
part of that setting) should have picked "native" in this case or not. 
converters/libiconv isn't installed, but OS X ships with it iconv 
pre-installed.


- IT

--------------010108090904000900070409
Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0";
 name="Makefile.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="Makefile.diff"

--- Makefile.orig	Sun Oct  3 02:18:21 2004
+++ Makefile	Sun Apr 10 02:57:57 2005
@@ -19,9 +19,10 @@
 USE_LANGUAGES=		c c++
 
 .include "../../mk/bsd.prefs.mk"
-.if ${LOWER_OPSYS} == "SunOS"
+
+.if ${OPSYS} == "SunOS"
 XERCES_PLATFORM=	solaris
-.elif ${LOWER_OPSYS} == "Darwin"
+.elif ${OPSYS} == "Darwin"
 XERCES_PLATFORM=	macosx
 .else
 XERCES_PLATFORM=	${LOWER_OPSYS}
@@ -32,9 +33,26 @@
 CONFIGURE_SCRIPT=	./runConfigure
 CONFIGURE_ARGS+=	-P ${PREFIX}		# installation prefix
 CONFIGURE_ARGS+=	-p ${XERCES_PLATFORM}	# platform
+
+.if ${OPSYS} == "Darwin"
+CONFIGURE_ARGS+=	-n native		# net accessor
+.else
 CONFIGURE_ARGS+=	-n socket		# net accessor
+.endif
+
 CONFIGURE_ARGS+=	-m inmem		# message loader
-CONFIGURE_ARGS+=	-r none			# threading
+
+.if ${OPSYS} == "AIX" || ${OPSYS} == "HP-UX" || ${OPSYS} == "SunOS"
+CONFIGURE_ARGS+=	-r dce			# threading
+.elif ${OPSYS} == "IRIX"
+CONFIGURE_ARGS+=	-r sproc		# threading
+.else
+CONFIGURE_ARGS+=	-r pthread		# threading
+.endif
+
+.if ${OPSYS} == "Darwin"
+CONFIGURE_ARGS+=	-t native		# transcoder
+.else
 CONFIGURE_ARGS+=	${CONFIGURE_ARGS.${ICONV_TYPE}-iconv}
 
 CONFIGURE_ARGS.gnu-iconv=	-t IconvGNU	# transcoder
@@ -42,6 +60,7 @@
 
 CONFIGURE_ARGS.native-iconv=	-t native	# transcoder
 PLIST_SUBST.native-iconv=	NATIVEICONV="" GNUICONV="@comment "
+.endif
 
 CONFIGURE_ENV+=		${XERCES_ENV}
 MAKE_ENV+=		${XERCES_ENV}

--------------010108090904000900070409--