pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk mk: Use OPSYS_VERSION where appropriate.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/8c73fd90a83f
branches:  trunk
changeset: 770335:8c73fd90a83f
user:      jperkin <jperkin%pkgsrc.org@localhost>
date:      Mon Nov 29 16:14:23 2021 +0000

description:
mk: Use OPSYS_VERSION where appropriate.

Should improve readability and in some cases avoid potential failure due to
string comparisons being used.  No other functional change intended.

diffstat:

 mk/bsd.prefs.mk           |  12 ++++++------
 mk/compiler/sunpro.mk     |   6 +++---
 mk/platform/Darwin.mk     |  28 ++++++++++++++--------------
 mk/platform/NetBSD.mk     |   7 +++----
 mk/platform/OpenBSD.mk    |   4 ++--
 mk/platform/SunOS.mk      |   6 +++---
 mk/tools/tools.FreeBSD.mk |   4 ++--
 7 files changed, 33 insertions(+), 34 deletions(-)

diffs (219 lines):

diff -r 6942cfe80702 -r 8c73fd90a83f mk/bsd.prefs.mk
--- a/mk/bsd.prefs.mk   Mon Nov 29 15:57:55 2021 +0000
+++ b/mk/bsd.prefs.mk   Mon Nov 29 16:14:23 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.prefs.mk,v 1.412 2021/11/29 15:57:55 jperkin Exp $
+# $NetBSD: bsd.prefs.mk,v 1.413 2021/11/29 16:14:23 jperkin Exp $
 #
 # This file includes the mk.conf file, which contains the user settings.
 #
@@ -564,14 +564,14 @@
 X11BASE?=      /usr/openwin
 .  elif ${OPSYS} == "Cygwin" || ${OPSYS} == "IRIX" || ${OPSYS} == "OSF1" || ${OPSYS} == "HPUX"
 X11BASE?=      /usr
-.  elif !empty(MACHINE_PLATFORM:MDarwin-[0-8].*-*)
+.  elif ${OPSYS} == "Darwin"
+.    if ${OPSYS_VERSION} < 100500
 X11BASE?=      /usr/X11R6
-.  elif !empty(MACHINE_PLATFORM:MDarwin-9.*-*) || \
-        !empty(MACHINE_PLATFORM:MDarwin-10.*-*) || \
-        !empty(MACHINE_PLATFORM:MDarwin-11.*-*)
+.    elif ${OPSYS_VERSION} < 100800
 X11BASE?=      /usr/X11
-.  elif !empty(MACHINE_PLATFORM:MDarwin-??.*-*)
+.    else
 X11BASE?=      /opt/X11
+.    endif
 .  elif ${OPSYS} == "NetBSD"
 X11BASE?=      /usr/X11R7
 .  elif exists(/usr/X11R7/lib/libX11.so)
diff -r 6942cfe80702 -r 8c73fd90a83f mk/compiler/sunpro.mk
--- a/mk/compiler/sunpro.mk     Mon Nov 29 15:57:55 2021 +0000
+++ b/mk/compiler/sunpro.mk     Mon Nov 29 16:14:23 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: sunpro.mk,v 1.49 2015/05/03 23:16:41 joerg Exp $
+# $NetBSD: sunpro.mk,v 1.50 2021/11/29 16:14:23 jperkin Exp $
 #
 # This is the compiler definition for the SUNWspro C compiler.
 #
@@ -64,9 +64,9 @@
 # See PR 37200
 .if !empty(USE_LANGUAGES:Mc99)
 _WRAP_EXTRA_ARGS.CC+=  -xc99
-. if !empty(MACHINE_PLATFORM:MSunOS-5.[89]-*)
+.  if ${OPSYS_VERSION} < 051000
 _WRAP_EXTRA_ARGS.CC+=   -xc99=all,no_lib
-. endif
+.  endif
 .endif
 
 # The Solaris linker uses "-R" for rpath directives.
diff -r 6942cfe80702 -r 8c73fd90a83f mk/platform/Darwin.mk
--- a/mk/platform/Darwin.mk     Mon Nov 29 15:57:55 2021 +0000
+++ b/mk/platform/Darwin.mk     Mon Nov 29 16:14:23 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Darwin.mk,v 1.109 2021/11/29 12:38:44 jperkin Exp $
+# $NetBSD: Darwin.mk,v 1.110 2021/11/29 16:14:23 jperkin Exp $
 #
 # Variable definitions for the Darwin operating system.
 
