Merge pull request #134638 from jkarlson/master
This commit is contained in:
commit
bbc0ff1ebb
3 changed files with 49 additions and 10 deletions
|
@ -5189,6 +5189,12 @@
|
|||
githubId = 9866621;
|
||||
name = "Jack";
|
||||
};
|
||||
jkarlson = {
|
||||
email = "jekarlson@gmail.com";
|
||||
github = "jkarlson";
|
||||
githubId = 1204734;
|
||||
name = "Emil Karlson";
|
||||
};
|
||||
jlesquembre = {
|
||||
email = "jl@lafuente.me";
|
||||
github = "jlesquembre";
|
||||
|
|
|
@ -1,27 +1,36 @@
|
|||
{ fetchurl, lib, stdenv, pkg-config, libxml2, llvm, perl }:
|
||||
{ callPackage, fetchurl, lib, stdenv, gtk3, pkg-config, libxml2, llvm, perl, sqlite }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
let
|
||||
GCC_BASE = "${stdenv.cc.cc}/lib/gcc/${stdenv.hostPlatform.uname.processor}-unknown-linux-gnu/${stdenv.cc.cc.version}";
|
||||
in stdenv.mkDerivation rec {
|
||||
pname = "sparse";
|
||||
version = "0.5.0";
|
||||
version = "0.6.3";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://kernel/software/devel/sparse/dist/${pname}-${version}.tar.xz";
|
||||
sha256 = "1mc86jc5xdrdmv17nqj2cam2yqygnj6ar1iqkwsx2y37ij8wy7wj";
|
||||
sha256 = "16d8c4dhipjzjf8z4z7pix1pdpqydz0v4r7i345f5s09hjnxpxnl";
|
||||
};
|
||||
|
||||
preConfigure = ''
|
||||
sed -i Makefile -e "s|^PREFIX=.*$|PREFIX=$out|g"
|
||||
sed -i 's|"/usr/include"|"${stdenv.cc.libc.dev}/include"|' pre-process.c
|
||||
sed -i 's|qx(\$ccom -print-file-name=)|"${GCC_BASE}"|' cgcc
|
||||
makeFlags+=" PREFIX=$out"
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
buildInputs = [ libxml2 llvm perl ];
|
||||
buildInputs = [ gtk3 libxml2 llvm perl sqlite ];
|
||||
doCheck = true;
|
||||
buildFlags = "GCC_BASE:=${GCC_BASE}";
|
||||
|
||||
meta = {
|
||||
passthru.tests = {
|
||||
simple-execution = callPackage ./tests.nix { };
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Semantic parser for C";
|
||||
homepage = "https://git.kernel.org/cgit/devel/sparse/sparse.git/";
|
||||
license = lib.licenses.mit;
|
||||
platforms = lib.platforms.linux;
|
||||
maintainers = [ lib.maintainers.thoughtpolice ];
|
||||
license = licenses.mit;
|
||||
platforms = platforms.linux;
|
||||
maintainers = with maintainers; [ thoughtpolice jkarlson ];
|
||||
};
|
||||
}
|
||||
|
|
24
pkgs/development/tools/analysis/sparse/tests.nix
Normal file
24
pkgs/development/tools/analysis/sparse/tests.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{ 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
|
||||
''
|
Loading…
Reference in a new issue