Date: Fri, 10 Aug 2001 17:37:51 +0300 From: Ruslan Ermilov <ru@FreeBSD.ORG> To: Bruce Evans <bde@zeta.org.au> 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: <20010810173751.B60193@sunbay.com> In-Reply-To: <20010810235643.Y23367-100000@besplex.bde.org>; from bde@zeta.org.au on Sat, Aug 11, 2001 at 12:17:24AM %2B1000 References: <20010810110151.B7988@sunbay.com> <20010810235643.Y23367-100000@besplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Aug 11, 2001 at 12:17:24AM +1000, Bruce Evans wrote:
> 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 can't believe I hear that from you, Bruce. :-)
Generation at install time is a damn bad idea, please see below.
[...]
> > 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>
> ---
1. This won't work for cross-platform installworld, since ./file
is targetted for a different platform. (My version builds the
xfile build-tool for the build platform and compiles .mgc files
in ${.OBJDIR}.)
2. .mgc files get wrong ownership and file modes. (My version
installs them with correct ownership and modes.)
3. usr.bin/file still needs to be bootstrapped, because -C is a
new option. (My version doesn't need bootstrapping file,
because it is only used as a `build-tool'.)
Cheers,
--
Ruslan Ermilov Oracle Developer/DBA,
ru@sunbay.com Sunbay Software AG,
ru@FreeBSD.org FreeBSD committer,
+380.652.512.251 Simferopol, Ukraine
http://www.FreeBSD.org The Power To Serve
http://www.oracle.com Enabling The Information Age
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?20010810173751.B60193>
