mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-15 18:23:09 +00:00
883874f513
Added sqlite and gtk+3 that are now wanted by sparse. Sparse expects to find system includes at /usr/include redirect this to glibc.dev. Sparse uses gcc -print-file-name= extensively to find gcc includes, due to split in nixos this direct to gcc-lib, which does not include the headers so redirect to GCC_BASE as defined in derivation. There might be a better way to do this, but I did not immediately find one. Define PREFIX as Make parameter, as old sed expression was broken. Add a trivial test for cgcc. Slightly irrelevant ref. https://bugzilla.redhat.com/show_bug.cgi?id=1114755
25 lines
508 B
Nix
25 lines
508 B
Nix
{ runCommand, gcc, sparse, writeText }:
|
|
let
|
|
src = writeText "CODE.c" ''
|
|
#include <stdio.h>
|
|
#include <stddef.h>
|
|
#include <stdlib.h>
|
|
|
|
int main(int argc, char *argv[]) {
|
|
return EXIT_SUCCESS;
|
|
}
|
|
'';
|
|
in
|
|
runCommand "${sparse.pname}-tests" { buildInputs = [ gcc sparse ]; meta.timeout = 3; }
|
|
''
|
|
set -eu
|
|
${sparse}/bin/cgcc ${src} > output 2>&1 || ret=$?
|
|
if [[ -z $(<output) ]]; then
|
|
mv output $out
|
|
else
|
|
echo "Test build returned $ret"
|
|
cat output
|
|
exit 1
|
|
fi
|
|
''
|