trofi / nix-guix-gentoo

Gentoo overlay for nix and guix functional package managers.
107 stars 9 forks source link

sys-apps/nix: econf fails when /bin/sh isn't bash #17

Closed 0n-s closed 2 years ago

0n-s commented 2 years ago

Nix's configure script contains bashisms, which means when /bin/sh isn't bash but instead a POSIX shell like dash, the src_configure step fails.

This can be fixed like this:

--- a/sys-apps/nix/nix-2.8.0.ebuild
+++ b/sys-apps/nix/nix-2.8.0.ebuild
@@ -118,7 +118,7 @@ src_configure() {
    # - don't disable implicitly: https://github.com/trofi/nix-guix-gentoo/issues/12
    export ac_cv_header_aws_s3_S3Client_h=$(usex s3)

-   econf \
+   CONFIG_SHELL="${BROOT}/bin/bash" econf \
        --localstatedir="${EPREFIX}"/nix/var \
        $(use_enable gc) \
        --with-sandbox-shell="${EPREFIX}"/usr/bin/busybox-nix-sandbox-shell

(same fix used in the gentoo overlay for e.g. app-containers/crun)

trofi commented 2 years ago

Yeah, it's a reasonable workaround. Let's see if it's a lot of work to make configure.ac more portable. Posting bits of error here for posterity:

...
checking for jq... /usr/bin/jq

dirname: invalid option -- 'p'
Try 'dirname --help' for more information.

checking for boostlib >= 1.66 (106600)... yes
checking whether -latomic is needed... no
checking for x86_64-pc-linux-gnu-pkg-config... /usr/bin/x86_64-pc-linux-gnu-pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for OPENSSL... yes
checking for LIBARCHIVE... yes
checking for SQLITE3... yes
checking for LIBCURL... yes
checking for EDITLINE... yes
checking for SODIUM... yes
checking for LIBBROTLI... yes
checking for LIBCPUID... yes
checking for LIBSECCOMP... yes
checking for aws/s3/S3Client.h... (cached) no
./configure: 7200: Syntax error: "(" unexpected (expecting "fi")
...
trofi commented 2 years ago

At a glance a few problems are:

AC_SUBST(coreutils, [$(dirname $(type -p cat))])

  declare $name="$(eval echo "${!name}")"

The porting change will probably be invasive and better done upstream first.

Do you want to send CONFIG_SHELL= fix as a pull request?

0n-s commented 2 years ago

Sure, here you go: https://github.com/trofi/nix-guix-gentoo/pull/18

0n-s commented 2 years ago

Seems to be fixed, at least from my testing (specifically with the live ebuild & 2.8.0).

trofi commented 2 years ago

Thank you!