From owner-svn-ports-head@freebsd.org Mon Oct 19 15:05:17 2015 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BFA09A19E4F; Mon, 19 Oct 2015 15:05:17 +0000 (UTC) (envelope-from danfe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D05C25C; Mon, 19 Oct 2015 15:05:17 +0000 (UTC) (envelope-from danfe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9JF5GoY029681; Mon, 19 Oct 2015 15:05:16 GMT (envelope-from danfe@FreeBSD.org) Received: (from danfe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9JF5GHK029678; Mon, 19 Oct 2015 15:05:16 GMT (envelope-from danfe@FreeBSD.org) Message-Id: <201510191505.t9JF5GHK029678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: danfe set sender to danfe@FreeBSD.org using -f From: Alexey Dokuchaev Date: Mon, 19 Oct 2015 15:05:16 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r399689 - in head/x11-wm/golem: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Oct 2015 15:05:17 -0000 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@