Subject: bug#55349: closed (Re: bug#55349: [PATCH]: Add libobjc2.)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 20 May 2022 18:28:01 +0000

Your bug report

#55349: [PATCH]: Add libobjc2.

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
55349: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=55349
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#55349: [PATCH]: Add libobjc2.
From: Ludovic Courtès <[email-masked]>
To: Zhu Zihao <[email-masked]>
Cc: [email-masked]
Date: Fri, 20 May 2022 20:27:18 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

Zhu Zihao <[email-masked]> skribis:

>>>From 8ecb351adf9220651d7901d88c1acc120b2572f2 Mon Sep 17 00:00:00 2001
> From: Zhu Zihao <[email-masked]>
> Date: Tue, 10 May 2022 19:57:17 +0800
> Subject: [PATCH 1/3] gnu: Use license: prefix for gnu/packages/gnustep.scm.
>
> * gnu/packages/gnustep.scm (gnustep-make)[license]: Use "license:" prefix.
> (windowmaker): Ditto.
> (wmbattery): Ditto.
> (wmnd): Ditto.
> (wmcpuload): Ditto.
> (wmclock): Ditto.
> (wmfire): Ditto.

[...]

>>>From f8e8dccc92813ded4e3464593427c6cae095e490 Mon Sep 17 00:00:00 2001
> From: Zhu Zihao <[email-masked]>
> Date: Tue, 10 May 2022 19:27:25 +0800
> Subject: [PATCH 2/3] gnu: clang: Add OBJC_INCLUDE_PATH to native-search-paths.
>
> Clang is also a compiler for Objective-C.
>
> * gnu/packages/llvm.scm (clang-for-llvm): Add OBJC_INCLUDE_PATH to native-search-paths.

[...]

>>>From 6c828759cc66da8a1c7ecfed77abe7cd41aee055 Mon Sep 17 00:00:00 2001
> From: Zhu Zihao <[email-masked]>
> 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.

Applied, with the cosmetic changes below to placate ‘guix lint’.

Thanks,
Ludo’.

