forked from jralls/gtk-osx-build
-
Notifications
You must be signed in to change notification settings - Fork 2
/
jhbuildrc-gtk-osx
631 lines (530 loc) · 24.9 KB
/
jhbuildrc-gtk-osx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
# -*- mode: python -*-
#
# Copyright (C) 2006, 2007, 2008 Imendio AB
# Copyright 2009, 2010, 2011 John Ralls, Fremont, CA
#
# Default setup for building GTK+ on Mac OS X. Note that you should
# normally never need to edit this file. Any custom settings should be
# done in ~/.jhbuildrc-custom.
#
# Specific builds can be set up by creating files named
# ~/.jhbuildrc-<build>. When setting the environment variable JHB to
# such a name, the corresponding rc file will be read (e.g.:
# JHB=mybuild jhbuild shell).
#
# Use .jhbuildrc-custom to override the moduleset, modules to build,
# the source checkout location, installation prefix, or svn usernames
# etc.
#
# Please email [email protected] if you have suggestions for
# improving this setup, or have any patches that you would like to get
# included.
import sys
import errno
import re
#some variables we'll need defined later
_default_arch = ""
_osx_version = 0.0
_target = '10.11'
def _popen(cmd_arg):
from subprocess import Popen, PIPE
devnull = open('/dev/null')
cmd = Popen(cmd_arg, stdout=PIPE, stderr=devnull, shell=True)
retval = cmd.stdout.read().strip()
err = cmd.wait()
cmd.stdout.close()
devnull.close()
if err:
raise RuntimeError("Failed to close %s stream" % cmd_arg)
return retval.decode('utf-8')
# Register an extra command to get the checkout dir for a module.
#
import jhbuild
class _cmd_get_srcdir(jhbuild.commands.Command):
doc = 'Display information about one or more modules'
from jhbuild.errors import FatalError
name = 'gtk-osx-get-srcdir'
usage_args = 'module'
def run(self, config, options, args, help=None):
module_set = jhbuild.moduleset.load(config)
if args:
modname = args[0]
try:
module = module_set.get_module(modname, ignore_case = True)
except KeyError:
raise RuntimeError(_('unknown module %s') % modname)
print(module.get_srcdir(None))
else:
raise FatalError('no module specified')
jhbuild.commands.register_command(_cmd_get_srcdir)
class _cmd_bootstrap_gtk_osx(jhbuild.commands.base.cmd_build):
doc = 'Build buildsystem tools not provided by MacOS.'
name = 'bootstrap-gtk-osx'
def run(self, config, options, args, help=None):
global use_local_modulesets
moduleset="bootstrap"
modulesets_dir = os.path.join(os.path.dirname(os.path.dirname(config.moduleset)), 'modulesets-stable')
print(f"Modulests Dir: ${modulesets_dir}")
if (use_local_modulesets and
os.path.exists(os.path.join(modulesets_dir,
moduleset + '.modules'))):
config.modulesets_dir = modulesets_dir
config.moduleset = moduleset
elif (use_local_modulesets and config.modulesets_dir and
os.path.exists(os.path.join(config.modulesets_dir,
moduleset + '.modules'))):
config.moduleset = moduleset
else:
config.moduleset = 'https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/modulesets-stable/bootstrap.modules'
args = ['meta-bootstrap']
for item in options.skip:
config.skip += item.split(',')
options.skip = []
rc = jhbuild.commands.base.cmd_build.run(self, config, options, args)
return rc
jhbuild.commands.register_command(_cmd_bootstrap_gtk_osx)
class _getenv(jhbuild.commands.Command):
doc = "Retrieve an environment variable set within jhbuild"
name = "gtk-osx-getenv"
usage_args = 'envvar'
def run(self, config, options, args):
# module_set = jhbuild.moduleset.load(config)
if not args:
raise FatalError("No environment variable")
var = args[0]
if var not in os.environ:
raise FatalError("variable " + var + " not defined in jhbuild environment")
print(os.environ[var])
jhbuild.commands.register_command(_getenv)
# Determine the native system:
def osx_ver():
global _default_arch, _osx_version, _target
vstring = _popen("uname -r")
mstring = _popen("machine")
exp = re.compile(r'(\d+\.\d+)\.\d+')
vernum = exp.match(vstring)
_osx_version = float(vernum.group(1)) - 4.0
if _osx_version < 14.0:
print("Error: Mac OS X 10.14 or newer is required, exiting.")
raise SystemExit
if _osx_version < 16:
_target = '10.%d' % int(_osx_version)
else:
_target = '%d' % (_osx_version - 5)
_default_arch = _popen("uname -m")
# Determine the XCode Version:
def xcode_ver():
global conditions
devdir = _popen("xcode-select -p")
if devdir != "/Library/Developer/CommandLineTools":
ver = _popen("xcodebuild -version")
exp = re.compile(r'Xcode (\d+\.\d+)')
vernum = exp.match(ver)
if vernum:
_xcode_ver = float(vernum.group(1))
if _xcode_ver < 5.0:
raise EnvironmentError("Xcode Version %f is not supported; if you want to build with Xcode versions earlier than 5.0 checkout tag Last-Lion." % _xcode_ver)
if _xcode_ver < 10.0:
conditions.add('pre-Mavericks')
return _xcode_ver
else:
raise EnvironmentError("No suitable Xcode found. Xcode 5.0 or later is required.")
else: #Command-Line Tools instead of Xcode
ver_str = _popen("pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version*")
print("Found Command Line Tools '%s'" % ver_str)
exp = re.compile(r'version: (\d+\.\d+)')
vernum = exp.match(ver_str)
if vernum:
print("Command Line Tools version %f" % float(vernum.group(1)))
return float(vernum.group(1))
else:
return 8.0
# Some utitily functions used here and in custom files:
#
def environ_append(key, value, separator=' '):
old_value = os.environ.get(key)
if old_value is not None:
value = old_value + separator + value
os.environ[key] = value
def environ_prepend(key, value, separator=' '):
old_value = os.environ.get(key)
if old_value is not None:
value = value + separator + old_value
os.environ[key] = value
def environ_remove(key, value, separator=':'):
old_value = os.environ.get(key)
if old_value is not None:
old_value_split = old_value.split(separator)
value_split = [x for x in old_value_split if x != value]
value = separator.join(value_split)
os.environ[key] = value
def parse_custom_argument(key):
for i, arg in enumerate(sys.argv[:-1]):
if arg == key:
return sys.argv[i+1]
return None
def append_autogenargs(module, args):
old_value = module_autogenargs.get(module, autogenargs)
module_autogenargs[module] = old_value + " " + args
def remove_autogenargs(module, args):
arg_string = module_autogenargs.get(module, autogenargs)
module_autogenargs[module] = arg_string.replace(args, "")
# Call either setup_debug or setup_release in your .jhbuildrc-custom
# or other customization file to get the compilation flags.
def setup_debug():
global autogenargs
# The enable-debug option generally turns on ASSERTS, which can slow
# down code and in the case of WebKit, breaks it on OSX because of
# threading problems. It's better to set it for individual packages
# with append_autogenargs().
# autogenargs = autogenargs + " --enable-debug=yes"
# Gtk+ crashes in gdk_window_quartz_raise() -- in a call to [NSWindow
# orderFront:] if clang is passed -O0 for 64-bit compilation. The old
# stabs+ debug format also doesn't work. See Snow Leopard in the Wiki
# for more information about debugging.
environ_prepend('CFLAGS', "-O0 -g")
environ_prepend('CXXFLAGS', "-O0 -g")
environ_prepend('OBJCFLAGS', "-O0 -g")
def setup_release():
environ_prepend('CFLAGS', "-O2")
environ_prepend('CXXFLAGS', "-O2")
environ_prepend('OBJCFLAGS', "-O2")
# Set up the environment for building against particular SDK.
#
#We call osx_ver() here so that we can set up _default_arch for setup_sdk
osx_ver()
#
# This is the workhorse of the setup. Call this function from
# .jhbuildrc-custom to configure compile and link flags. Optionally
# specify a minimum MacOS version (10.11, 10.12, 10.13, etc.) and a list
# of architectures.
#
# The sdk_version does nothing, as since Xcode 5 it is preferred to
# build with the SDK that goes with the selected Xcode or command-line
# tools, which we retrieve via xcrun. sdk_version remains in the
# setup_sdk signature to prevent breaking existing jhbuildrc-customs.
#
# For most users accepting the defaults is the right course.
def setup_sdk(target=_target, sdk_version=None, architectures=[_default_arch]):
global use_local_modulesets, conditions
os.environ["MACOSX_DEPLOYMENT_TARGET"] = target
sdkdir = None
xcodepath = None
xcodeversion = xcode_ver()
sdkdir = _popen("xcrun --show-sdk-path")
if sdkdir:
environ_prepend("CMAKE_PREFIX_PATH", os.path.join(sdkdir, 'usr'), ':')
environ_prepend("LIBRARY_PATH", sdkdir + "/usr/lib", ':')
# It's often necessary to look for things in the SDK when
# developing, and it takes a lot of typing, so define a
# convenience environment variable:
environ_append('SDKDIR', sdkdir)
os.environ["SDKROOT"] = sdkdir
# Apple Documentation says that "-syslibroot" is the arg to pass to the
# linker, but we are using the compiler to control the linker, and
# everything seems to be working correctly.
environ_append("CFLAGS", "-isysroot " + sdkdir)
environ_append("CPPFLAGS", "-isysroot " + sdkdir)
environ_append("CXXFLAGS", "-isysroot " + sdkdir)
environ_append("OBJCFLAGS", "-isysroot " + sdkdir)
environ_append("LDFLAGS", "-isysroot " + sdkdir)
# To pick up cups-config from the right place.
os.environ["CUPS_CONFIG"] = os.path.join(sdkdir, "usr/bin/cups-config")
if architectures == ["i386"]:
# The '#' on openssl is to stop jhbuild from appending any more autogen
# arguments such as --disable-Werror; they cause openssl to error out
append_autogenargs("openssl", "darwin-i386-cc #")
elif architectures == ["x86_64"]:
conditions.add('64-bit')
append_autogenargs("glib", "ac_cv_c_bigendian=no")
append_autogenargs("openssl", "darwin64-x86_64-cc #")
elif architectures == ["arm64"]:
conditions.add('64-bit')
conditions.add('arm64')
append_autogenargs("glib", "ac_cv_c_bigendian=no")
append_autogenargs("openssl", "darwin64-arm64-cc #") # Not a legal value
elif len(set(architectures) - {"i386", "x86_64", 'arm64'}) > 0:
raise EnvironmentError("Only architectures i386, x86_64, and arm64 are supported.")
if len(set(architectures)) > 1:
print("WARNING: Universal builds are neither prohibited nor supported. It might work, but if it doesn't you're on your own.")
# For unknown reasons, iconv is not picked up correctly without this
#
cc = _popen("xcrun -f clang")
cxx = _popen("xcrun -f clang++")
ld = _popen("xcrun -f ld")
os.environ["CC"] = cc
os.environ["OBJC"] = cc
os.environ["CXX"] = cxx
os.environ['LD'] = ld
# Set the -arch flags for everything we're building.
#
for arch in architectures:
environ_prepend("CFLAGS", "-arch " + arch)
environ_prepend("CXXFLAGS", "-arch " + arch)
environ_prepend("CPPFLAGS", "-arch " + arch)
environ_prepend("OBJCFLAGS", "-arch " + arch)
environ_prepend("LDFLAGS", "-arch " + arch)
# For intel, set glib's build parameter so that it builds the
# correct atomic asm functions
#
if architectures == ["i386"]:
append_autogenargs("glib", "--build=i486-apple-darwin")
append_autogenargs("gmp", "ABI=32")
append_autogenargs("liboil", "--host=i486-apple-darwin")
append_autogenargs("gnutls", "--host=i486-apple-darwin")
elif architectures == ["x86_64"]:
append_autogenargs("glib", "--build=x86_64-apple-darwin")
append_autogenargs("gmp", "--host=x86_64-apple-darwin ABI=64")
append_autogenargs("liboil", "--host=x86_64-apple-darwin")
append_autogenargs("gnutls", "--host=x86_64-apple-darwin")
elif architectures == ["arm64"]:
append_autogenargs("glib", "--build=aarch64-apple-darwin")
append_autogenargs("gmp", "--host=aarch64-apple-darwin ABI=64")
append_autogenargs("liboil", "--host=aarch64-apple-darwin")
append_autogenargs("libffi", "--host=aarch64-apple-darwin")
if not sdkdir:
sdkdir = '/'
# gettext-fw rebuilds gettext with an in-tree libiconv to get
# around the Apple-provided one not defining _libiconv_init for
# x86_64
append_autogenargs("gettext", "--with-libiconv-prefix=" + prefix)
environ_append("CFLAGS", "-mmacosx-version-min=" + target)
environ_append("CXXFLAGS", "-mmacosx-version-min=" + target)
environ_append("OBJCFLAGS", "-mmacosx-version-min=" + target)
environ_append("LDFLAGS", "-mmacosx-version-min=" + target)
#Overcome Python's obnoxious misconfiguration of portable builds
if len(architectures) == 1:
os.environ["BUILDCFLAGS"] = os.environ["CFLAGS"]
append_autogenargs("gnutls", '--disable-guile CXXFLAGS="$CXXFLAGS -std=c++11"')
append_autogenargs("guile", 'CFLAGS="$CFLAGS -O1"')
#Some packages require special arguments or flags to compile with Clang:
append_autogenargs('libgcrypt', 'CFLAGS="$CFLAGS -fheinous-gnu-extensions"')
module_makeargs['liboil'] = 'CFLAGS="$CFLAGS -DHAVE_SYMBOL_UNDERSCORE -fheinous-gnu-extensions"'
# openssl doesn't understand DESTDIR, but luckily it has its own mechanism.
module_extra_env['openssl'] = {'INSTALL_PREFIX': os.path.join(prefix, '_jhbuild', 'root-openssl')}
# GMP deliberately attempts to use CC_FOR_BUILD with no separate
# cflags so we need to force it:
module_extra_env['gmp'] = {'CC_FOR_BUILD':os.environ['CC'] + ' ' + os.environ['CFLAGS']}
# Kill a couple of noisy warnings for webkit1:
module_extra_env["webkit"] = {'CPPFLAGS':os.environ['CPPFLAGS'] + " -Wno-unused-local-typedef -Wno-missing-field-initializsers"}
module_extra_env["webkit1gtk3"] = {'CPPFLAGS':os.environ['CPPFLAGS'] + " -Wno-unused-local-typedef -Wno-missing-field-initializsers -Wno-undefined-bool-conversion"}
module_extra_env["webkit"] = {'CXXFLAGS':os.environ['CXXFLAGS'] + ' -Wno-inconsistent-missing-override'}
module_extra_env["webkit1gtk3"] = {'CXXFLAGS':os.environ['CXXFLAGS'] + ' -Wno-inconsistent-missing-override'}
# Finally when building normally we need to force CFLAGS_FOR_BUILD
# to our current CFLAGS so that everything will link with other
# build products. Note that this will generally break
# cross-compilation, not that it works anyway.
os.environ['CFLAGS_FOR_BUILD'] = os.environ['CFLAGS']
# Make sure we don't link against XQuartz whose freetype-config is on PATH
# when XQuartz is installed by removing it from PATH
environ_remove('PATH', '/opt/X11/bin')
return sdkdir
###### End Function Definitions #######
##### The following configuration can be overridden in custom files ######
# Moduleset to use. You can override this in .jhbuildrc-custom or on
# the command line.
#
moduleset = 'http://gitlab.gnome.org/GNOME/gtk-osx/raw/master/modulesets-stable/gtk-osx.modules'
use_local_modulesets = False
modulesets_dir = ""
# A list of the modules to build. You can override this in
# .jhbuildrc-custom or on the command line.
#
modules = [ 'meta-gtk-osx-bootstrap', 'meta-gtk-osx-gtk3' ]
# A list of modules to skip.
#
# Source and installation locations.
#
_root = os.path.expanduser("~/gtk")
checkoutroot = os.path.join(_root, "source")
prefix = os.path.join(_root, "inst")
_exec_prefix = None
tarballdir = None
# Extra arguments to pass to all autogen.sh scripts.
#
autogenargs=''
# Extra meson args. --wrapmode=nofallback prevents meson projects from
# building dependencies on their own. We generally want failed
# dependencies to error out so that we know to add them to the
# appropriate modules.
mesonargs='--wrap-mode=nofallback'
# Use the included install-check program if available. It won't update
# timestamps if the header hasn't changed, which speeds up builds.
#
_path = os.path.expanduser('~/.local/bin/install-check')
if os.path.exists(_path):
os.environ['INSTALL'] = _path
_gtk_osx_prompt_prefix = "JH"
_gtk_osx_default_build = ""
#print "Default Architecture %s\n" % _default_arch
###### Import Customizations ######
# Import optional user RC for further customization. You can override
# the prefix or default build setup for example, or CFLAGS or
# module_autogenargs, etc.
#
_this_dir = os.path.dirname(__file__);
_home = os.path.expanduser('~')
_user_config_dir = os.environ.get('XDG_CONFIG_HOME',
os.path.join(_home, '.config'))
_user_rc = ''
if ('JHBUILDRC_CUSTOM' in os.environ and
os.environ['JHBUILDRC_CUSTOM']):
_user_rc = os.environ['JHBUILDRC_CUSTOM']
if not os.path.exists(_user_rc):
_user_rc = os.path.join(_this_dir, 'jhbuildrc-custom');
if not os.path.exists(_user_rc):
_user_rc = os.path.join(_this_dir, '.jhbuildrc-custom')
if not os.path.exists(_user_rc):
_user_rc = os.path.join(_user_config_dir, 'jhbuildrc-custom')
if not os.path.exists(_user_rc):
_user_rc = os.path.join(_user_config_dir, '.jhbuildrc-custom')
if not os.path.exists(_user_rc):
_user_rc = os.path.join(_home, 'jhbuildrc-custom')
if not os.path.exists(_user_rc):
_user_rc = os.path.join(_home, '.jhbuildrc-custom')
if os.path.exists(_user_rc):
exec(compile(open(_user_rc, "rb").read(), _user_rc, 'exec'))
# Allow including different variants depending on the environment
# variable JHB. This can be used to have different setups for SDK
# builds, for example.
#
_build = os.environ.get('JHB', _gtk_osx_default_build)
disable_Werror = False
###### Everything Below Uses (and Overrides) customizations! #######
# jhbuild turns on 'nice' by default ut that messes up some of the
# custom autogen-templates Gtk-OSX needs to use:"
nice_build = False
# Harfbuzz needs to be built twice, once before cairo and again after
# gobject-introspection because cairo needs harfbuzz and
# gobject-introspection needs cairo. The only way to get jhbuild to
# run the configuration for harfbuzz the second time is to set
# alwaysautogen to true.
alwaysautogen = True
# Freetype2 if left to itself will create an install name without the
# path so none of the libraries that depend on it can link. Require
# the install name to be an absolute path.
module_cmakeargs["freetype"] = '-DCMAKE_INSTALL_NAME_DIR="' + os.path.join(prefix, 'lib') + '"'
module_cmakeargs["freetype-no-harfbuzz"] = '-DCMAKE_INSTALL_NAME_DIR="' + os.path.join(prefix, 'lib') + '"'
module_cmakeargs["webkit2gtk3"] = '-DCMAKE_INSTALL_NAME_DIR="' + os.path.join(prefix, 'lib') + '"'
module_cmakeargs["zlib"] = '-DCMAKE_INSTALL_NAME_DIR="' + os.path.join(prefix, 'lib') + '"'
# Check and warn if jhbuild is started from within jhbuild, since that
# will mess up environment variables, especially if different build
# setups are used.
#
_old_prefix = os.environ.get('JHBUILD_PREFIX', "")
_old_build = os.environ.get('JHBUILD_CONFIG', "")
_ran_recursively = _old_prefix != ""
if _ran_recursively:
if _old_build != _build:
print("Error: jhbuild is already running with a different build setup, exiting.")
raise SystemExit
print("Warning: jhbuild is started from within a jhbuild session.")
if _build != "":
try:
exec(compile(open(os.path.join(os.environ['HOME'], '.jhbuildrc-' + _build), "rb").read(), os.path.join(os.environ['HOME'], '.jhbuildrc-' + _build), 'exec'))
except EnvironmentError as e:
print("Couldn't find the file '.jhbuildrc-" + _build + "', exiting.")
raise SystemExit
# The following parameters were set to None at the top of the file;
# they're set here to their default values after processing the
# customizations, but tested to make sure that if they've been
# customized, it will stick.
# Default location for tarball download is into checkoutroot/pkgs. If
# you do multiple builds with different checkoutroots, you'll want to
# override this to somewhere common (~/.local/pkgs is one alternative)
if tarballdir == None:
tarballdir = os.path.join(checkoutroot, 'pkgs')
# _exec_prefix is used to set $M4 and $LIBTOOLIZE. We set it here to
# prefix if it wasn't over-ridden in .jhbuildrc-custom
if _exec_prefix == None:
_exec_prefix = prefix
os.environ['PREFIX'] = prefix # Deprecated, please move to JHBUILD_PREFIX.
os.environ['JHBUILD_PREFIX'] = prefix
os.environ['JHBUILD_SOURCE'] = checkoutroot
# Some packages go off and find /usr/lib/gm4, which is broken Note the
# use of _exec_prefix here. By default it's prefix, but you can
# override it to somewhere else in jhbuildrc-custom if you like.
#os.environ["M4"] = _exec_prefix + "/bin/m4"
#os.environ['LIBTOOLIZE'] = _exec_prefix + '/bin/libtoolize'
#Some autogens detect that it's a Mac and use glibtoolize if it's
#available. Override this behavior.
if not ("LIBTOOLIZE" in os.environ and os.environ["LIBTOOLIZE"]):
environ_append('LIBTOOLIZE', os.path.join(prefix, "bin", "libtoolize"))
# The option "headerpad_max_install_names" is there to leave some room for
# changing the library locations with install_name_tool. Note that GNU
# libtool seems to drop the option if we don't use -W here.
#
environ_append('LDFLAGS', '-Wl,-headerpad_max_install_names')
#environ_append('LDFLAGS', '-Wl,-no_weak_imports')
# Make sure we find our installed modules, and before other versions.
environ_prepend('LDFLAGS', '-L' + prefix + '/lib')
environ_prepend('CPPFLAGS', '-I' + prefix + '/include')
# Make sure that ltdl can find our libraries
addpath("LTDL_LIBRARY_PATH", prefix + "/lib")
# Add additional Perl paths so that our modules can be found.
prependpath('PERL5LIB', prefix + '/lib/perl5/vendor_perl')
prependpath('PERL5LIB', prefix + '/lib/perl5/site_perl')
# Point gtk-doc and other xsltproc users to our XML catalog.
#
_pfx_cat_file = os.path.join(prefix, 'share', 'xml', 'catalog')
if not os.path.exists(_pfx_cat_file):
os.makedirs(os.path.dirname(_pfx_cat_file))
open(_pfx_cat_file, "w").close()
if 'XML_CATALOG_FILES' in os.environ:
# os.environ['XML_CATALOG_FILES'] += ':' + _pfx_cat_file
pass
else:
os.environ['XML_CATALOG_FILES'] = _pfx_cat_file
#GConf needs to be built static, overriding the generic autogenargs,
#but including it in the module puts it in front of where autogenargs
#puts --disable-static, so we need the override here.
#
append_autogenargs("gconf", "--enable-static")
if _build:
if "shell" in sys.argv:
print("Build setup: %s, prefix: %s" % (_build, prefix))
os.environ["JHBUILD_CONFIG"] = _build
else:
if "shell" in sys.argv:
print("Prefix: %s" % (prefix))
if not _ran_recursively and _gtk_osx_prompt_prefix:
os.environ["JHBUILD_PROMPT"] = "[" + _gtk_osx_prompt_prefix + "] "
# We want libxml2 to install its python module in $PREFIX even if
# we're not building python because if it tries to install in the
# virtenv site-packages jhbuild will refuse to install it. Ideally
# we'd do this only if not building python because if we do then it
# finds the right place and does the right thing.
# Unfortunately there's no way to get the config object from the
# project to find out if we're building python3. We test the modules
# list here but that's not really reliable because python3 might be
# pulled in as a dependency by another module.
# Note that this will break if there's an undetected python3 build and
# the built python is a different major + minor version from the
# virtenv one.
# Note that PYENV_VERSION sets the version of python that pyenv uses,
# not pyenv's own version. It's defined by pyenv and can't be changed.
_python3_path = os.path.join(prefix, 'bin', 'python3')
if ('python3' in modules or 'pygments' in modules or
'meta-gtk-osx-python3' in modules or os.path.exists(_python3_path)):
os.environ['PYTHON'] = _python3_path
else:
_python_ver = str(sys.version_info.major) + '.' + str(sys.version_info.minor)
_python_install_path = os.path.join(prefix, 'lib', 'python' + _python_ver,
'site-packages')
append_autogenargs('libxml2',
'--with-python-install-dir=' + _python_install_path)
environ_append('PYTHONPATH', _python_install_path, ':')
_python_library_path = os.path.join(os.environ['PYENV_ROOT'], 'versions',
os.environ['PYENV_VERSION'], 'lib')
environ_append('LDFLAGS', '-L' + _python_library_path)
os.environ['PYTHON'] = sys.executable
environ_append('PKG_CONFIG_PATH', os.path.join(_python_library_path, 'pkgconfig'), ":")
module_extra_env["python3"] = {'LIBS':'-lintl'}
module_extra_env["spidermonkey"] = {'AUTOCONF':'autoconf'}
module_extra_env["harfbuzz-no-cairo"] = {"CXXFLAGS":"-std=c++17"}
module_extra_env["harfbuzz"] = {"CXXFLAGS":"-std=c++17"}
# Unset this so we don't mess with the check for not starting
# recursively.
os.unsetenv("JHB")
if "shell" in sys.argv:
print("Entered jhbuild shell, type 'exit' to return.")