@@ -1,4 +1,4 @@
-$NetBSD: patch-meson.build,v 1.8 2019/11/28 18:11:48 jperkin Exp $
+$NetBSD: patch-meson.build,v 1.9 2020/02/07 17:05:14 prlw1 Exp $
- On Darwin, optionally use Cocoa (needed for X11 users).
@@ -12,7 +12,12 @@
- Define a newer POSIX, as we build this package with -std=gnu99
---- meson.build.orig 2019-11-19 17:51:31.000000000 +0000
+- Check size_t compatibility with various other types
+ commit 505c9544247f27cb6ebf749d0902d53c33dac308
+ glib bug #1777
+ c.f., PR pkg/54909 and PR pkg/54298
+
+--- meson.build.orig 2020-02-07 11:23:09.221446856 +0000
+++ meson.build
@@ -5,7 +5,6 @@ project('glib', 'c', 'cpp',
default_options : [
@@ -22,7 +27,7 @@
]
)
-@@ -677,6 +676,7 @@ if host_system == 'darwin'
+@@ -671,6 +670,7 @@ if host_system == 'darwin'
#error "Detected GNUstep, not Cocoa"
#endif''',
name : 'Mac OS X Cocoa support')
@@ -30,7 +35,98 @@
if glib_have_cocoa
glib_conf.set('HAVE_COCOA', true)
-@@ -1838,7 +1838,7 @@ endif
+@@ -1314,28 +1314,86 @@ else
+ glibconfig_conf.set('g_searchpath_separator', ':')
+ endif
+
+-if sizet_size == short_size
++g_sizet_compatibility = {
++ 'short': sizet_size == short_size,
++ 'int': sizet_size == int_size,
++ 'long': sizet_size == long_size,
++ 'long long': sizet_size == long_long_size,
++}
++
++# Do separate checks for gcc/clang (and ignore other compilers for now), since
++# we need to explicitly pass -Werror to the compilers.
++# FIXME: https://github.com/mesonbuild/meson/issues/5399
++# We can’t simplify these checks using a foreach loop because dictionary keys
++# have to be string literals.
++# FIXME: https://github.com/mesonbuild/meson/issues/5231
++if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
++ g_sizet_compatibility += {
++ 'short': g_sizet_compatibility['short'] and cc.compiles(
++ '''#include <stddef.h>
++ size_t f (size_t *i) { return *i + 1; }
++ int main (void) {
++ unsigned short i = 0;
++ f (&i);
++ return 0;
++ }''',
++ args: ['-Werror'],
++ name : 'GCC size_t typedef is short'),
++ 'int': g_sizet_compatibility['int'] and cc.compiles(
++ '''#include <stddef.h>
++ size_t f (size_t *i) { return *i + 1; }
++ int main (void) {
++ unsigned int i = 0;
++ f (&i);
++ return 0;
++ }''',
++ args: ['-Werror'],
++ name : 'GCC size_t typedef is int'),
++ 'long': g_sizet_compatibility['long'] and cc.compiles(
++ '''#include <stddef.h>
++ size_t f (size_t *i) { return *i + 1; }
++ int main (void) {
++ unsigned long i = 0;
++ f (&i);
++ return 0;
++ }''',
++ args: ['-Werror'],
++ name : 'GCC size_t typedef is long'),
++ 'long long': g_sizet_compatibility['long long'] and cc.compiles(
++ '''#include <stddef.h>
++ size_t f (size_t *i) { return *i + 1; }
++ int main (void) {
++ unsigned long long i = 0;
++ f (&i);
++ return 0;
++ }''',
++ args: ['-Werror'],
++ name : 'GCC size_t typedef is long long'),
++ }
++endif
++
++if g_sizet_compatibility['short']
+ glibconfig_conf.set('glib_size_type_define', 'short')
+ glibconfig_conf.set_quoted('gsize_modifier', 'h')
+ glibconfig_conf.set_quoted('gssize_modifier', 'h')
+ glibconfig_conf.set_quoted('gsize_format', 'hu')
+ glibconfig_conf.set_quoted('gssize_format', 'hi')
+ glibconfig_conf.set('glib_msize_type', 'SHRT')
+-elif sizet_size == int_size
++elif g_sizet_compatibility['int']
+ glibconfig_conf.set('glib_size_type_define', 'int')
+ glibconfig_conf.set_quoted('gsize_modifier', '')
+ glibconfig_conf.set_quoted('gssize_modifier', '')
+ glibconfig_conf.set_quoted('gsize_format', 'u')
+ glibconfig_conf.set_quoted('gssize_format', 'i')
+ glibconfig_conf.set('glib_msize_type', 'INT')
+-elif sizet_size == long_size
++elif g_sizet_compatibility['long']
+ glibconfig_conf.set('glib_size_type_define', 'long')
+ glibconfig_conf.set_quoted('gsize_modifier', 'l')
+ glibconfig_conf.set_quoted('gssize_modifier', 'l')
+ glibconfig_conf.set_quoted('gsize_format', 'lu')
+ glibconfig_conf.set_quoted('gssize_format', 'li')
+ glibconfig_conf.set('glib_msize_type', 'LONG')
+-elif sizet_size == long_long_size
++elif g_sizet_compatibility['long long']
+ glibconfig_conf.set('glib_size_type_define', 'long long')
+ glibconfig_conf.set_quoted('gsize_modifier', int64_m)
+ glibconfig_conf.set_quoted('gssize_modifier', int64_m)
+@@ -1832,7 +1890,7 @@ endif
# proxy-libintl subproject.
# FIXME: glib-gettext.m4 has much more checks to detect broken/uncompatible
# implementations. This could be extended if issues are found in some platforms.
@@ -39,7 +135,7 @@
libintl = []
have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset')
else
-@@ -1889,16 +1889,15 @@ if host_system != 'windows' and get_opti
+@@ -1883,16 +1941,15 @@ if host_system != 'windows' and get_opti
if cc.has_function('getxattr') and cc.has_header('sys/xattr.h')
glib_conf.set('HAVE_SYS_XATTR_H', 1)
glib_conf_prefix = glib_conf_prefix + '#define @0@ 1\n'.format('HAVE_SYS_XATTR_H')
@@ -58,7 +154,7 @@
if cc.compiles(glib_conf_prefix + '''
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
-@@ -1992,9 +1991,11 @@ endif
+@@ -1986,9 +2043,11 @@ endif
glib_conf.set('HAVE_PROC_SELF_CMDLINE', have_proc_self_cmdline)
@@ -73,7 +169,7 @@
python_version = python.language_version()
python_version_req = '>=3.4'
-@@ -2003,7 +2004,7 @@ if not python_version.version_compare(py
+@@ -1997,7 +2056,7 @@ if not python_version.version_compare(py
endif
# Determine which user environment-dependent files that we want to install
@@ -82,7 +178,7 @@
have_sh = find_program('sh', required : false).found() # For glib-gettextize
# Some installed tests require a custom environment
-@@ -2011,8 +2012,7 @@ env_program = find_program('env', requir
+@@ -2005,8 +2064,7 @@ env_program = find_program('env', requir
# FIXME: How to detect Solaris? https://github.com/mesonbuild/meson/issues/1578
if host_system == 'sunos'