[gnome-nettool] build: add meson build
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-nettool] build: add meson build
- Date: Thu, 28 Sep 2017 12:39:11 +0000 (UTC)
commit 8c5311136fa541786e2e9c23159d1d7945361bad
Author: Tim-Philipp Müller <tim centricular com>
Date: Fri Jun 9 01:16:23 2017 +0100
build: add meson build
https://bugzilla.gnome.org/show_bug.cgi?id=783608
Makefile.am | 14 ++++++-
data/gnome-nettool.desktop.in.meson | 14 ++++++
data/meson.build | 38 ++++++++++++++++
data/org.gnome.gnome-nettool.gschema.xml.meson | 20 +++++++++
help/meson.build | 41 ++++++++++++++++++
meson.build | 55 ++++++++++++++++++++++++
pixmaps/meson.build | 28 ++++++++++++
po/meson.build | 3 +
postinstall.py | 28 ++++++++++++
src/meson.build | 21 +++++++++
10 files changed, 261 insertions(+), 1 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 4115853..9f5fcd7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,11 +2,23 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
SUBDIRS = pixmaps data src help po
+MESON_FILES = \
+ data/gnome-nettool.desktop.in.meson \
+ data/org.gnome.gnome-nettool.gschema.xml.meson \
+ data/meson.build \
+ help/meson.build \
+ pixmaps/meson.build \
+ po/meson.build \
+ postinstall.py \
+ src/meson.build \
+ meson.build
+
EXTRA_DIST = \
intltool-extract.in \
intltool-merge.in \
intltool-update.in \
- mkinstalldirs
+ mkinstalldirs \
+ $(MESON_FILES)
DISTCLEANFILES = \
intltool-extract \
diff --git a/data/gnome-nettool.desktop.in.meson b/data/gnome-nettool.desktop.in.meson
new file mode 100644
index 0000000..74a601c
--- /dev/null
+++ b/data/gnome-nettool.desktop.in.meson
@@ -0,0 +1,14 @@
+[Desktop Entry]
+Name=Network Tools
+Comment=View information about your network
+Keywords=network;monitor;remote;
+Exec=gnome-nettool
+Icon=gnome-nettool
+Terminal=false
+Type=Application
+Categories=System;Utility;GNOME;GTK;
+StartupNotify=true
+X-GNOME-Bugzilla-Bugzilla=GNOME
+X-GNOME-Bugzilla-Product=gnome-nettool
+X-GNOME-Bugzilla-Component=general
+X-GNOME-Bugzilla-Version=@PACKAGE_VERSION@
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..32dff0a
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,38 @@
+pkg = meson.project_name()
+prefix = get_option('prefix')
+datadir = get_option('datadir')
+localedir = get_option('localedir')
+
+ui_dir = join_paths(prefix, datadir, pkg, 'ui', '') # want trailing slash
+pixmaps_dir = join_paths(prefix, datadir, pkg, 'pixmaps')
+
+cdata.set_quoted('GNOME_NETTOOL_LOCALEDIR', join_paths(prefix, localedir))
+cdata.set_quoted('PIXMAPS_DIR', pixmaps_dir)
+cdata.set_quoted('UI_DIR', ui_dir)
+
+install_data('gnome-nettool.ui', install_dir: ui_dir)
+
+desktop_conf = configuration_data()
+desktop_conf.set('PACKAGE_VERSION', meson.project_version())
+
+# gnome-nettool.desktop.in.meson has leading _ removed for Name, Comment, Keywords
+desktop_in = configure_file(input: 'gnome-nettool.desktop.in.meson',
+ output: 'gnome-nettool.desktop.in',
+ configuration: desktop_conf)
+
+i18n.merge_file('desktop',
+ type: 'desktop',
+ input: desktop_in,
+ output: 'gnome-nettool.desktop',
+ po_dir: join_paths(meson.current_source_dir(), '../po'),
+ install: true,
+ install_dir: join_paths(prefix, datadir, 'applications'))
+
+# FIXME: not sure how to do things with the orignal .in file with translatable xml tags
+# Apparently very very recent gettext (git) has gschema support.
+# Also: https://github.com/mesonbuild/meson/pull/1757
+configure_file(input: 'org.gnome.gnome-nettool.gschema.xml.meson',
+ output: 'org.gnome.gnome-nettool.gschema.xml',
+ configuration: configuration_data(),
+ install: true,
+ install_dir: join_paths(prefix, datadir, 'glib-2.0', 'schemas'))
diff --git a/data/org.gnome.gnome-nettool.gschema.xml.meson b/data/org.gnome.gnome-nettool.gschema.xml.meson
new file mode 100644
index 0000000..aa3a1b1
--- /dev/null
+++ b/data/org.gnome.gnome-nettool.gschema.xml.meson
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schemalist>
+ <schema path="/org/gnome/gnome-nettool/" id="org.gnome.gnome-nettool" gettext-domain="gnome-nettool">
+ <key type="as" name="hostnames">
+ <default>[]</default>
+ <summary>Historically used hostnames</summary>
+ <description>A list of hostnames previously used</description>
+ </key>
+ <key type="as" name="usernames">
+ <default>[]</default>
+ <summary>Historically used usernames</summary>
+ <description>A list of usernames previously used</description>
+ </key>
+ <key type="as" name="domains">
+ <default>[]</default>
+ <summary>Historically used domains</summary>
+ <description>A list of domains previously used</description>
+ </key>
+ </schema>
+</schemalist>
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 0000000..d902db2
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,41 @@
+gnome = import('gnome')
+
+sources = [
+ 'index.page',
+ 'introduction.page',
+ 'ip-information.page',
+ 'network-connectivity.page',
+]
+
+media = [
+ 'figures/gnome-nettool-trail.png',
+ 'figures/gnome-nettool.png',
+]
+
+linguas = [
+ 'ca',
+ 'cs',
+ 'da',
+ 'de',
+ 'el',
+ 'en_GB',
+ 'es',
+ 'fr',
+ 'hu',
+ 'ko',
+ 'oc',
+ 'pa',
+ 'pl',
+ 'pt_BR',
+ 'ru',
+ 'sv',
+ 'uk',
+ 'vi',
+ 'zh_CN',
+]
+
+gnome.yelp(meson.project_name(),
+ sources: sources,
+ media: media,
+ symlink_media: true,
+ languages: linguas)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..56d58d6
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,55 @@
+project('gnome-nettool', 'c',
+ version: '3.8.1',
+ default_options: [
+ 'buildtype=debugoptimized',
+ 'warning_level=1',
+ ],
+ meson_version: '>= 0.40.1',
+ license: 'GPLv2.0+')
+
+gio_req = '>= 2.26'
+gtk_req = '>= 3.0.0'
+
+cc = meson.get_compiler('c')
+
+# config.h configuration data
+cdata = configuration_data()
+cdata.set_quoted('GETTEXT_PACKAGE', 'gnome-nettool')
+cdata.set_quoted('PACKAGE_VERSION', meson.project_version())
+cdata.set_quoted('PACKAGE_URL', 'http://projects.gnome.org/gnome-network/')
+
+add_project_arguments('-DHAVE_CONFIG_H', language: 'c')
+
+if cc.has_argument('-Wno-deprecated-declarations')
+ add_project_arguments('-Wno-deprecated-declarations', language: 'c')
+endif
+
+config_inc = include_directories('.')
+
+# Check headers
+cdata.set('HAVE_SYS_SOCKIO_H', cc.has_header('sys/sockio.h'))
+
+req_headers = ['sys/socket.h', 'ifaddrs.h']
+foreach req_header : req_headers
+ if not cc.has_header(req_header)
+ error('Required header not found: ' + req_header)
+ endif
+endforeach
+
+gtk_dep = dependency('gtk+-3.0', version: gtk_req)
+gio_dep = dependency('gio-2.0', version: gio_req)
+gtop_dep = dependency('libgtop-2.0')
+gmodule_dep = dependency('gmodule-export-2.0')
+
+nettool_deps = [gtk_dep, gio_dep, gmodule_dep, gtop_dep]
+
+subdir('src')
+subdir('po')
+subdir('data')
+subdir('help')
+subdir('pixmaps')
+
+# write config.h
+configure_file(output: 'config.h', configuration: cdata)
+
+meson.add_install_script('postinstall.py')
diff --git a/pixmaps/meson.build b/pixmaps/meson.build
new file mode 100644
index 0000000..e20a605
--- /dev/null
+++ b/pixmaps/meson.build
@@ -0,0 +1,28 @@
+pixmaps = [
+ '16_ethernet.xpm',
+ '16_loopback.xpm',
+ '16_plip.xpm',
+ '16_ppp.xpm',
+ 'irda-16.png',
+ 'network.png',
+ 'gnome-nettool.png',
+ 'wavelan-16.png',
+]
+pixmaps_dir = join_paths(prefix, datadir, pkg, 'pixmaps')
+install_data(pixmaps, install_dir: pixmaps_dir)
+
+icons = [
+ ['16x16', files('icons/16x16/apps/gnome-nettool.png')],
+ ['22x22', files('icons/22x22/apps/gnome-nettool.png')],
+ ['24x24', files('icons/24x24/apps/gnome-nettool.png')],
+ ['32x32', files('icons/32x32/apps/gnome-nettool.png')],
+ ['scalable', files('icons/scalable/apps/gnome-nettool.svg')],
+ ['scalable', files('icons/scalable/apps/gnome-nettool-symbolic.svg')],
+]
+
+foreach icon : icons
+ size = icon[0]
+ file = icon[1]
+ iconsdir = join_paths(prefix, datadir, 'icons', 'hicolor', size, 'apps')
+ install_data(file, install_dir: iconsdir)
+endforeach
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..192e262
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,3 @@
+i18n = import('i18n')
+
+i18n.gettext('gnome-nettool', preset : 'glib')
diff --git a/postinstall.py b/postinstall.py
new file mode 100755
index 0000000..300995f
--- /dev/null
+++ b/postinstall.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+
+prefix = os.environ.get('MESON_INSTALL_PREFIX', '/usr/local')
+datadir = os.path.join(prefix, 'share')
+
+# Packaging tools define DESTDIR and this isn't needed for them
+if 'DESTDIR' not in os.environ:
+ print('Updating icon cache...')
+ icon_cache_dir = os.path.join(datadir, 'icons', 'hicolor')
+ if not os.path.exists(icon_cache_dir):
+ os.makedirs(icon_cache_dir)
+ subprocess.call(['gtk-update-icon-cache', '-qtf', icon_cache_dir])
+
+ print('Updating desktop database...')
+ desktop_database_dir = os.path.join(datadir, 'applications')
+ if not os.path.exists(desktop_database_dir):
+ os.makedirs(desktop_database_dir)
+ subprocess.call(['update-desktop-database', '-q', desktop_database_dir])
+
+ print('Compiling GSettings schemas...')
+ schemas_dir = os.path.join(datadir, 'glib-2.0', 'schemas')
+ if not os.path.exists(schemas_dir):
+ os.makedirs(schemas_dir)
+ subprocess.call(['glib-compile-schemas', schemas_dir])
+
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..0dd9e8b
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,21 @@
+nettool_sources = [
+ 'callbacks.c',
+ 'nettool.c',
+ 'gn-combo-history.c',
+ 'ping.c',
+ 'traceroute.c',
+ 'netstat.c',
+ 'info.c',
+ 'scan.c',
+ 'lookup.c',
+ 'finger.c',
+ 'whois.c',
+ 'utils.c',
+ 'util-mii.c',
+ 'main.c',
+]
+
+executable('gnome-nettool', nettool_sources,
+ include_directories: config_inc,
+ dependencies: nettool_deps,
+ install: true)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]