Subject: [CORE-UPDATES PATCH] gnu: gcc: Support objc, objc++ by default.
From: Efraim Flashner <[email-masked]>
To: [email-masked]
Cc: Efraim Flashner <[email-masked]>
Date: Mon, 6 Nov 2023 12:07:47 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

* gnu/packages/gcc.scm (gcc-4.7)[configure-flags]: Adjust the
enable-languages flag to also enable objc, obj-c++.
[native-search-paths]: Add fields for OBJC_INCLUDE_PATH,
OJBCPLUS_INCLUDE_PATH.
(gcc-objc-4.8, gcc-objc-4.9, gcc-objc-5, gcc-objc-6, gcc-objc-7,
gcc-objc-8, gcc-objc-9, gcc-objc-10, gcc-objc-11, gcc-objc-12, gcc-objc,
gcc-objc++-4.8, gcc-objc++-4.9, gcc-objc++-5, gcc-objc++-6,
gcc-objc++-7, gcc-objc++-8, gcc-objc++-9, gcc-objc++-10, gcc-objc++-11,
gcc-objc++-12, gcc-objc++, %objc-search-paths, %objc++-search-paths):
Remove variables.

Change-Id: Ib4cd176eb88c733a82f2d31e8cc45b9c61720f8f
---

Currently we have separate gcc-objc and gcc-objc++ packages, but they
need the gcc frontend to use their library files. The output of the
diff between the lib outputs of gcc-10 and gcc-objc-10 is below. The net
difference in size is 368 KB.

This would allow us to drop 20 gcc derivations per architecture, seeing
that objc and objc++ should probably be joined together anyway, and no
one can really use them as they are currently.

This patch would cause a full world rebuild, all the way down to
gcc-boot0.

1c1
< /gnu/store/sxnv230gv2mj5x9v3gfadw118gkl2rcf-gcc-10.5.0-lib/
---
> /gnu/store/1p8hc8mrigismnndycwih2k2015v0z1q-gcc-objc-10.5.0-lib/
78a79,89
> │   │           │   ├── objc
> │   │           │   │   ├── message.h
> │   │           │   │   ├── NXConstStr.h
> │   │           │   │   ├── objc-decls.h
> │   │           │   │   ├── objc-exception.h
> │   │           │   │   ├── objc.h
> │   │           │   │   ├── objc-sync.h
> │   │           │   │   ├── Object.h
> │   │           │   │   ├── Protocol.h
> │   │           │   │   ├── runtime.h
> │   │           │   │   └── thr.h
645a657,661
> │   ├── libobjc.a
> │   ├── libobjc.la
> │   ├── libobjc.so -> libobjc.so.4.0.0
> │   ├── libobjc.so.4 -> libobjc.so.4.0.0
> │   ├── libobjc.so.4.0.0
682c698
<     │   └── gcc-10.5.0
---
>     │   └── gcc-objc-10.5.0
697c713
< 34 directories, 661 files
---
> 35 directories, 676 files

$ du -sch /gnu/store/1p8hc8mrigismnndycwih2k2015v0z1q-gcc-objc-10.5.0-lib/lib/libobjc.*
164K    /gnu/store/1p8hc8mrigismnndycwih2k2015v0z1q-gcc-objc-10.5.0-lib/lib/libobjc.a
4.0K    /gnu/store/1p8hc8mrigismnndycwih2k2015v0z1q-gcc-objc-10.5.0-lib/lib/libobjc.la
4.0K    /gnu/store/1p8hc8mrigismnndycwih2k2015v0z1q-gcc-objc-10.5.0-lib/lib/libobjc.so
4.0K    /gnu/store/1p8hc8mrigismnndycwih2k2015v0z1q-gcc-objc-10.5.0-lib/lib/libobjc.so.4
92K     /gnu/store/1p8hc8mrigismnndycwih2k2015v0z1q-gcc-objc-10.5.0-lib/lib/libobjc.so.4.0.0
268K    total

---

 gnu/packages/gcc.scm | 109 ++++---------------------------------------
 1 file changed, 8 insertions(+), 101 deletions(-)

diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index e352cff5f9..e7dc79c00a 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -127,7 +127,7 @@ (define-public gcc-4.7
             (list 'quasiquote
                   (append
                    '("--enable-plugin"
-                     "--enable-languages=c,c++"
+                     "--enable-languages=c,c++,objc,obj-c++"
                      "--disable-multilib"
                      "--with-system-zlib"
 
@@ -377,6 +377,13 @@ (define-public gcc-4.7
                ;; Add 'include/c++' here so that <cstdlib>'s "#include_next
                ;; <stdlib.h>" finds GCC's <stdlib.h>, not libc's.
                (files '("include/c++" "include")))
+              ;; Also Objective-C and Objective-C++
+              (search-path-specification
+               (variable "OBJC_INCLUDE_PATH")
+               (files '("include")))
+              (search-path-specification
+               (variable "OBJCPLUS_INCLUDE_PATH")
+               (files '("include")))
               (search-path-specification
                (variable "LIBRARY_PATH")
                (files '("lib" "lib64")))))
@@ -1240,106 +1247,6 @@ (define-public gccgo-12
 (define-public gccgo-13
   (make-gccgo gcc-13))
 
-(define %objc-search-paths
-  (list (search-path-specification
-         (variable "OBJC_INCLUDE_PATH")
-         (files '("include")))
-        (search-path-specification
-         (variable "LIBRARY_PATH")
-         (files '("lib" "lib64")))))
-
-(define-public gcc-objc-4.8
-  (custom-gcc gcc-4.8 "gcc-objc" '("objc")
-              %objc-search-paths))
-
-(define-public gcc-objc-4.9
-  (custom-gcc gcc-4.9 "gcc-objc" '("objc")
-              %objc-search-paths))
-
-(define-public gcc-objc-5
-  (custom-gcc gcc-5 "gcc-objc" '("objc")
-              %objc-search-paths))
-
-(define-public gcc-objc-6
-  (custom-gcc gcc-6 "gcc-objc" '("objc")
-              %objc-search-paths))
-
-(define-public gcc-objc-7
-  (custom-gcc gcc-7 "gcc-objc" '("objc")
-              %objc-search-paths))
-
-(define-public gcc-objc-8
-  (custom-gcc gcc-8 "gcc-objc" '("objc")
-              %objc-search-paths))
-
-(define-public gcc-objc-9
-  (custom-gcc gcc-9 "gcc-objc" '("objc")
-              %objc-search-paths))
-
-(define-public gcc-objc-10
-  (custom-gcc gcc-10 "gcc-objc" '("objc")
-              %objc-search-paths))
-
-(define-public gcc-objc-11
-  (custom-gcc gcc-11 "gcc-objc" '("objc")
-              %objc-search-paths))
-
-(define-public gcc-objc-12
-  (custom-gcc gcc-12 "gcc-objc" '("objc")
-              %objc-search-paths))
-
-(define-public gcc-objc gcc-objc-11)
-
-(define %objc++-search-paths
-  (list (search-path-specification
-         (variable "OBJCPLUS_INCLUDE_PATH")
-         (files '("include")))
-        (search-path-specification
-         (variable "LIBRARY_PATH")
-         (files '("lib" "lib64")))))
-
-(define-public gcc-objc++-4.8
-  (custom-gcc gcc-4.8 "gcc-objc++" '("obj-c++")
-              %objc++-search-paths))
-
-(define-public gcc-objc++-4.9
-  (custom-gcc gcc-4.9 "gcc-objc++" '("obj-c++")
-              %objc++-search-paths))
-
-(define-public gcc-objc++-5
-  (custom-gcc gcc-5 "gcc-objc++" '("obj-c++")
-              %objc++-search-paths))
-
-(define-public gcc-objc++-6
-  (custom-gcc gcc-6 "gcc-objc++" '("obj-c++")
-              %objc++-search-paths))
-
-(define-public gcc-objc++-7
-  (custom-gcc gcc-7 "gcc-objc++" '("obj-c++")
-              %objc++-search-paths))
-
-(define-public gcc-objc++-8
-  (custom-gcc gcc-8 "gcc-objc++" '("obj-c++")
-              %objc++-search-paths))
-
-(define-public gcc-objc++-9
-  (custom-gcc gcc-9 "gcc-objc++" '("obj-c++")
-              %objc++-search-paths))
-
-(define-public gcc-objc++-10
-  (custom-gcc gcc-10 "gcc-objc++" '("obj-c++")
-              %objc++-search-paths))
-
-(define-public gcc-objc++-11
-  (custom-gcc gcc-11 "gcc-objc++" '("obj-c++")
-              %objc++-search-paths))
-
-(define-public gcc-objc++-12
-  (custom-gcc gcc-12 "gcc-objc++" '("obj-c++")
-              %objc++-search-paths))
-
-(define-public gcc-objc++ gcc-objc++-11)
-
 (define (make-libstdc++-doc gcc)
   "Return a package with the libstdc++ documentation for GCC."
   (package

base-commit: d52ee267ee8245a6edfcd137c73d20b036ec08d1
-- 
Efraim Flashner   <[email-masked]>   רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted