1 |
commit: 25e51618ccb10172768758cfb00339ac9c652a4b |
2 |
Author: Sobhan Mohammadpour <sobhan <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Dec 9 17:03:40 2017 +0000 |
4 |
Commit: Sobhan Mohammadpour <sobhan <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Dec 9 17:18:11 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/gnome.git/commit/?id=25e51618 |
7 |
|
8 |
gnome-meson.eclass: A new eclass to help with gnome packages using meson |
9 |
|
10 |
The gnome-meson.eclass is equivalent of the gnome2.eclass for packages |
11 |
that are using meson instead of other build systems. It is based on |
12 |
gnome2.eclass. |
13 |
|
14 |
eclass/gnome-meson.eclass | 163 ++++++++++++++++++++++++++++++++++++++++++++++ |
15 |
1 file changed, 163 insertions(+) |
16 |
|
17 |
diff --git a/eclass/gnome-meson.eclass b/eclass/gnome-meson.eclass |
18 |
new file mode 100644 |
19 |
index 00000000..0e2466cb |
20 |
--- /dev/null |
21 |
+++ b/eclass/gnome-meson.eclass |
22 |
@@ -0,0 +1,163 @@ |
23 |
+# Copyright 1999-2015 Gentoo Foundation |
24 |
+# Distributed under the terms of the GNU General Public License v2 |
25 |
+ |
26 |
+# @ECLASS: gnome-meson.eclass |
27 |
+# @MAINTAINER: |
28 |
+# gnome@g.o |
29 |
+# @BLURB: Provides phases for Gnome/Gtk+ based packages that use meosn. |
30 |
+# @DESCRIPTION: |
31 |
+# Exports portage base functions used by ebuilds written for packages using the |
32 |
+# GNOME framework and meson. For additional functions, see gnome2-utils.eclass. |
33 |
+ |
34 |
+inherit eutils gnome.org gnome2-utils meson xdg |
35 |
+ |
36 |
+case "${EAPI:-0}" in |
37 |
+ 6) |
38 |
+ EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install pkg_preinst pkg_postinst pkg_postrm |
39 |
+ ;; |
40 |
+ *) die "EAPI=${EAPI} is not supported" ;; |
41 |
+esac |
42 |
+ |
43 |
+# @ECLASS-VARIABLE: GNOME-MESON_ECLASS_GIO_MODULES |
44 |
+# @INTERNAL |
45 |
+# @DESCRIPTION: |
46 |
+# Array containing glib GIO modules |
47 |
+ |
48 |
+# @FUNCTION: gnome-meson_src_prepare |
49 |
+# @DESCRIPTION: |
50 |
+# Prepare environment for build, fix build of scrollkeeper documentation, |
51 |
+# run elibtoolize. |
52 |
+gnome-meson_src_prepare() { |
53 |
+ xdg_src_prepare |
54 |
+ |
55 |
+ # Prevent assorted access violations and test failures |
56 |
+ gnome2_environment_reset |
57 |
+ |
58 |
+ # Disable all deprecation warnings |
59 |
+ gnome2_disable_deprecation_warning |
60 |
+} |
61 |
+ |
62 |
+# @FUNCTION: gnome-meson_src_configure |
63 |
+# @DESCRIPTION: |
64 |
+# Gnome specific configure handling |
65 |
+gnome-meson_src_configure() { |
66 |
+ #FIXME: handle gtk-doc |
67 |
+ |
68 |
+ #FIXME is this still valid ? |
69 |
+ # Avoid sandbox violations caused by gnome-vfs (bug #128289 and #345659) |
70 |
+ addpredict "$(unset HOME; echo ~)/.gnome2" |
71 |
+ |
72 |
+ |
73 |
+ local emesonargs=( |
74 |
+ "$@" |
75 |
+ ) |
76 |
+ |
77 |
+ meson_src_configure |
78 |
+} |
79 |
+ |
80 |
+# @FUNCTION: gnome-meson_src_compile |
81 |
+# @DESCRIPTION: |
82 |
+# Only default src_compile for now |
83 |
+gnome-meson_src_compile() { |
84 |
+ meson_src_compile |
85 |
+} |
86 |
+ |
87 |
+# @FUNCTION: gnome-meson_src_install |
88 |
+# @DESCRIPTION: |
89 |
+# Gnome specific install. Handles typical GConf and scrollkeeper setup |
90 |
+# in packages and removal of .la files if requested |
91 |
+gnome-meson_src_install() { |
92 |
+ # we must delay gconf schema installation due to sandbox |
93 |
+ export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL="1" |
94 |
+ |
95 |
+ unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL |
96 |
+ |
97 |
+ |
98 |
+ # Since eapi6 this is handled by default on its own plus MAINTAINERS and HACKING |
99 |
+ # files that are really common in gnome packages (bug #573390) |
100 |
+ local d |
101 |
+ for d in HACKING MAINTAINERS; do |
102 |
+ [[ -s "${d}" ]] && dodoc "${d}" |
103 |
+ done |
104 |
+ |
105 |
+ # Delete all .la files |
106 |
+ |
107 |
+ case "${GNOME2_LA_PUNT}" in |
108 |
+ yes) prune_libtool_files --modules;; |
109 |
+ no) ;; |
110 |
+ *) prune_libtool_files;; |
111 |
+ esac |
112 |
+ |
113 |
+ meson_src_install |
114 |
+} |
115 |
+ |
116 |
+# @FUNCTION: gnome-meson_pkg_preinst |
117 |
+# @DESCRIPTION: |
118 |
+# Finds Icons, GConf and GSettings schemas for later handling in pkg_postinst |
119 |
+gnome-meson_pkg_preinst() { |
120 |
+ xdg_pkg_preinst |
121 |
+ gnome2_gconf_savelist |
122 |
+ gnome2_icon_savelist |
123 |
+ gnome2_schemas_savelist |
124 |
+ gnome2_scrollkeeper_savelist |
125 |
+ gnome2_gdk_pixbuf_savelist |
126 |
+ |
127 |
+ local f |
128 |
+ |
129 |
+ GNOME2_ECLASS_GIO_MODULES=() |
130 |
+ while IFS= read -r -d '' f; do |
131 |
+ GNOME2_ECLASS_GIO_MODULES+=( ${f} ) |
132 |
+ done < <(cd "${D}" && find usr/$(get_libdir)/gio/modules -type f -print0 2>/dev/null) |
133 |
+ |
134 |
+ export GNOME2_ECLASS_GIO_MODULES |
135 |
+} |
136 |
+ |
137 |
+# @FUNCTION: gnome-meson_pkg_postinst |
138 |
+# @DESCRIPTION: |
139 |
+# Handle scrollkeeper, GConf, GSettings, Icons, desktop and mime |
140 |
+# database updates. |
141 |
+gnome-meson_pkg_postinst() { |
142 |
+ xdg_pkg_postinst |
143 |
+ gnome2_gconf_install |
144 |
+ if [[ -n ${GNOME2_ECLASS_ICONS} ]]; then |
145 |
+ gnome2_icon_cache_update |
146 |
+ fi |
147 |
+ if [[ -n ${GNOME2_ECLASS_GLIB_SCHEMAS} ]]; then |
148 |
+ gnome2_schemas_update |
149 |
+ fi |
150 |
+ gnome2_scrollkeeper_update |
151 |
+ gnome2_gdk_pixbuf_update |
152 |
+ |
153 |
+ if [[ ${#GNOME2_ECLASS_GIO_MODULES[@]} -gt 0 ]]; then |
154 |
+ gnome2_giomodule_cache_update |
155 |
+ fi |
156 |
+} |
157 |
+ |
158 |
+# # FIXME Handle GConf schemas removal |
159 |
+#gnome2_pkg_prerm() { |
160 |
+# gnome2_gconf_uninstall |
161 |
+#} |
162 |
+ |
163 |
+# @FUNCTION: gnome-meson_pkg_postrm |
164 |
+# @DESCRIPTION: |
165 |
+# GSettings, Icons, desktop and mime database updates. |
166 |
+gnome-meson_pkg_postrm() { |
167 |
+ xdg_pkg_postrm |
168 |
+ if [[ -n ${GNOME2_ECLASS_ICONS} ]]; then |
169 |
+ gnome2_icon_cache_update |
170 |
+ fi |
171 |
+ if [[ -n ${GNOME2_ECLASS_GLIB_SCHEMAS} ]]; then |
172 |
+ gnome2_schemas_update |
173 |
+ fi |
174 |
+ |
175 |
+ if [[ ${#GNOME2_ECLASS_GIO_MODULES[@]} -gt 0 ]]; then |
176 |
+ gnome2_giomodule_cache_update |
177 |
+ fi |
178 |
+} |
179 |
+ |
180 |
+# @FUNTION: gnome-meson_use |
181 |
+# @DESCRIPTION: |
182 |
+# Make setting arguments easier taken from https://github.com/Heather/gentoo-gnome/blob/4f61803890da76026f4fed772c34c4394e1d2959/gnome-base/nautilus/nautilus-3.27.2.ebuild#L83 |
183 |
+gnome-meson_use() { |
184 |
+ echo "-Denable-${2:-${1}}=$(usex ${1} 'true' 'false')" |
185 |
+} |