summary refs log tree commit diff
path: root/pkgs/test/cc-wrapper/multilib.nix
blob: 5ea50b5eb268c800936ca150ca62f5dd72dd0bb3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{ stdenv }:

stdenv.mkDerivation {
  name = "cc-multilib-test";

  # XXX: "depend" on cc-wrapper test?

  # TODO: Have tests report pointer size or something; ensure they are what we asked for
  buildCommand = ''
    NIX_DEBUG=1 $CC -v
    NIX_DEBUG=1 $CXX -v

    printf "checking whether compiler builds valid C binaries... " >&2
    $CC -o cc-check ${./cc-main.c}
    ./cc-check

    printf "checking whether compiler builds valid 32bit C binaries... " >&2
    $CC -m32 -o c32-check ${./cc-main.c}
    ./c32-check

    printf "checking whether compiler builds valid 64bit C binaries... " >&2
    $CC -m64 -o c64-check ${./cc-main.c}
    ./c64-check

    printf "checking whether compiler builds valid 32bit C++ binaries... " >&2
    $CXX -m32 -o cxx32-check ${./cxx-main.cc}
    ./cxx32-check

    printf "checking whether compiler builds valid 64bit C++ binaries... " >&2
    $CXX -m64 -o cxx64-check ${./cxx-main.cc}
    ./cxx64-check

    touch $out
  '';

  meta.platforms = stdenv.lib.platforms.x86_64;
}