mirror of https://github.com/microsoft/vcpkg.git
61 lines
2.6 KiB
Diff
61 lines
2.6 KiB
Diff
diff --git a/tools/g-ir-tool-template.in b/tools/g-ir-tool-template.in
|
|
index 648c9ab..b5e3568 100755
|
|
--- a/tools/g-ir-tool-template.in
|
|
+++ b/tools/g-ir-tool-template.in
|
|
@@ -1,4 +1,4 @@
|
|
-#!@PYTHON_CMD@
|
|
+#!/usr/bin/env python3
|
|
# -*- Mode: Python -*-
|
|
# GObject-Introspection - a framework for introspecting GObject libraries
|
|
# Copyright (C) 2008 Johan Dahlin
|
|
@@ -46,22 +46,20 @@ if debug:
|
|
filedir = os.path.dirname(__file__)
|
|
|
|
# Try using relative paths first so that the installation prefix is relocatable
|
|
-datadir = os.path.abspath(os.path.join(filedir, '..', 'share'))
|
|
+datadir = os.path.abspath(os.path.join(filedir, '..', '..', 'share'))
|
|
# Fallback to hard-coded paths if the relocatable paths are wrong
|
|
+datadir = os.getenv('VCPKG_GI_DATADIR', datadir)
|
|
if not os.path.isdir(os.path.join(datadir, 'gir-1.0')):
|
|
- datadir = "@datarootdir@"
|
|
+ raise Exception('Failed to determine datadir')
|
|
|
|
builtins.__dict__['DATADIR'] = datadir
|
|
|
|
-gir_dir = os.path.abspath(os.path.join(filedir, '..', '@gir_dir_prefix@', 'gir-1.0'))
|
|
-# Fallback to hard-coded paths if the relocatable paths are wrong
|
|
-if not os.path.isdir(gir_dir):
|
|
- gir_dir = "@GIR_DIR@"
|
|
+gir_dir = os.path.abspath(os.path.join(datadir, 'gir-1.0'))
|
|
|
|
builtins.__dict__['GIR_DIR'] = gir_dir
|
|
|
|
# Again, relative paths first so that the installation prefix is relocatable
|
|
-pylibdir = os.path.abspath(os.path.join(filedir, '..', 'lib', 'gobject-introspection'))
|
|
+pylibdir = os.path.abspath(os.path.join(filedir, '..', '..', 'lib', 'gobject-introspection'))
|
|
|
|
# EXT_SUFFIX for py3 SO for py2
|
|
py_mod_suffix = sysconfig.get_config_var('EXT_SUFFIX') or sysconfig.get_config_var('SO')
|
|
@@ -90,12 +88,18 @@ if not os.path.isfile(os.path.join(pylibdir, 'giscanner', '_giscanner' + py_mod_
|
|
if os.path.isfile(gdump_path):
|
|
builtins.__dict__['GDUMP_PATH'] = gdump_path
|
|
else:
|
|
- # Okay, we're not running uninstalled and the prefix is not
|
|
- # relocatable. Use hard-coded libdir.
|
|
- pylibdir = os.path.join('@libdir@', 'gobject-introspection')
|
|
+ raise Exception('Could not determine pylibdir')
|
|
|
|
sys.path.insert(0, pylibdir)
|
|
|
|
+vcpkg_gi_lib_path = os.getenv('VCPKG_GI_LIBDIR', None)
|
|
+vcpkg_gi_lib_path_var = os.getenv('VCPKG_GI_LIBDIR_VAR', None)
|
|
+if vcpkg_gi_lib_path_var is not None and vcpkg_gi_lib_path is not None:
|
|
+ ld_lib_path = os.getenv(vcpkg_gi_lib_path_var, '')
|
|
+ if ld_lib_path != '':
|
|
+ ld_lib_path = os.pathsep + ld_lib_path
|
|
+ os.environ[vcpkg_gi_lib_path_var] = vcpkg_gi_lib_path + ld_lib_path
|
|
+
|
|
from giscanner.utils import dll_dirs
|
|
dll_dirs = dll_dirs()
|
|
dll_dirs.add_dll_dirs(['gio-2.0'])
|