From c3cacc07154b1094d91fcb46c9a6586d5e20db04 Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Mon, 20 Oct 2025 08:13:17 +0000 Subject: [PATCH] gnu: Add swift-cmark. * gnu/packages/swift.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add reference to it. Change-Id: I107a466da824670ce71f38b9e03be06b1e35612a --- gnu/local.mk | 1 + gnu/packages/swift.scm | 72 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 gnu/packages/swift.scm diff --git a/gnu/local.mk b/gnu/local.mk index a3bc00b6db955a21af42d8dc0dd09998a7e1571d..6988c93b3e63b5b38b6e5be8913b7cfe751e99d6 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -648,6 +648,7 @@ GNU_SYSTEM_MODULES = \ %D%/packages/storage.scm \ %D%/packages/suckless.scm \ %D%/packages/sugar.scm \ + %D%/packages/swift.scm \ %D%/packages/swig.scm \ %D%/packages/sycl.scm \ %D%/packages/sync.scm \ diff --git a/gnu/packages/swift.scm b/gnu/packages/swift.scm new file mode 100644 index 0000000000000000000000000000000000000000..b1ff620188f516e4309ea445221874840b6f8cf5 --- /dev/null +++ b/gnu/packages/swift.scm @@ -0,0 +1,72 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2025 Danny Milosavljevic +;;; +;;; 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 swift) + #:use-module (guix packages) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix git-download) + #:use-module (guix gexp) + #:use-module (guix build-system cmake) + #:use-module (gnu packages) + #:use-module (gnu packages cmake) + #:use-module (gnu packages ninja) + #:use-module (gnu packages python)) + +(define %swift-bootstrap-version "5.7.3") + +(define-public swift-cmark + (package + (name "swift-cmark") + (version %swift-bootstrap-version) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/apple/swift-cmark.git") + (commit (string-append "swift-" %swift-bootstrap-version + "-RELEASE")))) + (file-name (git-file-name "swift-cmark" %swift-bootstrap-version)) + (sha256 + (base32 + "0340j9x2n40yx61ma2pgqfbn3a9ijrh20iwzd1zxqq87rr76hh3z")))) + (build-system cmake-build-system) + (arguments + (list + #:tests? #f + #:build-type "Release" + #:configure-flags + #~(list (string-append "-DCMAKE_INSTALL_PREFIX=" #$output)) + #:phases + #~(modify-phases %standard-phases + (add-after 'install 'install-cmake-exports + (lambda _ + (install-file "src/cmarkTargets.cmake" + (string-append #$output "/src")) + (substitute* (string-append #$output "/src/cmarkTargets.cmake") + (("/tmp/guix-build-swift-cmark-[^/]+/source/src") + #$output) + (("/tmp/guix-build-swift-cmark-[^/]+/build/src") + (string-append #$output "/lib"))) + #t))))) + (native-inputs + (list cmake ninja python-3)) + (home-page "https://swift.org/") + (synopsis "CommonMark parsing and rendering library for Swift") + (description + "This is Apple's fork of cmark (CommonMark implementation) with +Swift-specific modifications, required to build Swift 4.2.4.") + (license license:bsd-2)))