pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/buildlink3 mk/buildlink3: remove makefile hacks for...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/06bf4901e911
branches:  trunk
changeset: 381551:06bf4901e911
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat Jul 09 07:46:02 2022 +0000

description:
mk/buildlink3: remove makefile hacks for NetBSD 5

pkgsrc does not support NetBSD 5 anymore.

Back then, when expanding the body of a .for loop, the variable values
were inserted verbatim in the body, allowing for lots of unintended
special effects, making it essentially impossible to use these values
directly in conditions.

In this case, the values do not contain double quotes, that's why
enclosing the ${_pkg_} in double quotes worked.

See src/usr.bin/make/unit-tests/directive-for.mk for more details,
search for '2008-12-21'.

Combining .for loops with 'empty(...)' conditions still does not work,
so replace these with direct comparisons.  Before 2008-12-21, using
'empty(...)' was the safer variant because it avoided the uncontrolled
code injection.

No functional change.

diffstat:

 mk/buildlink3/bsd.buildlink3.mk |  19 ++++++-------------
 1 files changed, 6 insertions(+), 13 deletions(-)

diffs (54 lines):

diff -r 6af2e1746dbb -r 06bf4901e911 mk/buildlink3/bsd.buildlink3.mk
--- a/mk/buildlink3/bsd.buildlink3.mk   Sat Jul 09 06:41:32 2022 +0000
+++ b/mk/buildlink3/bsd.buildlink3.mk   Sat Jul 09 07:46:02 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.buildlink3.mk,v 1.248 2022/06/07 10:04:25 jperkin Exp $
+# $NetBSD: bsd.buildlink3.mk,v 1.249 2022/07/09 07:46:02 rillig Exp $
 #
 # Copyright (c) 2004 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -92,8 +92,7 @@
 _BUILDLINK_DEPENDS:=
 _BUILDLINK_DEPTH:=
 .for _pkg_ in ${BUILDLINK_TREE}
-_BUILDLINK_pkg:=       ${_pkg_:N-*}
-.  if empty(_BUILDLINK_pkg)
+.  if ${_pkg_:M-*}
 _BUILDLINK_DEPTH:=     ${_BUILDLINK_DEPTH:S/+$//}
 .  else
 .    if empty(_BUILDLINK_DEPTH)
@@ -122,22 +121,16 @@
 _stack_:=bot
 _ok_:=yes
 .for _pkg_ in ${BUILDLINK_TREE}
-# work around PR 47888
-_enter_:=${_pkg_:M-*}
-# work around another bug in netbsd-5's make (fixed in HEAD)
-_use_:=${USE_BUILTIN.${_pkg_:S/^-//}:M[Yy][Ee][Ss]}
-_ignore_:=${IGNORE_PKG.${_pkg_:S/^-//}:M[Yy][Ee][Ss]}
-
-.  if "${_pkg_}" == "x11-links" || "${_pkg_}" == "-x11-links"
+.  if ${_pkg_} == "x11-links" || ${_pkg_} == "-x11-links"
      # (nothing)
-.  elif empty(_enter_)
+.  elif !${_pkg_:M-*}
      # entering a package (in the buildlink tree)
      #.say "${_stack_:C/.*/  /} ${_pkg_}:"
      _stack_:=${_ok_} ${_stack_}
      _ok_:=yes
 .  else
      # leaving a package (in the buildlink tree)
-.    if !empty(_use_)
+.    if ${USE_BUILTIN.${_pkg_:S/^-//}:M[Yy][Ee][Ss]}
        # this package is going to use the builtin version
 .      if ${_ok_} != yes
          # not ok for it to be builtin; force it to pkgsrc
@@ -149,7 +142,7 @@
 .      else
          #.say "${_stack_:C/.*/  /} ${_pkg_:S/^-//} built-in"
 .      endif
-.    elif empty(_ignore_)
+.    elif !${IGNORE_PKG.${_pkg_:S/^-//}:M[Yy][Ee][Ss]}
        # no builtin version or not using it
        #.say "${_stack_:C/.*/  /} ${_pkg_:S/^-//} pkgsrc"
 .      if ${_ok_} == yes



Home | Main Index | Thread Index | Old Index