From patchwork Tue Mar 8 14:36:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 37651 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 20B9227BBE9; Tue, 8 Mar 2022 14:37:19 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS 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 9A99E27BBEA for ; Tue, 8 Mar 2022 14:37:18 +0000 (GMT) Received: from localhost ([::1]:34742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRaxh-0006Mx-QH for patchwork@mira.cbaines.net; Tue, 08 Mar 2022 09:37:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59100) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRaxT-0005zx-Es for guix-patches@gnu.org; Tue, 08 Mar 2022 09:37:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:33503) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRaxT-0005O1-6B for guix-patches@gnu.org; Tue, 08 Mar 2022 09:37:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nRaxT-0001rr-3f for guix-patches@gnu.org; Tue, 08 Mar 2022 09:37:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#54235] [PATCH v3 3/4] gnu: Add ck. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 08 Mar 2022 14:37:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54235 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54235@debbugs.gnu.org Cc: maximedevos@telenet.be, Maxim Cournoyer Received: via spool by 54235-submit@debbugs.gnu.org id=B54235.16467501937110 (code B ref 54235); Tue, 08 Mar 2022 14:37:03 +0000 Received: (at 54235) by debbugs.gnu.org; 8 Mar 2022 14:36:33 +0000 Received: from localhost ([127.0.0.1]:55628 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nRawz-0001qc-11 for submit@debbugs.gnu.org; Tue, 08 Mar 2022 09:36:33 -0500 Received: from mail-qt1-f180.google.com ([209.85.160.180]:44619) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nRawx-0001q7-BF for 54235@debbugs.gnu.org; Tue, 08 Mar 2022 09:36:31 -0500 Received: by mail-qt1-f180.google.com with SMTP id v3so16208258qta.11 for <54235@debbugs.gnu.org>; Tue, 08 Mar 2022 06:36:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cEKZgvfdFyMt1a9T96wy+psDNn26efCAZ0hyxB/RN1M=; b=IBfPhRZaQKYceF7PRve0oZJDTz3YnZ45dLzl/9F6qmvJZtHXDdlVLVFKCym9ye6SGJ yQ5pg51APElya6xKkfMNce9lMaeMnWJV7DKtAWmMbpFlbhwJb7ex4UtxFshB+xx4lWBG Z9yTQkbhO7vRG+IQ/ks5M89bDPUpEJ3OQ0rYt57FAlFbZBpa59DwHZdZpGQlEU5UddA5 py0xnOb+HHtcJztKOOLPYNOPyhkb3Mw2A9ScxyDvUC88x1o/06Zw+m2v+qdPQuUsqKeU WKj10Gx7V7sCZdo59USiEsGn4WoU5V0AraNOhtcZoUgTeF+eQJUQxvvEUi5zvqNQuUOh 2T+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cEKZgvfdFyMt1a9T96wy+psDNn26efCAZ0hyxB/RN1M=; b=GX9Bv0ECu6x6PSE+OSkW+6MM0oxko7vvIlM90hLhxwKy8IF9MJcwRsisTq/nxOSikM hWeU/nBxAnTTqZpFAUco8MTPEcGZ7GQWrOKE8AfHGiZDNlEwWCgfRTQQSxXrGuRd3xyY o6tQ3nFtRbPmUSp8W+g0mPA9qG2ii2/0IbQaslGJ5EdquNe4HzAmdIf9SYOKaXfncz3a zzMplwO/dsltvVuV4BAns9uENkpxPudoDbFbT+7nFRNxeJ1VeX/qrlVrWeGM4nApPOyU zETEViLdBAhOvBcxw3MaTOH5zdlpNp63s83CQpDlnSUhmeVK1y6CVXtrK3/vchJZvLw+ JgeA== X-Gm-Message-State: AOAM530WWxSidI1A2e+CXRxbwl3WSwvsdAgilLb47yX0XddNv4/aEhjU zqISeR2LSUt3dMwwiaQyzJJGV0e18js= X-Google-Smtp-Source: ABdhPJxCxIYs2hMjeUARJgxCq5crpcLG+AS0KzdZC+A/N9NzAFKPFQOdGTIbOFIFeIi9xj1+cgRC/A== X-Received: by 2002:a05:622a:1985:b0:2de:b88:4673 with SMTP id u5-20020a05622a198500b002de0b884673mr13887572qtc.230.1646750185697; Tue, 08 Mar 2022 06:36:25 -0800 (PST) Received: from localhost.localdomain (dsl-205-151-56-54.b2b2c.ca. [205.151.56.54]) by smtp.gmail.com with ESMTPSA id e9-20020ac85989000000b002de2bfc8f94sm10338847qte.88.2022.03.08.06.36.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 06:36:25 -0800 (PST) From: Maxim Cournoyer Date: Tue, 8 Mar 2022 09:36:06 -0500 Message-Id: <20220308143607.7449-3-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220308143607.7449-1-maxim.cournoyer@gmail.com> References: <20220308143607.7449-1-maxim.cournoyer@gmail.com> MIME-Version: 1.0 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: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/c.scm (ck): New variable. --- gnu/packages/c.scm | 78 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm index e53a7c865f..d545d98938 100644 --- a/gnu/packages/c.scm +++ b/gnu/packages/c.scm @@ -38,6 +38,7 @@ (define-module (gnu packages c) #:use-module (guix build-system cmake) #:use-module (guix build-system gnu) #:use-module (guix build-system trivial) + #:use-module (guix store) #:use-module (gnu packages) #:use-module (gnu packages bash) #:use-module (gnu packages bootstrap) @@ -896,6 +897,83 @@ (define-public aws-c-mqtt (home-page "https://github.com/awslabs/aws-c-mqtt") (license license:asl2.0))) +;;; Factored out of the ck package so that it can be adjusted and called on +;;; the host side easily, without impacting the package definition. +(define (gnu-triplet->ck-machine target) + (letrec-syntax + ((matches (syntax-rules (=>) + ((_ (target-prefix => machine) rest ...) + (if (string-prefix? target-prefix target) + machine + (matches rest ...))) + ((_) + (error "unsupported target" target))))) + ;; This basically reproduces the logic handling the + ;; PLATFORM variable in the configure script of ck. + (matches ("x86_64" => "x86_64") + ("i586" => "x86") + ("i686" => "x86") + ("aarch64" => "aarch64") + ("arm" => "arm") + ("ppc64" => "ppc64") + ("ppc" => "ppc") + ("s390x" => "s390x") + ("sparc64" => "sparcv9")))) + +(define-public ck + (package + (name "ck") + (version "0.7.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/concurrencykit/ck") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "020yzfpvymdc8lc44znlnxmxb8mvp42g4nb4p8k814klazqvwh0x")))) + (build-system gnu-build-system) + (arguments + (list + #:phases + #~(modify-phases %standard-phases + (replace 'configure + ;; ck uses a custom configure script that stumbles on + ;; '--enable-fast-install', among other things. + (lambda* (#:key parallel-build? #:allow-other-keys) + (define target-machine #$(and=> (%current-target-system) + gnu-triplet->ck-machine)) + (when target-machine + ;; The configure script doesn't currently work for + ;; cross-compiling (see: + ;; https://github.com/concurrencykit/ck/issues/191). + (error "ck cannot currently be cross-compiled")) + ;; The custom configure script doesn't make cross-compilation + ;; adjustments itself, so manually set the archiver, compiler + ;; and linker. + (setenv "AR" #$(ar-for-target)) + (setenv "CC" #$(cc-for-target)) + (setenv "LD" #$(ld-for-target)) + (apply invoke "./configure" + `(,@(if target-machine + (list (string-append "--profile=" target-machine)) + '()) + ,(string-append "--prefix=" #$output) + ,(string-append "--mandir=" #$output "/share/man") + ,(string-append "--cores=" + (if parallel-build? + (number->string (parallel-job-count)) + "1"))))))))) + (home-page "https://github.com/concurrencykit/ck") + (synopsis "C library for concurrent systems") + (description "Concurrency Kit (@code{ck}) provides concurrency primitives, +safe memory reclamation mechanisms and non-blocking (including lock-free) data +structures designed to aid in the research, design and implementation of high +performance concurrent systems developed in C99+.") + (license (list license:bsd-2 ;everything except... + license:asl2.0)))) ;src/ck_hp.c + (define-public utf8-h ;; The latest tag is used as there is no release. (let ((commit "500d4ea9f4c3449e5243c088d8af8700f7189734")