libjansson: Update from 2.10 to 2.11
[termux-packages] / scripts / meson-android.patch
CommitLineData
490a9b18
FF
1diff -u -r /home/fornwall/.termux-build/json-glib/tmp/meson-0.44.0/mesonbuild/build.py ./mesonbuild/build.py
2--- /home/fornwall/.termux-build/json-glib/tmp/meson-0.44.0/mesonbuild/build.py 2017-12-10 14:37:19.000000000 +0100
3+++ ./mesonbuild/build.py 2018-01-21 20:32:18.294784968 +0100
08c55bda
FF
4@@ -22,7 +22,7 @@
5 from .mesonlib import File, MesonException, listify, extract_as_list
6 from .mesonlib import typeslistify, stringlistify, classify_unity_sources
f0c1439b 7 from .mesonlib import get_filenames_templates_dict, substitute_values
08c55bda
FF
8-from .mesonlib import for_windows, for_darwin, for_cygwin
9+from .mesonlib import for_windows, for_darwin, for_cygwin, for_android
f0c1439b
FF
10 from .compilers import is_object, clike_langs, sort_clike, lang_suffixes
11
12 known_basic_kwargs = {'install': True,
08c55bda 13@@ -1278,6 +1278,7 @@
f0c1439b
FF
14 if not hasattr(self, 'suffix'):
15 self.suffix = None
16 self.basic_filename_tpl = '{0.prefix}{0.name}.{0.suffix}'
17+ self.is_cross = is_cross
18 self.determine_filenames(is_cross, environment)
19
20 def determine_filenames(self, is_cross, env):
08c55bda 21@@ -1380,25 +1381,26 @@
f0c1439b
FF
22
23 def process_kwargs(self, kwargs, environment):
24 super().process_kwargs(kwargs, environment)
25- # Shared library version
26- if 'version' in kwargs:
27- self.ltversion = kwargs['version']
28- if not isinstance(self.ltversion, str):
29- raise InvalidArguments('Shared library version needs to be a string, not ' + type(self.ltversion).__name__)
30- if not re.fullmatch(r'[0-9]+(\.[0-9]+){0,2}', self.ltversion):
31- raise InvalidArguments('Invalid Shared library version "{0}". Must be of the form X.Y.Z where all three are numbers. Y and Z are optional.'.format(self.ltversion))
32- # Try to extract/deduce the soversion
33- if 'soversion' in kwargs:
34- self.soversion = kwargs['soversion']
35- if isinstance(self.soversion, int):
36- self.soversion = str(self.soversion)
37- if not isinstance(self.soversion, str):
38- raise InvalidArguments('Shared library soversion is not a string or integer.')
39- elif self.ltversion:
40- # library version is defined, get the soversion from that
41- # We replicate what Autotools does here and take the first
42- # number of the version by default.
43- self.soversion = self.ltversion.split('.')[0]
44+ if not for_android(self.is_cross, environment):
45+ # Shared library version
46+ if 'version' in kwargs:
47+ self.ltversion = kwargs['version']
48+ if not isinstance(self.ltversion, str):
49+ raise InvalidArguments('Shared library version needs to be a string, not ' + type(self.ltversion).__name__)
50+ if not re.fullmatch(r'[0-9]+(\.[0-9]+){0,2}', self.ltversion):
51+ raise InvalidArguments('Invalid Shared library version "{0}". Must be of the form X.Y.Z where all three are numbers. Y and Z are optional.'.format(self.ltversion))
52+ # Try to extract/deduce the soversion
53+ if 'soversion' in kwargs:
54+ self.soversion = kwargs['soversion']
55+ if isinstance(self.soversion, int):
56+ self.soversion = str(self.soversion)
57+ if not isinstance(self.soversion, str):
58+ raise InvalidArguments('Shared library soversion is not a string or integer.')
59+ elif self.ltversion:
60+ # library version is defined, get the soversion from that
61+ # We replicate what Autotools does here and take the first
62+ # number of the version by default.
63+ self.soversion = self.ltversion.split('.')[0]
64 # Visual Studio module-definitions file
65 if 'vs_module_defs' in kwargs:
66 path = kwargs['vs_module_defs']
490a9b18
FF
67diff -u -r /home/fornwall/.termux-build/json-glib/tmp/meson-0.44.0/mesonbuild/mesonlib.py ./mesonbuild/mesonlib.py
68--- /home/fornwall/.termux-build/json-glib/tmp/meson-0.44.0/mesonbuild/mesonlib.py 2017-12-10 14:37:19.000000000 +0100
69+++ ./mesonbuild/mesonlib.py 2018-01-21 20:33:57.597610548 +0100
08c55bda
FF
70@@ -245,6 +245,12 @@
71 def is_haiku():
72 return platform.system().lower() == 'haiku'
f0c1439b
FF
73
74+def is_android():
75+ import sysconfig
76+ # Taken from Lib/test/support/__init__.py of the python source:
77+ _ANDROID_API_LEVEL = sysconfig.get_config_var('ANDROID_API_LEVEL')
78+ return _ANDROID_API_LEVEL is not None and _ANDROID_API_LEVEL > 0
79+
80 def is_windows():
81 platname = platform.system().lower()
82 return platname == 'windows' or 'mingw' in platname
490a9b18
FF
83@@ -268,6 +274,18 @@
84 return env.cross_info.config['host_machine']['system'] == 'windows'
85 return False
86
87+def for_android(is_cross, env):
88+ """
89+ Host machine is Android?
90+
91+ Note: 'host' is the machine on which compiled binaries will run
92+ """
93+ if not is_cross:
94+ return mesonlib.is_android()
95+ elif env.cross_info.has_host():
96+ return env.cross_info.config['host_machine']['system'] == 'android'
97+ return False
98+
99 def for_cygwin(is_cross, env):
100 """
101 Host machine is cygwin?