diff mbox series

[bug#55349] Acknowledgement ([PATCH]: Add libobjc2.)

Message ID 864k1xbm5m.fsf@163.com
State New
Headers show
Series [bug#55349] Acknowledgement ([PATCH]: Add libobjc2.) | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Zhu Zihao May 10, 2022, 12:34 p.m. UTC
Remove unneeded input gcc-objc.

Comments

Zhu Zihao May 19, 2022, 3:55 p.m. UTC | #1
ping.
diff mbox series

Patch

From 6c828759cc66da8a1c7ecfed77abe7cd41aee055 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Sun, 27 Mar 2022 01:11:15 +0800
Subject: [PATCH 3/3] gnu: Add libobjc2.

* gnu/packages/patches/libobjc2-unbundle-robin-map.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add corresponding file entry.
* gnu/packages/gnustep.scm (libobjc2): New variable.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/gnustep.scm                      | 48 +++++++++++++++++++
 .../patches/libobjc2-unbundle-robin-map.patch | 47 ++++++++++++++++++
 3 files changed, 96 insertions(+)
 create mode 100644 gnu/packages/patches/libobjc2-unbundle-robin-map.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 3b7db46b26..066aad89e1 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1333,6 +1333,7 @@  dist_patch_DATA =						\
   %D%/packages/patches/kdbusaddons-kinit-file-name.patch	\
   %D%/packages/patches/libffi-3.3-powerpc-fixes.patch		\
   %D%/packages/patches/libffi-float128-powerpc64le.patch	\
+  %D%/packages/patches/libobjc2-unbundle-robin-map.patch	\
   %D%/packages/patches/librime-fix-build-with-gcc10.patch	\
   %D%/packages/patches/libvirt-add-install-prefix.patch	\
   %D%/packages/patches/libziparchive-add-includes.patch		\
diff --git a/gnu/packages/gnustep.scm b/gnu/packages/gnustep.scm
index a6c7c800a8..0fde3c0ebe 100644
--- a/gnu/packages/gnustep.scm
+++ b/gnu/packages/gnustep.scm
@@ -22,15 +22,21 @@ 
 
 (define-module (gnu packages gnustep)
   #:use-module (guix download)
+  #:use-module (guix git-download)
+  #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system cmake)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages datastructures)
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages libffcall)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages gtk)
+  #:use-module (gnu packages llvm)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages glib)
@@ -65,6 +71,48 @@  (define-public gnustep-make
 to easily create cross-compiled binaries.")
     (license license:gpl3+)))
 
+(define-public libobjc2
+  (package
+    (name "libobjc2")
+    (version "2.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/gnustep/libobjc2")
+         (commit (string-append "v" version))))
+       (sha256
+        (base32
+         "1zjryzvy06gjf36gz6zrkg9icwz6wsf80mp94x6bq1109vkl40b5"))
+       (patches
+        (search-patches "libobjc2-unbundle-robin-map.patch"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      ;; XXX: Cannot use GCC to compile ObjC code due to
+      ;; https://issues.guix.gnu.org/29644.
+      #:configure-flags #~(list "-DCMAKE_C_COMPILER=clang"
+                                "-DCMAKE_CXX_COMPILER=clang++")))
+    (inputs
+     (list clang robin-map))
+    (home-page "http://www.gnustep.org/")
+    (synopsis "Objective-C runtime library for Clang")
+    (description "Libobjc2 is an Objective-C runtime library designed as a
+drop-in replacment for GCC runtime. It supports following features beyond
+GCC runtime.
+
+@itemize
+@item Modern Objective-C runtime APIs.
+@item Blocks (Closures).
+@item Synthesised property accessors.
+@item Efficient support for @code{@@synchronized()}.
+@item Type-dependent dispatch.
+@item Associated reference API.
+@item Automatic Reference Counting.
+@end itemize")
+    (license license:expat)))
+
 (define-public windowmaker
   (package
     (name "windowmaker")
diff --git a/gnu/packages/patches/libobjc2-unbundle-robin-map.patch b/gnu/packages/patches/libobjc2-unbundle-robin-map.patch
new file mode 100644
index 0000000000..b828a64221
--- /dev/null
+++ b/gnu/packages/patches/libobjc2-unbundle-robin-map.patch
@@ -0,0 +1,47 @@ 
+From 2c5b0d5d6eba3bda4e83f489da546060fa8f3a2b Mon Sep 17 00:00:00 2001
+From: Zhu Zihao <all_but_last@163.com>
+Date: Sat, 26 Mar 2022 16:54:43 +0800
+Subject: [PATCH] Unbundle robin-map.
+
+This patch makes libobjc2 use robin-map header from system instead of cloning
+from submodule.
+---
+ CMakeLists.txt | 8 --------
+ arc.mm         | 2 +-
+ 2 files changed, 1 insertion(+), 9 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index e2746e9..cf731f1 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -86,14 +86,6 @@ else ()
+ 	list(APPEND libobjc_C_SRCS eh_personality.c)
+ endif (WIN32)
+ 
+-if (NOT EXISTS "${CMAKE_SOURCE_DIR}/third_party/robin-map/include/tsl/robin_map.h")
+-	message(FATAL_ERROR "Git submodules not present, please run:\n\n"
+-						" $ git submodule init && git submodule update\n\n"
+-						"If you did not checkout via git, you will need to"
+-						"fetch the submodule's contents from"
+-						"https://github.com/Tessil/robin-map/")
+-endif ()
+-
+ # For release builds, we disable spamming the terminal with warnings about
+ # selector type mismatches
+ if (CMAKE_BUILD_TYPE STREQUAL Release)
+diff --git a/arc.mm b/arc.mm
+index c96681f..cc93e7f 100644
+--- a/arc.mm
++++ b/arc.mm
+@@ -3,7 +3,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <assert.h>
+-#include "third_party/robin-map/include/tsl/robin_map.h"
++#include <tsl/robin_map.h>
+ #import "lock.h"
+ #import "objc/runtime.h"
+ #import "objc/blocks_runtime.h"
+-- 
+2.34.0
+
-- 
2.36.0