pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk Move detection of shared library type into the plat...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/aa2a3c0a8436
branches:  trunk
changeset: 363082:aa2a3c0a8436
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Wed May 31 22:55:01 2017 +0000

description:
Move detection of shared library type into the platform file.

Only four platforms, all BSDs, need to resolve "ELF/a.out" into
either ELF or a.out.  Calculate it directly in the platform file
and return the value in ${_OPSYS_SHLIB_TYPE} and export that value
in bsd.prefs.mk as ${SHLIB_TYPE}.

Instead of requiring the file(1) tool, we can expect the base
system of those BSDs to have /usr/bin/file, so make use of it
directly.

diffstat:

 mk/bsd.pkg.mk          |   7 +------
 mk/bsd.prefs.mk        |   5 ++++-
 mk/platform/BSDOS.mk   |  12 ++++++++++--
 mk/platform/FreeBSD.mk |  12 ++++++++++--
 mk/platform/NetBSD.mk  |  12 ++++++++++--
 mk/platform/OpenBSD.mk |  12 ++++++++++--
 6 files changed, 45 insertions(+), 15 deletions(-)

diffs (144 lines):

diff -r 53f9b58e3088 -r aa2a3c0a8436 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Wed May 31 22:35:42 2017 +0000
+++ b/mk/bsd.pkg.mk     Wed May 31 22:55:01 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.2022 2017/05/04 18:30:56 joerg Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.2023 2017/05/31 22:55:01 jlam Exp $
 #
 # This file is in the public domain.
 #
@@ -371,11 +371,6 @@
 # bsd.wrapper.mk
 USE_TOOLS+=    expr
 
-# scripts/shlib-type
-.if ${_OPSYS_SHLIB_TYPE} == "ELF/a.out"
-USE_TOOLS+=    file
-.endif
-
 # INSTALL/DEINSTALL script framework
 .include "pkginstall/bsd.pkginstall.mk"
 
diff -r 53f9b58e3088 -r aa2a3c0a8436 mk/bsd.prefs.mk
--- a/mk/bsd.prefs.mk   Wed May 31 22:35:42 2017 +0000
+++ b/mk/bsd.prefs.mk   Wed May 31 22:55:01 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.prefs.mk,v 1.390 2017/04/16 23:12:37 khorben Exp $
+# $NetBSD: bsd.prefs.mk,v 1.391 2017/05/31 22:55:01 jlam Exp $
 #
 # This file includes the mk.conf file, which contains the user settings.
 #
@@ -378,6 +378,9 @@
 PKG_FAIL_REASON+=      "missing mk/platform/${OPSYS}.mk"
 .endif
 
+# Set default SHLIB_TYPE to the ${OPSYS}-specific shared library type.
+SHLIB_TYPE?=           ${_OPSYS_SHLIB_TYPE}
+
 PKGDIRMODE?=           755
 
 # A meta-package is a package that does not have any files and whose
diff -r 53f9b58e3088 -r aa2a3c0a8436 mk/platform/BSDOS.mk
--- a/mk/platform/BSDOS.mk      Wed May 31 22:35:42 2017 +0000
+++ b/mk/platform/BSDOS.mk      Wed May 31 22:55:01 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: BSDOS.mk,v 1.34 2016/03/10 16:58:19 jperkin Exp $
+# $NetBSD: BSDOS.mk,v 1.35 2017/05/31 22:55:01 jlam Exp $
 #
 # Variable definitions for the BSD/OS operating system.
 
@@ -50,7 +50,15 @@
 _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_SHLIB_TYPE=     ELF/a.out       # shared lib type
+_OPSYS_SHLIB_TYPE=     ${_OPSYS_SHLIB_TYPE_cmd:sh}     # shared library type
+_OPSYS_SHLIB_TYPE_cmd= \
+       output=`/usr/bin/file /sbin/sysctl`;    \
+       case $$output in                        \
+       *ELF*dynamically*)      echo ELF ;;     \
+       *shared*library*)       echo a.out ;;   \
+       *dynamically*)          echo a.out ;;   \
+       *)                      echo ELF ;;     \
+       esac
 _PATCH_CAN_BACKUP=     yes     # native patch(1) can make backups
 _PATCH_BACKUP_ARG?=    -V simple -b -z # switch to patch(1) for backup suffix
 _USE_RPATH=            yes     # add rpath to LDFLAGS
