Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meson AppImage releases #7518

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release

# Run on all tags
on:
push:
tags:
- '*'

jobs:
runtime_builder:
name: Runtime ${{ matrix.cfg.id }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cfg:
- { id: x86_64 }
- { id: i386 }
env:
NONINTERACTIVE: 1

steps:
- uses: actions/checkout@v2
- name: Building ${{ matrix.cfg.id }} Meson runtime
run: ./packaging/appimage/build_${{ matrix.cfg.id }}.sh
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: appimage/meson-${{ matrix.cfg.id }}.runtime
tag: ${{ github.ref }}
overwrite: true
body: ${{ github.ref }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ __pycache__
.DS_Store
*~
*.swp
meson*.runtime
packagecache
/MANIFEST
/build
/appimage
/dist
/meson.egg-info

Expand Down
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
/mesonbuild/cmake/ @mensinda
/mesonbuild/compilers/ @dcbaker
/mesonbuild/linkers.py @dcbaker
/packaging/appimage @mensinda
8 changes: 6 additions & 2 deletions mesonbuild/mesonlib/universal.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@

from glob import glob

if os.path.basename(sys.executable) == 'meson.exe':
if 'MESON_PYTHON_BIN' in os.environ:
python_command = shlex.split(os.environ['MESON_PYTHON_BIN'])
elif os.path.basename(sys.executable) == 'meson.exe':
# In Windows and using the MSI installed executable.
python_command = [sys.executable, 'runpython']
else:
Expand Down Expand Up @@ -219,7 +221,9 @@ def set_meson_command(mainfile: str) -> None:
global _meson_command
# On UNIX-like systems `meson` is a Python script
# On Windows `meson` and `meson.exe` are wrapper exes
if not mainfile.endswith('.py'):
if 'MESON_COMMAND' in os.environ:
_meson_command = shlex.split(os.environ['MESON_COMMAND'])
elif not mainfile.endswith('.py'):
_meson_command = [mainfile]
elif os.path.isabs(mainfile) and mainfile.endswith('mesonmain.py'):
# Can't actually run meson with an absolute path to mesonmain.py, it must be run as -m mesonbuild.mesonmain
Expand Down
18 changes: 18 additions & 0 deletions mesonbuild/msetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@
import sys, stat
import datetime
import os.path
import os
import platform
import cProfile as profile
import argparse
import tempfile
import shutil
import glob
import subprocess

from pathlib import Path

from . import environment, interpreter, mesonlib
from . import build
Expand Down Expand Up @@ -74,6 +78,20 @@ def __init__(self, options: argparse.Namespace) -> None:
options.sourcedir,
options.reconfigure,
options.wipe)
# Detect if we are running from the AppImage runtime. Then self-extract
# and relaunch with the extracted binaries
if 'APPIMAGE' in os.environ:
rc = subprocess.run([os.environ['APPIMAGE'], '--runtime-setup', self.build_dir]).returncode
if rc == 0:
del os.environ['APPIMAGE'] # avoid infinite loops
del os.environ['APPDIR']
meson_exe = Path(self.build_dir) / 'meson-runtime' / 'fakebin' / 'meson'
meson_exe = meson_exe.resolve()
os.execve(meson_exe.as_posix(), [meson_exe.as_posix(), *sys.argv[1:]], os.environ)
# execve never returns. See `man 3 exec`.

mlog.warning('Failed to self extract', mlog.bold(os.environ['APPIMAGE']), 'to', mlog.bold(options.builddir), f'(rc = {rc})')

if options.wipe:
# Make a copy of the cmd line file to make sure we can always
# restore that file if anything bad happens. For example if
Expand Down
Loading