From patchwork Wed Aug 7 06:36:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Adam Faiz X-Patchwork-Id: 66861 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 58C9F27BBEA; Wed, 7 Aug 2024 07:37:55 +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 61B4927BBE9 for ; Wed, 7 Aug 2024 07:37:54 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sbaIl-0002nE-LB; Wed, 07 Aug 2024 02:37:39 -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 1sbaIj-0002mh-DX for guix-patches@gnu.org; Wed, 07 Aug 2024 02:37:37 -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 1sbaIj-0001Co-4t for guix-patches@gnu.org; Wed, 07 Aug 2024 02:37:37 -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=jaPSzUjU2/sYbeSwY8ROCN44rTHH9Euq8qorh4w4j6w=; b=h/8clzd4sAX6TZ+7TT95/rNi98WAtB1899vYpveXIwmxwJqDlTo8bmEXjEsfX+yjZjnm2MQr9qu9XkB1Hw6Dpwn+J0378WQ5X6ops+jD5mCEeUeacj1B+aaFw272v3rnnmnyNZgcTA0P32XlEadAEYBaNrhHEH5oJuBqEayh6W3gte3ZIFqaT/UG4+vSu1AkCRa+Mjv3kAaFzImWaUZ/F7I9we56CzY5hJ8mw0p/9YSnUke2O04YQ2cEDP0GUj0XM+EUGaevj+hmtrXcFV4q06c2p2GY+Q+bRRb56Cwsw3JPV4limLOqqFALlyMBL7gfb7vdiMFcAoEwpfxrzCrkFA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sbaJ7-0001LJ-Qz for guix-patches@gnu.org; Wed, 07 Aug 2024 02:38:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#72494] [PATCH v3] gnu: Add c3c-bootstrap. References: In-Reply-To: Resent-From: Adam Faiz Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 07 Aug 2024 06:38: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: ashvithshetty10@gmail.com Received: via spool by 72494-submit@debbugs.gnu.org id=B72494.17230126785151 (code B ref 72494); Wed, 07 Aug 2024 06:38:01 +0000 Received: (at 72494) by debbugs.gnu.org; 7 Aug 2024 06:37:58 +0000 Received: from localhost ([127.0.0.1]:33528 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sbaJ3-0001L0-MF for submit@debbugs.gnu.org; Wed, 07 Aug 2024 02:37:58 -0400 Received: from layka.disroot.org ([178.21.23.139]:46224) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sbaJ0-0001Kj-8k for 72494@debbugs.gnu.org; Wed, 07 Aug 2024 02:37:55 -0400 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id A434B41943; Wed, 7 Aug 2024 08:37:26 +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 R9WG0YZrBid8; Wed, 7 Aug 2024 08:37:25 +0200 (CEST) Message-ID: <25ba6326-a778-7f9e-1930-2d8d6c35375b@disroot.org> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1723012645; bh=gJMGp5W2tsGbv0ozrfWmwV6TWeGVSCfTDYfRojCUKoc=; h=Date:To:Subject:Cc:From; b=XTDfh35aFJNvvyx08GYCRDX9kbWRRvpCVJcvwL6AKCqj54qyxQqifGs4M2y0bQAID pFjpivywBYZyN58YmEcM8yJtzxHK25fyNzaPlLOO+T3NO3whtaIP3E9C1tM25glZ9e rg026Qe4h3jiQ+w7LJSrolA6cK9WslYDbahqMlyedKEg9m/d4UMeQGxnV3Nx49sleC ZquTWklUPjMVJoC27pEbZvSl+DGK8GMle/mWAyjIexj1k1NUHuDPK9IapYGnhVhLMx TPsdJF0fvT9DKfe8UR+XY0zWGn8vNC0d1rWe/jZuU7cBkpHD2lf9TXSdHuMnceffau YF1eo/D8tr89w== Date: Wed, 7 Aug 2024 14:36:48 +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 3f9768c8fe5cc965170a74e5c018887793cb3ac0 Mon Sep 17 00:00:00 2001 Message-ID: <3f9768c8fe5cc965170a74e5c018887793cb3ac0.1723012269.git.adam.faiz@disroot.org> From: AwesomeAdam54321 Date: Wed, 7 Aug 2024 12:18:23 +0800 Subject: [PATCH v3] 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 | 92 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 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..2c5924807f --- /dev/null +++ b/gnu/packages/c3.scm @@ -0,0 +1,92 @@ +;;; 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 curl) + #: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)") + (("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/"))))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (with-directory-excursion "../source/resources/testproject" + (invoke "../../../build/c3c" + "--cc" #$(cc-for-target) "build")) + (invoke "python3" "../source/test/src/tester.py" + "./c3c" "../source/test/test_suite") + (invoke "./c3c" "--cc" #$(cc-for-target) + "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))))