diff -r 53f9b58e3088 -r aa2a3c0a8436 mk/platform/FreeBSD.mk
--- a/mk/platform/FreeBSD.mk    Wed May 31 22:35:42 2017 +0000
+++ b/mk/platform/FreeBSD.mk    Wed May 31 22:55:01 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: FreeBSD.mk,v 1.34 2017/05/18 01:29:56 khorben Exp $
+# $NetBSD: FreeBSD.mk,v 1.35 2017/05/31 22:55:01 jlam Exp $
 #
 # Variable definitions for the FreeBSD operating system.
 
@@ -47,7 +47,15 @@
 _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_SHLIB_TYPE=     ELF/a.out       # shared lib type
+_OPSYS_SHLIB_TYPE=     ${_OPSYS_SHLIB_TYPE_cmd:sh}     # shared library type
+_OPSYS_SHLIB_TYPE_cmd= \
+       output=`/usr/bin/file /sbin/sysctl`;    \
+       case $$output in                        \
+       *ELF*dynamically*)      echo ELF ;;     \
+       *shared*library*)       echo a.out ;;   \
+       *dynamically*)          echo a.out ;;   \
+       *)                      echo ELF ;;     \
+       esac
 _PATCH_CAN_BACKUP=     yes     # native patch(1) can make backups
 _PATCH_BACKUP_ARG?=    -V simple -b    # switch to patch(1) for backup suffix
 _USE_RPATH=            yes     # add rpath to LDFLAGS
diff -r 53f9b58e3088 -r aa2a3c0a8436 mk/platform/NetBSD.mk
--- a/mk/platform/NetBSD.mk     Wed May 31 22:35:42 2017 +0000
+++ b/mk/platform/NetBSD.mk     Wed May 31 22:55:01 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: NetBSD.mk,v 1.49 2016/10/27 12:29:17 wiz Exp $
+# $NetBSD: NetBSD.mk,v 1.50 2017/05/31 22:55:01 jlam Exp $
 #
 # Variable definitions for the NetBSD operating system.
 
@@ -71,7 +71,15 @@
 _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_SHLIB_TYPE=     ELF/a.out       # shared lib type
+_OPSYS_SHLIB_TYPE=     ${_OPSYS_SHLIB_TYPE_cmd:sh}     # shared library type
+_OPSYS_SHLIB_TYPE_cmd= \
+       output=`/usr/bin/file /sbin/sysctl`;    \
+       case $$output in                        \
+       *ELF*dynamically*)      echo ELF ;;     \
+       *shared*library*)       echo a.out ;;   \
+       *dynamically*)          echo a.out ;;   \
+       *)                      echo ELF ;;     \
+       esac
 _PATCH_CAN_BACKUP=     yes     # native patch(1) can make backups
 _PATCH_BACKUP_ARG?=    -V simple --suffix # switch to patch(1) for backup suffix
 _USE_RPATH=            yes     # add rpath to LDFLAGS
diff -r 53f9b58e3088 -r aa2a3c0a8436 mk/platform/OpenBSD.mk
--- a/mk/platform/OpenBSD.mk    Wed May 31 22:35:42 2017 +0000
+++ b/mk/platform/OpenBSD.mk    Wed May 31 22:55:01 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: OpenBSD.mk,v 1.41 2016/10/28 09:21:08 jperkin Exp $
+# $NetBSD: OpenBSD.mk,v 1.42 2017/05/31 22:55:01 jlam Exp $
 #
 # Variable definitions for the OpenBSD operating system.
 
@@ -51,7 +51,15 @@
 _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_SHLIB_TYPE=     ELF/a.out       # shared lib type
+_OPSYS_SHLIB_TYPE=     ${_OPSYS_SHLIB_TYPE_cmd:sh}     # shared library type
+_OPSYS_SHLIB_TYPE_cmd= \
+       output=`/usr/bin/file /sbin/sysctl`;    \
+       case $$output in                        \
+       *ELF*dynamically*)      echo ELF ;;     \
+       *shared*library*)       echo a.out ;;   \
+       *dynamically*)          echo a.out ;;   \
+       *)                      echo ELF ;;     \
+       esac
 _PATCH_CAN_BACKUP=     yes     # native patch(1) can make backups
 .if ${OS_VERSION} >= 3.4
 _PATCH_BACKUP_ARG?=    -V simple -z    # switch to patch(1) for backup suffix



Home | Main Index | Thread Index | Old Index