From 45bfea7e85b8c902378d40e9e91006579a86dcaa Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Mon, 21 Oct 2024 21:19:53 +0200 Subject: [PATCH] meson: Make libportal a meson subproject 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. --- .github/workflows/build-and-test.yml | 33 +++++----------------------- .gitignore | 1 + meson.build | 27 ++++++++++++++++++----- subprojects/libportal.wrap | 4 ++++ 4 files changed, 32 insertions(+), 33 deletions(-) create mode 100644 subprojects/libportal.wrap diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index f13e51dfc..7bdbaeaa1 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -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 diff --git a/.gitignore b/.gitignore index bee8a64b7..fecc3abf8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ __pycache__ +subprojects/libportal/ diff --git a/meson.build b/meson.build index fb997ade6..8189bd3e2 100644 --- a/meson.build +++ b/meson.build @@ -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 @@ -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')) diff --git a/subprojects/libportal.wrap b/subprojects/libportal.wrap new file mode 100644 index 000000000..02195f485 --- /dev/null +++ b/subprojects/libportal.wrap @@ -0,0 +1,4 @@ +[wrap-git] +directory=libportal +url=https://github.com/flatpak/libportal.git +revision=main