pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk dlopen.buildlink3.mk should be added to packages th...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/cc20d2d7dd5f
branches:  trunk
changeset: 484189:cc20d2d7dd5f
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Thu Nov 25 21:33:36 2004 +0000

description:
dlopen.buildlink3.mk should be added to packages that use dlopen() to
load shared objects.  Some platforms require pthreads to be linked
into the application if it uses dlopen() or else the applications will
core dump when they dlopen a shared module that _is_ linked with
pthread support.  Including dlopen.buildlink3.mk in a package Makefile
will cause pthread.buildlink3.mk to also be included.

It is up to the package to ensure that PTHREAD_{CFLAGS,LDFLAGS,LIBS}
(defined by pthread.buildlink3.mk) are passed to the compiler when
building/linking the applications, possibly by setting PTHREAD_AUTO_VARS
to "yes" in the package Makefile.

diffstat:

 mk/bsd.pkg.mk           |  10 +++++++++-
 mk/dlopen.buildlink3.mk |  35 +++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletions(-)

diffs (63 lines):

diff -r 1ce7b0ce9ace -r cc20d2d7dd5f mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Thu Nov 25 20:49:30 2004 +0000
+++ b/mk/bsd.pkg.mk     Thu Nov 25 21:33:36 2004 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.1540 2004/11/17 22:55:14 jlam Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.1541 2004/11/25 21:33:36 jlam Exp $
 #
 # This file is in the public domain.
 #
@@ -349,6 +349,14 @@
 .  endif     # !defined(PERL5_*)
 .endif       # USE_PERL5 == run
 
+# _DLOPEN_REQUIRE_PTHREADS is defined by dlopen.buildlink3.mk.
+.if defined(_DLOPEN_REQUIRE_PTHREADS) && \
+    !empty(_DLOPEN_REQUIRE_PTHREADS:M[yY][eE][sS])
+.  if !empty(USE_BUILDLINK3:M[yY][eE][sS])
+.    include "../../mk/pthread.buildlink3.mk"
+.  endif
+.endif
+
 .if defined(USE_FORTRAN)
 .  if !exists(/usr/bin/f77)
 PKG_FC?=               f2c-f77
diff -r 1ce7b0ce9ace -r cc20d2d7dd5f mk/dlopen.buildlink3.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/dlopen.buildlink3.mk   Thu Nov 25 21:33:36 2004 +0000
@@ -0,0 +1,35 @@
+# $NetBSD: dlopen.buildlink3.mk,v 1.1 2004/11/25 21:33:37 jlam Exp $
+#
+# This Makefile fragment is included by package Makefiles and
+# buildlink3.mk files for the packages that use dlopen().
+#
+# DLOPEN_REQUIRE_PTHREADS is a user- and package-settable yes/no variable
+#      whose value decides whether pthread.buildlink3.mk is automatically
+#      included or not.  Its default value depends on whether native
+#      pthreads exist.
+#
+# Including pthread.buildlink3.mk is deferred until bsd.pkg.mk.
+
+.include "../../mk/bsd.prefs.mk"
+
+# The following platforms require pthreads to be linked into the
+# application if it uses dlopen() or else the applications will core
+# dump when they dlopen a shared module that _is_ linked with pthread
+# support.
+#
+_DLOPEN_REQUIRE_PTHREAD_PLATFORMS=                                     \
+       NetBSD-2.[0-9] NetBSD-2.[0-8][0-9]* NetBSD-2.9[0-8]*            \
+       NetBSD-2.99.[0-9] NetBSD-2.99.10
+
+_DLOPEN_REQUIRE_PTHREADS?=     no
+.for _pattern_ in ${_DLOPEN_REQUIRE_PTHREAD_PLATFORMS}
+.  if !empty(MACHINE_PLATFORM:${_pattern_})
+_DLOPEN_REQUIRE_PTHREADS=      yes
+.  endif
+.endfor
+
+.if defined(DLOPEN_REQUIRE_PTHREADS)
+_DLOPEN_REQUIRE_PTHREADS=      ${DLOPEN_REQUIRE_PTHREADS}
+.else
+DLOPEN_REQUIRE_PTHREADS=       ${_DLOPEN_REQUIRE_PTHREADS}
+.endif



Home | Main Index | Thread Index | Old Index