[gthumb] extensions: ported the example to meson
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] extensions: ported the example to meson
- Date: Sun, 7 Feb 2021 17:30:27 +0000 (UTC)
commit 5fc2ff0cd51bdff4af2744295a0885bec9c1677f
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sun Feb 7 13:21:08 2021 +0100
extensions: ported the example to meson
extensions/example/AUTHORS | 0
extensions/example/Makefile.am | 67 --------
extensions/example/NEWS | 0
extensions/example/README | 24 ---
extensions/example/README.md | 25 +++
extensions/example/autogen.sh | 17 --
extensions/example/configure.ac.example | 115 -------------
extensions/example/git.mk | 181 ---------------------
extensions/example/init.sh | 47 ++----
extensions/example/meson.build | 30 ++++
extensions/example/po/LINGUAS | 1 -
extensions/example/po/POTFILES.in | 4 -
extensions/example/po/it.po | 26 ---
extensions/example/po/meson.build | 1 +
extensions/example/src/Makefile.am | 22 ---
.../example/src/example.extension.desktop.in.in | 12 ++
extensions/example/src/example.extension.in.in | 12 --
extensions/example/src/main.c | 2 +-
extensions/example/src/meson.build | 29 ++++
19 files changed, 111 insertions(+), 504 deletions(-)
---
diff --git a/extensions/example/README.md b/extensions/example/README.md
new file mode 100644
index 00000000..e6fb979f
--- /dev/null
+++ b/extensions/example/README.md
@@ -0,0 +1,25 @@
+# Example
+
+This is an example extension that can be used as a starting point to develop
+new extensions.
+
+To create a new extension named my-extension type the following:
+
+ cp -R example ~/my-extension
+ cd ~/my-extension
+ ./init.sh my-extension
+
+To compile the extension:
+
+ meson build
+ ninja -C build
+
+To install:
+
+ sudo ninja -C install
+
+After installing the extension, start gThumb and activate it from the
+Preferences dialog.
+
+If you think your extension can be useful to others as well, add it to
+the extensions list available at <https://wiki.gnome.org/Apps/Gthumb/extensions>.
diff --git a/extensions/example/init.sh b/extensions/example/init.sh
old mode 100644
new mode 100755
index 05a13de4..2159dd47
--- a/extensions/example/init.sh
+++ b/extensions/example/init.sh
@@ -1,42 +1,21 @@
+#/usr/bin/sh
+
if [ -z $1 ]; then
- echo "Usage: sh init.sh YOUR-EXTENSION-NAME [ORIGINAL-NAME]"
- echo "Change the name of the extension in YOUR-EXTENSION-NAME"
+ echo "Usage: ./init.sh NEW_NAME]"
+ echo "Change the name of the extension to NEW_NAME."
echo ""
- echo " YOUR-EXTENSION-NAME The new name to use, separate the words with -"
- echo " [ORIGINAL-NAME] The original name to substitute (optional, default:example)"
+ echo " NEW_NAME The new name to use, separate words with - or _"
exit 1
fi
-if [ -z $2 ]; then
- originalname=example
-else
- originalname=$2
-fi
-originalname=`echo $originalname | tr '_' '-'`
-original_name=`echo $originalname | tr '-' '_'`
-
-extensionname=`echo $1 | tr '_' '-'`
-extension_name=`echo $extensionname | tr '-' '_'`
-
-orig_dir=`pwd`
+extensionname=$1
+originalname=example
-sed -e "s|$originalname|$extensionname|" < autogen.sh > autogen.sh.tmp
-mv autogen.sh.tmp autogen.sh
-chmod a+x autogen.sh
-
-if [ -e configure.ac.example ]; then
- mv configure.ac.example configure.ac
-fi
-sed -e "s|gthumb-$originalname|gthumb-$extensionname|" < configure.ac > configure.ac.tmp
-mv configure.ac.tmp configure.ac
-
-if [ -e src/$original_name.extension.in.in ]; then
- mv src/$original_name.extension.in.in src/$extension_name.extension.in.in
-fi
-sed -e "s|$original_name|$extension_name|" < src/Makefile.am > src/Makefile.am.tmp
-mv src/Makefile.am.tmp src/Makefile.am
+sed -e "s|$originalname|$extensionname|" < meson.build > meson.build.tmp
+mv meson.build.tmp meson.build
-cd po
-sh update-potfiles.sh > POTFILES.in
+sed -e "s|$originalname|$extensionname|" < src/${originalname}.extension.desktop.in.in >
src/${extensionname}.extension.desktop.in.in
+rm src/${originalname}.extension.desktop.in.in
-cd $orig_dir
+sed -e "s|$originalname|$extensionname|" < src/meson.build > src/meson.build.tmp
+mv src/meson.build.tmp src/meson.build
diff --git a/extensions/example/meson.build b/extensions/example/meson.build
new file mode 100644
index 00000000..95713448
--- /dev/null
+++ b/extensions/example/meson.build
@@ -0,0 +1,30 @@
+project('example', ['c'],
+ license : 'GPL2+',
+ version : '1.0',
+ meson_version : '>=0.43'
+)
+
+gnome = import('gnome')
+i18n = import('i18n')
+gettext_package = meson.project_name()
+
+extensions_install_dir = dependency('gthumb').get_pkgconfig_variable('extensionsdir')
+extension_data = configuration_data()
+extension_data.set('GTHUMB_API', dependency('gthumb').get_pkgconfig_variable('apiversion'))
+
+extension_deps = [
+ dependency('gthumb'),
+]
+
+po_dir = join_paths(meson.source_root(), 'po')
+
+config_data = configuration_data()
+config_data.set_quoted('PACKAGE_NAME', meson.project_name())
+config_data.set_quoted('PACKAGE_VERSION', meson.project_version())
+config_data.set_quoted('GETTEXT_PACKAGE', gettext_package)
+config_data.set_quoted('EXTENSION_LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
+config_file = configure_file(output : 'config.h', configuration : config_data)
+config_inc = include_directories('.')
+
+subdir('src')
+subdir('po')
diff --git a/extensions/example/po/LINGUAS b/extensions/example/po/LINGUAS
index 7d5856f0..e69de29b 100644
--- a/extensions/example/po/LINGUAS
+++ b/extensions/example/po/LINGUAS
@@ -1 +0,0 @@
-it
diff --git a/extensions/example/po/meson.build b/extensions/example/po/meson.build
new file mode 100644
index 00000000..5159141f
--- /dev/null
+++ b/extensions/example/po/meson.build
@@ -0,0 +1 @@
+i18n.gettext(gettext_package, preset : 'glib')
diff --git a/extensions/example/src/example.extension.desktop.in.in
b/extensions/example/src/example.extension.desktop.in.in
new file mode 100644
index 00000000..bdd4d86e
--- /dev/null
+++ b/extensions/example/src/example.extension.desktop.in.in
@@ -0,0 +1,12 @@
+[Extension]
+Name=example
+Comment=What example does
+Authors=Development Team
+Copyright=Copyright © 2021 Development Team
+Version=1.0
+Category=Browser
+URL=https://www.example.com
+
+[Loader]
+Type=module
+API=@GTHUMB_API@
diff --git a/extensions/example/src/main.c b/extensions/example/src/main.c
index e348200f..aabcda8d 100644
--- a/extensions/example/src/main.c
+++ b/extensions/example/src/main.c
@@ -3,7 +3,7 @@
/*
* GThumb
*
- * Copyright (C) 2010 Free Software Foundation, Inc.
+ * Copyright (C) 2010-2021 Free Software Foundation, Inc.
*
* 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
diff --git a/extensions/example/src/meson.build b/extensions/example/src/meson.build
new file mode 100644
index 00000000..9afcafee
--- /dev/null
+++ b/extensions/example/src/meson.build
@@ -0,0 +1,29 @@
+source_files = files(
+ 'main.c'
+)
+
+shared_module('example',
+ sources : [ source_files ],
+ dependencies : extension_deps,
+ include_directories : [ config_inc ],
+ install : true,
+ install_dir : extensions_install_dir,
+ install_rpath : extensions_install_dir
+)
+
+# .extension file
+
+extension_in_file = configure_file(
+ input : 'example.extension.desktop.in.in',
+ output : 'example.extension.in',
+ configuration : extension_data
+)
+
+i18n.merge_file(
+ input : extension_in_file,
+ output : 'example.extension',
+ type : 'desktop',
+ po_dir : po_dir,
+ install : true,
+ install_dir : extensions_install_dir
+)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]