Skip to content

Commit

Permalink
build: Make libportal a meson subproject
Browse files Browse the repository at this point in the history
This has a few advantages:
* there is a circular dependency between x-d-p and libportal which we
  can break by building a specific commit from any repo which isn't
  upstream, yet
* the version required for the tests will automatically reach developers
* CI and local builds use the same version
  • Loading branch information
swick committed Oct 18, 2024
1 parent 4a60011 commit d1a7838
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 27 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,30 +41,6 @@ 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
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/
20 changes: 17 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ 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'))
pipewire_dep = dependency('libpipewire-0.3', version: '>= 0.2.90')
libsystemd_dep = dependency('libsystemd', required: get_option('systemd'))

Expand All @@ -129,7 +127,23 @@ if not bwrap.found()
''')
endif

have_libportal = libportal_dep.found()
if get_option('libportal-subproject')
libportal_proj = subproject(
'libportal',
default_options: [
'introspection=false',
'vapi=false',
'docs=false',
'tests=false',
],
)
libportal_dep = libportal_proj.get_variable('libportal_dep')
else
libportal_dep = dependency('libportal', required: false)
endif

libportal_option = get_option('libportal').require(libportal_dep.found())
have_libportal = libportal_option.allowed()
if have_libportal
config_h.set('HAVE_LIBPORTAL', 1)
endif
Expand Down
4 changes: 4 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ option('libportal',
type: 'feature',
value: 'auto',
description: 'Enable libportal support. Needed for tests')
option('libportal-subproject',
type: 'boolean',
value: true,
description: 'Use libportal as subproject')
option('geoclue',
type: 'feature',
value: 'auto',
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/jsparber/libportal.git
revision=implement_v2_notification_spec

0 comments on commit d1a7838

Please sign in to comment.