Subject: pkg/30019: [PATCH] textproc/openjade fails to build on OS X
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <idart@performancedesign.no>
List: pkgsrc-bugs
Date: 04/20/2005 23:02:00
>Number: 30019
>Category: pkg
>Synopsis: [PATCH] textproc/openjade fails to build on OS X
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Apr 20 23:02:00 +0000 2005
>Originator: Idar Tollefsen
>Release: N/A
>Organization:
Performance Design
>Environment:
Darwin fulcrum.performancedesign.no 7.9.0 Darwin Kernel Version 7.9.0: Wed Mar 30 20:11:17 PST 2005; root:xnu/xnu-517.12.7.obj~1/RELEASE_PPC Power Macintosh powerpc
>Description:
Bulding textproc/openjade on OS X fails in three steps:
- Undefined symbols for libstdc++ symbols.
- Undefined symbols while linking libraries.
- Unknown target -lintl after bulding libraries, before bulding programs.
>How-To-Repeat:
On OS X, get pkgsrc, go to textproc/openjade and try to build it.
>Fix:
The following patch does the following:
- For ${OPSYS} == "Darwin":
- Adds explicit linkage against libstdc++ to LDFLAGS.
- Removes -no-undefined from Makefile.lib in the post-configure pahse.
This allows libraries to be built without resolving all symbols.
They are resolved when the programs link against them and the
library containing the missing symbols. The libraries themselves
need not be self contained.
- For all platforms, required:
- Adds libintl to LDFLAGS (see next two change for more).
- Removes -lintl from LIBS in Makefile.comm.
- Sets LDFLAGS as LINKFLAGS in Makefile.comm, Makefile.lib and
Makefile.prog.
- For all platforms, nice-to-have:
- Only set CXXFLAGS to CFLAGS if CXXFLAGS itself is not defined or is
empty. This as opposed to previously allways setting CXXFLAGS to
CFLAGS.
- Changed default catalog to match OpenSP's default catalog.
Failing to do so will produce compiler warnings, and I believe the
previous setting was a oversight of an earlier change.
Removing -lintl fro LIBS in Makefile.comm was necessary to prevent the build process from mistaking it for a target, which it did and failed. I don't think this is OS X specific, so moving it to LDFLAGS is done for all platforms.
Here's the patch against textproc/openjade/Makefile:
--- Makefile.org Mon Apr 18 15:07:34 2005
+++ Makefile Mon Apr 18 17:44:46 2005
@@ -16,12 +16,46 @@
USE_LIBTOOL= YES
GNU_CONFIGURE= YES
+.include "../../mk/bsd.prefs.mk"
+
+.if !defined(CXXFLAGS) || empty(CXXFLAGS)
CONFIGURE_ENV+= CXXFLAGS="${CFLAGS}"
-CONFIGURE_ARGS+= --enable-default-catalog=${OPENJADE_DATA_DIR}/catalog \
+.endif
+CONFIGURE_ARGS+= --enable-default-catalog=${PREFIX}/share/sgml/catalog \
--datadir=${OPENJADE_DATA_DIR}
+LDFLAGS+= -lintl
+# If you get undefined symbol errors like these:
+# vtable for __cxxabiv1::__class_type_info
+# vtable for __cxxabiv1::__si_class_type_info
+# operator delete(void*)
+# operator new(unsigned long)
+# ___cxa_pure_virtual
+# ___gxx_personality_v0
+# then try adding your platform here for explicit
+# linkage against libstdc++.
+.if ${OPSYS} == "Darwin"
+LDFLAGS+= -lstdc++
+.endif
+
OPENJADE_DATA_DIR= ${PREFIX}/share/sgml/openjade
OPENJADE_DOC_DIR= ${PREFIX}/share/doc/openjade
+
+post-configure:
+ @${CP} ${WRKSRC}/Makefile.comm ${WRKSRC}/Makefile.comm.orig
+ @${SED} "s|LIBS= -lintl|LIBS= |g" \
+ < ${WRKSRC}/Makefile.comm.orig > ${WRKSRC}/Makefile.comm
+ @${CP} ${WRKSRC}/Makefile.lib ${WRKSRC}/Makefile.lib.orig
+.if ${OPSYS} == "Darwin"
+ @${SED} "s|LINKFLAGS = -no-undefined|LINKFLAGS = ${LDFLAGS}|g" \
+ < ${WRKSRC}/Makefile.lib.orig > ${WRKSRC}/Makefile.lib
+.else
+ @${SED} "s|LINKFLAGS = |LINKFLAGS = ${LDFLAGS} |g" \
+ < ${WRKSRC}/Makefile.lib.orig > ${WRKSRC}/Makefile.lib
+.endif
+ @${CP} ${WRKSRC}/Makefile.prog ${WRKSRC}/Makefile.prog.orig
+ @${SED} "s|LINKFLAGS = |LINKFLAGS = ${LDFLAGS} |g" \
+ < ${WRKSRC}/Makefile.prog.orig > ${WRKSRC}/Makefile.prog
post-install:
${INSTALL_DATA_DIR} ${OPENJADE_DATA_DIR}/pubtext