Merge pull request #153615 from alyssais/glib-static

netbsd: fixes for static Linux GLib
This commit is contained in:
John Ericson 2022-01-06 10:45:28 -08:00 committed by GitHub
commit ca53314dea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View file

@ -3,4 +3,3 @@ getHostRole
export NIX_LDFLAGS${role_post}+=" -lnbcompat"
export NIX_CFLAGS_COMPILE${role_post}+=" -DHAVE_NBTOOL_CONFIG_H"
export NIX_CFLAGS_COMPILE${role_post}+=" -include nbtool_config.h"

View file

@ -120,7 +120,17 @@ in lib.makeScopeWithSplicing
} // lib.optionalAttrs (attrs.headersOnly or false) {
installPhase = "includesPhase";
dontBuild = true;
} // attrs));
} // attrs // {
postPatch = lib.optionalString (!stdenv'.hostPlatform.isNetBSD) ''
# Files that use NetBSD-specific macros need to have nbtool_config.h
# included ahead of them on non-NetBSD platforms.
set +e
grep -Zlr "^__RCSID
^__BEGIN_DECLS" | xargs -0r grep -FLZ nbtool_config.h |
xargs -0tr sed -i '0,/^#/s//#include <nbtool_config.h>\n\0/'
set -e
'' + attrs.postPatch or "";
}));
##
## START BOOTSTRAPPING
@ -182,6 +192,12 @@ in lib.makeScopeWithSplicing
configurePlatforms = [ "build" "host" ];
configureFlags = [
"--cache-file=config.cache"
] ++ lib.optionals stdenv.hostPlatform.isMusl [
# We include this header in our musl package only for legacy
# compatibility, and compat works fine without it (and having it
# know about sys/cdefs.h breaks packages like glib when built
# statically).
"ac_cv_header_sys_cdefs_h=no"
];
nativeBuildInputs = with buildPackages.netbsd; commonDeps ++ [