Is the default configure phase only for autotools configure script?

The documentation for the configuration phase makes it look like any configure script can be run, and this can be customized with configureScript (which can be a command), configureFlags/configureFlagsArray, dontAddPrefix, prefixKey, prefix, etc, without overriding configurePhase.

This is supposed to be the proper way to write derivations as I understand, minimize overriding phases and use variables and hooks:

configureScript = "./configure.sh";
configureFlags = [ "--install-prefix" "${placeholder "out"}" ];  # etc
dontAddPrefix = true;

outputs = [ "bin", "out", "dev" ];

But as soon as multiple outputs are set, the multiple-outputs.sh pre-configuration hook will run and forcefully set a bunch of configuration flags that will break any custom script that fails when unsupported flags are passed:

    configureFlags="\
        --bindir=${!outputBin}/bin --sbindir=${!outputBin}/sbin \
        --includedir=${!outputInclude}/include --oldincludedir=${!outputInclude}/include \
        --mandir=${!outputMan}/share/man --infodir=${!outputInfo}/share/info \
        --docdir=${!outputDoc}/share/doc/${shareDocName} \
        --libdir=${!outputLib}/lib --libexecdir=${!outputLib}/libexec \
        --localedir=${!outputLib}/share/locale \
        $configureFlags"

    installFlags="\
        pkgconfigdir=${!outputDev}/lib/pkgconfig \
        m4datadir=${!outputDev}/share/aclocal aclocaldir=${!outputDev}/share/aclocal \
        $installFlags"

And then we are forced to override the configurePhase:

configurePhase = ''
  runHook preConfigure
  ./configure.sh --install-prefix $out  # etc
  runHook postConfigure
'';

outputs = [ "bin", "out", "dev" ];

So, it looks like only autotools-generated configure scripts are fully supported by the configure phase.

You can pass setOutputFlags = false to disable the flags from multiple-outputs.sh:

2 Likes