diff --git a/pkgs/by-name/an/analyze-build/package.nix b/pkgs/by-name/an/analyze-build/package.nix new file mode 100644 index 000000000000..7d4ec5845407 --- /dev/null +++ b/pkgs/by-name/an/analyze-build/package.nix @@ -0,0 +1,46 @@ +{ + lib, + llvmPackages, + python3, +}: +let + inherit (llvmPackages) clang-unwrapped; +in +python3.pkgs.buildPythonApplication rec { + pname = "analyze-build"; + inherit (clang-unwrapped) version; + + format = "other"; + + src = clang-unwrapped + "/bin"; + + dontUnpack = true; + + dependencies = with python3.pkgs; [ + libscanbuild + ]; + + installPhase = '' + mkdir -p "$out/bin" + install "$src/analyze-build" "$out/bin/" + ''; + + makeWrapperArgs = [ + "--prefix" + "PATH" + ":" + (lib.makeBinPath [ clang-unwrapped ]) + ]; + + meta = { + description = "run Clang static analyzer against a project with compilation database"; + homepage = "https://github.com/llvm/llvm-project/tree/llvmorg-${version}/clang/tools/scan-build-py/"; + mainProgram = "scan-build"; + license = with lib.licenses; [ + asl20 + llvm-exception + ]; + maintainers = with lib.maintainers; [ RossSmyth ]; + platforms = lib.intersectLists python3.meta.platforms clang-unwrapped.meta.platforms; + }; +} diff --git a/pkgs/by-name/in/intercept-build/package.nix b/pkgs/by-name/in/intercept-build/package.nix new file mode 100644 index 000000000000..0188b28aecc4 --- /dev/null +++ b/pkgs/by-name/in/intercept-build/package.nix @@ -0,0 +1,38 @@ +{ + lib, + llvmPackages, + python3, +}: +let + inherit (llvmPackages) clang-unwrapped; +in +python3.pkgs.buildPythonApplication rec { + pname = "intercept-build"; + inherit (clang-unwrapped) version; + + format = "other"; + + src = clang-unwrapped + "/bin"; + + dontUnpack = true; + + dependencies = with python3.pkgs; [ + libscanbuild + ]; + + installPhase = '' + mkdir -p "$out/bin" + install "$src/intercept-build" "$out/bin" + ''; + + meta = { + description = "intercepts the build process to generate a compilation database"; + homepage = "https://github.com/llvm/llvm-project/tree/llvmorg-${version}/clang/tools/scan-build-py/"; + mainProgram = "intercept-build"; + license = with lib.licenses; [ + asl20 + llvm-exception + ]; + maintainers = with lib.maintainers; [ RossSmyth ]; + }; +} diff --git a/pkgs/by-name/sc/scan-build-py/package.nix b/pkgs/by-name/sc/scan-build-py/package.nix new file mode 100644 index 000000000000..934a77f5db21 --- /dev/null +++ b/pkgs/by-name/sc/scan-build-py/package.nix @@ -0,0 +1,46 @@ +{ + lib, + llvmPackages, + python3, +}: +let + inherit (llvmPackages) clang-unwrapped; +in +python3.pkgs.buildPythonApplication rec { + pname = "scan-build-py"; + inherit (clang-unwrapped) version; + + format = "other"; + + src = clang-unwrapped + "/bin"; + + dontUnpack = true; + + dependencies = with python3.pkgs; [ + libscanbuild + ]; + + installPhase = '' + mkdir -p "$out/bin" + install "$src/scan-build-py" "$out/bin/scan-build-py" + ''; + + makeWrapperArgs = [ + "--prefix" + "PATH" + ":" + (lib.makeBinPath [ clang-unwrapped ]) + ]; + + meta = { + description = "intercepts the build process to generate a compilation database"; + homepage = "https://github.com/llvm/llvm-project/tree/llvmorg-${version}/clang/tools/scan-build-py/"; + mainProgram = "scan-build-py"; + license = with lib.licenses; [ + asl20 + llvm-exception + ]; + maintainers = with lib.maintainers; [ RossSmyth ]; + platforms = lib.intersectLists python3.meta.platforms clang-unwrapped.meta.platforms; + }; +} diff --git a/pkgs/development/python-modules/libear/default.nix b/pkgs/development/python-modules/libear/default.nix new file mode 100644 index 000000000000..b1f00bc1e1aa --- /dev/null +++ b/pkgs/development/python-modules/libear/default.nix @@ -0,0 +1,37 @@ +{ + lib, + llvmPackages, + buildPythonPackage, +}: +let + inherit (llvmPackages) clang-unwrapped; +in +buildPythonPackage rec { + pname = "libear"; + inherit (clang-unwrapped) version; + + format = "other"; + + src = clang-unwrapped.lib + "/lib/libear"; + + dontUnpack = true; + + installPhase = '' + LIBPATH="$(toPythonPath "$out")/libear" + mkdir -p "$LIBPATH" + + install -t "$LIBPATH" $src/* + ''; + + pythonImportsCheck = [ "libear" ]; + + meta = { + description = "Hooks into build systems to listen to which files are opened"; + homepage = "https://github.com/llvm/llvm-project/tree/llvmorg-${version}/clang/tools/scan-build-py/lib/libear"; + license = with lib.licenses; [ + asl20 + llvm-exception + ]; + maintainers = with lib.maintainers; [ RossSmyth ]; + }; +} diff --git a/pkgs/development/python-modules/libscanbuild/default.nix b/pkgs/development/python-modules/libscanbuild/default.nix new file mode 100644 index 000000000000..667c7e162e77 --- /dev/null +++ b/pkgs/development/python-modules/libscanbuild/default.nix @@ -0,0 +1,42 @@ +{ + lib, + llvmPackages, + buildPythonPackage, + libear, +}: +let + inherit (llvmPackages) clang-unwrapped; +in +buildPythonPackage rec { + pname = "libscanbuild"; + inherit (clang-unwrapped) version; + + format = "other"; + + src = clang-unwrapped.lib + "/lib/libscanbuild"; + + dontUnpack = true; + + dependencies = [ + libear + ]; + + installPhase = '' + LIBPATH="$(toPythonPath "$out")/libscanbuild" + mkdir -p "$LIBPATH" + + cp -r "$src/"* "$LIBPATH" + ''; + + pythonImportsCheck = [ "libscanbuild" ]; + + meta = { + description = "Captures all child process creation and log information about it"; + homepage = "https://github.com/llvm/llvm-project/tree/llvmorg-${version}/clang/tools/scan-build-py/lib/libscanbuild"; + license = with lib.licenses; [ + asl20 + llvm-exception + ]; + maintainers = with lib.maintainers; [ RossSmyth ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index b93f78a9ac72..d15cfca161bb 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -8099,6 +8099,8 @@ self: super: with self; { (p: p.py) ]; + libear = callPackage ../development/python-modules/libear { }; + libevdev = callPackage ../development/python-modules/libevdev { }; libfdt = toPythonModule ( @@ -8234,6 +8236,8 @@ self: super: with self; { } ); + libscanbuild = callPackage ../development/python-modules/libscanbuild { }; + libselinux = lib.pipe pkgs.libselinux [ toPythonModule (