Ports: Add glib version 2.69.0

This commit is contained in:
Kenneth Myhra 2021-08-11 19:37:44 +02:00 committed by Linus Groh
parent cb10c62327
commit df176ca2d9
Notes: sideshowbarker 2024-07-18 05:43:01 +09:00
17 changed files with 562 additions and 0 deletions

View file

@ -45,6 +45,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^
| [`genemu`](genemu/) | Genesis / MegaDrive Emulator | 3bf6f7c | https://github.com/rasky/genemu |
| [`gettext`](gettext/) | GNU gettext | 0.21 | https://www.gnu.org/software/gettext/ |
| [`git`](git/) | Git | 2.31.1 | https://git-scm.com/ |
| [`glib`](glib/) | GLib | 2.69.0 | https://wiki.gnome.org/Projects/GLib |
| [`gmp`](gmp/) | GNU Multiple Precision Arithmetic Library (GMP) | 6.2.1 | https://gmplib.org/ |
| [`gnucobol`](gnucobol/) | GnuCOBOL | 3.1.2 | https://gnucobol.sourceforge.io/ |
| [`gnupg`](gnupg/) | GnuPG | 2.3.0 | https://gnupg.org/software/index.html |

View file

@ -0,0 +1,16 @@
[binaries]
c = 'i686-pc-serenity-gcc'
cpp = 'i686-pc-serenity-g++'
ar = 'i686-pc-serenity-ar'
ranlib = 'i686-pc-serenity-ranlib'
pkgconfig = 'pkg-config'
[properties]
sys_root = '../../../../Build/i686/Root'
needs_exe_wrapper = true
[host_machine]
system = 'serenity'
cpu_family = 'x86'
cpu = 'i686'
endian = 'little'

View file

@ -0,0 +1,16 @@
[binaries]
c = 'x86_64-pc-serenity-gcc'
cpp = 'x86_64-pc-serenity-g++'
ar = 'x86_64-pc-serenity-ar'
ranlib = 'x86_64-pc-serenity-ranlib'
pkgconfig = 'pkg-config'
[properties]
sys_root = '../../../../Build/x86_64/Root'
needs_exe_wrapper = true
[host_machine]
system = 'serenity'
cpu_family = 'x86'
cpu = 'x86_64'
endian = 'little'

20
Ports/glib/package.sh Executable file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env -S bash ../.port_include.sh
port=glib
version=2.69.0
depends="libiconv libffi zlib gettext"
useconfigure=true
configopts="--cross-file ../cross_file-$SERENITY_ARCH.txt"
files="https://gitlab.gnome.org/GNOME/glib/-/archive/2.69.0/glib-${version}.tar.gz glib-${version}.tar.gz 35af83aedf34b96f1e99ed9c995c50960509f504750fb4def2440a9406b00a95"
auth_type=sha256
configure() {
run meson _build $configopts
}
build() {
run ninja -C _build
}
install() {
run meson install -C _build --destdir $SERENITY_BUILD_DIR/Root
}

View file

