From 2bf8e1b1a36db47bd37dd428d7a376bd7f2e3044 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 12 Mar 2018 08:10:53 +0530 Subject: [PATCH] Allow the name of the lib directory in linux-package to be configurable. Fixes #372 --- linux-launcher.c | 2 +- setup.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/linux-launcher.c b/linux-launcher.c index b0bde136b..1c8497af0 100644 --- a/linux-launcher.c +++ b/linux-launcher.c @@ -94,7 +94,7 @@ int main(int argc, char *argv[]) { #ifdef FOR_LAUNCHER num = snprintf(lib, PATH_MAX, "%s%s", exe_dir, "/../Frameworks/kitty"); #else - num = snprintf(lib, PATH_MAX, "%s%s", exe_dir, "/../lib/kitty"); + num = snprintf(lib, PATH_MAX, "%s%s%s%s", exe_dir, "/../", LIB_DIR_NAME, "/kitty"); #endif #endif diff --git a/setup.py b/setup.py index 1aab8f96f..41ef8828f 100755 --- a/setup.py +++ b/setup.py @@ -485,6 +485,7 @@ def build_linux_launcher(args, launcher_dir='.', for_bundle=False, sh_launcher=F cflags.append('-DPYVER="{}"'.format(sysconfig.get_python_version())) elif sh_launcher: cflags.append('-DFOR_LAUNCHER') + cflags.append('-DLIB_DIR_NAME="{}"'.format(args.libdir_name.strip('/'))) pylib = get_python_flags(cflags) exe = 'kitty-profile' if args.profile else 'kitty' cflags += shlex.split(os.environ.get('CFLAGS', '')) @@ -498,7 +499,9 @@ def build_linux_launcher(args, launcher_dir='.', for_bundle=False, sh_launcher=F def package(args, for_bundle=False, sh_launcher=False): # {{{ ddir = args.prefix - libdir = os.path.join(ddir, 'lib', 'kitty') + if for_bundle or sh_launcher: + args.libdir_name = 'lib' + libdir = os.path.join(ddir, args.libdir_name.strip('/'), 'kitty') if os.path.exists(libdir): shutil.rmtree(libdir) os.makedirs(os.path.join(libdir, 'logo')) @@ -676,6 +679,11 @@ def option_parser(): action='store_true', help='Use the -pg compile flag to add profiling information' ) + p.add_argument( + '--libdir-name', + default='lib', + help='The name of the directory inside --prefix in which to store compiled files' + ) return p