468d7e6877780c4c3359b3a18f009b16cd72cc36
[gentoo.git] / net-irc / hexchat / hexchat-2.14.2.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 PYTHON_COMPAT=( python3_{6,7} )
7
8 inherit gnome2-utils meson mono-env python-single-r1 xdg-utils
9
10 DESCRIPTION="Graphical IRC client based on XChat"
11 HOMEPAGE="https://hexchat.github.io/"
12
13 if [[ "${PV}" == "9999" ]] ; then
14         inherit git-r3
15         SRC_URI=""
16         EGIT_REPO_URI="https://github.com/${PN}/${PN}.git"
17 else
18         SRC_URI="https://dl.hexchat.net/${PN}/${P}.tar.xz"
19         KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux"
20 fi
21
22 LICENSE="GPL-2 plugin-fishlim? ( MIT )"
23 SLOT="0"
24 IUSE="dbus debug +gtk libcanberra libnotify libproxy libressl lua perl plugin-checksum plugin-fishlim plugin-sysinfo python ssl theme-manager"
25 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
26
27 COMMON_DEPEND="
28         dev-libs/glib:2
29         dbus? ( dev-libs/dbus-glib )
30         gtk? (
31                 x11-libs/gdk-pixbuf:2
32                 x11-libs/gtk+:2
33                 x11-libs/libX11
34                 x11-libs/pango
35         )
36         libcanberra? ( media-libs/libcanberra )
37         libproxy? ( net-libs/libproxy )
38         libnotify? ( x11-libs/libnotify )
39         lua? ( dev-lang/lua:= )
40         perl? ( dev-lang/perl:= )
41         plugin-sysinfo? ( sys-apps/pciutils )
42         python? ( ${PYTHON_DEPS} )
43         ssl? (
44                 !libressl? ( dev-libs/openssl:0= )
45                 libressl? ( dev-libs/libressl:0= )
46         )
47         theme-manager? (
48                 || (
49                         ( dev-lang/mono[minimal] dev-dotnet/libgdiplus )
50                         dev-lang/mono[-minimal]
51                 )
52         )"
53
54 RDEPEND="${COMMON_DEPEND}"
55 DEPEND="
56         ${COMMON_DEPEND}
57         dev-util/glib-utils
58         app-arch/xz-utils
59         app-text/iso-codes
60         sys-devel/gettext
61         virtual/pkgconfig
62 "
63
64 pkg_setup() {
65         use python && python-single-r1_pkg_setup
66         if use theme-manager ; then
67                 mono-env_pkg_setup
68                 export XDG_CACHE_HOME="${T}/.cache"
69         fi
70 }
71
72 src_configure() {
73         local emesonargs=(
74                 -Dwith-gtk="$(usex gtk true false)"
75                 -Dwith-text="$(usex gtk false true)"
76                 -Dwith-ssl="$(usex ssl true false)"
77                 -Dwith-plugin=true
78                 -Dwith-dbus="$(usex dbus true false)"
79                 -Dwith-libproxy="$(usex libproxy true false)"
80                 -Dwith-libnotify="$(usex libnotify true false)"
81                 -Dwith-libcanberra="$(usex libcanberra true false)"
82                 -Dwith-theme-manager="$(usex theme-manager true false)"
83                 -Ddbus-service-use-appid=false
84                 -Dwith-checksum="$(usex plugin-checksum true false)"
85                 -Dwith-fishlim="$(usex plugin-fishlim true false)"
86                 -Dwith-lua="$(usex lua lua false)"
87                 -Dwith-perl="$(usex perl "${EPREFIX}"/usr/bin/perl false)"
88                 -Dwith-python="$(usex python "${EPYTHON/.*}" false)"
89                 -Dwith-sysinfo="$(usex plugin-sysinfo true false)"
90                 -Dwith-appdata=false
91         )
92         meson_src_configure
93 }
94
95 src_install() {
96         meson_src_install
97         dodoc readme.md
98         find "${D}" -name '*.la' -delete || die
99 }
100
101 pkg_preinst() {
102         if use gtk ; then
103                 gnome2_icon_savelist
104         fi
105 }
106
107 pkg_postinst() {
108         if use gtk ; then
109                 gnome2_icon_cache_update
110                 xdg_desktop_database_update
111                 xdg_mimeinfo_database_update
112         else
113                 elog "You have disabled the gtk USE flag. This means you don't have"
114                 elog "the GTK-GUI for HexChat but only a text interface called \"hexchat-text\"."
115         fi
116
117         if use theme-manager ; then
118                 elog "Themes are available at:"
119                 elog "  https://hexchat.github.io/themes.html"
120         fi
121
122         elog
123         elog "optional dependencies:"
124         elog "  media-sound/sox (sound playback if you don't have libcanberra"
125         elog "    enabled)"
126         elog "  x11-plugins/hexchat-javascript (javascript support)"
127         elog "  x11-themes/sound-theme-freedesktop (default BEEP sound,"
128         elog "    needs libcanberra enabled)"
129 }
130
131 pkg_postrm() {
132         if use gtk ; then
133                 gnome2_icon_cache_update
134                 xdg_desktop_database_update
135                 xdg_mimeinfo_database_update
136         fi
137 }