diff --git a/pkgs/build-support/setup-hooks/flatten-include-hack/default.nix b/pkgs/build-support/setup-hooks/flatten-include-hack/default.nix new file mode 100644 index 000000000000..74bbf5673292 --- /dev/null +++ b/pkgs/build-support/setup-hooks/flatten-include-hack/default.nix @@ -0,0 +1,2 @@ +{ makeSetupHook }: +makeSetupHook { name = "flatten-include-hack-hook"; } ./flatten-include-hack-hook.sh diff --git a/pkgs/build-support/setup-hooks/flatten-include-hack/flatten-include-hack-hook.sh b/pkgs/build-support/setup-hooks/flatten-include-hack/flatten-include-hack-hook.sh new file mode 100644 index 000000000000..b860d4755648 --- /dev/null +++ b/pkgs/build-support/setup-hooks/flatten-include-hack/flatten-include-hack-hook.sh @@ -0,0 +1,16 @@ +# shellcheck shell=bash + +# This is a horrible hack. You should not use this. + +flattenIncludes() { + ( + cd "${!outputInclude}/include" || exit + for file in */*; do + target=$(basename "$file") + echo "[HACK] Symlinking include $file to flattened path $target..." + ln -s "$file" "$target" + done + ) +} + +preFixupHooks+=(flattenIncludes) diff --git a/pkgs/development/libraries/freetype/default.nix b/pkgs/development/libraries/freetype/default.nix index 1586ce27e69f..034ba4c33839 100644 --- a/pkgs/development/libraries/freetype/default.nix +++ b/pkgs/development/libraries/freetype/default.nix @@ -33,6 +33,7 @@ , texmacs , ttfautohint , testers +, __flattenIncludeHackHook }: @@ -48,7 +49,7 @@ stdenv.mkDerivation (finalAttrs: { propagatedBuildInputs = [ zlib bzip2 brotli libpng ]; # needed when linking against freetype # dependence on harfbuzz is looser than the reverse dependence - nativeBuildInputs = [ pkg-config which ] + nativeBuildInputs = [ pkg-config which __flattenIncludeHackHook ] ++ lib.optional (!stdenv.hostPlatform.isWindows) makeWrapper # FreeType requires GNU Make, which is not part of stdenv on FreeBSD. ++ lib.optional (!stdenv.hostPlatform.isLinux) gnumake; diff --git a/pkgs/development/libraries/pixman/default.nix b/pkgs/development/libraries/pixman/default.nix index b5bdcec35e56..0678539b79a3 100644 --- a/pkgs/development/libraries/pixman/default.nix +++ b/pkgs/development/libraries/pixman/default.nix @@ -18,6 +18,8 @@ , gitUpdater , testers + +, __flattenIncludeHackHook }: stdenv.mkDerivation (finalAttrs: { @@ -40,7 +42,7 @@ stdenv.mkDerivation (finalAttrs: { separateDebugInfo = !stdenv.hostPlatform.isStatic; - nativeBuildInputs = [ meson ninja pkg-config ]; + nativeBuildInputs = [ meson ninja pkg-config __flattenIncludeHackHook ]; buildInputs = [ libpng ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b26388f2ab9c..7f09c5329365 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -161,6 +161,8 @@ with pkgs; ### BUILD SUPPORT + __flattenIncludeHackHook = callPackage ../build-support/setup-hooks/flatten-include-hack { }; + autoreconfHook = callPackage ( { makeSetupHook, autoconf, automake, gettext, libtool }: makeSetupHook {