1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-26 00:55:14 +00:00
freebsd-ports/x11-wm/golem
Alexey Dokuchaev 529fb56e36 Get rid of hand-rolled do-build' and do-install' targets which serve the
sole purpose to avoid using our standard MAKE_ENV.

They were introduced in r279589 as part of "update to 0.0.6" PR 159499 by
Kato (duh!) some four years ago; in r359185 bapt@ had mentioned that "lots
of invocation of MAKE_CMD here are wrong as they do not properly respect
MAKE_ENV" (which is ironic as avoiding MAKE_ENV *is* their only point) but
the the real problem was neither fixed nor rationale for ugly work-around
explained.

The port builds itself through a series of recursive make(1) calls, and is
using variables to pass various bits of internal state to submakes.  This
approach typically requires strict discipline and can be hard to implement
correctly, to an extent being considered harmful [Miller 1997].

Incidentally, ${MAKE_ENV} includes variables that are 1) used by the port's
own build logic and 2) are not handled in a robust way by it.

Problem #1: consider the following code from `Makefile.rules.gnu.in':

  ifndef LIBDIR
    LIBDIR=.
  endif

This is roughly equivalent to the following:

  ifeq ($(origin LIBDIR), undefined)
    LIBDIR=.
  else
    # use whatever LIBDIR value make(1) can deduce
  endif

Knowing that LIBDIR is set to some other value (`..') by inner makefiles,
that code can be rewritten more elaborately like this:

  ifeq ($(origin LIBDIR), undefined)
    LIBDIR=.
  else ifeq ($(origin LIBDIR), file)
    # use LIBDIR value set by some Makefile
  else
    # use whatever LIBDIR value make(1) can deduce
  endif

Now, because LIBDIR is passed to make(1) via MAKE_ENV and the code above
does not have "ifeq ($(origin LIBDIR), environment)" check, the build was
affected by unexpected bogus value of it and subsequently failed.  Since
the only valid place we can expect "our" LIBDIR to come from is makefiles,
we can inhibit unwanted pollution from the environment by rewriting the
initial code like this:

  ifneq ($(origin LIBDIR), file)
    LIBDIR=.
  endif

Problem #2 is similar: checking for CFLAGS and LDFLAGS to protect their
initial assignment is very fragile as many frameworks akin to the Ports
Collection would provide some default values.  While it is usually safe
to append to them, it is almost always a bad idea to use them verbatim.

Apparently, these checks were put there to support resetting CFLAGS and
LDFLAGS in `util/Makefile', but since removing them does not hurt do so
regardless of small pollution in that one case that does not affect the
build in any noticeable way.
2015-10-19 15:05:16 +00:00
..
files Get rid of hand-rolled do-build' and do-install' targets which serve the 2015-10-19 15:05:16 +00:00
distinfo
Makefile Get rid of hand-rolled do-build' and do-install' targets which serve the 2015-10-19 15:05:16 +00:00
pkg-descr
pkg-plist