pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk backout previous until it can be done a better way.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/a490e6225f29
branches:  trunk
changeset: 466020:a490e6225f29
user:      grant <grant%pkgsrc.org@localhost>
date:      Sat Jan 10 09:52:56 2004 +0000

description:
backout previous until it can be done a better way.

diffstat:

 mk/bsd.pkg.mk |  50 ++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 38 insertions(+), 12 deletions(-)

diffs (87 lines):

diff -r 9841b9ce9fee -r a490e6225f29 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Sat Jan 10 09:50:53 2004 +0000
+++ b/mk/bsd.pkg.mk     Sat Jan 10 09:52:56 2004 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.1341 2004/01/10 08:38:43 grant Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.1342 2004/01/10 09:52:56 grant Exp $
 #
 # This file is in the public domain.
 #
@@ -98,14 +98,6 @@
 SHLIB_HANDLING?=       YES     # do automatic shared lib handling
 NOCLEAN?=              NO      # don't clean up after update
 
-.if exists(/usr/lib/libc.dylib)
-SHLIB_TYPE=            dylib
-.elif ${OPSYS} == "AIX"
-SHLIB_TYPE=            aixlib
-.else
-SHLIB_TYPE=            ${OBJECT_FMT}
-.endif
-
 PKGBASE?=              ${PKGNAME:C/-[^-]*$//}
 PKGVERSION?=           ${PKGNAME:C/^.*-//}
 PKGWILDCARD?=          ${PKGBASE}-[0-9]*
@@ -2875,10 +2867,11 @@
        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
        sos=`${EGREP} -h -x '.*/lib[^/]+\.so' ${PLIST} || ${TRUE}`;     \
        if [ "$$sos" != "" ]; then                                      \
+               shlib_type=`${MAKE} ${MAKEFLAGS} show-shlib-type`;      \
                if [ "${SHLIB_PLIST_MODE}" = "0" ]; then                \
-                       ${ECHO_MSG} "${_PKGSRC_IN}> [Automatic ${SHLIB_TYPE} shared object handling]"; \
+                       ${ECHO_MSG} "${_PKGSRC_IN}> [Automatic $$shlib_type shared object handling]"; \
                fi;                                                     \
-               case "${SHLIB_TYPE}" in                                 \
+               case "$$shlib_type" in                                  \
                ELF)    ;;                                              \
                "a.out")                                                \
                        ${AWK} '${_AOUT_AWK}' <${PLIST} >${PLIST}.tmp ; \
@@ -2974,6 +2967,38 @@
        fi
 .endif # NO_PKG_REGISTER
 
+
+.if !target(show-shlib-type)
+# Show the shared lib type being built: one of ELF, a.out, dylib, or none
+.PHONY: show-shlib-type
+show-shlib-type:
+.  if exists(/usr/lib/libc.dylib)
+       ${_PKG_SILENT}${_PKG_DEBUG}                                     \
+       ${ECHO} "dylib"
+.  elif ${OPSYS} == "AIX"
+       ${_PKG_SILENT}${_PKG_DEBUG}                                     \
+       ${ECHO} "aixlib"
+.  else
+       ${_PKG_SILENT}${_PKG_DEBUG}                                     \
+       cd ${WRKDIR} &&                                                 \
+       sotype=none;                                                    \
+       if [ "X${MKPIC}" != "Xno" -a "X${NOPIC}" = "X" ]; then          \
+               ${ECHO} "int main() { exit(0); }" > a.$$$$.c;           \
+               ${CC} ${CFLAGS} a.$$$$.c -o a.$$$$.out;                 \
+               case `${FILE_CMD} a.$$$$.out` in                        \
+               *ELF*dynamically*)                                      \
+                       sotype=ELF ;;                                   \
+               *shared*library*)                                       \
+                       sotype="a.out" ;;                               \
+               *dynamically*)                                          \
+                       sotype="a.out" ;;                               \
+               esac;                                                   \
+       fi;                                                             \
+       ${ECHO} "$$sotype";                                             \
+       ${RM} -f a.$$$$.c a.$$$$.out
+.  endif # libc.dylib
+.endif
+
 .PHONY: acquire-extract-lock acquire-patch-lock acquire-tools-lock
 .PHONY: acquire-buildlink-lock acquire-configure-lock acquire-build-lock
 acquire-extract-lock:
@@ -4479,7 +4504,8 @@
        ${_PKG_SILENT}${_PKG_DEBUG}\
        ${ECHO} '@comment $$'NetBSD'$$'
        ${_PKG_SILENT}${_PKG_DEBUG}\
-       case "${SHLIB_TYPE}" in                                         \
+       shlib_type=`${MAKE} ${MAKEFLAGS} show-shlib-type`;              \
+       case $$shlib_type in                                            \
        "a.out")        genlinks=1 ;;                                   \
        *)              genlinks=0 ;;                                   \
        esac;                                                           \



Home | Main Index | Thread Index | Old Index