Subject: pkg/30019: [PATCH] textproc/openjade fails to build on OS X
To: None <,,>
From: None <>
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
Performance Design
Darwin 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
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.
On OS X, get pkgsrc, go to textproc/openjade and try to build it.
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
- 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
  - 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:

---	Mon Apr 18 15:07:34 2005
+++ Makefile	Mon Apr 18 17:44:46 2005
@@ -16,12 +16,46 @@
+.include "../../mk/"
+.if !defined(CXXFLAGS) || empty(CXXFLAGS)
-CONFIGURE_ARGS+=	--enable-default-catalog=${OPENJADE_DATA_DIR}/catalog \
+CONFIGURE_ARGS+=	--enable-default-catalog=${PREFIX}/share/sgml/catalog \
+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++
 OPENJADE_DATA_DIR=	${PREFIX}/share/sgml/openjade
 OPENJADE_DOC_DIR=	${PREFIX}/share/doc/openjade
+	@${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
+		< ${WRKSRC}/Makefile.lib.orig > ${WRKSRC}/Makefile.lib
+	@${CP} ${WRKSRC}/Makefile.prog ${WRKSRC}/Makefile.prog.orig
+		< ${WRKSRC}/Makefile.prog.orig > ${WRKSRC}/Makefile.prog