@@ -30,14 +30,15 @@
 #
 
 # Tiger (and earlier) use Xfree 4.4.0 (and earlier)
-.if empty(MACHINE_PLATFORM:MDarwin-[0-8].*-*)
+.if ${OPSYS_VERSION} < 100500
 X11_TYPE?=     native
 .endif
 
 .if !defined(CPP) || ${CPP} == "cpp"
 CPP=           ${CC} -E ${CPP_PRECOMP_FLAGS}
 .endif
-.if empty(MACHINE_PLATFORM:MDarwin-[0-8].*-*)
+# bash invoked as /bin/sh on Leopard and newer does not support echo -n.
+.if ${OPSYS_VERSION} >= 100500
 ECHO_N?=       /bin/echo -n
 .else
 ECHO_N?=       ${ECHO} -n
@@ -153,14 +154,14 @@
 # in the SDK directory.  It may be that this can be set for all versions, but
 # for now keep the legacy behaviour and limit it to Big Sur onwards only.
 #
-.if ${OS_VERSION:R} >= 20
+.if ${OPSYS_VERSION} >= 110000
 DARWIN_NO_SYSTEM_LIBS= # defined
 _OPSYS_LIB_DIRS?=      ${OSX_SDK_PATH}/usr/lib
 .else
 _OPSYS_LIB_DIRS?=      /usr/lib
 .endif
 
-.if ${OS_VERSION:R} >= 6
+.if ${OPSYS_VERSION} >= 100200
 _OPSYS_HAS_INET6=      yes     # IPv6 is standard
 .else
 _OPSYS_HAS_INET6=      no      # IPv6 is not standard
@@ -183,8 +184,8 @@
 #
 # Builtin overrides.
 #
-.if !empty(OS_VERSION:M[56].*)
-USE_BUILTIN.dl=                no      # Darwin-[56].* uses devel/dlcompat
+.if ${OPSYS_VERSION} < 100300
+USE_BUILTIN.dl=                no      # Use devel/dlcompat
 .endif
 
 # Builtin defaults which make sense for this platform.
@@ -252,15 +253,14 @@
 CONFIGURE_ENV+=                gl_cv_func_getcwd_abort_bug=no
 .endif
 
-# Use "/bin/ksh" for buildlink3 wrapper script to improve build performance.
-.if (!empty(OS_VERSION:M9.*) || !empty(OS_VERSION:M1[0-2].*) || \
-     !empty(OS_VERSION:M1[4-9].*)) && \
-    exists(/bin/ksh)
+# Use ksh to improve wrapper script performance, except on buggy Mavericks.
+.if exists(/bin/ksh)
+.  if ${OPSYS_VERSION} < 100900 || ${OPSYS_VERSION} >= 101000
 WRAPPER_BIN_SH?=       /bin/ksh
+.  endif
 .endif
 
-# strnlen(3) wasn't included until Lion, pull it in from libnbcompat on prior
-# releases.
-.if ${OS_VERSION:R} < 11
+# strnlen(3) is available from Lion onwards
+.if ${OPSYS_VERSION} < 100700
 _OPSYS_MISSING_FEATURES+=      strnlen
 .endif
diff -r 6942cfe80702 -r 8c73fd90a83f mk/platform/NetBSD.mk
--- a/mk/platform/NetBSD.mk     Mon Nov 29 15:57:55 2021 +0000
+++ b/mk/platform/NetBSD.mk     Mon Nov 29 16:14:23 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: NetBSD.mk,v 1.69 2021/11/09 12:04:43 nia Exp $
+# $NetBSD: NetBSD.mk,v 1.70 2021/11/29 16:14:23 jperkin Exp $
 #
 # Variable definitions for the NetBSD operating system.
 
@@ -43,7 +43,7 @@
 # Native X11 is only supported on NetBSD-5 and later.
 # On NetBSD-5, native X11 has enough issues that we default
 # to modular.
