1{ lib, stdenv }:
2
3stdenv.mkDerivation {
4 name = "cc-multilib-test";
5
6 # XXX: "depend" on cc-wrapper test?
7
8 # TODO: Have tests report pointer size or something; ensure they are what we asked for
9 buildCommand = ''
10 NIX_DEBUG=1 $CC -v
11 NIX_DEBUG=1 $CXX -v
12
13 printf "checking whether compiler builds valid C binaries...\n " >&2
14 $CC -o cc-check ${./cc-main.c}
15 ./cc-check
16
17 printf "checking whether compiler builds valid 32bit C binaries...\n " >&2
18 $CC -m32 -o c32-check ${./cc-main.c}
19 ./c32-check
20
21 printf "checking whether compiler builds valid 64bit C binaries...\n " >&2
22 $CC -m64 -o c64-check ${./cc-main.c}
23 ./c64-check
24
25 printf "checking whether compiler builds valid 32bit C++ binaries...\n " >&2
26 $CXX -m32 -o cxx32-check ${./cxx-main.cc}
27 ./cxx32-check
28
29 printf "checking whether compiler builds valid 64bit C++ binaries...\n " >&2
30 $CXX -m64 -o cxx64-check ${./cxx-main.cc}
31 ./cxx64-check
32
33 touch $out
34 '';
35
36 meta.platforms = lib.platforms.x86_64;
37}