Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Aug 2001 00:17:24 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Ruslan Ermilov <ru@FreeBSD.ORG>
Cc:        Warner Losh <imp@harmony.village.org>, "David O'Brien" <obrien@FreeBSD.ORG>, <current@FreeBSD.ORG>
Subject:   Re: Cross builds and upgrade path from 4.x are broken in usr.bin/file
Message-ID:  <20010810235643.Y23367-100000@besplex.bde.org>
In-Reply-To: <20010810110151.B7988@sunbay.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 10 Aug 2001, Ruslan Ermilov wrote:

> On Fri, Aug 10, 2001 at 01:28:31AM -0600, Warner Losh wrote:
> > In message <20010809123057.A2745@sunbay.com> Ruslan Ermilov writes:
> > : As you have been warned, revisions 1.19 and 1.20 to file/Makefile
> >
> > This looks like it should work.  I'm starting a build before I head to
> > bed with the changes to see if they really do work or not.  It is a
> > little ugly, but not so ugly that I'd object overmuch.
> >
> Not uglier than, say, in usr.sbin/sysinstall/Makefile.  Imagine that
> the -C functionality has been moved into its own utility.  Then
> things become much more obvious.  And yes, it worked for me last night
> on a fresh 5.0 `make world' run on a 4.3-STABLE box.

Mark Peek noticed the cross-building problem and sent a little less ugly
fix to a few (?) people a couple of days ago.  His version just runs
"./file -C" at install time.  This is ugly but avoids depending on file(1)
working as a cross-tool, provided "make install" is run on the target.

> > I'd be inclinded to add a small comment to the files Makefile
> > explaining what build-tools is used for:
> >
> > # build-tools for cross compilation and system upgrades
> >
> > maybe.  Otherwise, someone may accidentally break it in one of the
> > periodic cleaning sweeps we have.
> >
> Nope, the `build-tools' is not for cross compilation and system
> upgrades.  This target builds tools that are needed (only) during
> the build process (read: buildworld), hence the `build-tools'.
> As a consequence, they *must* be built in a host environment
> (libraries, etc.) and for the building platform (not the target
> platform for the cross-building case).

But "file -C" does need to be a cross tool if it is run on the host,
since it produces a binary file (if the binary format is actually
machine-dependent).  The only real difference between build-tools and
cross-tools is that the latter produce machine-dependent output so
they need to have special code to work in the cross-building case.

> I am going to commit my patch tomorrow, unless I hear any better
> ideas of how to fix this.

I hope you have heard better ideas :-).  Here is the latest version of
Mark's patch that I have.

---
Index: Makefile
===================================================================
RCS file: /home/ncvs/src/usr.bin/file/Makefile,v
retrieving revision 1.21
diff -u -r1.21 Makefile
--- Makefile	2001/08/08 16:19:30	1.21
+++ Makefile	2001/08/08 16:59:22
@@ -34,32 +34,25 @@
 CFLAGS+= -DMAGIC='"${MAGICPATH}/magic"' -DBUILTIN_ELF -DELFCORE -DHAVE_CONFIG_H
 CFLAGS+= -I${.CURDIR} -I${SRCDIR}

-CLEANFILES+=	magic magic.mgc magic.mime.mgc magic.mime.PITA
+CLEANFILES+=	magic

 MAGFILES=	${SRCDIR}/Header\
 		${SRCDIR}/Localstuff\
 		${SRCDIR}/Magdir/[a-z]*

-all: file magic magic.mgc magic.mime.mgc
+all: file magic

 magic: ${MAGFILES}
 	cat ${.ALLSRC} > ${.TARGET}

-magic.mgc: file magic
-	./${PROG} -C -m magic
-
-magic.mime.mgc: file magic.mime
-	ln -sf ${SRCDIR}/magic.mime magic.mime.PITA
-	./${PROG} -C -m magic.mime.PITA
-	mv magic.mime.PITA.mgc magic.mime.mgc
-
 CLEANFILES+=	print-hacked.c
 print-hacked.c: print.c
 	sed -e 's|daylight|0/*daylight*/|g' ${.ALLSRC} > ${.TARGET}

 beforeinstall:
 	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${MAGICMODE} \
-	    magic magic.mgc ${SRCDIR}/magic.mime magic.mime.mgc \
-	    ${DESTDIR}${MAGICPATH}
+	    magic ${SRCDIR}/magic.mime ${DESTDIR}${MAGICPATH}
+	./file -C -m ${DESTDIR}${MAGICPATH}/magic
+	./file -C -m ${DESTDIR}${MAGICPATH}/magic.mime

 .include <bsd.prog.mk>
---

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010810235643.Y23367-100000>