summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhuyaliang <[email protected]>2021-07-25 11:52:47 +0800
committerraveit65 <[email protected]>2021-07-30 19:02:49 +0200
commit8dca108a6a4bed0b3411e41cb04b143c71036b67 (patch)
tree35632a66e2d50c89a690e5202a2e0ff56e7285b6
parenta1216168706c08384154d3cea579d223fdc9e81d (diff)
downloadmate-calc-8dca108a6a4bed0b3411e41cb04b143c71036b67.tar.bz2
mate-calc-8dca108a6a4bed0b3411e41cb04b143c71036b67.tar.xz
Add build support for meson
-rw-r--r--data/meson.build30
-rw-r--r--help/LINGUAS112
-rw-r--r--help/meson.build33
-rw-r--r--meson-postinstall.sh13
-rw-r--r--meson.build65
-rw-r--r--po/meson.build3
-rw-r--r--src/meson.build120
-rw-r--r--src/utility.h1
8 files changed, 377 insertions, 0 deletions
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..538b26a
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1,30 @@
+# Desktop file
+i18n.merge_file(
+ input: 'mate-calc.desktop.in',
+ output: 'mate-calc.desktop',
+ type: 'desktop',
+ po_dir: po_dir,
+ install: true,
+ install_dir: join_paths(get_option('datadir'), 'applications'),
+)
+
+# Appdata
+i18n.merge_file(
+ input: 'mate-calc.appdata.xml.in',
+ output: 'mate-calc.appdata.xml',
+ type: 'xml',
+ po_dir: po_dir,
+ install: true,
+ install_dir: join_paths(get_option('datadir'), 'metainfo')
+)
+
+# Gschema
+ install_data('org.mate.calc.gschema.xml',
+ install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas'),
+ )
+
+# Manpage
+install_man(
+ 'mate-calc-cmd.1',
+ 'mate-calc.1'
+)
diff --git a/help/LINGUAS b/help/LINGUAS
new file mode 100644
index 0000000..f7091dc
--- /dev/null
+++ b/help/LINGUAS
@@ -0,0 +1,112 @@
+af
+am
+ar
+as
+ast
+az
+be
+bg
+bn
+bn_IN
+br
+bs
+ca
+ca@valencia
+cmn
+crh
+cs
+cy
+da
+de
+dz
+el
+en_AU
+en_CA
+en_GB
+eo
+es
+es_AR
+es_CO
+es_MX
+et
+eu
+fa
+fi
+fr
+frp
+fur
+ga
+gl
+gu
+ha
+he
+hi
+hr
+hu
+hy
+id
+ie
+ig
+is
+it
+ja
+ka
+kk
+km
+kn
+ko
+ku
+ku_IQ
+ky
+li
+lt
+lv
+mai
+mg
+mk
+ml
+mn
+mr
+ms
+my
+nb
+nds
+ne
+nl
+nn
+nso
+oc
+or
+pa
+pl
+pms
+ps
+pt
+pt_BR
+ro
+ru
+rw
+si
+sk
+sl
+sq
+sr
+sr@latin
+sv
+ta
+te
+th
+tk
+tr
+ug
+uk
+ur
+uz
+vi
+wa
+xh
+yo
+zh_CN
+zh_HK
+zh_TW
+zu
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 0000000..bbe3028
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,33 @@
+mate_calc_help_pages = [
+ 'absolute.page',
+ 'base.page',
+ 'boolean.page',
+ 'complex.page',
+ 'conv-base.page',
+ 'conv-character.page',
+ 'conv-currency.page',
+ 'conv-length.page',
+ 'conv-time.page',
+ 'conv-weight.page',
+ 'equation.page',
+ 'factorial.page',
+ 'factorize.page',
+ 'financial.page',
+ 'functions.page',
+ 'index.page',
+ 'keyboard.page',
+ 'legal.xml',
+ 'logarithm.page',
+ 'modulus.page',
+ 'mouse.page',
+ 'number-display.page',
+ 'percentage.page',
+ 'power.page',
+ 'scientific.page',
+ 'superscript.page',
+ 'trigonometry.page',
+ 'variables.page'
+]
+gnome.yelp(meson.project_name(),
+ sources: mate_calc_help_pages,
+)
diff --git a/meson-postinstall.sh b/meson-postinstall.sh
new file mode 100644
index 0000000..fa131ea
--- /dev/null
+++ b/meson-postinstall.sh
@@ -0,0 +1,13 @@
+#!/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 desktop database...
+ update-desktop-database -q ${MESON_INSTALL_PREFIX}/share/applications
+
+ ln -sf ${MESON_INSTALL_PREFIX}/bin/'mate-calc' ${MESON_INSTALL_PREFIX}/bin/'mate-calculator'
+fi
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..d7fa021
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,65 @@
+project('mate-calc','c',
+ version: '1.25.1',
+ meson_version: '>=0.50.0',
+ license: 'GPLv3+',
+)
+
+i18n = import('i18n')
+gnome = import('gnome')
+
+po_dir = join_paths(meson.source_root(), 'po')
+datadir = join_paths([ get_option('prefix'),get_option('datadir') ])
+pkgdatadir = join_paths([ get_option('prefix'),get_option('datadir'),'mate-calc' ])
+bindir = join_paths([ get_option('prefix'), 'bin' ])
+schemadir = join_paths([ datadir, 'glib-2.0', 'schemas' ])
+locale_dir = join_paths(get_option('prefix'), get_option('localedir'))
+
+# Dependencies
+glib_min_version = '2.40.0'
+
+gio = dependency('gio-2.0', version: '>= ' + glib_min_version)
+glib = dependency('glib-2.0', version: '>= ' + glib_min_version)
+gobject = dependency('gobject-2.0', version: '>= ' + glib_min_version)
+libxml = dependency('libxml-2.0')
+gtk = dependency('gtk+-3.0', version : '>=3.22')
+
+# Libraries
+cc = meson.get_compiler('c')
+mpc = declare_dependency(
+ dependencies: [
+ cc.find_library('mpc'),
+ ]
+)
+mpfr = declare_dependency(
+ dependencies: [
+ cc.find_library('mpfr'),
+ ]
+)
+conf = configuration_data()
+
+top_inc = include_directories('.')
+
+conf.set('G_LOG_USE_STRUCTURED', true)
+conf.set_quoted('PACKAGE_NAME', 'mate-calc')
+conf.set_quoted('PACKAGE_VERSION', meson.project_version())
+conf.set_quoted('VERSION', meson.project_version())
+conf.set_quoted('GETTEXT_PACKAGE', 'mate-calc')
+conf.set_quoted('PACKAGE_URL', 'https://mate-desktop.org')
+conf.set_quoted('DATADIR', datadir)
+conf.set_quoted('UI_DIR', join_paths([pkgdatadir,'uidir']))
+conf.set_quoted('PKGDATADIR', pkgdatadir)
+conf.set_quoted('LOCALE_DIR', join_paths([ get_option('prefix'),
+ get_option('datadir'),
+ 'locale' ]))
+
+conf.set_quoted('pkgdatadir', pkgdatadir)
+conf.set_quoted('bindir', bindir)
+
+configure_file(output : 'config.h', configuration : conf)
+
+subdir('src')
+subdir('data')
+subdir('po')
+subdir('help')
+
+meson.add_install_script('meson-postinstall.sh')
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..f904cde
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,3 @@
+i18n.gettext(meson.project_name(),
+ preset: 'glib'
+)
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..bb183cd
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,120 @@
+src = []
+src_cmd = []
+test_mp_src = []
+test_mp_eq_src = []
+
+enums = []
+
+enums += gnome.mkenums('types',
+ sources: 'mp-serializer.h',
+ c_template: 'mp-enums.c.template',
+ h_template: 'mp-enums.h.template')
+
+ui_files = files(
+ 'buttons-advanced.ui',
+ 'buttons-basic.ui',
+ 'buttons-financial.ui',
+ 'preferences.ui'
+)
+
+ui_resources = gnome.compile_resources(
+ 'ui_resources',
+ 'org.mate.calculator.gresource.xml',
+ source_dir: 'src'
+)
+
+src += [
+ 'mate-calc.c',
+ 'currency-manager.c',
+ 'currency.c',
+ 'financial.c',
+ 'lexer.c',
+ 'math-buttons.c',
+ 'math-converter.c',
+ 'math-display.c',
+ 'math-equation.c',
+ 'math-history.c',
+ 'math-history-entry.c',
+ 'math-preferences.c',
+ 'math-variable-popup.c',
+ 'math-variables.c',
+ 'math-window.c',
+ 'mp-binary.c',
+ 'mp-convert.c',
+ 'mp-equation.c',
+ 'mp-trigonometric.c',
+ 'mp-serializer.c',
+ 'mp.c',
+ 'parser.c',
+ 'parserfunc.c',
+ 'prelexer.c',
+ 'unit-category.c',
+ 'unit-manager.c',
+ 'unit.c',
+ enums,
+ ui_resources
+]
+
+src_cmd += [
+ 'mate-calc-cmd.c',
+ 'currency.c',
+ 'currency-manager.c',
+ 'mp.c',
+ 'mp-binary.c',
+ 'mp-convert.c',
+ 'mp-equation.c',
+ 'mp-serializer.c',
+ 'mp-trigonometric.c',
+ 'unit.c',
+ 'unit-category.c',
+ 'unit-manager.c',
+ 'prelexer.c',
+ 'lexer.c',
+ 'parserfunc.c',
+ 'parser.c',
+ enums
+]
+
+test_mp_src += [
+ 'test-mp.c',
+ 'mp.c',
+ 'mp-convert.c',
+ 'mp-trigonometric.c'
+]
+
+test_mp_eq_src += [
+ 'test-mp-equation.c',
+ 'currency.c',
+ 'currency-manager.c',
+ 'mp.c',
+ 'mp-convert.c',
+ 'mp-binary.c',
+ enums,
+ 'mp-equation.c',
+ 'mp-serializer.c',
+ 'mp-trigonometric.c',
+ 'unit.c',
+ 'unit-category.c',
+ 'unit-manager.c',
+ 'prelexer.c',
+ 'lexer.c',
+ 'parserfunc.c',
+ 'parser.c',
+]
+
+executable('mate-calc', src, include_directories: top_inc,
+ dependencies : [gio, glib, gobject,gtk, libxml, mpc, mpfr],
+ link_args: '-rdynamic',
+ install : true,
+ install_dir : get_option('bindir'))
+
+executable('mate-calc-cmd', src_cmd, include_directories: top_inc,
+ dependencies : [gio, libxml, mpc, mpfr],
+ install : true,
+ install_dir : get_option('bindir'))
+
+executable('test-mp', test_mp_src, include_directories: top_inc,
+ dependencies : [gio, libxml, mpc, mpfr])
+
+executable('test-mp-equation', test_mp_eq_src, include_directories: top_inc,
+ dependencies: [gio, libxml, mpc, mpfr])
diff --git a/src/utility.h b/src/utility.h
index 91745ed..15d40b2 100644
--- a/src/utility.h
+++ b/src/utility.h
@@ -2,6 +2,7 @@
#define UTILITY_H
#include <glib/gi18n.h>
+#include "config.h"
extern GSettings *g_settings_var;