This commit is contained in:
Kovid Goyal 2024-08-13 20:45:17 +05:30
commit 67bb8299c6
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -59,7 +59,7 @@ def compile_launcher_lib(contents_dir, gcc, base, pyver, inc_dir):
dest = join(contents_dir, 'Frameworks', 'calibre-launcher.dylib') dest = join(contents_dir, 'Frameworks', 'calibre-launcher.dylib')
src = join(base, 'util.c') src = join(base, 'util.c')
cmd = [gcc] + ARCH_FLAGS + '-Wall -dynamiclib -std=gnu99'.split() + [src] + \ cmd = [gcc] + ARCH_FLAGS + CFLAGS + '-Wall -dynamiclib -std=gnu99'.split() + [src] + \
['-I' + base] + '-DPY_VERSION_MAJOR={} -DPY_VERSION_MINOR={}'.format(*pyver.split('.')).split() + \ ['-I' + base] + '-DPY_VERSION_MAJOR={} -DPY_VERSION_MINOR={}'.format(*pyver.split('.')).split() + \
[f'-I{path_to_freeze_dir()}', f'-I{inc_dir}'] + \ [f'-I{path_to_freeze_dir()}', f'-I{inc_dir}'] + \
[f'-DENV_VARS={env}', f'-DENV_VAR_VALS={env_vals}'] + \ [f'-DENV_VARS={env}', f'-DENV_VAR_VALS={env_vals}'] + \
@ -82,6 +82,7 @@ def compile_launcher_lib(contents_dir, gcc, base, pyver, inc_dir):
gcc = os.environ.get('CC', 'clang') gcc = os.environ.get('CC', 'clang')
CFLAGS = os.environ.get('CFLAGS', '-Os')
def compile_launchers(contents_dir, inc_dir, xprograms, pyver): def compile_launchers(contents_dir, inc_dir, xprograms, pyver):
@ -95,7 +96,7 @@ def compile_launchers(contents_dir, inc_dir, xprograms, pyver):
out = join(contents_dir, 'MacOS', program) out = join(contents_dir, 'MacOS', program)
programs.append(out) programs.append(out)
is_gui = 'true' if ptype == 'gui' else 'false' is_gui = 'true' if ptype == 'gui' else 'false'
cmd = [gcc] + ARCH_FLAGS + [ cmd = [gcc] + ARCH_FLAGS + CFLAGS + [
'-Wall', f'-DPROGRAM=L"{program}"', f'-DMODULE=L"{module}"', f'-DFUNCTION=L"{func}"', f'-DIS_GUI={is_gui}', '-Wall', f'-DPROGRAM=L"{program}"', f'-DMODULE=L"{module}"', f'-DFUNCTION=L"{func}"', f'-DIS_GUI={is_gui}',
'-I' + base, src, lib, '-o', out, '-headerpad_max_install_names', '-I' + base, src, lib, '-o', out, '-headerpad_max_install_names',
] ]
@ -707,7 +708,7 @@ class Freeze:
plist['CFBundleExecutable'] = exe + '-placeholder-for-codesigning' plist['CFBundleExecutable'] = exe + '-placeholder-for-codesigning'
nexe = join(exe_dir, plist['CFBundleExecutable']) nexe = join(exe_dir, plist['CFBundleExecutable'])
base = os.path.dirname(abspath(__file__)) base = os.path.dirname(abspath(__file__))
cmd = [gcc] + ARCH_FLAGS + [ cmd = [gcc] + ARCH_FLAGS + CFLAGS + [
'-Wall', '-Werror', '-DEXE_NAME="%s"' % exe, '-DREL_PATH="%s"' % rel_path, '-Wall', '-Werror', '-DEXE_NAME="%s"' % exe, '-DREL_PATH="%s"' % rel_path,
join(base, 'placeholder.c'), '-o', nexe, '-headerpad_max_install_names' join(base, 'placeholder.c'), '-o', nexe, '-headerpad_max_install_names'
] ]