Skip to content

Commit

Permalink
Add support to build AppImages on ARM
Browse files Browse the repository at this point in the history
  • Loading branch information
rmartin16 committed Dec 7, 2023
1 parent 13551e5 commit 220dd47
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 11 deletions.
1 change: 1 addition & 0 deletions changes/1564.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
AppImages can now be built for the ARM architecture.
2 changes: 1 addition & 1 deletion docs/reference/platforms/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Platform support
+---------+-----------------+--------+-------+-----+--------+-------+-----+--------+-----+-------+
| iOS | |iOS|_ | |f| | |y| | | | | | | | |
+---------+-----------------+--------+-------+-----+--------+-------+-----+--------+-----+-------+
| Linux | |AppImage|_ | |v| | | | | | |v| | |v| | | |
| Linux | |AppImage|_ | |v| | |v| | | | | |v| | |v| | |v| | |v| |
+ +-----------------+--------+-------+-----+--------+-------+-----+--------+-----+-------+
| | |Flatpak|_ | | | | | | |v| | |f| | |v| | |v| |
+ +-----------------+--------+-------+-----+--------+-------+-----+--------+-----+-------+
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/platforms/linux/appimage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ AppImage
+--------+-------+-----+--------+-------+-----+--------+-----+-------+
| x86‑64 | arm64 | x86 | x86‑64 | arm64 | x86 | x86‑64 | arm | arm64 |
+========+=======+=====+========+=======+=====+========+=====+=======+
| |v| | | | | | |v| | |v| | | |
| |v| | |v| | | | | |v| | |v| | |v| | |v| |
+--------+-------+-----+--------+-------+-----+--------+-----+-------+

.. admonition:: Best effort support
Expand Down
2 changes: 1 addition & 1 deletion src/briefcase/bootstraps/pursuedpybear.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def pyproject_table_linux_system_arch(self):

def pyproject_table_linux_appimage(self):
return """
manylinux = "manylinux2014"
manylinux = "manylinux_2_28"
system_requires = [
# ?? FIXME
Expand Down
2 changes: 1 addition & 1 deletion src/briefcase/bootstraps/pygame.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def pyproject_table_linux_system_arch(self):

def pyproject_table_linux_appimage(self):
return """
manylinux = "manylinux2014"
manylinux = "manylinux_2_28"
system_requires = [
]
Expand Down
2 changes: 1 addition & 1 deletion src/briefcase/bootstraps/toga.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def pyproject_table_linux_system_arch(self):

def pyproject_table_linux_appimage(self):
return """
manylinux = "manylinux2014"
manylinux = "manylinux_2_28"
system_requires = [
# Needed to compile pycairo wheel
Expand Down
3 changes: 3 additions & 0 deletions src/briefcase/integrations/linuxdeploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ def arch(cls, host_arch: str) -> str:
return {
"x86_64": "x86_64",
"i686": "i386",
"armv7l": "armhf",
"armv8l": "armhf",
"aarch64": "aarch64",
}[host_arch]
except KeyError as e:
raise UnsupportedHostError(
Expand Down
12 changes: 10 additions & 2 deletions src/briefcase/platforms/linux/appimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,21 @@ class LinuxAppImageCreateCommand(
def output_format_template_context(self, app: AppConfig):
context = super().output_format_template_context(app)

# Add the manylinux tag to the template context.
try:
tag = getattr(app, "manylinux_image_tag", "latest")
manylinux_arch = {
"x86_64": "x86_64",
"i386": "i686",
"aarch64": "aarch64",
}[LinuxDeploy.arch(self.tools.host_arch)]
except KeyError:
manylinux_arch = "unknown"
self.logger.warning(
f"There is not a manylinux base image for {self.tools.host_arch}"
)

# Add the manylinux tag to the template context.
try:
tag = getattr(app, "manylinux_image_tag", "latest")
context["manylinux_image"] = f"{app.manylinux}_{manylinux_arch}:{tag}"
if app.manylinux in {"manylinux1", "manylinux2010", "manylinux2014"}:
context["vendor_base"] = "centos"
Expand Down
8 changes: 4 additions & 4 deletions tests/commands/new/test_build_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def main():
]
""",
pyproject_table_linux_appimage="""
manylinux = "manylinux2014"
manylinux = "manylinux_2_28"
system_requires = [
# Needed to compile pycairo wheel
Expand Down Expand Up @@ -578,7 +578,7 @@ def main():
]
""",
pyproject_table_linux_appimage="""
manylinux = "manylinux2014"
manylinux = "manylinux_2_28"
system_requires = [
# ?? FIXME
Expand Down Expand Up @@ -748,7 +748,7 @@ def main():
]
""",
pyproject_table_linux_appimage="""
manylinux = "manylinux2014"
manylinux = "manylinux_2_28"
system_requires = [
]
Expand Down Expand Up @@ -1178,7 +1178,7 @@ def main():
]
""",
pyproject_table_linux_appimage="""
manylinux = "manylinux2014"
manylinux = "manylinux_2_28"
system_requires = [
# Needed to compile pycairo wheel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ def test_file_path(linuxdeploy, mock_tools):
[
("Linux", "x86_64", "x86_64"),
("Linux", "i686", "i386"),
("Linux", "aarch64", "aarch64"),
("Linux", "armv7l", "armhf"),
("Linux", "armv8l", "armhf"),
("Darwin", "x86_64", "x86_64"),
],
)
Expand Down
26 changes: 26 additions & 0 deletions tests/platforms/linux/appimage/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,32 @@ def test_finalize_nodocker(create_command, first_app_config, capsys):
"use_non_root_user": True,
},
),
# Linux on aarch64 hardware
(
"manylinux_2_28",
None,
"Linux",
"aarch64",
False,
{
"manylinux_image": "manylinux_2_28_aarch64:latest",
"vendor_base": "almalinux",
"use_non_root_user": True,
},
),
# Linux on arm hardware
(
"manylinux_2_28",
None,
"Linux",
"armv7l",
False,
{
"manylinux_image": "manylinux_2_28_unknown:latest",
"vendor_base": "almalinux",
"use_non_root_user": True,
},
),
# macOS on x86_64
(
"manylinux2014",
Expand Down

0 comments on commit 220dd47

Please sign in to comment.