[gjs/meson.msvc: 1/9] meson.build: Symlink gjs to gjs-console in a Python script
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/meson.msvc: 1/9] meson.build: Symlink gjs to gjs-console in a Python script
- Date: Fri, 25 Oct 2019 10:36:58 +0000 (UTC)
commit f95fa49f370bc6c875dc6fdb11c4b5e45261628f
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Fri Oct 25 13:06:00 2019 +0800
meson.build: Symlink gjs to gjs-console in a Python script
Doing so will enable that things run correctly on Windows/MSVC builds as
well. This will also enable to copy (instead of symlink)
gjs-console.exe on Windows as symlinks often require admin privileges on
Windows.
build/symlink-gjs.py | 23 +++++++++++++++++++++++
meson.build | 4 +---
2 files changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/build/symlink-gjs.py b/build/symlink-gjs.py
new file mode 100644
index 00000000..51465e31
--- /dev/null
+++ b/build/symlink-gjs.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+
+import os
+import shutil
+import subprocess
+import sys
+
+assert(len(sys.argv) == 2)
+
+destdir = os.environ.get('DESTDIR')
+install_prefix = os.environ.get('MESON_INSTALL_PREFIX')
+bindir = sys.argv[1]
+if destdir is not None:
+ installed_bin_dir = os.path.join(destdir, install_prefix, bindir)
+else:
+ installed_bin_dir = os.path.join(install_prefix, bindir)
+
+if os.name == 'nt':
+ # Using symlinks on Windows often require administrative privileges,
+ # which is not what we want. Instead, copy gjs-console.exe.
+ shutil.copyfile('gjs-console.exe', os.path.join(installed_bin_dir, 'gjs.exe'))
+else:
+ os.symlink('gjs-console', os.path.join(installed_bin_dir, 'gjs'))
diff --git a/meson.build b/meson.build
index 7263fbe3..a3578ea7 100644
--- a/meson.build
+++ b/meson.build
@@ -547,9 +547,7 @@ gjs_console = executable('gjs-console', gjs_console_srcs,
cpp_args: extra_libgjs_cpp_args,
dependencies: libgjs_dep, install: true)
-meson.add_install_script('sh', '-c',
- 'ln -sf gjs-console ${DESTDIR}/${MESON_INSTALL_PREFIX}/@0@/gjs'.format(
- get_option('bindir')))
+meson.add_install_script('build/symlink-gjs.py', get_option('bindir'))
### Install data files #########################################################
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]