diff options
Diffstat (limited to 'pkgs/test')
-rw-r--r-- | pkgs/test/macos-sierra-shared/default.nix | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/pkgs/test/macos-sierra-shared/default.nix b/pkgs/test/macos-sierra-shared/default.nix new file mode 100644 index 0000000000000..8d7b9fc938420 --- /dev/null +++ b/pkgs/test/macos-sierra-shared/default.nix @@ -0,0 +1,43 @@ +{ lib, clangStdenv, clang-sierraHack-stdenv }: + +let + makeBigExe = stdenv: prefix: rec { + + sillyLibs = lib.genList (i: stdenv.mkDerivation rec { + name = "${prefix}-fluff-${toString i}"; + unpackPhase = '' + src=$PWD + echo 'int asdf${toString i}(void) { return ${toString i}; }' > ${name}.c + ''; + buildPhase = '' + $CC -shared ${name}.c -o lib${name}.dylib -Wl,-install_name,$out/lib/lib${name}.dylib + ''; + installPhase = '' + mkdir -p "$out/lib" + mv lib${name}.dylib "$out/lib" + ''; + }) 500 + ; + + finalExe = stdenv.mkDerivation rec { + name = "${prefix}-final-asdf"; + unpackPhase = '' + src=$PWD + echo 'int main(int argc, char **argv) { return argc; }' > main.c; + ''; + buildPhase = '' + $CC main.c ${toString (map (x: "-l${x.name}") sillyLibs)} -o asdf + ''; + buildInputs = sillyLibs; + installPhase = '' + mkdir -p "$out/bin" + mv asdf "$out/bin" + ''; + }; + + }; + +in { + good = makeBigExe clang-sierraHack-stdenv "good"; + bad = makeBigExe clangStdenv "bad"; +} |