Commit 9e0942aa authored by Jeremy Bicha's avatar Jeremy Bicha

snap: switch to core18

This reverts commit ea16a0a3.

Build gsound and libcanberra as a way to get sound working in the snap
parent d3a0ed22
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
import os
import snapcraft
class MesonPlugin(snapcraft.BasePlugin):
@classmethod
def schema(cls):
schema = super().schema()
schema['properties']['meson-parameters'] = {
'type': 'array',
'minitems': 1,
'uniqueItems': True,
'items': {
'type': 'string',
},
'default': [],
}
return schema
@classmethod
def get_build_properties(cls):
return ['meson-parameters']
def __init__(self, name, options, project):
super().__init__(name, options, project)
self.snapbuildname = 'snapbuild'
self.mesonbuilddir = os.path.join(self.builddir, self.snapbuildname)
self.build_packages.append('meson')
self.build_packages.append('ninja-build')
def build(self):
super().build()
self._run_meson()
self._run_ninja_build_default()
self._run_ninja_install()
def _run_meson(self):
os.makedirs(self.mesonbuilddir, exist_ok=True)
meson_command = ['meson']
if self.options.meson_parameters:
meson_command.extend(self.options.meson_parameters)
meson_command.append(self.snapbuildname)
env = os.environ.copy()
env['PKG_CONFIG_PATH'] = self.project.stage_dir + '/usr/lib/pkgconfig:/usr/lib/' + self.project.arch_triplet + '/pkgconfig:/usr/lib/pkgconfig'
env['VAPIDIR'] = self.project.stage_dir + '/usr/share/vala/vapi'
env['GI_TYPELIB_PATH'] = self.project.stage_dir + '/usr/lib/' + self.project.arch_triplet + '/girepository-1.0:/usr/lib/' + self.project.arch_triplet + '/girepository-1.0'
env['XDG_DATA_DIRS'] = self.project.stage_dir + '/usr/share:/usr/share'
self.run(meson_command, env=env)
def _run_ninja_build_default(self):
ninja_command = ['ninja']
env = os.environ.copy()
env['PKG_CONFIG_PATH'] = self.project.stage_dir + '/usr/lib/pkgconfig:/usr/lib/' + self.project.arch_triplet + '/pkgconfig:/usr/lib/pkgconfig'
env['VAPIDIR'] = self.project.stage_dir + '/usr/share/vala/vapi'
env['GI_TYPELIB_PATH'] = self.project.stage_dir + '/usr/lib/' + self.project.arch_triplet + '/girepository-1.0:/usr/lib/' + self.project.arch_triplet + '/girepository-1.0'
env['XDG_DATA_DIRS'] = self.project.stage_dir + '/usr/share:/usr/share'
self.run(ninja_command, env=env, cwd=self.mesonbuilddir)
def _run_ninja_install(self):
env = os.environ.copy()
env['DESTDIR'] = self.installdir
ninja_install_command = ['ninja', 'install']
self.run(ninja_install_command, env=env, cwd=self.mesonbuilddir)
......@@ -7,6 +7,7 @@ description: |
grade: stable # must be 'stable' to release into candidate/stable channels
confinement: strict
base: core18
# Launchpad doesn't recognize these fields yet
passthrough:
......@@ -14,10 +15,10 @@ passthrough:
title: GNOME Clocks
plugs:
gnome-3-26-1604:
gnome-3-28-1804:
interface: content
target: $SNAP/gnome-platform
default-provider: gnome-3-26-1604
default-provider: gnome-3-28-1804
gtk-3-themes:
interface: content
target: $SNAP/data-dir/themes
......@@ -55,15 +56,62 @@ apps:
LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/lib/gnome-clocks
parts:
desktop-gnome-platform:
source: https://github.com/ubuntu/snapcraft-desktop-helpers.git
source-subdir: gtk
plugin: make
make-parameters: ["FLAVOR=gtk3"]
build-packages:
- build-essential
- libgtk-3-dev
override-build: |
snapcraftctl build
mkdir -pv $SNAPCRAFT_PART_INSTALL/gnome-platform
libcanberra:
source: git://git.0pointer.de/libcanberra
source-type: git
plugin: autotools
configflags:
- --prefix=/snap/gnome-clocks/current/usr
- --enable-pulse
- --enable-gstreamer
- --enable-gtk3
- --enable-alsa
- --disable-oss
organize:
snap/gnome-clocks/current/usr: usr
build-packages:
- libltdl-dev
- libasound2-dev
- libvorbis-dev
- libgtk-3-dev
- libtdb-dev
- libpulse-dev
- libgstreamer1.0-dev
- gtk-doc-tools
gsound:
after: [libcanberra]
source: https://gitlab.gnome.org/GNOME/gsound.git
source-type: git
plugin: autotools
configflags: [--prefix=/snap/gnome-clocks/current/usr, --disable-Werror]
organize:
snap/gnome-clocks/current/usr: usr
build-packages:
- autoconf-archive
- intltool
- libgirepository1.0-dev
- libglib2.0-dev
- valac
libgweather:
source: https://git.gnome.org/browse/libgweather
source-type: git
plugin: meson
meson-parameters:
- --prefix=/usr
- --datadir=../snap/gnome-clocks/current/usr/share
organize:
snap/gnome-clocks/current/usr: usr
build-packages:
- libxml2-dev
- libglib2.0-dev
......@@ -81,7 +129,7 @@ parts:
- libgladeui-dev
gnome-clocks:
after: [libgweather, desktop-gnome-platform]
after: [gsound, libgweather, desktop-gnome-platform]
source: .
source-type: git
plugin: meson
......@@ -89,6 +137,7 @@ parts:
organize:
snap/gnome-clocks/current/usr: usr
override-build: |
sed -i.bak -e "s|'--vapidir'|'--vapidir', '$SNAPCRAFT_STAGE/usr/share/vala/vapi', '--vapidir'|g" src/meson.build
sed -i.bak -e 's|=org.gnome.clocks$|=${SNAP}/meta/gui/org.gnome.clocks.svg|g' data/org.gnome.clocks.desktop.in.in
snapcraftctl build
mkdir -p $SNAPCRAFT_PART_INSTALL/meta/gui/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment