Skip to content

Commit

Permalink
switch to meson
Browse files Browse the repository at this point in the history
  • Loading branch information
bilelmoussaoui committed Apr 6, 2018
1 parent 70cbeea commit 00d2708
Show file tree
Hide file tree
Showing 20 changed files with 463 additions and 165 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*~
build
build/
builddir/
47 changes: 0 additions & 47 deletions CMakeLists.txt

This file was deleted.

25 changes: 0 additions & 25 deletions Config.vala.cmake

This file was deleted.

11 changes: 0 additions & 11 deletions data/CMakeLists.txt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Name=Melody
GenericName=Melody
Comment=Listen your music
Comment[lt]=Klausytis savo muzikos
Keywords=music;radio;playlist;
Exec=com.github.artemanufrij.playmymusic %U
Icon=com.github.artemanufrij.playmymusic
Expand All @@ -27,4 +26,4 @@ Icon=media-skip-forward-symbolic
[Desktop Action Prev]
Name=Previous
Exec=com.github.artemanufrij.playmymusic --prev
Icon=media-skip-backward-symbolic
Icon=media-skip-backward-symbolic
13 changes: 13 additions & 0 deletions data/icons/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
icon_sizes = ['16', '24', '32', '48']

foreach i : icon_sizes
install_data(
join_paths(i, meson.project_name() + '.svg'),
install_dir: join_paths(get_option('datadir'), 'icons', 'hicolor', i + 'x' + i, 'apps')
)
endforeach

install_data(
join_paths('symbolic', meson.project_name() + '-symbolic.svg'),
install_dir: join_paths(get_option('datadir'), 'icons/hicolor/symbolic/apps')
)
39 changes: 39 additions & 0 deletions data/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

i18n.merge_file(
input: meson.project_name() + '.desktop.in',
output: meson.project_name() + '.desktop',
po_dir: join_paths(meson.source_root(), 'po'),
type: 'desktop',
install: true,
install_dir: join_paths(get_option('datadir'), 'applications')
)

i18n.merge_file(
input: meson.project_name() + '.appdata.xml.in',
output: meson.project_name() + '.appdata.xml',
po_dir: join_paths(meson.source_root(), 'po'),
install: true,
install_dir: join_paths(get_option('datadir'), 'metainfo')
)

desktop_file_validate = find_program('desktop-file-validate', required:false)

if desktop_file_validate.found()
test (
'Validate desktop file',
desktop_file_validate,
args: join_paths(meson.current_build_dir (), meson.project_name() + '.desktop')
)
endif

appstreamcli = find_program(['appstreamcli', 'appstream-util'], required:false)

if appstreamcli.found()
test (
'Validate appdata file',
appstreamcli,
args: ['validate', join_paths(meson.current_build_dir (), meson.project_name() + '.appdata.xml')]
)
endif

subdir('icons')
5 changes: 3 additions & 2 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ Source: com.github.artemanufrij.playmymusic
Section: x11
Priority: optional
Maintainer: Artem Anufrij <artem.anufrij@live.de>
Build-Depends: cmake (>= 2.8),
cmake-elementary,
Build-Depends: appstream,
debhelper (>= 9),
desktop-file-utils,
libgranite-dev,
libjson-glib-dev,
libsoup2.4-dev,
libsqlite3-dev,
libgstreamer-plugins-base1.0-dev,
libtagc0-dev,
meson,
valac (>= 0.26)
Standards-Version: 3.9.3

Expand Down
44 changes: 44 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
project('com.github.artemanufrij.playmymusic', ['vala', 'c'], version: '0.6.9')


gnome = import('gnome')
i18n = import('i18n')

# Add vapi files
add_project_arguments(
[
'--vapidir',
join_paths(meson.current_source_dir(), 'vapi')
],
language: 'vala'
)


# Add locale support
conf = configuration_data()
conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
conf.set_quoted('PREFIX', get_option('prefix'))
conf.set_quoted('VERSION', meson.project_version())
conf.set_quoted('PACKAGE', meson.project_name())
conf.set_quoted('LOCALE_DIR', join_paths(get_option('prefix'), get_option('localedir')))
conf.set_quoted('DATADIR', join_paths(get_option('prefix'), get_option('datadir')))
conf.set_quoted('PKGDATADIR', join_paths(get_option('prefix'), get_option('datadir'), meson.project_name()))

configure_file(
output: 'config.h',
configuration: conf
)
config_h_dir = include_directories('src')

# Arguments C - no gcc warnings
c_args = [
'-include', 'config.h',
'-w', '-DGETTEXT_PACKAGE="' + meson.project_name() + '"'
]


subdir('data')
subdir('po')
subdir('schemas')
subdir('src')
meson.add_install_script('meson_post_install.py')
24 changes: 24 additions & 0 deletions meson_post_install.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env python3

import os
import subprocess

prefix = os.environ.get('MESON_INSTALL_PREFIX', '/usr')
datadir = os.path.join(prefix, 'share')

# Packaging tools define DESTDIR and this isn't needed for them
if 'DESTDIR' not in os.environ:


print('Compiling gsettings schemas...')
schema_dir = os.path.join(datadir, 'glib-2.0/schemas')
subprocess.call(['glib-compile-schemas', schema_dir])

print('Updating icon cache...')
icon_cache_dir = os.path.join(datadir, 'icons', 'hicolor')

subprocess.call(['gtk-update-icon-cache', '-qtf', icon_cache_dir])

print('Updating desktop database...')
desktop_database_dir = os.path.join(datadir, 'applications')
subprocess.call(['update-desktop-database', '-q', desktop_database_dir])
6 changes: 0 additions & 6 deletions po/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit 00d2708

Please sign in to comment.