diff --git a/bypy/macos/__main__.py b/bypy/macos/__main__.py index fa2792a4b8..cb42452f53 100644 --- a/bypy/macos/__main__.py +++ b/bypy/macos/__main__.py @@ -646,6 +646,7 @@ class Freeze(object): base_dir = base_dir or self.contents_dir cc_dir = join(base_dir, name, 'Contents') exe_dir = join(cc_dir, 'MacOS') + rel_path = os.path.relpath(join(self.contents_dir, 'MacOS'), exe_dir) os.makedirs(exe_dir) for x in os.listdir(self.contents_dir): if x.endswith('.app'): @@ -662,7 +663,10 @@ class Freeze(object): plist['CFBundleExecutable'] = exe + '-placeholder-for-codesigning' nexe = join(exe_dir, plist['CFBundleExecutable']) base = os.path.dirname(abspath(__file__)) - cmd = [gcc, '-Wall', '-Werror', '-DEXE_NAME="%s"' % exe, join(base, 'placeholder.c'), '-o', nexe, '-headerpad_max_install_names'] + cmd = [ + gcc, '-Wall', '-Werror', '-DEXE_NAME="%s"' % exe, '-DREL_PATH="%s"' % rel_path, + join(base, 'placeholder.c'), '-o', nexe, '-headerpad_max_install_names' + ] subprocess.check_call(cmd) with open(join(cc_dir, x), 'wb') as p: plistlib.dump(plist, p) diff --git a/bypy/macos/placeholder.c b/bypy/macos/placeholder.c index 79a3f981ae..9ad1426a81 100644 --- a/bypy/macos/placeholder.c +++ b/bypy/macos/placeholder.c @@ -36,6 +36,6 @@ main(int argc, char * const *argv, const char **envp) { return 1; } *(t + 1) = 0; - snprintf(t + 1, sizeof(realpath_buf) - strlen(path), "%s", EXE_NAME); + snprintf(t + 1, sizeof(realpath_buf) - strlen(path), "%s/%s", REL_PATH, EXE_NAME); execv(path, argv); }