[glib] Visual Studio builds: Improve flexibility of .pc generation
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Visual Studio builds: Improve flexibility of .pc generation
- Date: Wed, 15 Jun 2016 09:32:13 +0000 (UTC)
commit 39a22880b6d8544fec51ba3176214f38a8a572b8
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Wed Jun 15 17:30:24 2016 +0800
Visual Studio builds: Improve flexibility of .pc generation
Allow the use of shorthands using ${prefix} for exec_prefix, and
${exec_prefix} for includedir and libdir, which makes the generated .pc
files a bit cleaner and more flexible.
build/win32/pc_base.py | 39 +++++++++++++++++++++++++++++----------
1 files changed, 29 insertions(+), 10 deletions(-)
---
diff --git a/build/win32/pc_base.py b/build/win32/pc_base.py
index da10560..3ae8c49 100644
--- a/build/win32/pc_base.py
+++ b/build/win32/pc_base.py
@@ -54,11 +54,19 @@ class BasePCItems:
if getattr(args, 'exec_prefix', None) is None:
input_exec_prefix = args.prefix
else:
- input_exec_prefix = args.exec_prefix
- if not os.path.exists(input_exec_prefix):
- raise SystemExit('Specified exec-prefix \'%s\' is invalid' %
- input_exec_prefix)
-
+ if args.exec_prefix.startswith('${prefix}'):
+ exec_prefix_use_shorthand = True
+ input_exec_prefix = args.prefix + args.exec_prefix[len('${prefix}'):]
+ else:
+ exec_prefix_use_shorthand = False
+ input_exec_prefix = args.exec_prefix
+ if not os.path.exists(input_exec_prefix):
+ raise SystemExit('Specified exec_prefix \'%s\' is invalid' %
+ args.exec_prefix)
+ if exec_prefix_use_shorthand is True:
+ self.exec_prefix = args.exec_prefix.replace('\\','/')
+ else:
+ self.exec_prefix = os.path.abspath(input_exec_prefix).replace('\\','/')
# check and setup the includedir
if getattr(args, 'includedir', None) is None:
@@ -68,8 +76,12 @@ class BasePCItems:
includedir_use_shorthand = True
input_includedir = args.prefix + args.includedir[len('${prefix}'):]
else:
- includedir_use_shorthand = False
- input_includedir = args.includedir
+ if args.includedir.startswith('${exec_prefix}'):
+ includedir_use_shorthand = True
+ input_includedir = input_exec_prefix + args.includedir[len('${exec_prefix}'):]
+ else:
+ includedir_use_shorthand = False
+ input_includedir = args.includedir
if not os.path.exists(input_includedir):
raise SystemExit('Specified includedir \'%s\' is invalid' %
args.includedir)
@@ -86,8 +98,12 @@ class BasePCItems:
libdir_use_shorthand = True
input_libdir = args.prefix + args.libdir[len('${prefix}'):]
else:
- libdir_use_shorthand = False
- input_libdir = args.libdir
+ if args.libdir.startswith('${exec_prefix}'):
+ libdir_use_shorthand = True
+ input_libdir = input_exec_prefix + args.libdir[len('${exec_prefix}'):]
+ else:
+ libdir_use_shorthand = False
+ input_libdir = args.libdir
if not os.path.exists(input_libdir):
raise SystemExit('Specified libdir \'%s\' is invalid' %
args.libdir)
@@ -98,7 +114,10 @@ class BasePCItems:
# use absolute paths for prefix and exec_prefix
self.prefix = os.path.abspath(args.prefix).replace('\\','/')
- self.exec_prefix = os.path.abspath(input_exec_prefix).replace('\\','/')
+ if exec_prefix_use_shorthand is True:
+ self.exec_prefix = args.exec_prefix.replace('\\','/')
+ else:
+ self.exec_prefix = os.path.abspath(input_exec_prefix).replace('\\','/')
# setup dictionary for replacing items in *.pc.in
self.base_replace_items.update({'@VERSION@': self.version})
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]