tech-pkg archive

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

ocaml, dune, environment, PKG_CONFIG in the environment



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.

1) Looking at lang/ocaml/ocaml.mk, I notice that the build envrironment is
not set in one of the do-build overrides, and that seems like a bug.  So
I am inclined to commit the following as an "obvious bugfix".  Comments?
  Index: ocaml.mk
  ===================================================================
  RCS file: /cvsroot/pkgsrc/lang/ocaml/ocaml.mk,v
  retrieving revision 1.2
  diff -u -p -U 10 -r1.2 ocaml.mk
  --- ocaml.mk	9 Apr 2023 07:28:27 -0000	1.2
  +++ ocaml.mk	24 Nov 2024 14:36:05 -0000
  @@ -234,20 +234,21 @@ do-install:

   do-build:
   .  if !empty(DUNE_BUILD_PACKAGES)
          ${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}
   .  else
          ${RUN} ${_ULIMIT_CMD} \
  -		cd ${WRKSRC} && dune build --profile release -j ${MAKE_JOBS:U1} \
  +		cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
  +		dune build --profile release -j ${MAKE_JOBS:U1} \
                  ${DUNE_BUILD_FLAGS} ${DUNE_BUILD_TARGETS}
   .  endif

   .endif # ${OCAML_USE_DUNE} == "yes"

   # Add dependency on ocaml.
   .include "../../lang/ocaml/buildlink3.mk"

   .endif # OCAML_MK

2) My kludge is

  # 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}

and I am more or less inclined to just put that into ocaml.mk, on the
theory that this is a dune bug, not a lablgkt3 bug.  By "put that" I
mean adding

  ${SETENV} -u PKG_CONFIG

so that the only difference is removing that env var.

Comments/objections?

Other theories about why this is breaking?
Anyone wishing to dig in for a 'real fix' instead of doing this?


Home | Main Index | Thread Index | Old Index