diff options
author | danfe <danfe@FreeBSD.org> | 2015-10-19 23:05:16 +0800 |
---|---|---|
committer | danfe <danfe@FreeBSD.org> | 2015-10-19 23:05:16 +0800 |
commit | 0fd8c0bcd71535f636e23351cac1132304bd3f77 (patch) | |
tree | 5e07284afbe349a018a39c96511d400218ac5efa /x11-wm/golem | |
parent | 86224fbb46f3191e8c29c738c1ba56e527ab5dc5 (diff) | |
download | freebsd-ports-gnome-0fd8c0bcd71535f636e23351cac1132304bd3f77.tar.gz freebsd-ports-gnome-0fd8c0bcd71535f636e23351cac1132304bd3f77.tar.zst freebsd-ports-gnome-0fd8c0bcd71535f636e23351cac1132304bd3f77.zip |
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.
Diffstat (limited to 'x11-wm/golem')
-rw-r--r-- | x11-wm/golem/Makefile | 9 | ||||
-rw-r--r-- | x11-wm/golem/files/patch-Makefile.macros.gnu.in | 20 | ||||
-rw-r--r-- | x11-wm/golem/files/patch-Makefile.rules.gnu.in | 13 |
3 files changed, 32 insertions, 10 deletions
diff --git a/x11-wm/golem/Makefile b/x11-wm/golem/Makefile index 98c10fd55b02..68f07b4cf6ce 100644 --- a/x11-wm/golem/Makefile +++ b/x11-wm/golem/Makefile @@ -38,14 +38,7 @@ post-patch: ${WRKSRC}/complib/asm-generic/cl_atomic_asm.h \ ${WRKSRC}/complib/asm-ppc/cl_atomic_asm.h -# avoid using standard MAKE_ENV -do-build: - @cd ${BUILD_WRKSRC}; \ - ${MAKE_CMD} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${ALL_TARGET} - -do-install: - @cd ${INSTALL_WRKSRC}; \ - ${MAKE_CMD} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${INSTALL_TARGET} +post-install: ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/golem ${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/golem/plugins/*.so diff --git a/x11-wm/golem/files/patch-Makefile.macros.gnu.in b/x11-wm/golem/files/patch-Makefile.macros.gnu.in new file mode 100644 index 000000000000..b6744622c2e5 --- /dev/null +++ b/x11-wm/golem/files/patch-Makefile.macros.gnu.in @@ -0,0 +1,20 @@ +--- Makefile.macros.gnu.in.orig 2006-03-01 18:59:55 UTC ++++ Makefile.macros.gnu.in +@@ -56,17 +56,13 @@ ifdef PROG + BUILDDIR=../build-bin + BUILDPROG=$(BUILDDIR)/$(PROG) + +- ifndef CFLAGS + CFLAGS+=-I$(GOLEM_HOME) -I$(GOLEM_HOME)/complib -I. @CFLAGS@ @X_CFLAGS@ + CFLAGS+=@DEFS@ -DLIBDIR=\"$(libdir)\" -DDATADIR=\"$(datadir)\" +- endif +- ifndef LDFLAGS + LDFLAGS= @LDFLAGS@ @X_LIBS@ @EXPORT_FLAG@ + LDFLAGS+= @LIBS@ -lX11 -lXpm -lXext + ifdef LIBS + LDFLAGS+= -L$(BUILDA) -L$(BUILDLIB) + endif +- endif + + endif + diff --git a/x11-wm/golem/files/patch-Makefile.rules.gnu.in b/x11-wm/golem/files/patch-Makefile.rules.gnu.in index 4011d01ecef8..0e065c535e6d 100644 --- a/x11-wm/golem/files/patch-Makefile.rules.gnu.in +++ b/x11-wm/golem/files/patch-Makefile.rules.gnu.in @@ -1,5 +1,14 @@ ---- Makefile.rules.gnu.in.orig 2014-01-22 17:53:46.492137556 +0800 -+++ Makefile.rules.gnu.in 2014-01-22 17:58:12.855113204 +0800 +--- Makefile.rules.gnu.in.orig 2006-03-01 18:59:55 UTC ++++ Makefile.rules.gnu.in +@@ -15,7 +15,7 @@ ifdef LIBS + LINK_LIBS=$(strip $(foreach lib,$(LIBS),-l$(lib))) + endif + +-ifndef LIBDIR ++ifneq ($(origin LIBDIR), file) + LIBDIR=. + endif + ifdef LIB @@ -179,17 +179,17 @@ menuconfig: install-bin: @INSTALL_PLUGINS@ |