@ -0,0 +1,49 @@
From d39946bd24a98fbcee4740f14ccd85ed75f312c6 Mon Sep 17 00:00:00 2001
From: Kenneth Myhra <kennethmyhra@gmail.com>
Date: Thu, 12 Aug 2021 20:29:32 +0200
Subject: [PATCH 01/12] meson.build: 'poll.h' is located at root, not
'sys/poll.h'
---
meson.build | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/meson.build b/meson.build
index 1b54fdc..6b22e98 100644
--- a/meson.build
+++ b/meson.build
@@ -1717,7 +1717,11 @@ g_have_gnuc_varargs = cc.compiles('''
if cc.has_header('alloca.h')
glibconfig_conf.set('GLIB_HAVE_ALLOCA_H', true)
endif
-has_syspoll = cc.has_header('sys/poll.h')
+if host_system == 'serenity'
+ has_syspoll = cc.has_header('poll.h')
+else
+ has_syspoll = cc.has_header('sys/poll.h')
+endif
has_systypes = cc.has_header('sys/types.h')
if has_syspoll
glibconfig_conf.set('GLIB_HAVE_SYS_POLL_H', true)
@@ -1725,9 +1729,15 @@ endif
has_winsock2 = cc.has_header('winsock2.h')
if has_syspoll and has_systypes
- poll_includes = '''
- #include<sys/poll.h>
- #include<sys/types.h>'''
+ if host_system == 'serenity'
+ poll_includes = '''
+ #include<poll.h>
+ #include<sys/types.h>'''
+ else
+ poll_includes = '''
+ #include<sys/poll.h>
+ #include<sys/types.h>'''
+ endif
elif has_winsock2
poll_includes = '''
#define _WIN32_WINNT @0@
--
2.25.1

View file

@ -0,0 +1,27 @@
From a88e13c5461e50ddcad4b8ebeae8d15cee64368b Mon Sep 17 00:00:00 2001
From: Kenneth Myhra <kennethmyhra@gmail.com>
Date: Thu, 12 Aug 2021 20:22:35 +0200
Subject: [PATCH 02/12] gio/meson.build: Use glib's in-built C_IN
Since we do not have C_IN and glib has functionality for providing it,
let glib provide it.
---
gio/meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gio/meson.build b/gio/meson.build
index 49a37a7..b4ba866 100644
--- a/gio/meson.build
+++ b/gio/meson.build
@@ -13,7 +13,7 @@ gnetworking_h_conf = configuration_data()
gnetworking_h_nameser_compat_include = ''
-if host_system not in ['windows', 'android']
+if host_system not in ['windows', 'android', 'serenity']
# Don't check for C_IN on Android since it does not define it in public
# headers, we define it ourselves wherever necessary
if not cc.compiles('''#include <sys/types.h>
--
2.25.1

View file

@ -0,0 +1,26 @@
From ba252fc514f8efa5af26fba2991caed73e2be771 Mon Sep 17 00:00:00 2001
From: Kenneth Myhra <kennethmyhra@gmail.com>
Date: Thu, 12 Aug 2021 20:25:48 +0200
Subject: [PATCH 03/12] gio/meson.build: Let glib know where our 'resolv.h' is
located
---
gio/meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gio/meson.build b/gio/meson.build
index b4ba866..849ea80 100644
--- a/gio/meson.build
+++ b/gio/meson.build
@@ -34,7 +34,7 @@ endif
network_libs = [ ]
network_args = [ ]
-if host_system != 'windows'
+if host_system not in ['windows', 'serenity']
# res_query()
res_query_test = '''#include <resolv.h>
int main (int argc, char ** argv) {
--
2.25.1

View file

@ -0,0 +1,26 @@
From 3bc52eef1086032e2c0379b3f86ce19760db818e Mon Sep 17 00:00:00 2001
From: Kenneth Myhra <kennethmyhra@gmail.com>
Date: Thu, 12 Aug 2021 20:33:11 +0200
Subject: [PATCH 04/12] meson.build: Disable IPV6 support
Serenity does not ahve IPV6 support so disable it
---
meson.build | 2 ++
1 file changed, 2 insertions(+)
diff --git a/meson.build b/meson.build
index f4025d8..d1745de 100644
--- a/meson.build
+++ b/meson.build
@@ -1789,6 +1789,8 @@ endforeach
if host_system == 'windows'
have_ipv6 = true
+elif host_system == 'serenity'
+ have_ipv6 = false
else
have_ipv6 = cc.has_type('struct in6_addr', prefix: '#include <netinet/in.h>')
endif
--
2.25.1

View file

@ -0,0 +1,31 @@
From 192e9481041cb925c6934f51b75f27aaf3421432 Mon Sep 17 00:00:00 2001
From: Kenneth Myhra <kennethmyhra@gmail.com>
Date: Thu, 12 Aug 2021 20:35:16 +0200
Subject: [PATCH 05/12] gio/ginetaddress.c: Serenity does not have
IN_MULTICAST, just return 0
Since Serenity does not have IN_MULTICAST we just return 0
---
gio/ginetaddress.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gio/ginetaddress.c b/gio/ginetaddress.c
index ada32f8..7a0a0c2 100644
--- a/gio/ginetaddress.c
+++ b/gio/ginetaddress.c
@@ -746,8 +746,11 @@ g_inet_address_get_is_multicast (GInetAddress *address)
if (address->priv->family == AF_INET)
{
guint32 addr4 = g_ntohl (address->priv->addr.ipv4.s_addr);
-
+#ifndef __serenity__
return IN_MULTICAST (addr4);
+#else
+ return 0;
+#endif
}
else
#ifdef HAVE_IPV6
--
2.25.1

View file

@ -0,0 +1,39 @@
From cadaea8b2c881bf4fcfa75a03fe07ae1addd4f43 Mon Sep 17 00:00:00 2001
From: Kenneth Myhra <kennethmyhra@gmail.com>
Date: Thu, 12 Aug 2021 20:38:51 +0200
Subject: [PATCH 06/12] gio/gio-tool-mount.c: Rename glib/gio mount function to
gio_mount
Somehow glib picks up on Serenity's mount function and gets confused
---
gio/gio-tool-mount.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/gio/gio-tool-mount.c b/gio/gio-tool-mount.c
index c624268..24723c5 100644
--- a/gio/gio-tool-mount.c
+++ b/gio/gio-tool-mount.c
@@ -330,7 +330,11 @@ new_mount_op (void)
static void
+#ifdef __serenity__
+gio_mount (GFile *file)
+#elif
mount (GFile *file)
+#endif
{
GMountOperation *op;
@@ -1241,7 +1245,7 @@ handle_mount (int argc, char *argv[], gboolean do_help)
else if (mount_eject)
eject (file);
else
- mount (file);
+ gio_mount (file);
g_object_unref (file);
}
}
--
2.25.1

View file

@ -0,0 +1,33 @@
From f228b35ce89f2ccf6d8c84a8a35c3e7279ddb424 Mon Sep 17 00:00:00 2001
From: Kenneth Myhra <kennethmyhra@gmail.com>
Date: Thu, 12 Aug 2021 20:51:13 +0200
Subject: [PATCH 08/12] gio/gsocketaddress.c: Add missing macro
IN6_IS_ADDR_V4MAPPED
---
gio/gsocketaddress.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/gio/gsocketaddress.c b/gio/gsocketaddress.c
index 2b7e83c..88d757c 100644
--- a/gio/gsocketaddress.c
+++ b/gio/gsocketaddress.c
@@ -39,6 +39,15 @@
#include "gunixsocketaddress.h"
#endif
+#ifndef IN6_IS_ADDR_V4MAPPED
+#define IN6_IS_ADDR_V4MAPPED(a) \
+((((a)->s6_addr[0]) == 0) && \
+(((a)->s6_addr[1]) == 0) && \
+(((a)->s6_addr[2]) == 0) && \
+(((a)->s6_addr[3]) == 0) && \
+(((a)->s6_addr[4]) == 0) && \
+(((a)->s6_addr[5]) == 0xFFFF))
+#endif
/**
* SECTION:gsocketaddress
--
2.25.1

View file

@ -0,0 +1,27 @@
From f4bbbbae7d502766e44c69f6c9286ef9ed0bf485 Mon Sep 17 00:00:00 2001
From: Kenneth Myhra <kennethmyhra@gmail.com>
Date: Thu, 12 Aug 2021 20:54:46 +0200
Subject: [PATCH 09/12] gio/gthredresolver.c: Need to include this section
Serenity is missing all that is defined in this section so let's
include it.
---
gio/gthreadedresolver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gio/gthreadedresolver.c b/gio/gthreadedresolver.c
index 93794b5..64c3b2e 100644
--- a/gio/gthreadedresolver.c
+++ b/gio/gthreadedresolver.c
@@ -394,7 +394,7 @@ lookup_by_address_finish (GResolver *resolver,
#if defined(G_OS_UNIX)
-#if defined __BIONIC__ && !defined BIND_4_COMPAT
+#if defined __serenity__ || defined __BIONIC__ && !defined BIND_4_COMPAT
/* Copy from bionic/libc/private/arpa_nameser_compat.h
* and bionic/libc/private/arpa_nameser.h */
typedef struct {
--
2.25.1

View file

@ -0,0 +1,31 @@
From 1fe4b3e57a1997dac79865b8b9790fae3597f175 Mon Sep 17 00:00:00 2001
From: Kenneth Myhra <kennethmyhra@gmail.com>
Date: Thu, 12 Aug 2021 20:56:26 +0200
Subject: [PATCH 10/12] gio/gthreadedresolver.c: Add stub for function
dn_expand.
Serenity is missing dn_expand so include a stub for it
---
gio/gthreadedresolver.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/gio/gthreadedresolver.c b/gio/gthreadedresolver.c
index 64c3b2e..ef709e0 100644
--- a/gio/gthreadedresolver.c
+++ b/gio/gthreadedresolver.c
@@ -462,6 +462,12 @@ typedef struct {
/* From bionic/libc/private/resolv_private.h */
int dn_expand(const u_char *, const u_char *, const u_char *, char *, int);
+#ifdef __serenity__
+int dn_expand(const u_char *, const u_char *, const u_char *, char *, int)
+{
+ return 0;
+}
+#endif
#define dn_skipname __dn_skipname
int dn_skipname(const u_char *, const u_char *);
--
2.25.1

View file

@ -0,0 +1,32 @@
From 821b33fbb3e93dfd3d43c98146a3399fd8ff1f41 Mon Sep 17 00:00:00 2001
From: Kenneth Myhra <kennethmyhra@gmail.com>
Date: Thu, 12 Aug 2021 20:59:25 +0200
Subject: [PATCH 11/12] gio/xdgmime/xdgmimecache.c: ntohl/ntohs is located in
'arpa/inet.h'
In Serenity ntohl/ntohs is located in arpa/inet.h, other stuff glib
needs is included in 'netinet/in.h'.
---
gio/xdgmime/xdgmimecache.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gio/xdgmime/xdgmimecache.c b/gio/xdgmime/xdgmimecache.c
index 769b578..625d8cc 100644
--- a/gio/xdgmime/xdgmimecache.c
+++ b/gio/xdgmime/xdgmimecache.c
@@ -34,7 +34,12 @@
#include <fnmatch.h>
#include <assert.h>
+#ifdef __serenity__
+#include <arpa/inet.h> /* for ntohl/ntohs */
+#include <netinet/in.h>
+#else
#include <netinet/in.h> /* for ntohl/ntohs */
+#endif
#ifdef HAVE_MMAP
#include <sys/mman.h>
--
2.25.1

View file

@ -0,0 +1,41 @@
From 5029cb921ae1420ef10d5ecb97d07ef9a9b5070a Mon Sep 17 00:00:00 2001
From: Kenneth Myhra <kennethmyhra@gmail.com>
Date: Thu, 12 Aug 2021 21:03:13 +0200
Subject: [PATCH 12/12] Include 'strings.h' for strcasecmp
---
glib/glib-init.c | 3 +++
glib/gstrfuncs.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/glib/glib-init.c b/glib/glib-init.c
index 2958fb5..ef49806 100644
--- a/glib/glib-init.c
+++ b/glib/glib-init.c
@@ -26,6 +26,9 @@
#include "gconstructor.h"
#include "gmem.h" /* for g_mem_gc_friendly */
+#ifdef __serenity__
+#include <strings.h>
+#endif
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c
index b6ff60f..670d1aa 100644
--- a/glib/gstrfuncs.c
+++ b/glib/gstrfuncs.c
@@ -32,6 +32,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
+#ifdef __serenity__
+#include <strings.h>
+#endif
#include <string.h>
#include <locale.h>
#include <errno.h>
--
2.25.1

View file

@ -0,0 +1,26 @@
From fb55058ea91d87802c696aa58bcaf97a6ff5b827 Mon Sep 17 00:00:00 2001
From: Kenneth Myhra <kennethmyhra@gmail.com>
Date: Fri, 13 Aug 2021 22:32:25 +0200
Subject: [PATCH 13/13] arpa/nameser.h is not needed, and Serenity do not have it at the moment.
---
gio/gnetworking.h.in | 2 ++
1 file changed, 2 insertions(+)
diff --git a/gio/gnetworking.h.in b/gio/gnetworking.h.in
index 2fa95ff..1d138cf 100644
--- a/gio/gnetworking.h.in
+++ b/gio/gnetworking.h.in
@@ -43,7 +43,9 @@
#include <net/if.h>
#include <arpa/inet.h>
+#ifndef __serenity__
#include <arpa/nameser.h>
+#endif
@NAMESER_COMPAT_INCLUDE@
#ifndef T_SRV
--
2.25.1

View file

@ -0,0 +1,121 @@
# Patches for glib (and submodules) on SerenityOS
## `0001-poll.h-is-located-at-root.patch`
glib includes poll.h from sys/poll.h, but our poll.h is located at root.
### Status
- [ ] Local?
- [X] Should be merged to upstream?
- [ ] Resolves issue(s) with our side of things
- [ ] Hack
## `0002-use-glib-in-built-C_IN.patch`
We do not have C_IN so use glib's in-built C_IN
### Status
- [X] Local?
- [ ] Should be merged to upstream?
- [X] Resolves issue(s) with our side of things
- [ ] Hack
## `0003-let-glib-know-where-our-resolv.h-is.patch`
Let glib's res_query_test know where our resolv.h is located.
### Status
- [ ] Local?
- [X] Should be merged to upstream?
- [ ] Resolves issue(s) with our side of things
- [ ] Hack
## `0004-disable-IPV6-support.patch`
Disable IPV6 support since we do not support that yet.
### Status
- [X] Local?
- [ ] Should be merged to upstream?
- [X] Resolves issue(s) with our side of things
- [ ] Hack
## `0005-serenity-does-not-have-IN_MULTICAST.patch`
Since Serenity does not have IN_MULTICAST we just return 0 instead of calling IN_MULTICAST.
### Status
- [ ] Local?
- [ ] Should be merged to upstream?
- [X] Resolves issue(s) with our side of things
- [X] Hack
## `0006-conflict-rename-gio-mount-function.patch`
Somehow we get a conflict with glib's mount function. This patch renames glib's mount function to gio_mount.
### Status
- [ ] Local?
- [ ] Should be merged to upstream?
- [X] Resolves issue(s) with our side of things
- [X] Hack
## `0008-add-missing-macro-IN6_IS_ADDR_V4MAPPED.patch`
Serenity lacks the macro 'IN6_IS_ADDR_V4MAPPED' so this patch adds such a macro.
### Status
- [ ] Local?
- [ ] Should be merged to upstream?
- [X] Resolves issue(s) with our side of things
- [X] Hack
## `0009-include-section-with-missing-functionality.patch`
This includes a bigger section with functionality that Serenity is missing.
### Status
- [ ] Local?
- [ ] Should be merged to upstream?
- [X] Resolves issue(s) with our side of things
- [ ] Hack
## `0010-stub-for-function-dn_expand.patch`
Adds a stub for the function dn_expand.
### Status
- [ ] Local?
- [ ] Should be merged to upstream?
- [X] Resolves issue(s) with our side of things
- [X] Hack
## `0011-ntohl-ntohs-located-in-arpa-inet.h.patch`
In Serenity ntohl/ntohs is located in arpa/inet.h, other stuff glib needs is included in 'netinet/in.h'.
### Status
- [ ] Local?
- [X] Should be merged to upstream?
- [X] Resolves issue(s) with our side of things
- [ ] Hack
## `0012-include-strings.h-for-strcasecmp.patch`
Include 'strings.h' for strcasecmp.
### Status
- [ ] Local?
- [X] Should be merged to upstream?
- [X] Resolves issue(s) with our side of things
- [ ] Hack
## `0013-nameser.h-is-not-needed.patch`
glib compiles fine without arpa/nameser.h so do not include since we do not yet support it.
### Status
- [ ] Local?
- [ ] Should be merged to upstream?
- [X] Resolves issue(s) with our side of things
- [X] Hack