From ba429d344132c088177e853cce8ff7181570b221 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 10 Apr 2024 19:42:51 +0200 Subject: Adding upstream version 44.2. Signed-off-by: Daniel Baumann --- subprojects/libgd/meson_readme.md | 88 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 subprojects/libgd/meson_readme.md (limited to 'subprojects/libgd/meson_readme.md') diff --git a/subprojects/libgd/meson_readme.md b/subprojects/libgd/meson_readme.md new file mode 100644 index 0000000..c3e7f26 --- /dev/null +++ b/subprojects/libgd/meson_readme.md @@ -0,0 +1,88 @@ +See README for general information. Read below for usage with Meson. + +Usage +===== + +libgd is intended to be used as a submodule from other projects. This requires passing default_options to the subproject +which was added in Meson 0.38.0. To see a full list of options you can run `mesonconf $your_build_dir`. If building a +non-static library `pkglibdir` must be set to a private location to install to which you will also want to pass (an absolute path) +with the `install_rpath` keyword to any executables. For introspection files you also must set `pkgdatadir`. + +So given a Meson project using git you would run this to do initial setup: + +``` +mkdir subprojects +git submodule add https://git.gnome.org/browse/libgd subprojects/libgd +``` + +Then from within your `meson.build` file: + +Static Library +-------------- + +```meson +libgd = subproject('libgd', + default_options: [ + 'with-tagged-entry=true' + ] +) +# Pass as dependency to another target +libgd_dep = libgd.get_variable('libgd_dep') +``` + +```c +#include "libgd/gd.h" + +int main(int argc, char **argv) +{ + gd_ensure_types(); /* As a test */ + return 0; +} +``` + +Introspection +------------- + +```meson +pkglibdir = join_paths(get_option('libdir'), meson.project_name()) +pkgdatadir = join_paths(get_option('datadir'), meson.project_name()) +libgd = subproject('libgd', + default_options: [ + 'pkglibdir=' + pkglibdir, + 'pkgdatadir=' + pkgdatadir, + 'with-tagged-entry=true', + 'with-introspection=true', + 'static=false', + ] +) +``` + +```python +import os +import gi +gi.require_version('GIRepository', '2.0') +from gi.repository import GIRepository +pkglibdir = '/usr/lib/foo' # This would be defined at build time +pkggirdir = os.path.join(pkglibdir, 'girepository-1.0') +GIRepository.Repository.prepend_search_path(pkggirdir) +GIRepository.Repository.prepend_library_path(pkglibdir) +gi.require_version('Gd', '1.0') +``` + +Vala +---- + +```meson +pkglibdir = join_paths(get_option('libdir'), meson.project_name()) +libgd = subproject('libgd', + default_options: [ + 'pkglibdir=' + pkglibdir, + 'with-tagged-entry=true', + 'with-vapi=true' + ] +) +# Pass as dependency to a Vala target +libgd_vapi_dep = libgd.get_variable('libgd_vapi_dep') +``` + + -- cgit v1.2.3