From patchwork Sun Aug 11 14:57:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Adam Faiz X-Patchwork-Id: 66969 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 0D2AF27BBEA; Sun, 11 Aug 2024 15:58:39 +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.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham 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 CF6D927BBE2 for ; Sun, 11 Aug 2024 15:58:37 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sdA1h-00079O-6j; Sun, 11 Aug 2024 10:58:33 -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 ) id 1sdA1f-00078z-GY for guix-patches@gnu.org; Sun, 11 Aug 2024 10:58:31 -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 ) id 1sdA1f-000417-7L for guix-patches@gnu.org; Sun, 11 Aug 2024 10:58:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=From:MIME-Version:Date:To:In-Reply-To:References:Subject; bh=2p/VzmBoa19lLE9dkdLbL2eDl+3bosyUZDkVIgS1XAE=; b=snCWEfJfgBFiVKjzyTCWlQwZTeO6VlHsJx+xUmx2dAZzM8RN150W1YY9bRAjNIpfHgFxqxtNytBoeEUl5rIZCqjhCrBiROXM9tzCgrWBGK8ZlSBNeHV1UnfnWRmIzGXFMOvd7AIj+jwZByE0w8FDnWhbLXo1EV0Ln9UjkeaeAvops2d2hW3zJsLRquNHAC8lRwcsvI38esTT8sM06hOOUhqvIXA1vYfNveGO8MW3KtzsMqjcOyFaUgQRJjbJ3oRHlGzhvYpWZLKKAzQmCqgwvNDGiped6uBtCGmomJruZeGWHOTg2yJ645jquTfMKJHCZOJriHs3+X3NpYwAaQ5Yow==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sdA29-0007Qh-UU for guix-patches@gnu.org; Sun, 11 Aug 2024 10:59:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#72494] [PATCH v4] gnu: Add c3c-bootstrap. References: In-Reply-To: Resent-From: Adam Faiz Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 11 Aug 2024 14:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72494 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 72494@debbugs.gnu.org Cc: Ashvith Shetty Received: via spool by 72494-submit@debbugs.gnu.org id=B72494.172338833828550 (code B ref 72494); Sun, 11 Aug 2024 14:59:01 +0000 Received: (at 72494) by debbugs.gnu.org; 11 Aug 2024 14:58:58 +0000 Received: from localhost ([127.0.0.1]:41861 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sdA26-0007QQ-14 for submit@debbugs.gnu.org; Sun, 11 Aug 2024 10:58:58 -0400 Received: from layka.disroot.org ([178.21.23.139]:37822) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sdA23-0007QG-6O for 72494@debbugs.gnu.org; Sun, 11 Aug 2024 10:58:56 -0400 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id D145040482; Sun, 11 Aug 2024 16:58:23 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from layka.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QYS_ypYJV-s4; Sun, 11 Aug 2024 16:58:22 +0200 (CEST) Message-ID: <8f0c2986-b790-86fa-7217-5491d6f7208f@disroot.org> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1723388302; bh=YejTjPxso1pe9SE60VPSVUYWQbJyPIbGHoIj3P7BOBk=; h=Date:To:Cc:From:Subject; b=C1rnDDNpXb5St4SejYmYrYhXTKfU/HrO8fAbOm9Kaeej0+QJl5rO7UZt9sxyuDgnO XK+iCGO3K9zsILCsOOE5w2y7hv7l9ybvZdwosRWTwwfNK8Mcv+p/B77HMBONcLnSvq GuUHNnihLUz9lD3+gdAlfu6Ikpvp2vzDB0BNgl+lHDUTN0I2hWAkuNyMuAWfIoLO6j f0dXvRavZ21wBDyfQdberLaHnaHqK75jZXci/zS7SqNirBFSvpfYTBx4mJcG9uacys lU+ogA/23u77rL3ezgLDsBqtKaShqtNBiQMTT8okyjkWhYWw+3qVqB/Zay51r4StDv 8KbI5/BZ6iNuQ== Date: Sun, 11 Aug 2024 22:57:52 +0800 MIME-Version: 1.0 Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Adam Faiz X-ACL-Warn: , Adam Faiz via Guix-patches X-Patchwork-Original-From: Adam Faiz via Guix-patches via From: Adam Faiz 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 From 8b6035ad6587d44a9d65575b0f307820e42a402e Mon Sep 17 00:00:00 2001 Message-ID: <8b6035ad6587d44a9d65575b0f307820e42a402e.1723388041.git.adam.faiz@disroot.org> From: AwesomeAdam54321 Date: Wed, 7 Aug 2024 12:18:23 +0800 Subject: [PATCH v4] gnu: Add c3c-bootstrap. This patch was co-authored with Ashvith Shetty. * gnu/packages/c3.scm: New file. * gnu/packages/c3.scm (c3c-bootstrap): New variable. --- gnu/packages/c3.scm | 94 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 gnu/packages/c3.scm base-commit: b20956651a53a8f23828fdeb6945e1a31e6997a8 diff --git a/gnu/packages/c3.scm b/gnu/packages/c3.scm new file mode 100644 index 0000000000..d179a30356 --- /dev/null +++ b/gnu/packages/c3.scm @@ -0,0 +1,94 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2024 Ashvith Shetty +;;; Copyright © 2024 Adam Faiz +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu packages c3) + #:use-module (gnu packages compression) + #:use-module (gnu packages libffi) + #:use-module (gnu packages llvm) + #:use-module (gnu packages python) + #:use-module (guix build-system cmake) + #:use-module (guix gexp) + #:use-module (guix git-download) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix packages) + #:use-module (guix utils)) + +(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")) + (modules '((guix build utils))) + (snippet + #~(begin + ;; Unbundle miniz. + (delete-file-recursively "dependencies") + ;; Swap out miniz for zlib. + (substitute* "CMakeLists.txt" + (("add_library\\(miniz.*\\)\n$") + "find_package(ZLIB REQUIRED)\n") + (("target_include_directories\\(miniz PUBLIC") "") + (("...*/dependencies/miniz/..") "") + (("miniz") "z")) + (substitute* "src/utils/unzipper.c" + (("miniz\\.h") "zlib.h")))))) + (build-system cmake-build-system) + (arguments + (list + #:configure-flags + #~(list "-DCMAKE_INSTALL_LIBDIR=lib") + #:phases + #~(modify-phases %standard-phases + (add-before 'configure 'fix-build + (lambda _ + (substitute* "CMakeLists.txt" + (("\\$\\{LLVM_LIBRARY_DIRS\\}") + (string-append #$lld-18 "/lib/ " + #$llvm-18 "/lib/"))) + (substitute* '("src/compiler/target.c" + "src/compiler/linker.c") + (("\"cc\"") (string-append "\"" #$(cc-for-target) "\""))) + (substitute* "resources/testproject/project.json" + (("\"cc\" : \"cc\",") "")))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (with-directory-excursion "../source/resources/testproject" + (invoke "../../../build/c3c" "build")) + (invoke "python3" "../source/test/src/tester.py" + "./c3c" "../source/test/test_suite") + (invoke "./c3c" "compile-test" "../source/test/unit"))))))) + (native-inputs (list python)) + (inputs (list libffi lld-18 llvm-18 zlib)) + (synopsis "Compiler for the C3 language") + (description + "C3 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.") + (home-page "https://c3-lang.org/") + (supported-systems '("x86_64-linux" "aarch64-linux" "riscv64-linux")) + (license (list license:lgpl3 license:expat))))