summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFélix Piédallu <felix@piedallu.me>2020-04-29 20:57:17 +0200
committerHans Petter Jansson <hpj@cl.no>2020-06-18 16:56:05 +0200
commit326fcaf32da800e3287c048ca02933900331ee29 (patch)
treef8ddc01c61706f659f49ab1a735673a9a23c6cc6
parentcec463c93d7211d4b5dea5f79aa451facbfbc3b8 (diff)
downloaddesktop-file-utils-326fcaf32da800e3287c048ca02933900331ee29.tar.gz
Add Meson build system
-rwxr-xr-xinstall.sh4
-rwxr-xr-xmake_dist.sh4
-rw-r--r--man/meson.build12
-rw-r--r--meson.build82
-rw-r--r--meson_options.txt2
-rw-r--r--misc/meson.build4
-rw-r--r--src/meson.build32
7 files changed, 140 insertions, 0 deletions
diff --git a/install.sh b/install.sh
new file mode 100755
index 0000000..3ffa06e
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+
+ln -sf "desktop-file-install" \
+ "${MESON_INSTALL_DESTDIR_PREFIX}/bin/desktop-file-edit"
diff --git a/make_dist.sh b/make_dist.sh
new file mode 100755
index 0000000..60ea4b7
--- /dev/null
+++ b/make_dist.sh
@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+
+git log --no-color -M -C --name-status \
+ > "${MESON_DIST_ROOT}/ChangeLog"
diff --git a/man/meson.build b/man/meson.build
new file mode 100644
index 0000000..1a8ee20
--- /dev/null
+++ b/man/meson.build
@@ -0,0 +1,12 @@
+desktop_file_edit_man = configure_file(
+ input : 'desktop-file-install.1',
+ output: 'desktop-file-edit.1',
+ copy: true,
+)
+
+install_man([
+ 'desktop-file-validate.1',
+ 'desktop-file-install.1',
+ 'update-desktop-database.1',
+ desktop_file_edit_man,
+])
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..45f2215
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,82 @@
+project('desktop-file-utils',
+ 'c',
+ version: '0.25',
+ meson_version: '>=0.49.0',
+ default_options: [
+ 'c_std=gnu11',
+ ],
+)
+
+###############################################################################
+# Project configuration
+
+cc = meson.get_compiler('c')
+
+config = configuration_data()
+
+config.set_quoted('DATADIR', get_option('prefix') / get_option('datadir'))
+config.set_quoted('VERSION', meson.project_version())
+
+
+###############################################################################
+# Compiler options
+
+custom_cflags = [
+ '-Wchar-subscripts',
+ '-Wmissing-declarations',
+ '-Wmissing-prototypes',
+ '-Wnested-externs',
+ '-Wpointer-arith',
+ '-Wcast-align',
+ '-Wsign-compare',
+
+ '-Wno-unused-parameter',
+]
+
+if get_option('ansi')
+ custom_cflags += [
+ '-ansi',
+ '-pedantic',
+ ]
+endif
+
+if get_option('gcov')
+ coverage_cflags = [
+ '-fprofile-arcs',
+ '-ftest-coverage',
+ ]
+ if cc.get_supported_arguments(coverage_cflags) != coverage_cflags
+ error('Coverage is not supported by this compiler')
+ endif
+ custom_cflags += coverage_cflags
+endif
+
+add_project_arguments(cc.get_supported_arguments(custom_cflags),
+ language: [ 'c', ],
+)
+
+check_functions = [
+ { 'f': 'pledge', 'm': 'HAVE_PLEDGE' },
+]
+foreach check : check_functions
+ config.set(check.get('m'), cc.has_function(check.get('f')))
+endforeach
+
+
+###############################################################################
+# Dependencies
+
+glib = dependency('glib-2.0', version: '>=2.8.0')
+
+
+###############################################################################
+
+subdir('man')
+subdir('misc')
+subdir('src')
+
+# This script installs a symlink desktop-file-edit -> desktop-file-install
+meson.add_install_script('install.sh')
+
+# This script writes git log to Changelog.
+meson.add_dist_script('make_dist.sh')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..45e1d6c
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,2 @@
+option('ansi', type: 'boolean', value: false)
+option('gcov', type: 'boolean', value: false)
diff --git a/misc/meson.build b/misc/meson.build
new file mode 100644
index 0000000..3a95554
--- /dev/null
+++ b/misc/meson.build
@@ -0,0 +1,4 @@
+
+install_data('desktop-entry-mode.el',
+ install_dir: get_option('datadir') / 'emacs' / 'site-lisp',
+)
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..2b8a906
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,32 @@
+configure_file(
+ output: 'config.h',
+ configuration: config,
+)
+
+desktop_file_lib = static_library('desktop_file',
+ 'keyfileutils.c',
+ 'mimeutils.c',
+ 'validate.c',
+ dependencies: glib,
+)
+
+executable('desktop-file-validate',
+ 'validator.c',
+ link_with: desktop_file_lib,
+ dependencies: glib,
+ install: true,
+)
+
+executable('desktop-file-install',
+ 'install.c',
+ link_with: desktop_file_lib,
+ dependencies: glib,
+ install: true,
+)
+
+executable('desktop-file-update',
+ 'update-desktop-database.c',
+ link_with: desktop_file_lib,
+ dependencies: glib,
+ install: true,
+)