diff --git a/gnu/packages/gnustep.scm b/gnu/packages/gnustep.scm
index 0fde3c0ebe..0314983559 100644
--- a/gnu/packages/gnustep.scm
+++ b/gnu/packages/gnustep.scm
@@ -75,18 +75,17 @@ (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"))))
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/gnustep/libobjc2")
+                    (commit (string-append "v" version))))
+              (sha256
+               (base32
+                "1zjryzvy06gjf36gz6zrkg9icwz6wsf80mp94x6bq1109vkl40b5"))
+              (file-name (git-file-name name version))
+              (patches
+               (search-patches "libobjc2-unbundle-robin-map.patch"))))
     (build-system cmake-build-system)
     (arguments
      (list
@@ -99,7 +98,7 @@ (define-public libobjc2
     (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
+drop-in replacment for GCC runtime.  It supports following features beyond
 GCC runtime.
 
 @itemize

Subject: [PATCH]: Add libobjc2.
From: Zhu Zihao <[email-masked]>
To: [email-masked]
Date: Tue, 10 May 2022 20:15:25 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

>From 8ecb351adf9220651d7901d88c1acc120b2572f2 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <[email-masked]>
Date: Tue, 10 May 2022 19:57:17 +0800
Subject: [PATCH 1/3] gnu: Use license: prefix for gnu/packages/gnustep.scm.

* gnu/packages/gnustep.scm (gnustep-make)[license]: Use "license:" prefix.
(windowmaker): Ditto.
(wmbattery): Ditto.
(wmnd): Ditto.
(wmcpuload): Ditto.
(wmclock): Ditto.
(wmfire): Ditto.
---
 gnu/packages/gnustep.scm | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/gnustep.scm b/gnu/packages/gnustep.scm
index eef3863949..a6c7c800a8 100644
--- a/gnu/packages/gnustep.scm
+++ b/gnu/packages/gnustep.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2016, 2017 Kei Kebreau <[email-masked]>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <[email-masked]>
 ;;; Copyright © 2018 Ricardo Wurmus <[email-masked]>
+;;; Copyright © 2022 Zhu Zihao <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -23,7 +24,7 @@ (define-module (gnu packages gnustep)
   #:use-module (guix download)
   #:use-module (guix packages)
   #:use-module (guix build-system gnu)
-  #:use-module (guix licenses)
+  #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
   #:use-module (gnu packages xorg)
@@ -62,7 +63,7 @@ (define-public gnustep-make
 project without having to deal with the complex issues associated with
 configuration, building, installation, and packaging.  It also allows the user
 to easily create cross-compiled binaries.")
-    (license gpl3+)))
+    (license license:gpl3+)))
 
 (define-public windowmaker
   (package
@@ -153,7 +154,7 @@ (define-public windowmaker
 interface.  It is fast, feature rich, easy to configure, and easy to use.")
 
     ;; Artwork is distributed under the WTFPL.
-    (license gpl2+)))
+    (license license:gpl2+)))
 
 (define-public wmbattery
   (package
@@ -180,7 +181,7 @@ (define-public wmbattery
 This includes if it is plugged in, if the battery is charging, how many minutes
 of battery life remain, battery life remaining (with both a percentage and a
 graph), and battery status (high - green, low - yellow, or critical - red).")
-    (license gpl2)))
+    (license license:gpl2)))
 
 (define-public wmnd
   (package
@@ -204,7 +205,7 @@ (define-public wmnd
     (description
      "WMND is a dockapp for monitoring network interfaces under WindowMaker and
 other compatible window managers.")
-    (license gpl2+)))
+    (license license:gpl2+)))
 
 (define-public wmcpuload
   (package
@@ -231,7 +232,7 @@ (define-public wmcpuload
 on and off by clicking the mouse button over the application.  If the CPU usage
 hits a certain threshold, an alarm-mode will alert you by turning back-light
 on.")
-    (license gpl2+)))
+    (license license:gpl2+)))
 
 (define-public wmclock
   (package
@@ -257,7 +258,7 @@ (define-public wmclock
      "wmclock is an applet for Window Maker which displays the date and time in
 a dockable tile.  It features multiple language support, 24h or 12h time
 display, and can run a user-specified program on mouse click.")
-    (license gpl2+)))
+    (license license:gpl2+)))
 
 (define-public wmfire
   (package
@@ -286,4 +287,4 @@ (define-public wmfire
 entering the dock a burning spot replaces the cursor, and after two seconds
 symbols to represent the current monitor are \"burnt\" onscreen.  The flame
 colour can also be changed.")
-    (license gpl2+)))
+    (license license:gpl2+)))
-- 
2.36.0

>From b73e30fa1a9d07c3d7f0f3ca0574b09c55622f85 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <[email-masked]>
Date: Sun, 27 Mar 2022 01:11:15 +0800
Subject: [PATCH 2/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                      | 50 +++++++++++++++++++
 .../patches/libobjc2-unbundle-robin-map.patch | 47 +++++++++++++++++
 3 files changed, 98 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..dd0b645395 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,50 @@ (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
+           gcc-objc                          ;For Objective-C headers
+           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 <[email-masked]>
+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

>From a0974ff954165732c90be02f20ac6e8701f4fb43 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <[email-masked]>
Date: Tue, 10 May 2022 19:27:25 +0800
Subject: [PATCH 3/3] gnu: clang: Add OBJC_INCLUDE_PATH to native-search-paths.

Clang is also a compiler for Objective-C.

* gnu/packages/llvm.scm (clang-for-llvm): Add OBJC_INCLUDE_PATH to native-search-paths.
---
 gnu/packages/llvm.scm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 0fc2a8e380..619c3280fc 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -388,6 +388,9 @@ (define* (clang-from-llvm llvm clang-runtime
            (search-path-specification
             (variable "CPLUS_INCLUDE_PATH")
             (files '("include/c++" "include")))
+           (search-path-specification
+            (variable "OBJC_INCLUDE_PATH")
+            (files '("include")))
            (search-path-specification
             (variable "LIBRARY_PATH")
             (files '("lib" "lib64")))))
-- 
2.36.0

-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao