uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
7
pkgs/test/cc-wrapper/cc-main.c
Normal file
7
pkgs/test/cc-wrapper/cc-main.c
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
fprintf(stderr, "ok\n");
|
||||
return 0;
|
||||
}
|
||||
10
pkgs/test/cc-wrapper/cflags-main.c
Normal file
10
pkgs/test/cc-wrapper/cflags-main.c
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#include <stdio.h>
|
||||
#include <foo.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (foo() != 42)
|
||||
return 1;
|
||||
fprintf(stderr, "ok\n");
|
||||
return 0;
|
||||
}
|
||||
7
pkgs/test/cc-wrapper/core-foundation-main.c
Normal file
7
pkgs/test/cc-wrapper/core-foundation-main.c
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
CFShow(CFSTR("ok"));
|
||||
return 0;
|
||||
}
|
||||
7
pkgs/test/cc-wrapper/cxx-main.cc
Normal file
7
pkgs/test/cc-wrapper/cxx-main.cc
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#include <iostream>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
std::cerr << "ok" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
80
pkgs/test/cc-wrapper/default.nix
Normal file
80
pkgs/test/cc-wrapper/default.nix
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
{ lib, stdenv, glibc }:
|
||||
|
||||
let
|
||||
# Sanitizers are not supported on Darwin.
|
||||
# Sanitizer headers aren't available in older libc++ stdenvs due to a bug
|
||||
sanitizersWorking = !stdenv.hostPlatform.isMusl && (
|
||||
(stdenv.cc.isClang && lib.versionAtLeast (lib.getVersion stdenv.cc.name) "5.0.0")
|
||||
|| (stdenv.cc.isGNU && stdenv.isLinux)
|
||||
);
|
||||
staticLibc = lib.optionalString (stdenv.hostPlatform.libc == "glibc") "-L ${glibc.static}/lib";
|
||||
in stdenv.mkDerivation {
|
||||
name = "cc-wrapper-test";
|
||||
|
||||
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 C++ binaries... " >&2
|
||||
$CXX -o cxx-check ${./cxx-main.cc}
|
||||
./cxx-check
|
||||
|
||||
${lib.optionalString (stdenv.isDarwin && stdenv.cc.isClang) ''
|
||||
printf "checking whether compiler can build with CoreFoundation.framework... " >&2
|
||||
mkdir -p foo/lib
|
||||
$CC -framework CoreFoundation -o core-foundation-check ${./core-foundation-main.c}
|
||||
./core-foundation-check
|
||||
''}
|
||||
|
||||
|
||||
${lib.optionalString (!stdenv.isDarwin) ''
|
||||
printf "checking whether compiler builds valid static C binaries... " >&2
|
||||
$CC ${staticLibc} -static -o cc-static ${./cc-main.c}
|
||||
./cc-static
|
||||
${lib.optionalString (stdenv.cc.isGNU && lib.versionAtLeast (lib.getVersion stdenv.cc.name) "8.0.0") ''
|
||||
printf "checking whether compiler builds valid static pie C binaries... " >&2
|
||||
$CC ${staticLibc} -static-pie -o cc-static-pie ${./cc-main.c}
|
||||
./cc-static-pie
|
||||
''}
|
||||
''}
|
||||
|
||||
printf "checking whether compiler uses NIX_CFLAGS_COMPILE... " >&2
|
||||
mkdir -p foo/include
|
||||
cp ${./foo.c} foo/include/foo.h
|
||||
NIX_CFLAGS_COMPILE="-Ifoo/include -DVALUE=42" $CC -o cflags-check ${./cflags-main.c}
|
||||
./cflags-check
|
||||
|
||||
printf "checking whether compiler uses NIX_LDFLAGS... " >&2
|
||||
mkdir -p foo/lib
|
||||
$CC -shared \
|
||||
${lib.optionalString stdenv.isDarwin "-Wl,-install_name,@rpath/libfoo.dylib"} \
|
||||
-DVALUE=42 \
|
||||
-o foo/lib/libfoo${stdenv.hostPlatform.extensions.sharedLibrary} \
|
||||
${./foo.c}
|
||||
|
||||
NIX_LDFLAGS="-L$NIX_BUILD_TOP/foo/lib -rpath $NIX_BUILD_TOP/foo/lib" $CC -lfoo -o ldflags-check ${./ldflags-main.c}
|
||||
./ldflags-check
|
||||
|
||||
printf "Check whether -nostdinc and -nostdinc++ is handled correctly" >&2
|
||||
mkdir -p std-include
|
||||
cp ${./stdio.h} std-include/stdio.h
|
||||
NIX_DEBUG=1 $CC -I std-include -nostdinc -o nostdinc-main ${./nostdinc-main.c}
|
||||
./nostdinc-main
|
||||
$CXX -I std-include -nostdinc++ -o nostdinc-main++ ${./nostdinc-main.c}
|
||||
./nostdinc-main++
|
||||
|
||||
${lib.optionalString sanitizersWorking ''
|
||||
printf "checking whether sanitizers are fully functional... ">&2
|
||||
$CC -o sanitizers -fsanitize=address,undefined ${./sanitizers.c}
|
||||
./sanitizers
|
||||
''}
|
||||
|
||||
touch $out
|
||||
'';
|
||||
|
||||
meta.platforms = lib.platforms.all;
|
||||
}
|
||||
4
pkgs/test/cc-wrapper/foo.c
Normal file
4
pkgs/test/cc-wrapper/foo.c
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
unsigned int foo(void)
|
||||
{
|
||||
return VALUE;
|
||||
}
|
||||
12
pkgs/test/cc-wrapper/ldflags-main.c
Normal file
12
pkgs/test/cc-wrapper/ldflags-main.c
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#include <stdio.h>
|
||||
|
||||
extern unsigned int foo(void);
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (foo() != 42) {
|
||||
return 1;
|
||||
}
|
||||
fprintf(stderr, "ok\n");
|
||||
return 0;
|
||||
}
|
||||
37
pkgs/test/cc-wrapper/multilib.nix
Normal file
37
pkgs/test/cc-wrapper/multilib.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{ lib, 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 = lib.platforms.x86_64;
|
||||
}
|
||||
8
pkgs/test/cc-wrapper/nostdinc-main.c
Normal file
8
pkgs/test/cc-wrapper/nostdinc-main.c
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// This one should not come from libc because of -nostdinc
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
// provided by our own stdio.h
|
||||
foo();
|
||||
return 0;
|
||||
}
|
||||
8
pkgs/test/cc-wrapper/sanitizers.c
Normal file
8
pkgs/test/cc-wrapper/sanitizers.c
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#include <sanitizer/asan_interface.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
fprintf(stderr, "ok\n");
|
||||
return 0;
|
||||
}
|
||||
1
pkgs/test/cc-wrapper/stdio.h
Normal file
1
pkgs/test/cc-wrapper/stdio.h
Normal file
|
|
@ -0,0 +1 @@
|
|||
static void foo(void) {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue