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/bsd.pkg.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:

    https://www.gnu.org/software/autoconf/manual/autoconf-2.70/html_node/System-Type.html

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
module.

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/bsd.prefs.mk
===================================================================
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/mk/bsd.prefs.mk,v
retrieving revision 1.416
diff -u -u -r1.416 bsd.prefs.mk
--- bsd.prefs.mk	18 Jan 2022 01:41:09 -0000	1.416
+++ bsd.prefs.mk	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"
 LOWER_VENDOR?=		pc
 .  endif
-LOWER_VENDOR?=		unknown

 .elif ${OPSYS} == "Haiku"
 LOWER_OPSYS?=		haiku
@@ -227,7 +225,6 @@
 .elif ${OPSYS} == "MirBSD"
 LOWER_OPSYS?=		mirbsd
 LOWER_OPSYS_VERSUFFIX=	${OS_VERSION}
-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
 OS_VARIANT!=		${UNAME} -r
 OS_VARIANT:=		${OS_VARIANT:C/^.*-//}
 .  if ${OS_VARIANT} != "Microsoft"
@@ -313,11 +309,9 @@
 .elif ${OPSYS} == "UnixWare"
 SCO_RELEASE?=		sysv5${OPSYS}
 SCO_VERSION!=		${UNAME} -v
-LOWER_VENDOR?=		unknown
 LOWER_OPSYS_VERSUFFIX=	${SCO_RELEASE}${SCO_VERSION}

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

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

 MAKEFLAGS+=		LOWER_OPSYS=${LOWER_OPSYS:Q}

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

 NATIVE_MACHINE_ARCH:=		${MACHINE_ARCH}
 NATIVE_MACHINE_PLATFORM?=	${OPSYS}-${OS_VERSION}-${NATIVE_MACHINE_ARCH}


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
-HAS_CONFIGURE=		yes
-CONFIGURE_ARGS+=	SHELL=${CONFIG_SHELL}
+# 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!
+#
+GNU_CONFIGURE=		yes
+CONFIGURE_ENV+=		SHELL=${CONFIG_SHELL}
 # Needed to work around broken configure check for accept4()
 LDFLAGS.SunOS+=		-lsocket -lnsl
 MAKE_ENV+=		PAXCTL=echo
@@ -25,15 +27,9 @@
 .if !empty(GUILE_SUBDIR)
 # Installation prefix is non-default.
 GUILE_PREFIX=			${PREFIX}/${GUILE_SUBDIR}
-CONFIGURE_ARGS+=		--prefix=${GUILE_PREFIX:Q}
-CONFIGURE_ARGS+=		--infodir=${GUILE_PREFIX:Q}/info
-CONFIGURE_ARGS+=		--mandir=${GUILE_PREFIX:Q}/man
+GNU_CONFIGURE_PREFIX=		${GUILE_PREFIX}
 BUILDLINK_PASSTHRU_DIRS+=	${GUILE_PREFIX}
 LDFLAGS+=			${COMPILER_RPATH_FLAG}${GUILE_PREFIX}/lib
-.else
-CONFIGURE_ARGS+=		--prefix=${PREFIX}
-CONFIGURE_ARGS+=		--infodir=${PREFIX}/${PKGINFODIR}
-CONFIGURE_ARGS+=		--mandir=${PREFIX}/${PKGMANDIR}
 .endif

 INFO_FILES=		yes



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 <gwoods%acm.org@localhost>

Kelowna, BC     +1 250 762-7675           RoboHack <woods%robohack.ca@localhost>
Planix, Inc. <woods%planix.com@localhost>     Avoncote Farms <woods%avoncote.ca@localhost>

Attachment: pgpAKMrccU_cg.pgp
Description: OpenPGP Digital Signature



Home | Main Index | Thread Index | Old Index