-.if empty(MACHINE_PLATFORM:MNetBSD-[0-5].*)
+.if ${OPSYS_VERSION} >= 060000
 X11_TYPE?=             native
 .endif
 
@@ -137,10 +137,9 @@
 .endif
 
 # Register support for FORTIFY (with GCC)
-.if !empty(OS_VERSION:M[2-6].*)
 # Disable on older versions, see:
 # http://mail-index.netbsd.org/pkgsrc-users/2017/08/07/msg025435.html
-.else
+.if ${OPSYS_VERSION} >= 070000
 _OPSYS_SUPPORTS_FORTIFY=yes
 .endif
 
diff -r 6942cfe80702 -r 8c73fd90a83f mk/platform/OpenBSD.mk
--- a/mk/platform/OpenBSD.mk    Mon Nov 29 15:57:55 2021 +0000
+++ b/mk/platform/OpenBSD.mk    Mon Nov 29 16:14:23 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: OpenBSD.mk,v 1.43 2021/11/09 12:04:43 nia Exp $
+# $NetBSD: OpenBSD.mk,v 1.44 2021/11/29 16:14:23 jperkin Exp $
 #
 # Variable definitions for the OpenBSD operating system.
 
@@ -61,7 +61,7 @@
        *)                      echo ELF ;;     \
        esac
 _PATCH_CAN_BACKUP=     yes     # native patch(1) can make backups
-.if ${OS_VERSION} >= 3.4
+.if ${OPSYS_VERSION} >= 030400
 _PATCH_BACKUP_ARG?=    -V simple -z    # switch to patch(1) for backup suffix
 .else
 _PATCH_BACKUP_ARG?=    -V simple -b    # switch to patch(1) for backup suffix
diff -r 6942cfe80702 -r 8c73fd90a83f mk/platform/SunOS.mk
--- a/mk/platform/SunOS.mk      Mon Nov 29 15:57:55 2021 +0000
+++ b/mk/platform/SunOS.mk      Mon Nov 29 16:14:23 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: SunOS.mk,v 1.81 2021/11/23 10:37:59 nia Exp $
+# $NetBSD: SunOS.mk,v 1.82 2021/11/29 16:14:23 jperkin Exp $
 #
 # Variable definitions for the SunOS/Solaris operating system.
 
@@ -40,7 +40,7 @@
 .endif
 
 # Use SMF by default if available.
-.if empty(OS_VERSION:M5.[0-9])
+.if ${OPSYS_VERSION} >= 051000
 INIT_SYSTEM?=          smf
 .endif
 
@@ -75,7 +75,7 @@
 _OPSYS_MISSING_FEATURES+=      err
 .endif
 
-.if ${OS_VERSION} != "5.11"
+.if ${OPSYS_VERSION} < 051100
 _OPSYS_MISSING_FEATURES+=      strnlen
 .endif
 
diff -r 6942cfe80702 -r 8c73fd90a83f mk/tools/tools.FreeBSD.mk
--- a/mk/tools/tools.FreeBSD.mk Mon Nov 29 15:57:55 2021 +0000
+++ b/mk/tools/tools.FreeBSD.mk Mon Nov 29 16:14:23 2021 +0000
@@ -1,11 +1,11 @@
-# $NetBSD: tools.FreeBSD.mk,v 1.48 2019/02/12 18:40:16 triaxx Exp $
+# $NetBSD: tools.FreeBSD.mk,v 1.49 2021/11/29 16:14:23 jperkin Exp $
 #
 # System-supplied tools for the FreeBSD operating system.
 
 TOOLS_PLATFORM.[?=             [                       # shell builtin
 TOOLS_PLATFORM.awk?=           /usr/bin/awk
 TOOLS_PLATFORM.basename?=      /usr/bin/basename
-.if empty(MACHINE_PLATFORM:MFreeBSD-[0-4].*-*) && empty(MACHINE_PLATFORM:MFreeBSD-5.[0-3]-*)
+.if ${OPSYS_VERSION} >= 050400
 TOOLS_PLATFORM.bsdtar?=                /usr/bin/tar
 .endif
 TOOLS_PLATFORM.byacc?=         /usr/bin/yacc



Home | Main Index | Thread Index | Old Index