svn commit: r399689 - in head/x11-wm/golem: . files
Alexey Dokuchaev
danfe at FreeBSD.org
Mon Oct 19 15:05:17 UTC 2015
Author: danfe
Date: Mon Oct 19 15:05:16 2015
New Revision: 399689
URL: https://svnweb.freebsd.org/changeset/ports/399689
Log:
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.
Added:
head/x11-wm/golem/files/patch-Makefile.macros.gnu.in (contents, props changed)
Modified:
head/x11-wm/golem/Makefile
head/x11-wm/golem/files/patch-Makefile.rules.gnu.in
Modified: head/x11-wm/golem/Makefile
==============================================================================
--- head/x11-wm/golem/Makefile Mon Oct 19 15:04:31 2015 (r399688)
+++ head/x11-wm/golem/Makefile Mon Oct 19 15:05:16 2015 (r399689)
@@ -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
Added: head/x11-wm/golem/files/patch-Makefile.macros.gnu.in
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/x11-wm/golem/files/patch-Makefile.macros.gnu.in Mon Oct 19 15:05:16 2015 (r399689)
@@ -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
+
Modified: head/x11-wm/golem/files/patch-Makefile.rules.gnu.in
==============================================================================
--- head/x11-wm/golem/files/patch-Makefile.rules.gnu.in Mon Oct 19 15:04:31 2015 (r399688)
+++ head/x11-wm/golem/files/patch-Makefile.rules.gnu.in Mon Oct 19 15:05:16 2015 (r399689)
@@ -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@
More information about the svn-ports-head
mailing list