diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 61d32ba2da30..74fec3f9b32a 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -9913,6 +9913,12 @@ github = "the-furry-hubofeverything"; githubId = 53921912; }; + hucancode = { + email = "hucancode@gmail.com"; + github = "hucancode"; + githubId = 15852849; + name = "Bang Nguyen Huu"; + }; hufman = { email = "hufman@gmail.com"; github = "hufman"; diff --git a/pkgs/by-name/c3/c3c/package.nix b/pkgs/by-name/c3/c3c/package.nix index 5cae5d2671c4..75dc31527bd7 100644 --- a/pkgs/by-name/c3/c3c/package.nix +++ b/pkgs/by-name/c3/c3c/package.nix @@ -9,29 +9,43 @@ libffi, xar, versionCheckHook, + rev ? "unknown", + debug ? false, + checks ? true, }: - +let + inherit (lib.strings) optionalString; +in llvmPackages.stdenv.mkDerivation (finalAttrs: { - pname = "c3c"; - version = "0.6.6"; + + pname = "c3c${optionalString debug "-debug"}"; + version = "0.7.0"; src = fetchFromGitHub { owner = "c3lang"; repo = "c3c"; tag = "v${finalAttrs.version}"; - hash = "sha256-+rNj1SmiBYBw3Ncx2uS8X5OA/qDvJ8SFpZOQVRCgvmM="; + hash = "sha256-SCUMyc8Gf7TAOXRppooNiyfbM84CUoIvokgvNgODqw8="; }; + cmakeBuildType = if debug then "Debug" else "Release"; + postPatch = '' - substituteInPlace CMakeLists.txt \ - --replace-fail "\''${LLVM_LIBRARY_DIRS}" "${llvmPackages.lld.lib}/lib ${llvmPackages.llvm.lib}/lib" + substituteInPlace git_hash.cmake \ + --replace-fail "\''${GIT_HASH}" "${rev}" ''; nativeBuildInputs = [ cmake ]; + cmakeFlags = [ + "-DC3_ENABLE_CLANGD_LSP=${if debug then "ON" else "OFF"}" + "-DC3_LLD_DIR=${llvmPackages.lld.lib}/lib" + "-DLLVM_CRT_LIBRARY_DIR=${llvmPackages.compiler-rt}/lib/darwin" + ]; buildInputs = [ llvmPackages.llvm llvmPackages.lld + llvmPackages.compiler-rt curl libxml2 libffi @@ -39,12 +53,18 @@ llvmPackages.stdenv.mkDerivation (finalAttrs: { nativeCheckInputs = [ python3 ]; - doCheck = llvmPackages.stdenv.system == "x86_64-linux"; + doCheck = + lib.elem llvmPackages.stdenv.system [ + "x86_64-linux" + "x86_64-darwin" + "aarch64-darwin" + ] + && checks; checkPhase = '' runHook preCheck - ( cd ../resources/testproject; ../../build/c3c build ) - ( cd ../test; python src/tester.py ../build/c3c test_suite ) + ( cd ../resources/testproject; ../../build/c3c build --trust=full ) + ( cd ../test; ../build/c3c compile-run -O1 src/test_suite_runner.c3 -- ../build/c3c test_suite ) runHook postCheck ''; @@ -56,6 +76,7 @@ llvmPackages.stdenv.mkDerivation (finalAttrs: { homepage = "https://github.com/c3lang/c3c"; license = licenses.lgpl3Only; maintainers = with maintainers; [ + hucancode anas ]; platforms = platforms.all;