Skip to content

Commit

Permalink
meson: Make libportal a meson subproject
Browse files Browse the repository at this point in the history
This has a few advantages:
* the version required for the tests will automatically reach developers
* CI and local builds use the same version

Long term we should move our tests to the python harness and drop
libportal as a dependency.
  • Loading branch information
swick authored and TingPing committed Oct 29, 2024
1 parent c0ead85 commit 45bfea7
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 33 deletions.
33 changes: 6 additions & 27 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,36 +47,15 @@ jobs:
- name: Check POTFILES.in
run: .github/workflows/check-potfiles.sh

- name: Check out libportal fork with a similarly named branch
id: libportal-branched
uses: actions/checkout@v4
continue-on-error: true
with:
repository: ${{ github.actor }}/libportal
ref: ${{ github.head_ref || github.ref_name }}
path: libportal

- name: Check out libportal default branch
if: steps.libportal-branched.outcome == 'failure'
uses: actions/checkout@v4
with:
repository: flatpak/libportal
path: libportal

- name: Build libportal
run: |
meson setup libportal _build_libportal $MESON_OPTIONS
meson compile -C _build_libportal
meson install -C _build_libportal
env:
MESON_OPTIONS: --prefix=/usr -Ddocs=false -Dintrospection=false -Dtests=false

- name: Build xdg-desktop-portal
run: |
meson setup _build $MESON_OPTIONS
meson setup _build \
-Dinstalled-tests=true \
-Dpytest=enabled \
-Db_sanitize=${{ matrix.sanitizer }} \
-Db_lundef=false \
-Dforce_fallback_for=libportal
meson compile -C _build
env:
MESON_OPTIONS: -Dinstalled-tests=true -Dpytest=enabled -Db_sanitize=${{ matrix.sanitizer }}
- name: Run xdg-desktop-portal tests
run: timeout --signal=KILL -v ${TESTS_TIMEOUT}m meson test -C _build
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
__pycache__
subprojects/libportal/
27 changes: 21 additions & 6 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ project(
version: '1.19.1',
meson_version: '>= 0.60',
license: 'LGPL-2.0-or-later',
default_options: ['warning_level=2'])
default_options: [
'warning_level=2',
],
)

###### various directories we'll use later
# foodir are built-in ones, foo_dir are our options
Expand Down Expand Up @@ -110,11 +113,23 @@ json_glib_dep = dependency('json-glib-1.0')
fuse3_dep = dependency('fuse3', version: '>= 3.10.0')
gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0')
gst_pbutils_dep = dependency('gstreamer-pbutils-1.0')
geoclue_dep = dependency('libgeoclue-2.0',
version: '>= 2.5.2',
required: get_option('geoclue'))
libportal_dep = dependency('libportal',
required: get_option('libportal'))
geoclue_dep = dependency(
'libgeoclue-2.0',
version: '>= 2.5.2',
required: get_option('geoclue'),
)
libportal_dep = dependency(
'libportal',
version: '>= 0.8.1',
required: get_option('libportal'),
fallback: ['libportal', 'libportal_dep'],
default_options: [
'introspection=false',
'vapi=false',
'docs=false',
'tests=false',
],
)
pipewire_dep = dependency('libpipewire-0.3', version: '>= 0.2.90')
libsystemd_dep = dependency('libsystemd', required: get_option('systemd'))

Expand Down
4 changes: 4 additions & 0 deletions subprojects/libportal.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[wrap-git]
directory=libportal
url=https://github.com/flatpak/libportal.git
revision=main

0 comments on commit 45bfea7

Please sign in to comment.