nixpkgs/pkgs/by-name/c3/c3c/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

66 lines
1.4 KiB
Nix

{
llvmPackages,
lib,
fetchFromGitHub,
cmake,
python3,
curl,
libxml2,
libffi,
xar,
versionCheckHook,
}:
llvmPackages.stdenv.mkDerivation (finalAttrs: {
pname = "c3c";
version = "0.6.3";
src = fetchFromGitHub {
owner = "c3lang";
repo = "c3c";
rev = "refs/tags/v${finalAttrs.version}";
hash = "sha256-hFLiE1S9l2NhSIaqpYoBfn27IkhavcM0Ma31+XJtYj4=";
};
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace-fail "\''${LLVM_LIBRARY_DIRS}" "${llvmPackages.lld.lib}/lib ${llvmPackages.llvm.lib}/lib"
'';
nativeBuildInputs = [ cmake ];
buildInputs = [
llvmPackages.llvm
llvmPackages.lld
curl
libxml2
libffi
] ++ lib.optionals llvmPackages.stdenv.hostPlatform.isDarwin [ xar ];
nativeCheckInputs = [ python3 ];
doCheck = llvmPackages.stdenv.system == "x86_64-linux";
checkPhase = ''
runHook preCheck
( cd ../resources/testproject; ../../build/c3c build )
( cd ../test; python src/tester.py ../build/c3c test_suite )
runHook postCheck
'';
nativeInstallCheckInputs = [ versionCheckHook ];
doInstallCheck = true;
meta = with lib; {
description = "Compiler for the C3 language";
homepage = "https://github.com/c3lang/c3c";
license = licenses.lgpl3Only;
maintainers = with maintainers; [
luc65r
anas
];
platforms = platforms.all;
mainProgram = "c3c";
};
})