Skip to content

Commit

Permalink
meson: Various fixes (#118)
Browse files Browse the repository at this point in the history
* meson: Require meson 0.49 and fix wrong version

Follow up of 878431b.

"/ with string arguments" requires meson 0.49.0.

* meson: Actually install usr and etc files

This is where the program actually lives.

* meson: Run post install script

Since we install usr/share/glib-2.0/schemas/org.x.sticky.gschema.xml,
we should run the glib-compile-schemas.

* meson: Fix org.x.sticky.service hardcode bindir

Let's respect meson's bindir option.

* usr/bin/sticky: Make this executable

Instead of telling people in README.md, let's just do it ourselves.
  • Loading branch information
bobby285271 authored May 30, 2024
1 parent 878431b commit 3a30b05
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ Sticky has support for the meson build system. See https://mesonbuild.com/Runnin
### Otherwise you can copy files directly to the file system:
```
sudo cp -r usr/* /usr/
chmod +x /usr/bin/sticky
sudo cp etc/xdg/autostart/sticky.desktop /etc/xdg/autostart/
sudo cp data/sticky.desktop.in /usr/share/applications/sticky.desktop
sudo cp data/org.x.sticky.service /usr/share/dbus-1/services/org.x.sticky.service
sed -i 's|@bindir@|/usr/bin|' data/org.x.sticky.service.in
sudo cp data/org.x.sticky.service.in /usr/share/dbus-1/services/org.x.sticky.service
```
> [!NOTE]
> This method doesn't install translations, so Sticky may not get translated if you install it this way.
Expand Down
9 changes: 7 additions & 2 deletions data/meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
install_data(
'org.x.sticky.service',
service_conf = configuration_data()
service_conf.set('bindir', prefix / bindir)

configure_file(
input: 'org.x.sticky.service.in',
output: 'org.x.sticky.service',
configuration: service_conf,
install_dir: datadir / 'dbus-1' / 'services',
)

Expand Down
2 changes: 1 addition & 1 deletion data/org.x.sticky.service → data/org.x.sticky.service.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[D-BUS Service]
Name=org.x.sticky
Exec=/usr/bin/sticky
Exec=@bindir@/sticky
9 changes: 8 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
project('sticky', version: '1.17')
project('sticky', version: '1.19', meson_version: '>= 0.49.0')

i18n = import('i18n')

gettext_package = meson.project_name()

prefix = get_option('prefix')
bindir = get_option('bindir')
datadir = get_option('datadir')
sysconfdir = get_option('sysconfdir')

podir = meson.source_root() / 'po'

subdir('data')
subdir('po')

install_subdir('etc', install_dir: sysconfdir, strip_directory: true)
install_subdir('usr', install_dir: prefix, strip_directory: true)

meson.add_install_script('meson/meson-postinstall.sh')
10 changes: 10 additions & 0 deletions meson/meson-postinstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/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

echo Updating icon cache...
gtk-update-icon-cache -qtf ${MESON_INSTALL_PREFIX}/share/icons/hicolor
fi
Empty file modified usr/bin/sticky
100644 → 100755
Empty file.

0 comments on commit 3a30b05

Please sign in to comment.