Skip to content

Commit 962f34a

Browse files
authored
build: Add meson support (#240)
* build: Add meson support ref: https://github.com/orgs/linuxmint/discussions/416 * tests: Fix compilation This FTBFS since 3a125b2. Note that the test still fails and the next commit disables the test. not ok /Simple Navigation - FATAL-CRITICAL: dash_box_push: assertion '_tmp1_ != NULL' failed * tests: Disable This still fails with "not ok /Simple Navigation - FATAL-CRITICAL: dash_box_push: assertion '_tmp1_ != NULL' failed". * meson: Restore meson 0.49.0 support Ubuntu 20.04 has meson 0.53.2. "/ with string arguments" requires meson 0.49.0. * debian: Switch packaging to meson
1 parent 34ca9b3 commit 962f34a

15 files changed

+240
-84
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
debian/.debhelper/
2+
debian/slick-greeter/
3+
debian/*.log
4+
debian/*.substvars
5+
debian/debhelper-build-stamp
6+
debian/files

Makefile.am

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- Mode: Automake; indent-tabs-mode: t; tab-width: 4 -*-
22

3-
SUBDIRS = data files po src tests
3+
SUBDIRS = data files po src
44

55
EXTRA_DIST = \
66
autogen.sh \

configure.ac

-1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,5 @@ data/Makefile
6666
files/Makefile
6767
po/Makefile.in
6868
src/Makefile
69-
tests/Makefile
7069
])
7170
AC_OUTPUT

data/meson.build

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
icon_files = [
2+
'a11y.svg',
3+
'active.png',
4+
'arrow_left.png',
5+
'arrow_right.png',
6+
'battery.svg',
7+
'battery_10.svg',
8+
'battery_25.svg',
9+
'battery_50.svg',
10+
'dialog_close.png',
11+
'dialog_close_highlight.png',
12+
'dialog_close_press.png',
13+
'hibernate_highlight.png',
14+
'hibernate.png',
15+
'keyboard.svg',
16+
'message.png',
17+
'remote_login_help.png',
18+
'restart_highlight.png',
19+
'restart.png',
20+
'shadow.png',
21+
'shutdown_highlight.png',
22+
'shutdown.png',
23+
'shutdown.svg',
24+
'suspend_highlight.png',
25+
'suspend.png',
26+
'switcher_corner.png',
27+
'switcher_left.png',
28+
'switcher_top.png',
29+
]
30+
31+
install_data(
32+
icon_files,
33+
install_dir: pkgdatadir,
34+
)
35+
36+
install_data(
37+
'x.dm.slick-greeter.gschema.xml',
38+
install_dir: datadir / 'glib-2.0' / 'schemas',
39+
)
40+
41+
install_data(
42+
'slick-greeter.desktop',
43+
install_dir: datadir / 'xgreeters',
44+
)
45+
46+
man_files = [
47+
'slick-greeter-set-keyboard-layout.1',
48+
'slick-greeter-check-hidpi.1',
49+
'slick-greeter-enable-tap-to-click.1',
50+
'slick-greeter.8',
51+
]
52+
53+
install_man(man_files)

debian/control

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@ Build-Depends: debhelper-compat (= 12),
77
at-spi2-core,
88
dbus-x11,
99
fonts-ubuntu,
10-
intltool (>= 0.37.1),
1110
libcanberra-dev,
1211
libgtk-3-dev,
1312
liblightdm-gobject-1-dev | liblightdm-gobject-dev,
1413
liblightdm-gobject-1-dev | lightdm-vala,
1514
libpixman-1-dev,
1615
libxapp-dev,
17-
valac (>= 0.20.0),
18-
xvfb
16+
meson (>= 0.49.0),
17+
valac (>= 0.20.0)
1918
Homepage: https://github.com/linuxmint/slick-greeter
2019

2120
Package: slick-greeter

debian/rules

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
LDFLAGS+=-Wl,--as-needed
44

55
%:
6-
dh $@ --with autoreconf
7-
8-
override_dh_autoreconf:
9-
NOCONFIGURE=1 dh_autoreconf ./autogen.sh
6+
dh $@ --without=autoreconf --buildsystem=meson
107

118
override_dh_missing:
129
dh_missing --list-missing

files/meson.build

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
install_subdir(
2+
'usr' / 'bin',
3+
install_dir: bindir,
4+
strip_directory: true,
5+
)
6+
7+
install_subdir(
8+
'usr' / 'share',
9+
install_dir: prefix,
10+
)

meson.build

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
project(
2+
'slick-greeter',
3+
'vala', 'c',
4+
version: '2.0.3',
5+
meson_version: '>= 0.49.0'
6+
)
7+
8+
cc = meson.get_compiler('c')
9+
10+
i18n = import('i18n')
11+
12+
gettext_package = meson.project_name()
13+
14+
prefix = get_option('prefix')
15+
bindir = get_option('bindir')
16+
datadir = get_option('datadir')
17+
localedir = get_option('localedir')
18+
pkgdatadir = datadir / meson.project_name()
19+
sbindir = get_option('sbindir')
20+
21+
cairo_dep = dependency('cairo')
22+
gdk_x11_dep = dependency('gdk-x11-3.0')
23+
gio_dep = dependency('gio-2.0')
24+
gio_unix_dep = dependency('gio-unix-2.0')
25+
gtk_dep = dependency('gtk+-3.0', version: '>= 3.20.0')
26+
libcanberra_dep = dependency('libcanberra')
27+
liblightdm_gobject_dep = dependency('liblightdm-gobject-1', version: '>= 1.12.0')
28+
m_dep = cc.find_library('m')
29+
pixman_dep = dependency('pixman-1')
30+
posix_dep = meson.get_compiler('vala').find_library('posix')
31+
x11_dep = dependency('x11')
32+
xapp_dep = dependency('xapp')
33+
xext_dep = cc.find_library('Xext')
34+
35+
config_data = configuration_data()
36+
config_data.set_quoted('GETTEXT_PACKAGE', gettext_package)
37+
config_data.set_quoted('LOCALEDIR', prefix / localedir)
38+
config_data.set_quoted('PKGDATADIR', prefix / pkgdatadir)
39+
config_data.set_quoted('VERSION', meson.project_version())
40+
configure_file(
41+
configuration: config_data,
42+
output: 'config.h',
43+
)
44+
config_h_dir = include_directories('.')
45+
46+
subdir('data')
47+
subdir('files')
48+
subdir('po')
49+
subdir('src')
50+
51+
meson.add_install_script('meson/meson-postinstall.sh')

meson/meson-postinstall.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
3+
# Package managers set this so we don't need to run
4+
if [ -z "$DESTDIR" ]; then
5+
echo Compiling GSettings schemas...
6+
glib-compile-schemas ${MESON_INSTALL_PREFIX}/share/glib-2.0/schemas
7+
fi

po/meson.build

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
i18n.gettext(
2+
gettext_package,
3+
preset: 'glib'
4+
)

src/meson.build

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
slick_greeter_sources = files(
2+
'config.vapi',
3+
'fixes.vapi',
4+
'xsync.vapi',
5+
'animate-timer.vala',
6+
'background.vala',
7+
'cached-image.vala',
8+
'cairo-utils.vala',
9+
'email-autocompleter.vala',
10+
'dash-box.vala',
11+
'dash-button.vala',
12+
'dash-entry.vala',
13+
'fadable.vala',
14+
'fadable-box.vala',
15+
'fading-label.vala',
16+
'flat-button.vala',
17+
'greeter-list.vala',
18+
'idle-monitor.vala',
19+
'list-stack.vala',
20+
'main-window.vala',
21+
'menu.vala',
22+
'menubar.vala',
23+
'prompt-box.vala',
24+
'session-list.vala',
25+
'remote-login-service.vala',
26+
'settings.vala',
27+
'shutdown-dialog.vala',
28+
'toggle-box.vala',
29+
'slick-greeter.vala',
30+
'user-list.vala',
31+
'user-prompt-box.vala',
32+
)
33+
34+
logo_generator_sources = files(
35+
'logo-generator.vala',
36+
)
37+
38+
dependencies = [
39+
cairo_dep,
40+
gdk_x11_dep,
41+
gio_dep,
42+
gio_unix_dep,
43+
gtk_dep,
44+
libcanberra_dep,
45+
liblightdm_gobject_dep,
46+
m_dep,
47+
pixman_dep,
48+
posix_dep,
49+
x11_dep,
50+
xapp_dep,
51+
xext_dep,
52+
]
53+
54+
c_args = [
55+
'-w',
56+
'-include', 'config.h',
57+
]
58+
59+
vala_args = [
60+
'--debug',
61+
'--target-glib', '2.32',
62+
'-D', 'HAVE_GTK_3_20_0',
63+
]
64+
65+
executable(
66+
'slick-greeter',
67+
slick_greeter_sources,
68+
dependencies: dependencies,
69+
include_directories: config_h_dir,
70+
c_args: c_args,
71+
vala_args: vala_args,
72+
install: true,
73+
install_dir: sbindir,
74+
)
75+
76+
executable(
77+
'logo-generator',
78+
logo_generator_sources,
79+
dependencies: dependencies,
80+
include_directories: config_h_dir,
81+
c_args: c_args,
82+
vala_args: vala_args,
83+
)

tests/Makefile.am

-73
This file was deleted.

tests/menubar.vala

+6-1
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,16 @@ public class MenuBar : Gtk.MenuBar
2121
public const int HEIGHT = 32;
2222
public bool high_contrast { get; private set; default = false; }
2323

24-
public MenuBar (Background bg, Gtk.AccelGroup ag)
24+
public MenuBar (Background bg, Gtk.AccelGroup ag, MainWindow mw)
2525
{
26+
Object ();
2627
}
2728

2829
public void set_keyboard_state ()
2930
{
3031
}
32+
33+
public void cleanup ()
34+
{
35+
}
3136
}

tests/slick-greeter.vala

+15
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,19 @@ public class SlickGreeter
126126
var ctx = widget.get_style_context ();
127127
ctx.add_class ("lightdm");
128128
}
129+
130+
public bool is_live_session (out string live_username, out string live_realname)
131+
{
132+
return false;
133+
}
134+
135+
public static string validate_session (string? session)
136+
{
137+
return session;
138+
}
139+
140+
public static string? get_default_session ()
141+
{
142+
return "cinnamon";
143+
}
129144
}

tests/test.vala

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public class Test
109109
}
110110
}
111111

112-
private static void inject_key (Gtk.Widget w, int keyval)
112+
private static void inject_key (Gtk.Widget w, uint keyval)
113113
{
114114
// Make sure everything is flushed
115115
process_events ();

0 commit comments

Comments
 (0)