tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lang/guile30 violates basic pkgsrc mechanisms to work around an ancient bug

So once some very long time ago it was effectively decided that pkgsrc
would pass "--host=$(uname -p)--netbsd" on the "configure" command line
for packages using GNU configure.

It was effectively this change, though in simpler terms that's only a
side-effect of this change since before this the option was just
"--host=$(uname -p)-netbsd", i.e. without any vendor part at all:

    Index: mk/
    revision 1.85
    date: 1998-05-23 08:42:59 -0700;  author: tv;  state: Exp;  lines: +2 -2;
    Fix --host= rule to use a three part architecture, and fix GNU pkgs to use
    the new automatic --host= setting.  Now all GNU pkgs should work on all
    archs (including arm32), except emacs/xemacs, which I'll fix soon.

I privately questioned this at the time (i.e. the choice of an empty
string for the vendor name instead of the traditional default of
"unknown"), but I hadn't really thought much about it for quite some
time now.

Now in guile30 the interpreter bootstrap code checks the target system
type, as set by the configure script, with the following function:

(define (validate-target target)
  (if (or (not (string? target))
          (let ((parts (string-split target #\-)))
            (or (< (length parts) 3)
                (or-map string-null? parts))))
      (error "invalid target" target)))

So, clearly the target string must have three hyphen-separated parts,
and none of them can be null strings!  Though it's not as clearly
documented as one might like, this is how I would read the specification
for the values of '--host' et al:

Indeed my first attempt to build guile30 on a NetBSD/amd64 system ended
up with that "invalid target" error showing up.

I think it may be because my first attempt failed due to my use of
autoswc, which encodes (and indeed overrides) the '--host' (and
'--build') options to configure with its CONFIG_SITE value.

If that's true, then whomever introduced the idea of pretending that
guile's configure script isn't actually a GNU Configure script did not
understand the original problem at all.

They simply relied on the default ability of "config.guess" and/or
"config.sub" to figure out the host and target platforms on its own when
no '--host' and '--build' options are given, and that's a rather poor
and fragile hack, especially given pkgsrc should normally provide all
the proper details, especially to support cross-compilation (with
'--target', something of quite some importance for the likes of Guile).

Anyway, once I discovered the actual problem I was already way down the
rabbit hole and wanted to get rid of this bogus hack in the pkgsrc

So, to make guile30 actually build and work without the hack I've done
the following, and coincidentally this also now works with a
(reinstalled) autoswc cache too:

Index: mk/
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/mk/,v
retrieving revision 1.416
diff -u -u -r1.416
---	18 Jan 2022 01:41:09 -0000	1.416
+++	12 Apr 2022 17:36:34 -0000
@@ -172,7 +172,6 @@

 .elif ${OPSYS} == "Bitrig"
 LOWER_OPSYS?= 		bitrig
-LOWER_VENDOR?= 		unknown

 .elif ${OPSYS} == "Cygwin"
 LOWER_OPSYS?=		cygwin
@@ -200,7 +199,6 @@
 .  if ${MACHINE_ARCH} == "i386"
 .  endif
-LOWER_VENDOR?=		unknown

 .elif ${OPSYS} == "Haiku"
 LOWER_OPSYS?=		haiku
@@ -227,7 +225,6 @@
 .elif ${OPSYS} == "MirBSD"
 LOWER_OPSYS?=		mirbsd
-LOWER_VENDOR?=		unknown

 .elif !empty(OPSYS:MIRIX*)
 LOWER_OPSYS?=		irix
@@ -255,7 +252,6 @@
 .  elif ${MACHINE_ARCH} == "i386"
 LOWER_VENDOR?=          pc
 .  endif
-LOWER_VENDOR?=          unknown
 .  if ${OS_VARIANT} != "Microsoft"
@@ -313,11 +309,9 @@
 .elif ${OPSYS} == "UnixWare"
-LOWER_VENDOR?=		unknown

 .elif ${OPSYS} == "Minix"
-LOWER_VENDOR?=		unknown

 .elif !defined(LOWER_OPSYS)
@@ -329,7 +323,7 @@


-LOWER_VENDOR?=			# empty ("arch--opsys")
+LOWER_VENDOR?=			unknown


And this of course undoes the hack in lang/guile30:

Index: lang/guile30/Makefile
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/lang/guile30/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- lang/guile30/Makefile	15 Mar 2022 10:10:19 -0000	1.3
+++ lang/guile30/Makefile	12 Apr 2022 18:19:52 -0000
@@ -14,9 +14,11 @@
 GUILE_SUBDIR=	guile/3.0
 #GUILE_SUBDIR=	# empty

-# guile does not like the --build and --host triplets on NetBSD
+# XXX guile does not like the _OLD_ style --build and --host triplets on NetBSD
+# i.e. the "$arch--netbsd" form -- it requires a non-NULL word in the middle!
 # Needed to work around broken configure check for accept4()
 LDFLAGS.SunOS+=		-lsocket -lnsl
@@ -25,15 +27,9 @@
 .if !empty(GUILE_SUBDIR)
 # Installation prefix is non-default.
-CONFIGURE_ARGS+=		--infodir=${GUILE_PREFIX:Q}/info


As a side note I had to restart some of my build attempts once or even
more than once due to a "parked" guile process during the build!

					Greg A. Woods <>

Kelowna, BC     +1 250 762-7675           RoboHack <>
Planix, Inc. <>     Avoncote Farms <>

Attachment: pgpAKMrccU_cg.pgp
Description: OpenPGP Digital Signature

Home | Main Index | Thread Index | Old Index