tech-pkg archive

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

Re: ocaml, dune, environment, PKG_CONFIG in the environment



David Holland <dholland-pkgtech%netbsd.org@localhost> writes:

> On Sun, Nov 24, 2024 at 09:42:04AM -0500, Greg Troxel wrote:
>  > I just committed a kludge to ocaml-lablgtk3 that lets it build.
>  > Essentially, dune seems to choke if PKG_CONFIG is defined in the
>  > environment.  That's probably a dune bug to be fixed, but for now
>  > avoiding that seems to build a working package.
>
> I can't replicate the problem. What are the symptoms? What is
> PKG_CONFIG being passed as? If you unset it, dune uses "pkg-config",
> which is fine for pkgsrc. But it seems like for it to be failing we
> must be passing something wrong, and we shouldn't do that.

I think we're going with Taylor's patch, but this is my rototill of the
"undef PKG_CONFIG" approach to avoid duplicate do-build targets.  Which
I was about to say we should commit until I got 15s into Taylor's
message.

Index: lang/ocaml/ocaml.mk
===================================================================
RCS file: /cvsroot/pkgsrc/lang/ocaml/ocaml.mk,v
retrieving revision 1.3
diff -u -p -r1.3 ocaml.mk
--- lang/ocaml/ocaml.mk	30 Nov 2024 00:32:16 -0000	1.3
+++ lang/ocaml/ocaml.mk	30 Nov 2024 00:48:21 -0000
@@ -232,13 +232,27 @@ do-install:
 #
 .if ${OCAML_USE_DUNE} == "yes"
 
+# DUNE_HIDE_PKG_CONFIG is a terrible kludge to omit PKG_CONFIG from
+# the environment so that a presumably buggy dune will not fail by
+# having PKG_CONFIG set to the wrapper.  It is not documented as a
+# package-settable variable because it is temporary.
+
 do-build:
 .  if !empty(DUNE_BUILD_PACKAGES)
+.    if !empty(DUNE_HIDE_PKG_CONFIG)
+	# KLUDGE: hide PKG_CONFIG
+	${RUN} ${_ULIMIT_CMD} \
+		cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${SETENV} -u PKG_CONFIG \
+		dune build -j ${MAKE_JOBS:U1} \
+		${DUNE_BUILD_FLAGS} -p ${DUNE_BUILD_PACKAGES:ts,} \
+		${DUNE_BUILD_TARGETS}
+.    else
 	${RUN} ${_ULIMIT_CMD} \
 		cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
 		dune build -j ${MAKE_JOBS:U1} \
 		${DUNE_BUILD_FLAGS} -p ${DUNE_BUILD_PACKAGES:ts,} \
 		${DUNE_BUILD_TARGETS}
+.    endif
 .  else
 	${RUN} ${_ULIMIT_CMD} \
 		cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
Index: x11/ocaml-lablgtk3/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/x11/ocaml-lablgtk3/Makefile,v
retrieving revision 1.36
diff -u -p -r1.36 Makefile
--- x11/ocaml-lablgtk3/Makefile	25 Nov 2024 20:37:17 -0000	1.36
+++ x11/ocaml-lablgtk3/Makefile	30 Nov 2024 00:48:21 -0000
@@ -42,14 +42,8 @@ no-pkgconfig-wrapper:
 	${CP} ${PREFIX}/bin/pkg-config ${WRKDIR}/.tools/bin/pkg-config
 
 # This is a huge hack, to undefine PKG_CONFIG in the environment,
-# which apparently breaks dune's searching for pkg-config.  Copied
-# from ocaml/ocaml.mk, to where it should perhaps be hoisted.
-do-build:
-	${RUN} ${_ULIMIT_CMD} \
-		cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${SETENV} -u PKG_CONFIG \
-		dune build -j ${MAKE_JOBS:U1} \
-		${DUNE_BUILD_FLAGS} -p ${DUNE_BUILD_PACKAGES:ts,} \
-		${DUNE_BUILD_TARGETS}
+# which apparently breaks dune's searching for pkg-config.
+DUNE_HIDE_PKG_CONFIG=	yes
 
 ## END DUNE/PKG-CONFIG KLUDGES
 


Home | Main Index | Thread Index | Old Index