| @@ -1,94 +1,190 @@ | | | @@ -1,94 +1,190 @@ |
1 | $NetBSD: patch-meson.build,v 1.8 2019/11/28 18:11:48 jperkin Exp $ | | 1 | $NetBSD: patch-meson.build,v 1.9 2020/02/07 17:05:14 prlw1 Exp $ |
2 | | | 2 | |
3 | - On Darwin, optionally use Cocoa (needed for X11 users). | | 3 | - On Darwin, optionally use Cocoa (needed for X11 users). |
4 | | | 4 | |
5 | - Don't insist that Python binary is called "python3". | | 5 | - Don't insist that Python binary is called "python3". |
6 | (Requires meson >= 0.50.0) | | 6 | (Requires meson >= 0.50.0) |
7 | | | 7 | |
8 | - Don't install bash completion scripts. | | 8 | - Don't install bash completion scripts. |
9 | | | 9 | |
10 | - Tolerate getxattr not existing (smartOS) | | 10 | - Tolerate getxattr not existing (smartOS) |
11 | https://gitlab.gnome.org/GNOME/glib/merge_requests/888 | | 11 | https://gitlab.gnome.org/GNOME/glib/merge_requests/888 |
12 | | | 12 | |
13 | - Define a newer POSIX, as we build this package with -std=gnu99 | | 13 | - Define a newer POSIX, as we build this package with -std=gnu99 |
14 | | | 14 | |
15 | --- meson.build.orig 2019-11-19 17:51:31.000000000 +0000 | | 15 | - Check size_t compatibility with various other types |
| | | 16 | commit 505c9544247f27cb6ebf749d0902d53c33dac308 |
| | | 17 | glib bug #1777 |
| | | 18 | c.f., PR pkg/54909 and PR pkg/54298 |
| | | 19 | |
| | | 20 | --- meson.build.orig 2020-02-07 11:23:09.221446856 +0000 |
16 | +++ meson.build | | 21 | +++ meson.build |
17 | @@ -5,7 +5,6 @@ project('glib', 'c', 'cpp', | | 22 | @@ -5,7 +5,6 @@ project('glib', 'c', 'cpp', |
18 | default_options : [ | | 23 | default_options : [ |
19 | 'buildtype=debugoptimized', | | 24 | 'buildtype=debugoptimized', |
20 | 'warning_level=1', | | 25 | 'warning_level=1', |
21 | - 'c_std=gnu89' | | 26 | - 'c_std=gnu89' |
22 | ] | | 27 | ] |
23 | ) | | 28 | ) |
24 | | | 29 | |
25 | @@ -677,6 +676,7 @@ if host_system == 'darwin' | | 30 | @@ -671,6 +670,7 @@ if host_system == 'darwin' |
26 | #error "Detected GNUstep, not Cocoa" | | 31 | #error "Detected GNUstep, not Cocoa" |
27 | #endif''', | | 32 | #endif''', |
28 | name : 'Mac OS X Cocoa support') | | 33 | name : 'Mac OS X Cocoa support') |
29 | + glib_have_cocoa = glib_have_cocoa and get_option('use_cocoa') | | 34 | + glib_have_cocoa = glib_have_cocoa and get_option('use_cocoa') |
30 | | | 35 | |
31 | if glib_have_cocoa | | 36 | if glib_have_cocoa |
32 | glib_conf.set('HAVE_COCOA', true) | | 37 | glib_conf.set('HAVE_COCOA', true) |
33 | @@ -1838,7 +1838,7 @@ endif | | 38 | @@ -1314,28 +1314,86 @@ else |
| | | 39 | glibconfig_conf.set('g_searchpath_separator', ':') |
| | | 40 | endif |
| | | 41 | |
| | | 42 | -if sizet_size == short_size |
| | | 43 | +g_sizet_compatibility = { |
| | | 44 | + 'short': sizet_size == short_size, |
| | | 45 | + 'int': sizet_size == int_size, |
| | | 46 | + 'long': sizet_size == long_size, |
| | | 47 | + 'long long': sizet_size == long_long_size, |
| | | 48 | +} |
| | | 49 | + |
| | | 50 | +# Do separate checks for gcc/clang (and ignore other compilers for now), since |
| | | 51 | +# we need to explicitly pass -Werror to the compilers. |
| | | 52 | +# FIXME: https://github.com/mesonbuild/meson/issues/5399 |
| | | 53 | +# We can’t simplify these checks using a foreach loop because dictionary keys |
| | | 54 | +# have to be string literals. |
| | | 55 | +# FIXME: https://github.com/mesonbuild/meson/issues/5231 |
| | | 56 | +if cc.get_id() == 'gcc' or cc.get_id() == 'clang' |
| | | 57 | + g_sizet_compatibility += { |
| | | 58 | + 'short': g_sizet_compatibility['short'] and cc.compiles( |
| | | 59 | + '''#include <stddef.h> |
| | | 60 | + size_t f (size_t *i) { return *i + 1; } |
| | | 61 | + int main (void) { |
| | | 62 | + unsigned short i = 0; |
| | | 63 | + f (&i); |
| | | 64 | + return 0; |
| | | 65 | + }''', |
| | | 66 | + args: ['-Werror'], |
| | | 67 | + name : 'GCC size_t typedef is short'), |
| | | 68 | + 'int': g_sizet_compatibility['int'] and cc.compiles( |
| | | 69 | + '''#include <stddef.h> |
| | | 70 | + size_t f (size_t *i) { return *i + 1; } |
| | | 71 | + int main (void) { |
| | | 72 | + unsigned int i = 0; |
| | | 73 | + f (&i); |
| | | 74 | + return 0; |
| | | 75 | + }''', |
| | | 76 | + args: ['-Werror'], |
| | | 77 | + name : 'GCC size_t typedef is int'), |
| | | 78 | + 'long': g_sizet_compatibility['long'] and cc.compiles( |
| | | 79 | + '''#include <stddef.h> |
| | | 80 | + size_t f (size_t *i) { return *i + 1; } |
| | | 81 | + int main (void) { |
| | | 82 | + unsigned long i = 0; |
| | | 83 | + f (&i); |
| | | 84 | + return 0; |
| | | 85 | + }''', |
| | | 86 | + args: ['-Werror'], |
| | | 87 | + name : 'GCC size_t typedef is long'), |
| | | 88 | + 'long long': g_sizet_compatibility['long long'] and cc.compiles( |
| | | 89 | + '''#include <stddef.h> |
| | | 90 | + size_t f (size_t *i) { return *i + 1; } |
| | | 91 | + int main (void) { |
| | | 92 | + unsigned long long i = 0; |
| | | 93 | + f (&i); |
| | | 94 | + return 0; |
| | | 95 | + }''', |
| | | 96 | + args: ['-Werror'], |
| | | 97 | + name : 'GCC size_t typedef is long long'), |
| | | 98 | + } |
| | | 99 | +endif |
| | | 100 | + |
| | | 101 | +if g_sizet_compatibility['short'] |
| | | 102 | glibconfig_conf.set('glib_size_type_define', 'short') |
| | | 103 | glibconfig_conf.set_quoted('gsize_modifier', 'h') |
| | | 104 | glibconfig_conf.set_quoted('gssize_modifier', 'h') |
| | | 105 | glibconfig_conf.set_quoted('gsize_format', 'hu') |
| | | 106 | glibconfig_conf.set_quoted('gssize_format', 'hi') |
| | | 107 | glibconfig_conf.set('glib_msize_type', 'SHRT') |
| | | 108 | -elif sizet_size == int_size |
| | | 109 | +elif g_sizet_compatibility['int'] |
| | | 110 | glibconfig_conf.set('glib_size_type_define', 'int') |
| | | 111 | glibconfig_conf.set_quoted('gsize_modifier', '') |
| | | 112 | glibconfig_conf.set_quoted('gssize_modifier', '') |
| | | 113 | glibconfig_conf.set_quoted('gsize_format', 'u') |
| | | 114 | glibconfig_conf.set_quoted('gssize_format', 'i') |
| | | 115 | glibconfig_conf.set('glib_msize_type', 'INT') |
| | | 116 | -elif sizet_size == long_size |
| | | 117 | +elif g_sizet_compatibility['long'] |
| | | 118 | glibconfig_conf.set('glib_size_type_define', 'long') |
| | | 119 | glibconfig_conf.set_quoted('gsize_modifier', 'l') |
| | | 120 | glibconfig_conf.set_quoted('gssize_modifier', 'l') |
| | | 121 | glibconfig_conf.set_quoted('gsize_format', 'lu') |
| | | 122 | glibconfig_conf.set_quoted('gssize_format', 'li') |
| | | 123 | glibconfig_conf.set('glib_msize_type', 'LONG') |
| | | 124 | -elif sizet_size == long_long_size |
| | | 125 | +elif g_sizet_compatibility['long long'] |
| | | 126 | glibconfig_conf.set('glib_size_type_define', 'long long') |
| | | 127 | glibconfig_conf.set_quoted('gsize_modifier', int64_m) |
| | | 128 | glibconfig_conf.set_quoted('gssize_modifier', int64_m) |
| | | 129 | @@ -1832,7 +1890,7 @@ endif |
34 | # proxy-libintl subproject. | | 130 | # proxy-libintl subproject. |
35 | # FIXME: glib-gettext.m4 has much more checks to detect broken/uncompatible | | 131 | # FIXME: glib-gettext.m4 has much more checks to detect broken/uncompatible |
36 | # implementations. This could be extended if issues are found in some platforms. | | 132 | # implementations. This could be extended if issues are found in some platforms. |
37 | -if cc.has_function('ngettext') | | 133 | -if cc.has_function('ngettext') |
38 | +if cc.has_function('ngettext') and host_system != 'sunos' | | 134 | +if cc.has_function('ngettext') and host_system != 'sunos' |
39 | libintl = [] | | 135 | libintl = [] |
40 | have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset') | | 136 | have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset') |
41 | else | | 137 | else |
42 | @@ -1889,16 +1889,15 @@ if host_system != 'windows' and get_opti | | 138 | @@ -1883,16 +1941,15 @@ if host_system != 'windows' and get_opti |
43 | if cc.has_function('getxattr') and cc.has_header('sys/xattr.h') | | 139 | if cc.has_function('getxattr') and cc.has_header('sys/xattr.h') |
44 | glib_conf.set('HAVE_SYS_XATTR_H', 1) | | 140 | glib_conf.set('HAVE_SYS_XATTR_H', 1) |
45 | glib_conf_prefix = glib_conf_prefix + '#define @0@ 1\n'.format('HAVE_SYS_XATTR_H') | | 141 | glib_conf_prefix = glib_conf_prefix + '#define @0@ 1\n'.format('HAVE_SYS_XATTR_H') |
46 | + glib_conf.set('HAVE_XATTR', 1) | | 142 | + glib_conf.set('HAVE_XATTR', 1) |
47 | #failure. try libattr | | 143 | #failure. try libattr |
48 | elif cc.has_header_symbol('attr/xattr.h', 'getxattr') | | 144 | elif cc.has_header_symbol('attr/xattr.h', 'getxattr') |
49 | glib_conf.set('HAVE_ATTR_XATTR_H', 1) | | 145 | glib_conf.set('HAVE_ATTR_XATTR_H', 1) |
50 | glib_conf_prefix = glib_conf_prefix + '#define @0@ 1\n'.format('HAVE_ATTR_XATTR_H') | | 146 | glib_conf_prefix = glib_conf_prefix + '#define @0@ 1\n'.format('HAVE_ATTR_XATTR_H') |
51 | xattr_dep = [cc.find_library('xattr')] | | 147 | xattr_dep = [cc.find_library('xattr')] |
52 | - else | | 148 | - else |
53 | - error('No getxattr implementation found in C library or libxattr') | | 149 | - error('No getxattr implementation found in C library or libxattr') |
54 | + glib_conf.set('HAVE_XATTR', 1) | | 150 | + glib_conf.set('HAVE_XATTR', 1) |
55 | endif | | 151 | endif |
56 | | | 152 | |
57 | - glib_conf.set('HAVE_XATTR', 1) | | 153 | - glib_conf.set('HAVE_XATTR', 1) |
58 | if cc.compiles(glib_conf_prefix + ''' | | 154 | if cc.compiles(glib_conf_prefix + ''' |
59 | #include <stdio.h> | | 155 | #include <stdio.h> |
60 | #ifdef HAVE_SYS_TYPES_H | | 156 | #ifdef HAVE_SYS_TYPES_H |
61 | @@ -1992,9 +1991,11 @@ endif | | 157 | @@ -1986,9 +2043,11 @@ endif |
62 | | | 158 | |
63 | glib_conf.set('HAVE_PROC_SELF_CMDLINE', have_proc_self_cmdline) | | 159 | glib_conf.set('HAVE_PROC_SELF_CMDLINE', have_proc_self_cmdline) |
64 | | | 160 | |
65 | -python = import('python').find_installation('python3') | | 161 | -python = import('python').find_installation('python3') |
66 | -# used for '#!/usr/bin/env <name>' | | 162 | -# used for '#!/usr/bin/env <name>' |
67 | -python_name = 'python3' | | 163 | -python_name = 'python3' |
68 | +python = import('python').find_installation('python3', required: false) | | 164 | +python = import('python').find_installation('python3', required: false) |
69 | +if not python.found() | | 165 | +if not python.found() |
70 | + python = import('python').find_installation() | | 166 | + python = import('python').find_installation() |
71 | +endif | | 167 | +endif |
72 | +python_name = python.path() | | 168 | +python_name = python.path() |
73 | | | 169 | |
74 | python_version = python.language_version() | | 170 | python_version = python.language_version() |
75 | python_version_req = '>=3.4' | | 171 | python_version_req = '>=3.4' |
76 | @@ -2003,7 +2004,7 @@ if not python_version.version_compare(py | | 172 | @@ -1997,7 +2056,7 @@ if not python_version.version_compare(py |
77 | endif | | 173 | endif |
78 | | | 174 | |
79 | # Determine which user environment-dependent files that we want to install | | 175 | # Determine which user environment-dependent files that we want to install |
80 | -have_bash = find_program('bash', required : false).found() # For completion scripts | | 176 | -have_bash = find_program('bash', required : false).found() # For completion scripts |
81 | +have_bash = false # For completion scripts | | 177 | +have_bash = false # For completion scripts |
82 | have_sh = find_program('sh', required : false).found() # For glib-gettextize | | 178 | have_sh = find_program('sh', required : false).found() # For glib-gettextize |
83 | | | 179 | |
84 | # Some installed tests require a custom environment | | 180 | # Some installed tests require a custom environment |
85 | @@ -2011,8 +2012,7 @@ env_program = find_program('env', requir | | 181 | @@ -2005,8 +2064,7 @@ env_program = find_program('env', requir |
86 | | | 182 | |
87 | # FIXME: How to detect Solaris? https://github.com/mesonbuild/meson/issues/1578 | | 183 | # FIXME: How to detect Solaris? https://github.com/mesonbuild/meson/issues/1578 |
88 | if host_system == 'sunos' | | 184 | if host_system == 'sunos' |
89 | - glib_conf.set('_XOPEN_SOURCE_EXTENDED', 1) | | 185 | - glib_conf.set('_XOPEN_SOURCE_EXTENDED', 1) |
90 | - glib_conf.set('_XOPEN_SOURCE', 2) | | 186 | - glib_conf.set('_XOPEN_SOURCE', 2) |
91 | + glib_conf.set('_POSIX_C_SOURCE',200809) | | 187 | + glib_conf.set('_POSIX_C_SOURCE',200809) |
92 | glib_conf.set('__EXTENSIONS__',1) | | 188 | glib_conf.set('__EXTENSIONS__',1) |
93 | endif | | 189 | endif |
94 | | | 190 | |