Skip to content

Commit

Permalink
Merge pull request #1 from gort818/gort818-meson
Browse files Browse the repository at this point in the history
Update to meson build
  • Loading branch information
gort818 authored Oct 15, 2017
2 parents 549ab88 + 0390bac commit 9bb4afc
Show file tree
Hide file tree
Showing 14 changed files with 492 additions and 25 deletions.
21 changes: 21 additions & 0 deletions build-aux/meson/postinstall.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python3

from os import environ, path
from subprocess import call

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

# Package managers set this so we don't need to run
if not destdir:
print('Updating icon cache...')
call(['gtk-update-icon-cache', '-qtf', path.join(datadir, 'icons', 'hicolor')])

print('Updating desktop database...')
call(['update-desktop-database', '-q', path.join(datadir, 'applications')])

print('Compiling GSettings schemas...')
call(['glib-compile-schemas', path.join(datadir, 'glib-2.0', 'schemas')])


41 changes: 41 additions & 0 deletions data/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
desktop_file = i18n.merge_file(
input: 'org.gnome.Ddgtk.desktop.in',
output: 'org.gnome.Ddgtk.desktop',
type: 'desktop',
po_dir: '../po',
install: true,
install_dir: join_paths(get_option('datadir'), 'applications')
)

desktop_utils = find_program('desktop-file-validate', required: false)
if desktop_utils.found()
test('Validate desktop file', desktop_utils,
args: [desktop_file]
)
endif

appstream_file = i18n.merge_file(
input: 'org.gnome.Ddgtk.appdata.xml.in',
output: 'org.gnome.Ddgtk.appdata.xml',
po_dir: '../po',
install: true,
install_dir: join_paths(get_option('datadir'), 'appdata')
)

appstream_util = find_program('appstream-util', required: false)
if appstream_util.found()
test('Validate appstream file', appstream_util,
args: ['validate', appstream_file]
)
endif

install_data('org.gnome.Ddgtk.gschema.xml',
install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas')
)

compile_schemas = find_program('glib-compile-schemas', required: false)
if compile_schemas.found()
test('Validate schema file', compile_schemas,
args: ['--strict', '--dry-run', meson.current_source_dir()]
)
endif
7 changes: 7 additions & 0 deletions data/org.gnome.Ddgtk.appdata.xml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>org.gnome.Ddgtk.desktop</id>
<licence>CC0</licence>
<description>
</description>
</component>
7 changes: 7 additions & 0 deletions data/org.gnome.Ddgtk.desktop.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Desktop Entry]
Name=ddgtk
Exec=ddgtk
Terminal=false
Type=Application
Categories=GTK;
StartupNotify=true
5 changes: 5 additions & 0 deletions data/org.gnome.Ddgtk.gschema.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="ddgtk">
<schema id="org.gnome.Ddgtk" path="/org/gnome/Ddgtk/">
</schema>
</schemalist>
11 changes: 11 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
project('ddgtk',
version: '0.1.0',
meson_version: '>= 0.40.0',
)
i18n = import('i18n')


subdir('data')
subdir('src')
subdir('po')
meson.add_install_script('build-aux/meson/postinstall.py')
9 changes: 9 additions & 0 deletions po/POTFILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
data/org.gnome.Ddgtk.desktop.in
data/org.gnome.Ddgtk.appdata.xml.in
data/org.gnome.Ddgtk.gschema.xml
src/window.ui



src/main.py
src/window.py
1 change: 1 addition & 0 deletions po/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
i18n.gettext('ddgtk', preset: 'glib')
6 changes: 6 additions & 0 deletions src/ddgtk.gresource.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/Ddgtk">
<file>window.ui</file>
</gresource>
</gresources>
41 changes: 41 additions & 0 deletions src/ddgtk.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!@PYTHON@

# ddgtk.in
#
# Copyright (C) 2017 Alessandro
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import os
import sys
import signal
import gettext

VERSION = '@VERSION@'
pkgdatadir = '@pkgdatadir@'
localedir = '@localedir@'

sys.path.insert(1, pkgdatadir)
signal.signal(signal.SIGINT, signal.SIG_DFL)
gettext.install('ddgtk', localedir)

if __name__ == '__main__':
import gi

from gi.repository import Gio
resource = Gio.Resource.load(os.path.join(pkgdatadir, 'ddgtk.gresource'))
resource._register()

from ddgtk import main
sys.exit(main.main())
Loading

0 comments on commit 9bb4afc

Please sign in to comment.