Subject: OS X pkgsrc fun
To: None <tech-pkg@NetBSD.org>
From: Dan Winship <danw@NetBSD.org>
List: tech-pkg
Date: 09/06/2003 16:52:06
--=-/LbBxFjHi29k9rHBFO35
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
I worked through a bunch of OS X pkgsrc bugs/issues and need to figure
out what to do with them now...
* libtool: 1.4.20010614nb12 doesn't really work that great on
Darwin. (PRs 20515, 20520, and 21654 are all libtool problems.)
1.4.3 works just fine, but I guess there are problems with that
somewhere else? (C++/KDE or something?) I saw something about
libtool 1.5, but it looks like that was during the period when
mail-index.netbsd.org wasn't indexing, because I can't find it
now. Is the plan to upgrade to 1.5 "soon"? If not, I guess I can
try to figure out what patches from 1.4.3 our existing libtool
needs.
* _USE_RPATH=no: There are about a zillion places that need to be
checking _USE_RPATH that aren't. Fixing all of them would be a
lot of work, especially in packages like freetype2 that actually
patch RPATH_FLAG into files. Since Darwin is the only
_USE_RPATH=no platform, it would be a lot simpler to just kludge
around the problem by setting _OPSYS_RPATH_NAME to "-L" on
Darwin and killing off _USE_RPATH. ?
* pthread.buildlink2.mk: "-lpthread" on Darwin is a no-op, and
while there is a libpthread.dylib, there's no
"libpthread.0.1.dylib" or whatever, so fake-la messes up when
trying to buildlink it. (PR 20516). I'm attaching a suggested
patch for this.
* do-shlib-handling: bsd.pkg.mk thinks that ".so" always needs to
be converted to ".dylib" on Darwin, which isn't quite right;
shared libraries end in ".dylib", but loadable modules end in
".so". But this is easy to fix; it just needs to check if the
".so" file is there, and if so, don't rename it to .dylib in the
PLIST. I'm also attaching a patch for this, but someone who
understands the code better could probably make a nicer patch.
* bsd.buildlink2.mk: Darwin's gcc has a bug in it that makes
symlinked header files on UFS not work quite right. I filed a
bug on opendarwin.org, maybe Apple will fix it for Panther.
Anyway, if we're not buildlinking /usr/include/pthread.h any
more, then in most cases we should be able to get away with
using "ln" rather than "ln -s" to populate the buildlink include
dirs. If not, or as a fallback, we'll have to cp them. Blah.
Either way, I'm not sure what the clean way to hack up
bsd.buildlink2.mk to do that on just Darwin is. (Maybe a
Darwin-only post-buildlink rule?)
This message was sent from evolution 1.4.4 built from pkgsrc on OS X.
:-)
-- Dan
--=-/LbBxFjHi29k9rHBFO35
Content-Disposition: attachment; filename=pthread.diff
Content-Type: text/x-patch; name=pthread.diff; charset=UTF-8
Content-Transfer-Encoding: 7bit
Index: defs.Darwin.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/defs.Darwin.mk,v
retrieving revision 1.53
diff -u -r1.53 defs.Darwin.mk
--- defs.Darwin.mk 2003/09/02 06:59:44 1.53
+++ defs.Darwin.mk 2003/09/06 16:45:12
@@ -113,6 +113,7 @@
_OPSYS_HAS_OSSAUDIO= no # libossaudio is available
_OPSYS_LIBTOOL_REQD= 1.4.20010614nb12 # base version of libtool required
_OPSYS_PERL_REQD= 5.8.0 # base version of perl required
+_OPSYS_PTHREAD_AUTO= yes # -lpthread not needed for pthreads
_OPSYS_RPATH_NAME= darwin_has_no_rpath
_PATCH_CAN_BACKUP= yes # native patch(1) can make backups
_PATCH_BACKUP_ARG= -V simple -b -z # switch to patch(1) for backup suffix
Index: defs.FreeBSD.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/defs.FreeBSD.mk,v
retrieving revision 1.23
diff -u -r1.23 defs.FreeBSD.mk
--- defs.FreeBSD.mk 2003/09/02 06:59:45 1.23
+++ defs.FreeBSD.mk 2003/09/06 16:45:12
@@ -127,6 +127,7 @@
_OPSYS_HAS_MANZ= yes # MANZ controls gzipping of man pages
_OPSYS_HAS_OSSAUDIO= yes # libossaudio is available
_OPSYS_PERL_REQD= # no base version of perl required
+_OPSYS_PTHREAD_AUTO= no # -lpthread needed for pthreads
_OPSYS_RPATH_NAME= -R # name of symbol in rpath directive to linker
_PATCH_CAN_BACKUP= yes # native patch(1) can make backups
_PATCH_BACKUP_ARG= -V simple -b # switch to patch(1) for backup suffix
Index: defs.IRIX.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/defs.IRIX.mk,v
retrieving revision 1.32
diff -u -r1.32 defs.IRIX.mk
--- defs.IRIX.mk 2003/09/02 06:59:45 1.32
+++ defs.IRIX.mk 2003/09/06 16:45:12
@@ -118,6 +118,7 @@
_OPSYS_LIBTOOL_REQD= 1.4.20010614nb14 # base version of libtool required
_OPSYS_NEEDS_XPKGWEDGE= yes # xpkgwedge is required for X11
_OPSYS_PERL_REQD= # no base version of perl required
+_OPSYS_PTHREAD_AUTO= no # -lpthread needed for pthreads
_OPSYS_RPATH_NAME= -rpath, # name of symbol in rpath directive to linker
_PATCH_CAN_BACKUP= no # native patch(1) can make backups
_PREFORMATTED_MAN_DIR= man # directory where catman pages are
Index: defs.Linux.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/defs.Linux.mk,v
retrieving revision 1.57
diff -u -r1.57 defs.Linux.mk
--- defs.Linux.mk 2003/09/02 06:59:45 1.57
+++ defs.Linux.mk 2003/09/06 16:45:13
@@ -162,6 +162,7 @@
_OPSYS_HAS_MANZ= no # no MANZ for gzipping of man pages
_OPSYS_HAS_OSSAUDIO= no # libossaudio is available
_OPSYS_PERL_REQD= # no base version of perl required
+_OPSYS_PTHREAD_AUTO= no # -lpthread needed for pthreads
_OPSYS_RPATH_NAME= -R # name of symbol in rpath directive to linker
_PATCH_CAN_BACKUP= yes # native patch(1) can make backups
_PATCH_BACKUP_ARG= -b -V simple -z # switch to patch(1) for backup suffix
Index: defs.NetBSD.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/defs.NetBSD.mk,v
retrieving revision 1.52
diff -u -r1.52 defs.NetBSD.mk
--- defs.NetBSD.mk 2003/09/02 06:59:45 1.52
+++ defs.NetBSD.mk 2003/09/06 16:45:13
@@ -123,6 +123,7 @@
_OPSYS_HAS_MANZ= yes # MANZ controls gzipping of man pages
_OPSYS_HAS_OSSAUDIO= yes # libossaudio is available
_OPSYS_PERL_REQD= # no base version of perl required
+_OPSYS_PTHREAD_AUTO= no # -lpthread needed for pthreads
_OPSYS_RPATH_NAME= -R # name of symbol in rpath directive to linker
_PATCH_CAN_BACKUP= yes # native patch(1) can make backups
_PATCH_BACKUP_ARG= -V simple -b # switch to patch(1) for backup suffix
Index: defs.OpenBSD.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/defs.OpenBSD.mk,v
retrieving revision 1.19
diff -u -r1.19 defs.OpenBSD.mk
--- defs.OpenBSD.mk 2003/09/02 06:59:46 1.19
+++ defs.OpenBSD.mk 2003/09/06 16:45:13
@@ -119,6 +119,7 @@
_OPSYS_HAS_MANZ= yes # MANZ controls gzipping of man pages
_OPSYS_HAS_OSSAUDIO= yes # libossaudio is available
_OPSYS_PERL_REQD= # no base version of perl required
+_OPSYS_PTHREAD_AUTO= no # -lpthread needed for pthreads
_OPSYS_RPATH_NAME= -R # name of symbol in rpath directive to linker
_PATCH_CAN_BACKUP= yes # native patch(1) can make backups
_PATCH_BACKUP_ARG= -V simple -b # switch to patch(1) for backup suffix
Index: defs.SunOS.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/defs.SunOS.mk,v
retrieving revision 1.65
diff -u -r1.65 defs.SunOS.mk
--- defs.SunOS.mk 2003/09/02 06:59:46 1.65
+++ defs.SunOS.mk 2003/09/06 16:45:14
@@ -127,6 +127,7 @@
_OPSYS_HAS_MANZ= no # no MANZ for gzipping of man pages
_OPSYS_HAS_OSSAUDIO= no # libossaudio is available
_OPSYS_PERL_REQD= # no base version of perl required
+_OPSYS_PTHREAD_AUTO= no # -lpthread needed for pthreads
_OPSYS_RPATH_NAME= -R # name of symbol in rpath directive to linker
_PATCH_CAN_BACKUP= yes # native patch(1) can make backups
_PATCH_BACKUP_ARG= -V simple -z # switch to patch(1) for backup suffix
Index: pthread.buildlink2.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/pthread.buildlink2.mk,v
retrieving revision 1.15
diff -u -r1.15 pthread.buildlink2.mk
--- pthread.buildlink2.mk 2003/09/02 06:59:47 1.15
+++ pthread.buildlink2.mk 2003/09/06 16:45:14
@@ -116,7 +116,9 @@
#
.undef PTHREAD_TYPE
PREFER_NATIVE_PTHREADS?= YES
-.if exists(/usr/include/pthread.h) && ${PREFER_NATIVE_PTHREADS} == "YES"
+.if ${_OPSYS_PTHREAD_AUTO} == "yes"
+PTHREAD_TYPE= automatic
+.elif exists(/usr/include/pthread.h) && ${PREFER_NATIVE_PTHREADS} == "YES"
PTHREAD_TYPE= native
.else
. if !empty(PTHREAD_OPTS:Mnative)
@@ -196,6 +198,10 @@
. else
PKG_SKIP_REASON= "${PKGNAME} needs pthreads, but ${_PKG_PTHREAD_BUILDLINK2_MK} is missing."
. endif
+
+.elif ${PTHREAD_TYPE} == "automatic"
+BUILDLINK_PREFIX.pthread= /usr
+
.endif
# Define user-visible PTHREAD_CFLAGS and PTHREAD_LDFLAGS as compiler
--=-/LbBxFjHi29k9rHBFO35
Content-Disposition: attachment; filename=shlib.diff
Content-Type: text/x-patch; name=shlib.diff; charset=UTF-8
Content-Transfer-Encoding: 7bit
Index: bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.1257
diff -u -r1.1257 bsd.pkg.mk
--- bsd.pkg.mk 2003/09/03 15:05:43 1.1257
+++ bsd.pkg.mk 2003/09/04 02:08:02
@@ -2767,8 +2767,11 @@
next \
} \
/.*\/lib[^\/]+\.so$$/ { \
- libtool_release($$0); \
lines[NR] = $$0; \
+ if (system("${TEST} -e ${PREFIX}/" $$0) == 0) { \
+ next; \
+ } \
+ libtool_release($$0); \
links[linkc++] = $$0; \
if (sub("-[^-]+\.so$$", "\.so")) { \
links[linkc++] = $$0; \
--=-/LbBxFjHi29k9rHBFO35--