gnome-meson.eclass (4236B)
1 # Copyright 1999-2015 Gentoo Foundation 2 # Distributed under the terms of the GNU General Public License v2 3 4 # @ECLASS: gnome-meson.eclass 5 # @MAINTAINER: 6 # gnome@gentoo.org 7 # @BLURB: Provides phases for Gnome/Gtk+ based packages that use meosn. 8 # @DESCRIPTION: 9 # Exports portage base functions used by ebuilds written for packages using the 10 # GNOME framework and meson. For additional functions, see gnome2-utils.eclass. 11 12 inherit eutils gnome.org gnome2-utils meson xdg 13 14 case "${EAPI:-0}" in 15 6) 16 EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install pkg_preinst pkg_postinst pkg_postrm 17 ;; 18 *) die "EAPI=${EAPI} is not supported" ;; 19 esac 20 21 # @ECLASS-VARIABLE: GNOME-MESON_ECLASS_GIO_MODULES 22 # @INTERNAL 23 # @DESCRIPTION: 24 # Array containing glib GIO modules 25 26 # @FUNCTION: gnome-meson_src_prepare 27 # @DESCRIPTION: 28 # Prepare environment for build, fix build of scrollkeeper documentation, 29 # run elibtoolize. 30 gnome-meson_src_prepare() { 31 # FIXME add gtk-doc stuff if needed 32 xdg_src_prepare 33 34 # Prevent assorted access violations and test failures 35 gnome2_environment_reset 36 } 37 38 # @FUNCTION: gnome-meson_src_configure 39 # @DESCRIPTION: 40 # Gnome specific configure handling 41 gnome-meson_src_configure() { 42 # Avoid sandbox violations caused by gnome-vfs (bug #128289 and #345659) 43 addpredict "$(unset HOME; echo ~)/.gnome2" 44 45 #FIXME are these valid/needed 46 # "-Dgtk-doc=no" 47 # "-Dmaintainer-mode=no" 48 # "-Dschemas-install=no" 49 # "-Dupdate-mimedb=no" 50 # "-Dcompile-warnings=minimum" 51 local emesonargs=( 52 "$@" 53 ) 54 55 meson_src_configure 56 } 57 58 # @FUNCTION: gnome-meson_src_compile 59 # @DESCRIPTION: 60 # Only default src_compile for now 61 gnome-meson_src_compile() { 62 meson_src_compile 63 } 64 65 # @FUNCTION: gnome-meson_src_install 66 # @DESCRIPTION: 67 # Gnome specific install. Handles typical GConf and scrollkeeper setup 68 # in packages and removal of .la files if requested 69 gnome-meson_src_install() { 70 # install docs 71 default 72 73 # files that are really common in gnome packages (bug #573390) 74 local d 75 for d in HACKING MAINTAINERS; do 76 [[ -s "${d}" ]] && dodoc "${d}" 77 done 78 79 # Make sure this one doesn't get in the portage db 80 rm -fr "${ED}/usr/share/applications/mimeinfo.cache" 81 82 # Delete all .la files 83 case "${GNOME2_LA_PUNT}" in 84 yes) prune_libtool_files --modules;; 85 no) ;; 86 *) prune_libtool_files;; 87 esac 88 89 meson_src_install 90 } 91 92 # @FUNCTION: gnome-meson_pkg_preinst 93 # @DESCRIPTION: 94 # Finds Icons, GConf and GSettings schemas for later handling in pkg_postinst 95 gnome-meson_pkg_preinst() { 96 xdg_pkg_preinst 97 gnome2_gconf_savelist 98 gnome2_icon_savelist 99 gnome2_schemas_savelist 100 gnome2_scrollkeeper_savelist 101 gnome2_gdk_pixbuf_savelist 102 103 local f 104 105 GNOME2_ECLASS_GIO_MODULES=() 106 while IFS= read -r -d '' f; do 107 GNOME2_ECLASS_GIO_MODULES+=( ${f} ) 108 done < <(cd "${D}" && find usr/$(get_libdir)/gio/modules -type f -print0 2>/dev/null) 109 110 export GNOME2_ECLASS_GIO_MODULES 111 } 112 113 # @FUNCTION: gnome-meson_pkg_postinst 114 # @DESCRIPTION: 115 # Handle scrollkeeper, GConf, GSettings, Icons, desktop and mime 116 # database updates. 117 gnome-meson_pkg_postinst() { 118 xdg_pkg_postinst 119 gnome2_gconf_install 120 if [[ -n ${GNOME2_ECLASS_ICONS} ]]; then 121 gnome2_icon_cache_update 122 fi 123 if [[ -n ${GNOME2_ECLASS_GLIB_SCHEMAS} ]]; then 124 gnome2_schemas_update 125 fi 126 gnome2_scrollkeeper_update 127 gnome2_gdk_pixbuf_update 128 129 if [[ ${#GNOME2_ECLASS_GIO_MODULES[@]} -gt 0 ]]; then 130 gnome2_giomodule_cache_update 131 fi 132 133 # This should only be in the overlay 134 ewarn "**************************************************************" 135 ewarn "This is the *experimental* Gentoo GNOME Overlay" 136 ewarn "Please report bugs at #gentoo-desktop @ FreeNode" 137 ewarn "Do NOT go to upstream with bugs without checking with us first" 138 ewarn "**************************************************************" 139 } 140 141 # # FIXME Handle GConf schemas removal 142 #gnome2_pkg_prerm() { 143 # gnome2_gconf_uninstall 144 #} 145 146 # @FUNCTION: gnome-meson_pkg_postrm 147 # @DESCRIPTION: 148 # GSettings, Icons, desktop and mime database updates. 149 gnome-meson_pkg_postrm() { 150 xdg_pkg_postrm 151 if [[ -n ${GNOME2_ECLASS_ICONS} ]]; then 152 gnome2_icon_cache_update 153 fi 154 if [[ -n ${GNOME2_ECLASS_GLIB_SCHEMAS} ]]; then 155 gnome2_schemas_update 156 fi 157 158 if [[ ${#GNOME2_ECLASS_GIO_MODULES[@]} -gt 0 ]]; then 159 gnome2_giomodule_cache_update 160 fi 161 }