Re: [workaroud/fix for] buildworld fails on FreeBSD 7.x for HEAD from 19.04.2012

2012-04-27 Thread Jan Sieka

On 2012.04.22 21:07, Garrett Cooper wrote:

On Apr 22, 2012, at 10:34 AM, Dimitry Andric wrote:


Well, I wouldn't want to run autoconf during build, firstly because it
is horribly slow, and second because the results will be less
predictable.  Maybe during the bootstrap stage, it would be acceptable.


Sure -- that seems reasonable.


But even then, one of the configure scripts could fail due to too-old
system components, and you would be SOL.


… but it would be a step forward from where things are currently at. I'm not sure how 
well tested "source upgrade" paths are, but being able to upgrade from the 
lowest supported version to the latest supported version, then upgrading to CURRENT (at 
the very least) would be nice.


Usually, if something is arch-dependent in a config.h file, we simply
surround it with #ifdefs.


Makes sense (assumption being that it can be controlled via the 
config.h/configure.{ac,in} file). However, jemalloc recently disproved this>_<.


Apparently the file(1) build needs a 'mkmagic' tool, which generates
.mgc files (the 'compiled' version of magic files).  This requirement
was originally added in r81845, more than 10 years ago.


I tested out removing libmagic from Makefile.inc1 and see that there's some 
dependency magic going on there where building the library failed.


Yes, it might work, but there is no guarantee.  I'm not sure if there is
enough incentive to change this policy.  It would potentially require a
lot effort to make it always work.


Understood and I guess the ownness is upon the stakeholders to fix this, but 
there are a lot of companies that depend on things like this working (at least 
to reduce pain when doing source upgrades). This would probably be less of an 
issue for developers that use freebsd-update or for companies that roll their 
own freebsd-update (and servers). I have yet to run into a company that does 
this though (not saying there aren't groups that could or do do this, but it's 
not the standard path).


I wasn't aware of any chroot hackery?


A publicly available example is available in FreeNAS ( 
http://freenas.svn.sourceforge.net/viewvc/freenas?view=revision&revision=8193 
); the hangup is building packages for a target system that doesn't match the build 
host.

Cheers!
-Garrett

Hello!

I have prepared workaround/fix for this issue. It has been tested on FreeBSD 7.3 
and 9.0 (both RELEASE) with good results: world build finishes OK. I attach the 
patch in case someone else is hit by this issue. Feel free to use it.


Thanks for all suggestions and comments.

Regards,

Jan Sieka

diff --git a/lib/libmagic/Makefile b/lib/libmagic/Makefile
index 9c35c35..e9b8240 100644
--- a/lib/libmagic/Makefile
+++ b/lib/libmagic/Makefile
@@ -10,9 +10,16 @@ DPADD=   ${LIBZ}
 LDADD= -lz
 MAN=   libmagic.3 magic.5
 
+HOSTOSRELDATE!=echo ${VERSION} | cut -d " " -f 4
+
+.if ${HOSTOSRELDATE} < 80
+GETLINE_C= getline.c
+.else
+GETLINE_C=
+.endif
 SRCS=  apprentice.c apptype.c ascmagic.c cdf.c cdf_time.c compress.c \
encoding.c fsmagic.c funcs.c \
-   is_tar.c magic.c print.c readcdf.c readelf.c softmagic.c
+   is_tar.c magic.c print.c readcdf.c readelf.c softmagic.c ${GETLINE_C}
 INCS=  magic.h
 
 MAGICPATH?=/usr/share/misc
@@ -39,7 +46,8 @@ magic.mgc: mkmagic magic
 
 CLEANFILES+=   mkmagic
 build-tools: mkmagic
-mkmagic: apprentice.c funcs.c magic.c print.c
+
+mkmagic: apprentice.c funcs.c magic.c print.c ${GETLINE_C}
${CC} ${CFLAGS} -DCOMPILE_ONLY ${LDFLAGS} -o ${.TARGET} ${.ALLSRC}
 
 FILEVER!= awk '$$1 == "\#define" && $$2 == "VERSION" { print $$3; exit }' \
diff --git a/lib/libmagic/config.h b/lib/libmagic/config.h
index 06ed4ec..3fe103e 100644
--- a/lib/libmagic/config.h
+++ b/lib/libmagic/config.h
@@ -39,7 +39,11 @@
 #define HAVE_FSEEKO 1
 
 /* Define to 1 if you have the `getline' function. */
-#define HAVE_GETLINE 1
+#if (__FreeBSD_version >= 80)
+#defineHAVE_GETLINE 1
+#else
+#defineHAVE_GETLINE 0
+#endif
 
 /* Define to 1 if you have the  header file. */
 #define HAVE_GETOPT_H 1
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Re: [workaroud/fix for] buildworld fails on FreeBSD 7.x for HEAD from 19.04.2012

2012-04-27 Thread David O'Brien
On Fri, Apr 27, 2012 at 02:05:37PM +0200, Jan Sieka wrote:
> --- a/lib/libmagic/Makefile
> +++ b/lib/libmagic/Makefile
> @@ -10,9 +10,16 @@ DPADD= ${LIBZ}
>  LDADD=   -lz
>  MAN= libmagic.3 magic.5
>  
> +HOSTOSRELDATE!=  echo ${VERSION} | cut -d " " -f 4

$ cd lib/libmagic
$ make -V VERSION
{empty}

Where is VERSION set?


> +.if ${HOSTOSRELDATE} < 80
> +GETLINE_C=   getline.c
> +.else
> +GETLINE_C=
> +.endif
>  SRCS=apprentice.c apptype.c ascmagic.c cdf.c cdf_time.c compress.c \
>   encoding.c fsmagic.c funcs.c \
> - is_tar.c magic.c print.c readcdf.c readelf.c softmagic.c
> + is_tar.c magic.c print.c readcdf.c readelf.c softmagic.c ${GETLINE_C}

Just 
.if ${HOSTOSRELDATE} < 80
GETLINE_C=  getline.c
.endif
is shorter.

Also r189136 (which added getline(3)) bumped __FreeBSD_version from
800066 to 800067.  So your patch is broken for some systems.  Getting
this right is one reason I'm loath to carry around this type of hack
in -CURRENT.


> --- a/lib/libmagic/config.h
> +++ b/lib/libmagic/config.h
>  /* Define to 1 if you have the `getline' function. */
> -#define HAVE_GETLINE 1
> +#if (__FreeBSD_version >= 80)

Where is "__FreeBSD_version" getting set?

> +#else
> +#define  HAVE_GETLINE 0
> +#endif

You've basically defined HAVE_GETLINE always as "0".

-- 
-- David  (obr...@freebsd.org)
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"