Message ID | cover.1722933384.git.ashvithshetty10@gmail.com |
---|---|
Headers |
Return-Path: <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 5E69527BBE9; Tue, 6 Aug 2024 12:03:29 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id DF17727BBE2 for <patchwork@mira.cbaines.net>; Tue, 6 Aug 2024 12:03:27 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <guix-patches-bounces@gnu.org>) id 1sbHyG-0003iu-Vf; Tue, 06 Aug 2024 07:03:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1sbHxh-0003gv-GH for guix-patches@gnu.org; Tue, 06 Aug 2024 07:02:42 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1sbHxf-0007Ie-LV for guix-patches@gnu.org; Tue, 06 Aug 2024 07:02:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=k0ZAj5RxOuFjOr2sIIviPAY7yXdErDHAsCs2alw0hJI=; b=mxO18M9Z+o7PwAsFxurdvcstsJpE32Q5CNDFrwAuLMSyL+zFWT4Zwwx8nobV3q5iY+2mrbCCU7m5wbKv1CHfKI1iuYnl+igYf1lxDm/+Rrqzv1pwi+BjLZN+FTrAT651CSUqKXuqr5+Sb6uO3+N/e/ifGkQbvoH1kR6vaPp99SFM/2j10q8zrm/OigdCloHsF+F/9o9QQ7ARU3pvPqAqa0Ul9wHiNjrX9/XqMxDkGCt+ZpXC3gAXgqsbdNnhgaUySRzE2cAHXt7smel0XuGCuaB7HGQQkTs85tAerWGRXXto3Eg160jQjSdOSTN9OTChpEHaFRWVFDUAOb2wno3dUg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1sbHy2-0000Oh-4I for guix-patches@gnu.org; Tue, 06 Aug 2024 07:03:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#72494] [PATCH 0/1] Add C3 Resent-From: Ashvith Shetty <ashvithshetty10@gmail.com> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> Resent-CC: , guix-patches@gnu.org Resent-Date: Tue, 06 Aug 2024 11:03:01 +0000 Resent-Message-ID: <handler.72494.B.17229421811516@debbugs.gnu.org> Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 72494 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 72494@debbugs.gnu.org Cc: Ashvith Shetty <ashvithshetty10@gmail.com>, ( <paren@disroot.org>, Christopher Baines <guix@cbaines.net>, Ludovic =?utf-8?q?Court=C3=A8s?= <ludo@gnu.org>, Mathieu Othacehe <othacehe@gnu.org>, Simon Tournier <zimon.toutoune@gmail.com>, Tobias Geerinckx-Rice <me@tobias.gr>, jgart <jgart@dismail.de> X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: ( <paren@disroot.org>, Christopher Baines <guix@cbaines.net>, Ludovic =?utf-8?q?Court=C3=A8s?= <ludo@gnu.org>, Mathieu Othacehe <othacehe@gnu.org>, Simon Tournier <zimon.toutoune@gmail.com>, Tobias Geerinckx-Rice <me@tobias.gr>, jgart <jgart@dismail.de> Received: via spool by submit@debbugs.gnu.org id=B.17229421811516 (code B ref -1); Tue, 06 Aug 2024 11:03:01 +0000 Received: (at submit) by debbugs.gnu.org; 6 Aug 2024 11:03:01 +0000 Received: from localhost ([127.0.0.1]:60109 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1sbHy0-0000OO-Hc for submit@debbugs.gnu.org; Tue, 06 Aug 2024 07:03:00 -0400 Received: from lists.gnu.org ([209.51.188.17]:40614) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ashvithshetty10@gmail.com>) id 1sbHxy-0000OE-GK for submit@debbugs.gnu.org; Tue, 06 Aug 2024 07:02:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ashvithshetty10@gmail.com>) id 1sbHxZ-0003fo-Ph for guix-patches@gnu.org; Tue, 06 Aug 2024 07:02:34 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <ashvithshetty10@gmail.com>) id 1sbHxX-0007HU-Fg for guix-patches@gnu.org; Tue, 06 Aug 2024 07:02:33 -0400 Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-7a263f6439eso253533a12.3 for <guix-patches@gnu.org>; Tue, 06 Aug 2024 04:02:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722942149; x=1723546949; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=k0ZAj5RxOuFjOr2sIIviPAY7yXdErDHAsCs2alw0hJI=; b=M3BuEtLGlfrIlKQ3mslBRiHPrhb3p7cZ4meGbRAsaHfQYy3rGaf34FAwy4imSfMnSd pAQ1fmvvG1qBJqpAhVYP/BaQSwtehYd8d2xWoIaaT26lSM+8iTrTkjFLKpvvPUXcPrYL xe6iTWcBYPdTMcrUrAzN9Q85CHhU0KhRuN7nV1OE3ROpcaKi3JnnMCXdH1x0haWrT1j2 30eqxobXc5e3Xkc3bgCg0vrHMC1H3SKDR//QrF2pF+cpznoSwisA6U1QT6fW2VOUTgw5 g0L6eZbN17+9lb7WBVk5+eNGHLr83sSxsfqs7+p4TW/xcNok+zywdVOZJLeP47Y5jpIn /CHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722942149; x=1723546949; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=k0ZAj5RxOuFjOr2sIIviPAY7yXdErDHAsCs2alw0hJI=; b=S+la40u5Bol7IaOqZDoFnyRK7jphyPD3KsQ8sHVNS7xDTJRcQuTam9JtQvzMsVnknt eLAEWhAF1vsAKxBl26zIimlx3XlS7MMRDI8eU8afA9jwRP5qL7OfuDxfZXp5awL13Qf5 PuohhiXtW2NfuiOk9q8WpYxPhyOj/8l/seb3CvLCS71GiwyeWVjyD5cPl7UjZKWsPsEb +GbYBNd/qZ+pzE2WDeco0tSGXC7wShnESVqNkefXzM1oxBIKauWaljjkvrY6/v4pV1SL 8kF7mCI+s5dMvR7EhsK+keZYfFVCYUTyCHnj2I/8BzWC5VUHBDCImHgwEcykvaXedREN /fLA== X-Gm-Message-State: AOJu0YytVqviM9W2Kff1C5F9IdnSxVEeUOP1OI6OCCxLiD++2bc9DS9N dzsZmTRn0Ny8akyGuhTy2YN8TQcdjgJHISvHaW1y0mA9PbQ8U3sYbXZNmQ== X-Google-Smtp-Source: AGHT+IEML4W+H4j/7OPTkM4cG//7z01h4M2m4GJnkECFI42a1iXI1DddVAEAiLKIuV4yCMX2Q1dUtA== X-Received: by 2002:a17:90b:180c:b0:2c9:a88d:26f2 with SMTP id 98e67ed59e1d1-2cff953e264mr12637352a91.36.1722942148675; Tue, 06 Aug 2024 04:02:28 -0700 (PDT) Received: from wisteria.bbrouter ([150.129.60.164]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2cfdc4e3c41sm12262961a91.48.2024.08.06.04.02.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Aug 2024 04:02:28 -0700 (PDT) From: Ashvith Shetty <ashvithshetty10@gmail.com> Date: Tue, 6 Aug 2024 16:32:20 +0530 Message-ID: <cover.1722933384.git.ashvithshetty10@gmail.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=ashvithshetty10@gmail.com; helo=mail-pg1-x52b.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: <guix-patches.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/guix-patches> List-Post: <mailto:guix-patches@gnu.org> List-Help: <mailto:guix-patches-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=subscribe> Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches |
Series |
Add C3
|
|
Message
Ashvith Shetty
Aug. 6, 2024, 11:02 a.m. UTC
This patch series adds C3, which is a programming language that builds on the syntax and semantics of the C language, with the goal of evolving it while still retaining familiarity for C programmers. Tests have been disabled, as I was not able to figure out on how to make it work, but I would appreciate it, if anyone is willing to improve this patch series. Ashvith Shetty (1): gnu: Add C3 1.6.1. gnu/packages/c3.scm | 59 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 gnu/packages/c3.scm base-commit: b20956651a53a8f23828fdeb6945e1a31e6997a8
Comments
Hello Ashvith, I'd like to give my feedback on this patch series. I'll send an updated patch series using the suggestions below if I have the time. > +(define-public c3c-bootstrap > + (package > + (name "c3c") > + (version "0.6.1") > + (source > + (origin > + (method git-fetch) > + (uri (git-reference > + (url "https://github.com/c3lang/c3c") > + (commit (string-append "v" version)))) > + (file-name (git-file-name name version)) > + (sha256 > + (base32 "0xjl3yghyqmqv9118nhcix3xywlpdirqc0dlmdaghdkja0wr19rw")) > + (snippet #~(begin > + (use-modules (guix build utils)) > + (substitute* "CMakeLists.txt" > + (("\\$\\{LLVM_LIBRARY_DIRS\\}") > + (string-append #$lld-18 "/lib/ " > + #$llvm-18 "/lib/"))))))) > + (build-system cmake-build-system) > + (arguments > + '(#:configure-flags '("-DCMAKE_INSTALL_LIBDIR=lib") > + ;; TODO: Fix test > + #:tests? #f)) According to its README, the unit tests are run using the built c3c with its compile-test subcommand: `c3c compile-test test/unit`. The `check` build phase needs to be replaced to run this command. A patch sent upstream to add a proper `check` target would be good, and the test/ subdirectory would probably also need to be specified as part of the out-of-tree build. > + (inputs (list curl libffi llvm-18 lld-18)) The curl dependency should be removed, since c3c's optional dependency downloading functionality isn't needed in Guix.
Hello, This is my second attempt at packaging c3-lang (https://github.com/c3lang/c3c). I am planning to refer zig to build all the way from 0.5.1 to the lastest version. In the earlier patches, miniz was unbundled and replaced with the input-provided zlib - however, this time was able to make it work with the input-provided miniz (patch not provided). 1) In the earlier patch I have worked on, I just noticed that I had to substitute ${LLVM_LIBRARY_DIRS}: --8<---------------cut here---------------start------------->8--- + (snippet #~(begin + (use-modules (guix build utils)) + (substitute* "CMakeLists.txt" + (("\\$\\{LLVM_LIBRARY_DIRS\\}") + (string-append #$lld-18 "/lib/ " + #$llvm-18 "/lib/"))))))) --8<---------------cut here---------------start------------->8--- However, this seems to me like an improper way to deal with it. I have a limited understanding of CMake, so please bear with me: Variable ${LLVM_LIBRARY_DIRS} (which I am assuming is a combination of variables including, but not limited to ${LLVM_DIR} and ${LLD_DIR}) seems to include only /gnu/store/z0abzsad781af8qp2wzqq8icwwyxb4ms-llvm-18.1.8/lib/ (${LLVM_DIR}?), but not /gnu/store/62jn91571kx31hqza7c9jzsc3sinkxjr-lld-18.1.8/lib/ (${LLD_DIR}?). When I try printing ${LLD_DIR} in CMakeLists.txt (patch not provided), it appears to be an empty string. Is there anything wrong with the way CMake is configured in c3c? 2) c3c assumes that there exists a compiler or an alias `cc`, but there isn't any such variable in Guix (at least to my knowledge). How do I deal with this issue? Because if not resolved, it also causes the tests to fail. Do I patch cc to gcc/clang/#$(cc-for-target)? --8<---------------cut here---------------start------------->8--- + (substitute* '("src/compiler/target.c" + "src/compiler/linker.c") + (("\"cc\"") (string-append "\"" #$(cc-for-target) "\""))) + (substitute* "resources/testproject/project.json" + (("\"cc\" : \"cc\",") "")))) --8<---------------cut here---------------start------------->8--- Or is there a better way to deal with this? By the way, commit 297a6c9 (https://github.com/c3lang/c3c/commit/297a6c93481e2f3b62bf0250750e20549108129d) in v0.6.3 includes support for C3C_LIB and C3C_CC - can this be re-used for earlier patches? 3) Tests in C3C don't run (or maybe I am doing something wrong), so I had to add this instead (this is specific to v0.6.1): --8<---------------cut here---------------start------------->8--- (replace 'check (lambda* (#:key tests? #:allow-other-keys) (when tests? ;; Compile and run some examples (display "# Compile and run some examples #\n") (with-directory-excursion "../source/resources" (for-each (lambda (file) (invoke "../../build/c3c" "compile" file)) '("examples/base64.c3" "examples/binarydigits.c3" "examples/brainfk.c3" "examples/factorial_macro.c3" "examples/fasta.c3" "examples/gameoflife.c3" "examples/hash.c3" "examples/levenshtein.c3" "examples/load_world.c3" "examples/map.c3" "examples/mandelbrot.c3" "examples/plus_minus.c3" "examples/nbodies.c3" "examples/spectralnorm.c3" "examples/swap.c3" "examples/contextfree/boolerr.c3" "examples/contextfree/dynscope.c3" "examples/contextfree/guess_number.c3" "examples/contextfree/multi.c3" "examples/contextfree/cleanup.c3")) (for-each (lambda (file) (invoke "../../build/c3c" "compile-run" file)) '("examples/hello_world_many.c3" "examples/time.c3" "examples/fannkuch-redux.c3" "examples/contextfree/boolerr.c3" "examples/load_world.c3" "examples/process.c3" "examples/ls.c3" "linux_stack.c3")) (invoke "../../build/c3c" "compile-run" "--linker=builtin" "linux_stack.c3")) ;; Compile run unit tests (display "# Compile run unit tests #\n") (invoke "./c3c" "compile-test" "../source/test/unit") (with-directory-excursion "../source/resources/testproject" ;; Build testproject (display "# Build testproject #\n") (invoke "../../../build/c3c" "build" "--debug-log") ;; Build testproject direct linker (display "# Build testproject direct linker #\n") (invoke "../../../build/c3c" "build" "--debug-log" "--linker=builtin")) ;; Run compiler tests (display "# Run compiler tests #\n") (invoke "python3" "../source/test/src/tester.py" "./c3c" "../source/test/test_suite"))))))) --8<---------------cut here---------------start------------->8--- These tests come from `.github/workflows/main.yml`. I feel like there has to be a better way to do this. Regards, Ashvith