Fix CI build failure on macOS

Also update simde to version 0.8. Accidental was using it to debug
issues with building against simde, but now that it's done, keep it.
This commit is contained in:
Kovid Goyal 2024-04-30 08:08:07 +05:30
parent 4858716ca0
commit 8183e9d3ef
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 18 additions and 9 deletions

View File

@ -69,7 +69,7 @@ def install_deps():
import ssl
if ssl.OPENSSL_VERSION_INFO[0] == 1:
openssl += '@1.1'
run('brew', 'install', 'fish', 'simde', openssl, *items)
run('brew', 'install', 'fish', openssl, *items)
else:
run('sudo apt-get update')
run('sudo apt-get install -y libgl1-mesa-dev libxi-dev libxrandr-dev libxinerama-dev ca-certificates'

View File

@ -1,6 +1,7 @@
brew "pkg-config"
brew "zlib"
brew "xxhash"
brew "simde"
brew "python"
brew "imagemagick"
brew "harfbuzz"

View File

@ -253,9 +253,9 @@
{
"name": "simde",
"unix": {
"filename": "simde-amalgamated-0.7.6.tar.xz",
"hash": "sha256:703eac1f2af7de1f7e4aea2286130b98e1addcc0559426e78304c92e2b4eb5e1",
"urls": ["https://github.com/simd-everywhere/simde/releases/download/v0.7.6/{filename}"]
"filename": "simde-amalgamated-0.8.0.tar.xz",
"hash": "sha256:7c8dd4d613b18724b7ef3dcd1d58739a91501ed80ace916cbca9b8c13e5b92bb",
"urls": ["https://github.com/simd-everywhere/simde/releases/download/v0.8.0/{filename}"]
}
},

View File

@ -267,11 +267,15 @@ def libcrypto_flags() -> Tuple[List[str], List[str]]:
openssl_dirs = glob.glob(f'/opt/homebrew/{q}') + glob.glob(f'/usr/local/{q}')
if openssl_dirs:
break
if not openssl_dirs:
else:
raise SystemExit(f'Failed to find OpenSSL version {v[0]}.{v[1]} on your system')
extra_pc_dir = os.pathsep.join(openssl_dirs)
cflags = pkg_config('libcrypto', '--cflags-only-I', extra_pc_dir=extra_pc_dir)
return cflags, pkg_config('libcrypto', '--libs', extra_pc_dir=extra_pc_dir)
ldflags = pkg_config('libcrypto', '--libs', extra_pc_dir=extra_pc_dir)
# Workaround bug in homebrew openssl package. This bug appears in CI only
if is_macos and ldflags and 'homebrew/Cellar' in ldflags[0] and not ldflags[0].endswith('/lib'):
ldflags.insert(0, ldflags[0] + '/lib')
return cflags, ldflags
def at_least_version(package: str, major: int, minor: int = 0) -> None:
@ -593,16 +597,20 @@ def kitty_env(args: Options) -> Env:
ans = env.copy()
cflags = ans.cflags
cflags.append('-pthread')
cppflags = ans.cppflags
# We add 4000 to the primary version because vim turns on SGR mouse mode
# automatically if this version is high enough
libcrypto_cflags, libcrypto_ldflags = libcrypto_flags()
cppflags = ans.cppflags
cppflags.append(f'-DPRIMARY_VERSION={version[0] + 4000}')
cppflags.append(f'-DSECONDARY_VERSION={version[1]}')
cppflags.append('-DXT_VERSION="{}"'.format('.'.join(map(str, version))))
at_least_version('harfbuzz', 1, 5)
cflags.extend(pkg_config('libpng', '--cflags-only-I'))
cflags.extend(pkg_config('lcms2', '--cflags-only-I'))
# simde doesnt come with pkg-config files but some Linux distros add
# them and on macOS when building with homebrew it is required
with suppress(SystemExit, subprocess.CalledProcessError):
cflags.extend(pkg_config('simde', '--cflags-only-I', fatal=False))
libcrypto_cflags, libcrypto_ldflags = libcrypto_flags()
cflags.extend(libcrypto_cflags)
if is_macos:
platform_libs = [
@ -969,7 +977,7 @@ def files(
files('transfer', 'rsync', libraries=pkg_config('libxxhash', '--libs'), includes=pkg_config('libxxhash', '--cflags-only-I')),
):
final_env = kenv.copy()
final_env.cflags.extend(f'-I{x}' for x in includes)
final_env.cflags.extend(includes)
final_env.ldpaths[:0] = list(libraries)
compile_c_extension(
final_env, dest, args.compilation_database, sources, all_headers + ['kitty/data-types.h'], build_dsym=args.build_dsym)