Skip to content

Commit

Permalink
build: Add meson support (#240)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
bobby285271 authored May 30, 2024
1 parent 34ca9b3 commit 962f34a
Show file tree
Hide file tree
Showing 15 changed files with 240 additions and 84 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
debian/.debhelper/
debian/slick-greeter/
debian/*.log
debian/*.substvars
debian/debhelper-build-stamp
debian/files
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- Mode: Automake; indent-tabs-mode: t; tab-width: 4 -*-

SUBDIRS = data files po src tests
SUBDIRS = data files po src

EXTRA_DIST = \
autogen.sh \
Expand Down
1 change: 0 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,5 @@ data/Makefile
files/Makefile
po/Makefile.in
src/Makefile
tests/Makefile
])
AC_OUTPUT
53 changes: 53 additions & 0 deletions data/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
icon_files = [
'a11y.svg',
'active.png',
'arrow_left.png',
'arrow_right.png',
'battery.svg',
'battery_10.svg',
'battery_25.svg',
'battery_50.svg',
'dialog_close.png',
'dialog_close_highlight.png',
'dialog_close_press.png',
'hibernate_highlight.png',
'hibernate.png',
'keyboard.svg',
'message.png',
'remote_login_help.png',
'restart_highlight.png',
'restart.png',
'shadow.png',
'shutdown_highlight.png',
'shutdown.png',
'shutdown.svg',
'suspend_highlight.png',
'suspend.png',
'switcher_corner.png',
'switcher_left.png',
'switcher_top.png',
]

install_data(
icon_files,
install_dir: pkgdatadir,
)

install_data(
'x.dm.slick-greeter.gschema.xml',
install_dir: datadir / 'glib-2.0' / 'schemas',
)

install_data(
'slick-greeter.desktop',
install_dir: datadir / 'xgreeters',
)

man_files = [
'slick-greeter-set-keyboard-layout.1',
'slick-greeter-check-hidpi.1',
'slick-greeter-enable-tap-to-click.1',
'slick-greeter.8',
]

install_man(man_files)
5 changes: 2 additions & 3 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ Build-Depends: debhelper-compat (= 12),
at-spi2-core,
dbus-x11,
fonts-ubuntu,
intltool (>= 0.37.1),
libcanberra-dev,
libgtk-3-dev,
liblightdm-gobject-1-dev | liblightdm-gobject-dev,
liblightdm-gobject-1-dev | lightdm-vala,
libpixman-1-dev,
libxapp-dev,
valac (>= 0.20.0),
xvfb
meson (>= 0.49.0),
valac (>= 0.20.0)
Homepage: https://github.com/linuxmint/slick-greeter

Package: slick-greeter
Expand Down
5 changes: 1 addition & 4 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
LDFLAGS+=-Wl,--as-needed

%:
dh $@ --with autoreconf

override_dh_autoreconf:
NOCONFIGURE=1 dh_autoreconf ./autogen.sh
dh $@ --without=autoreconf --buildsystem=meson

override_dh_missing:
dh_missing --list-missing
10 changes: 10 additions & 0 deletions files/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
install_subdir(
'usr' / 'bin',
install_dir: bindir,
strip_directory: true,
)

install_subdir(
'usr' / 'share',
install_dir: prefix,
)
51 changes: 51 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
project(
'slick-greeter',
'vala', 'c',
version: '2.0.3',
meson_version: '>= 0.49.0'
)

cc = meson.get_compiler('c')

i18n = import('i18n')

gettext_package = meson.project_name()

prefix = get_option('prefix')
bindir = get_option('bindir')
datadir = get_option('datadir')
localedir = get_option('localedir')
pkgdatadir = datadir / meson.project_name()
sbindir = get_option('sbindir')

cairo_dep = dependency('cairo')
gdk_x11_dep = dependency('gdk-x11-3.0')
gio_dep = dependency('gio-2.0')
gio_unix_dep = dependency('gio-unix-2.0')
gtk_dep = dependency('gtk+-3.0', version: '>= 3.20.0')
libcanberra_dep = dependency('libcanberra')
liblightdm_gobject_dep = dependency('liblightdm-gobject-1', version: '>= 1.12.0')
m_dep = cc.find_library('m')
pixman_dep = dependency('pixman-1')
posix_dep = meson.get_compiler('vala').find_library('posix')
x11_dep = dependency('x11')
xapp_dep = dependency('xapp')
xext_dep = cc.find_library('Xext')

config_data = configuration_data()
config_data.set_quoted('GETTEXT_PACKAGE', gettext_package)
config_data.set_quoted('LOCALEDIR', prefix / localedir)
config_data.set_quoted('PKGDATADIR', prefix / pkgdatadir)
config_data.set_quoted('VERSION', meson.project_version())
configure_file(
configuration: config_data,
output: 'config.h',
)
config_h_dir = include_directories('.')

subdir('data')
subdir('files')
subdir('po')
subdir('src')

meson.add_install_script('meson/meson-postinstall.sh')
7 changes: 7 additions & 0 deletions meson/meson-postinstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

# Package managers set this so we don't need to run
if [ -z "$DESTDIR" ]; then
echo Compiling GSettings schemas...
glib-compile-schemas ${MESON_INSTALL_PREFIX}/share/glib-2.0/schemas
fi
4 changes: 4 additions & 0 deletions po/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
i18n.gettext(
gettext_package,
preset: 'glib'
)
83 changes: 83 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
slick_greeter_sources = files(
'config.vapi',
'fixes.vapi',
'xsync.vapi',
'animate-timer.vala',
'background.vala',
'cached-image.vala',
'cairo-utils.vala',
'email-autocompleter.vala',
'dash-box.vala',
'dash-button.vala',
'dash-entry.vala',
'fadable.vala',
'fadable-box.vala',
'fading-label.vala',
'flat-button.vala',
'greeter-list.vala',
'idle-monitor.vala',
'list-stack.vala',
'main-window.vala',
'menu.vala',
'menubar.vala',
'prompt-box.vala',
'session-list.vala',
'remote-login-service.vala',
'settings.vala',
'shutdown-dialog.vala',
'toggle-box.vala',
'slick-greeter.vala',
'user-list.vala',
'user-prompt-box.vala',
)

logo_generator_sources = files(
'logo-generator.vala',
)

dependencies = [
cairo_dep,
gdk_x11_dep,
gio_dep,
gio_unix_dep,
gtk_dep,
libcanberra_dep,
liblightdm_gobject_dep,
m_dep,
pixman_dep,
posix_dep,
x11_dep,
xapp_dep,
xext_dep,
]

c_args = [
'-w',
'-include', 'config.h',
]

vala_args = [
'--debug',
'--target-glib', '2.32',
'-D', 'HAVE_GTK_3_20_0',
]

executable(
'slick-greeter',
slick_greeter_sources,
dependencies: dependencies,
include_directories: config_h_dir,
c_args: c_args,
vala_args: vala_args,
install: true,
install_dir: sbindir,
)

executable(
'logo-generator',
logo_generator_sources,
dependencies: dependencies,
include_directories: config_h_dir,
c_args: c_args,
vala_args: vala_args,
)
73 changes: 0 additions & 73 deletions tests/Makefile.am

This file was deleted.

7 changes: 6 additions & 1 deletion tests/menubar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@ public class MenuBar : Gtk.MenuBar
public const int HEIGHT = 32;
public bool high_contrast { get; private set; default = false; }

public MenuBar (Background bg, Gtk.AccelGroup ag)
public MenuBar (Background bg, Gtk.AccelGroup ag, MainWindow mw)
{
Object ();
}

public void set_keyboard_state ()
{
}

public void cleanup ()
{
}
}
15 changes: 15 additions & 0 deletions tests/slick-greeter.vala
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,19 @@ public class SlickGreeter
var ctx = widget.get_style_context ();
ctx.add_class ("lightdm");
}

public bool is_live_session (out string live_username, out string live_realname)
{
return false;
}

public static string validate_session (string? session)
{
return session;
}

public static string? get_default_session ()
{
return "cinnamon";
}
}
2 changes: 1 addition & 1 deletion tests/test.vala
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public class Test
}
}

private static void inject_key (Gtk.Widget w, int keyval)
private static void inject_key (Gtk.Widget w, uint keyval)
{
// Make sure everything is flushed
process_events ();
Expand Down

0 comments on commit 962f34a

Please sign in to comment.