ports infrastructure changes for standards/57295
Harti Brandt
brandt at fokus.fraunhofer.de
Mon Mar 22 05:48:16 PST 2004
Hi all,
a test build on bento with the patch from the above PR has shown that
a lot of port builds are broken by this patch. There are mainly three
sources of breakage two of which are infrastucture related. For those
I need the help of the ports gurus to come up with appropriate changes.
The first and probably most easiest to fix problem is the breakage of
imake-4. This is caused by the port's makefile overriding the top-level's
Makefile SUBDIR variable by specifying a new value for it on make's
command line. With a POSIX compliant make this doesn't work, because
command line assignments get absolute priority over makefile assignments
and are passed down to all sub-makes. So make SUBDIR='foo bar' overwrites
SUBDIR not only at the top-level, but also on all sub-makes, which wont
work of course. I have sent appripriate patches to imakes maintainers, so
this is fixed. There may be other ports suffering from this problem.
The next problem is examplified by dns/bind8. It contains a patch to add
'SH=${SH}' to a file that is then used to get command line parameters to
the makes that will build the port. Again with a POSIX complient make
this assignment gets evaluated at make startup time and leads to a
recursive variable assignment error. The problem here is that in order to
fix this we might need to apply different patches to the port for
different make version: with the old make we need the patch that adds the
SH line, with the new one we need a patch without this line. So my
question is: is this doable? Or is there another workaround for this
problem?
The third problem lies in the bsd.ports.mk. Version 1.315 added a speedup
by passing certain variables to sub-makes via command line assignments
(look for __softMAKEFLAGS). This wont work with the patched make, because
these variables are not-overrideable by submakes and this breaks any build
of dependent ports. I think this problem causes most breakage. I was able
to circumvent the problem by specifying NOPRECIOUSMAKEVARS=yes to make,
but don't know whether this is the correct thing to do. And, to be honest,
I don't fully understand what this __softMAKEFLAGS thing does. So could
please someone help me with this?
I have attached the patch to make from the above PR.
Regards,
harti
-------------- next part --------------
diff -ur /usr/src/usr.bin/make/main.c ./main.c
--- /usr/src/usr.bin/make/main.c Sat Dec 13 16:26:27 2003
+++ ./main.c Sat Mar 20 18:46:05 2004
@@ -636,6 +636,10 @@
MainParseArgs(argc, argv);
+#ifdef POSIX
+ Var_AddCmdline(MAKEFLAGS);
+#endif
+
/*
* Find where we are...
* All this code is so that we know where we are when we start up
diff -ur /usr/src/usr.bin/make/nonints.h ./nonints.h
--- /usr/src/usr.bin/make/nonints.h Tue Mar 16 12:36:12 2004
+++ ./nonints.h Sat Mar 20 18:46:05 2004
@@ -135,6 +135,7 @@
void Var_Append(char *, char *, GNode *);
Boolean Var_Exists(char *, GNode *);
char *Var_Value(char *, GNode *, char **);
+void Var_AddCmdLine(char *);
char *Var_Parse(char *, GNode *, Boolean, int *, Boolean *);
char *Var_Subst(char *, char *, GNode *, Boolean);
char *Var_GetTail(char *);
diff -ur /usr/src/usr.bin/make/var.c ./var.c
--- /usr/src/usr.bin/make/var.c Mon Jan 12 11:35:46 2004
+++ ./var.c Sat Mar 20 18:46:05 2004
@@ -832,6 +832,42 @@
}
+#ifdef POSIX
+
+
+/* In POSIX mode, variable assignments passed on the command line are
+ * propagated to sub makes through MAKEFLAGS.
+ */
+void
+Var_AddCmdline(char *name)
+{
+ const Var *v;
+ LstNode ln;
+ unsigned int i;
+ Buffer buf;
+ static const char quotable[] = " \t\n\\'\"";
+ char *s;
+
+ buf = Buf_Init (MAKE_BSIZE);
+
+ for (ln = Lst_First(VAR_CMD->context); ln != NULL;
+ ln = Lst_Succ(ln)) {
+ /* We assume variable names don't need quoting */
+ v = (Var *)Lst_Datum(ln);
+ Buf_AddBytes(buf, strlen(v->name), v->name);
+ Buf_AddByte(buf, '=');
+ for (s = Buf_GetAll(v->val, (int *)NULL); *s != '\0'; s++) {
+ if (strchr(quotable, *s))
+ Buf_AddByte(buf, '\\');
+ Buf_AddByte(buf, *s);
+ }
+ Buf_AddByte(buf, ' ');
+ }
+ Var_Append(name, Buf_GetAll(buf, (int *)NULL), VAR_GLOBAL);
+ Buf_Destroy(buf, 1);
+}
+#endif
+
/*-
*-----------------------------------------------------------------------
* Var_Parse --
More information about the freebsd-ports
mailing list