Commit 6a6c4961 authored by John Ericson's avatar John Ericson
Browse files

bash: Fix FreeBSD cross build

See code comment for details on this hacky fix.
parent a3c97b5a
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -73,6 +73,22 @@ lib.warnIf (withDocs != null)
    + ''
      -DNON_INTERACTIVE_LOGIN_SHELLS
      -DSSH_SOURCE_BASHRC
    ''
    # Bash's configure script assumes that CC and CC_FOR_BUILD have the
    # same default -std=... flags. But at this moment, for FreeBSD, we
    # have CC_FOR_BUILD that defaults to c23, and a CC that default to
    # something older, perhaps c17. This breaks the build because of
    # bash's faulty assumptions.
    #
    # To fix, we simply force the standard to be the higher for CC to
    # match CC_FOR_BUILD.
    #
    # Once FreeBSD is built with a newer version of Clang, this hack
    # should be removed.
    +
      lib.optionalString (stdenv.hostPlatform.isFreeBSD && stdenv.hostPlatform != stdenv.buildPlatform)
        ''
          -std=c23
        '';

    patchFlags = [ "-p0" ];