Build binaries for Linux ARM64

This commit is contained in:
Kovid Goyal 2021-12-10 12:47:34 +05:30
parent a4cd10c6fb
commit a938b01246
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
5 changed files with 29 additions and 11 deletions

View File

@ -19,7 +19,11 @@ from bypy.freeze import (
from bypy.utils import get_dll_path, mkdtemp, py_compile, walk
j = os.path.join
arch = 'x86_64' if is64bit else 'i686'
machine = (os.uname()[4] or '').lower()
if machine.startswith('arm64') or machine.startswith('aarch64'):
arch = 'arm64'
else:
arch = 'x86_64' if is64bit else 'i686'
self_dir = os.path.dirname(os.path.abspath(__file__))
py_ver = '.'.join(map(str, python_major_minor_version()))
iv = globals()['init_env']

View File

@ -20,10 +20,16 @@ import tempfile
py3 = sys.version_info[0] > 2
is64bit = platform.architecture()[0] == '64bit'
is_macos = 'darwin' in sys.platform.lower()
is_linux_arm = is_linux_arm64 = False
if is_macos:
mac_ver = tuple(map(int, platform.mac_ver()[0].split('.')))
if mac_ver[:2] < (10, 12):
raise SystemExit('Your version of macOS is too old, at least 10.12 is required')
else:
machine = (os.uname()[4] or '').lower()
if machine.startswith('arm') or machine.startswith('aarch64'):
is_linux_arm = True
is_linux_arm64 = machine.startswith('arm64') or machine.startswith('aarch64')
try:
__file__
@ -92,7 +98,8 @@ def get_release_data(relname='latest'):
else:
if name.endswith('.txz'):
if is64bit:
if name.endswith('-x86_64.txz'):
q = '-arm64.txz' if is_linux_arm64 else '-x86_64.txz'
if name.endswith(q):
return html_url + '/' + name, asset['size']
else:
if name.endswith('-i686.txz'):
@ -186,11 +193,10 @@ def main(dest=None, launch=True, installer=None):
dest = '/Applications'
else:
dest = os.path.expanduser('~/.local')
machine = os.uname()[4]
if not is_macos and machine and machine.lower().startswith('arm'):
if is_linux_arm and not is_linux_arm64:
raise SystemExit(
'You are running on an ARM system. The kitty binaries are only'
' available for x86 systems. You will have to build from'
'You are running on a 32-bit ARM system. The kitty binaries are only'
' available for 64 bit ARM systems. You will have to build from'
' source.')
if not installer:
url, size = get_release_data()

View File

@ -47,10 +47,16 @@ import tempfile
py3 = sys.version_info[0] > 2
is64bit = platform.architecture()[0] == '64bit'
is_macos = 'darwin' in sys.platform.lower()
is_linux_arm = is_linux_arm64 = False
if is_macos:
mac_ver = tuple(map(int, platform.mac_ver()[0].split('.')))
if mac_ver[:2] < (10, 12):
raise SystemExit('Your version of macOS is too old, at least 10.12 is required')
else:
machine = (os.uname()[4] or '').lower()
if machine.startswith('arm') or machine.startswith('aarch64'):
is_linux_arm = True
is_linux_arm64 = machine.startswith('arm64') or machine.startswith('aarch64')
try:
__file__
@ -119,7 +125,8 @@ def get_release_data(relname='latest'):
else:
if name.endswith('.txz'):
if is64bit:
if name.endswith('-x86_64.txz'):
q = '-arm64.txz' if is_linux_arm64 else '-x86_64.txz'
if name.endswith(q):
return html_url + '/' + name, asset['size']
else:
if name.endswith('-i686.txz'):
@ -213,11 +220,10 @@ def main(dest=None, launch=True, installer=None):
dest = '/Applications'
else:
dest = os.path.expanduser('~/.local')
machine = os.uname()[4]
if not is_macos and machine and machine.lower().startswith('arm'):
if is_linux_arm and not is_linux_arm64:
raise SystemExit(
'You are running on an ARM system. The kitty binaries are only'
' available for x86 systems. You will have to build from'
'You are running on a 32-bit ARM system. The kitty binaries are only'
' available for 64 bit ARM systems. You will have to build from'
' source.')
if not installer:
url, size = get_release_data()

View File

@ -373,6 +373,7 @@ def files_for_upload() -> Dict[str, str]:
'macos/dist/kitty-{}.dmg': 'macOS dmg',
'linux/64/dist/kitty-{}-x86_64.txz': 'Linux amd64 binary bundle',
'linux/32/dist/kitty-{}-i686.txz': 'Linux x86 binary bundle',
'linux/arm64/dist/kitty-{}-arm64.txz': 'Linux arm64 binary bundle',
}.items():
path = os.path.join('bypy', 'b', f.format(version))
if not os.path.exists(path):

View File

@ -1438,6 +1438,7 @@ def main() -> None:
subprocess.check_call(cmd + ['linux'] + dest)
subprocess.check_call(cmd + ['macos'] + dest)
subprocess.check_call(cmd + ['linux', '32'] + dest)
subprocess.check_call(cmd + ['linux', 'arm64'] + dest)
if __name__ == '__main__':