dev-python/pytest: arm64 stable (bug #723996)
[gentoo.git] / net-irc / weechat / weechat-2.7.1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 PYTHON_COMPAT=( python{3_6,3_7,3_8} )
7
8 inherit cmake-utils python-single-r1 xdg-utils
9
10 if [[ ${PV} == "9999" ]] ; then
11         inherit git-r3
12         EGIT_REPO_URI="https://github.com/weechat/weechat.git"
13 else
14         SRC_URI="https://weechat.org/files/src/${P}.tar.xz"
15         KEYWORDS="amd64 ~arm ppc64 x86 ~x64-macos"
16 fi
17
18 DESCRIPTION="Portable and multi-interface IRC client"
19 HOMEPAGE="https://weechat.org/"
20
21 LICENSE="GPL-3"
22 SLOT="0"
23
24 NETWORKS="+irc"
25 PLUGINS="+alias +buflist +charset +exec +fifo +fset +logger +relay +scripts +spell +trigger +xfer"
26 # dev-lang/v8 was dropped from Gentoo so we can't enable javascript support
27 SCRIPT_LANGS="guile lua +perl php +python ruby tcl"
28 LANGS=" cs de es fr it ja pl ru"
29 IUSE="doc man nls +ssl test ${SCRIPT_LANGS} ${PLUGINS} ${INTERFACES} ${NETWORKS}"
30 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
31
32 RDEPEND="
33         dev-libs/libgcrypt:0=
34         net-misc/curl[ssl]
35         sys-libs/ncurses:0=
36         sys-libs/zlib
37         charset? ( virtual/libiconv )
38         guile? ( >=dev-scheme/guile-2.0 )
39         lua? ( dev-lang/lua:0[deprecated] )
40         nls? ( virtual/libintl )
41         perl? ( dev-lang/perl:= )
42         php? ( >=dev-lang/php-7.0:*[embed] )
43         python? ( ${PYTHON_DEPS} )
44         ruby? ( || ( dev-lang/ruby:2.6 dev-lang/ruby:2.5 dev-lang/ruby:2.4 ) )
45         ssl? ( net-libs/gnutls )
46         spell? ( app-text/aspell )
47         tcl? ( >=dev-lang/tcl-8.4.15:0= )
48 "
49 DEPEND="${RDEPEND}
50         test? ( dev-util/cpputest )
51 "
52
53 BDEPEND="
54         virtual/pkgconfig
55         doc? ( >=dev-ruby/asciidoctor-1.5.4 )
56         man? ( >=dev-ruby/asciidoctor-1.5.4 )
57         nls? ( >=sys-devel/gettext-0.15 )
58 "
59
60 DOCS="AUTHORS.adoc ChangeLog.adoc Contributing.adoc ReleaseNotes.adoc README.adoc"
61
62 # tests need to be fixed to not use system plugins if weechat is already installed
63 RESTRICT="test"
64
65 pkg_setup() {
66         use python && python-single-r1_pkg_setup
67 }
68
69 src_prepare() {
70         cmake-utils_src_prepare
71
72         # install only required translations
73         local i
74         for i in ${LANGS} ; do
75                 if ! has ${i} ${LINGUAS-${i}} ; then
76                         sed -i \
77                                 -e "/${i}.po/d" \
78                                 po/CMakeLists.txt || die
79                 fi
80         done
81
82         # install only required documentation ; en always
83         for i in $(grep add_subdirectory doc/CMakeLists.txt \
84                         | sed -e 's/.*add_subdirectory(\(..\)).*/\1/' -e '/en/d'); do
85                 if ! has ${i} ${LINGUAS-${i}} ; then
86                         sed -i \
87                                 -e '/add_subdirectory('${i}')/d' \
88                                 doc/CMakeLists.txt || die
89                 fi
90         done
91
92         # install docs in correct directory
93         sed -i "s#\${SHAREDIR}/doc/\${PROJECT_NAME}#\0-${PV}/html#" doc/*/CMakeLists.txt || die
94
95         if [[ ${CHOST} == *-darwin* ]]; then
96                 # fix linking error on Darwin
97                 sed -i "s/+ get_config_var('LINKFORSHARED')//" \
98                         cmake/FindPython.cmake || die
99                 # allow to find the plugins by default
100                 sed -i 's/".so,.dll"/".bundle,.so,.dll"/' \
101                         src/core/wee-config.c || die
102         fi
103 }
104
105 src_configure() {
106         local mycmakeargs=(
107                 -DLIBDIR=/usr/$(get_libdir)
108                 -DENABLE_JAVASCRIPT=OFF
109                 -DENABLE_LARGEFILE=ON
110                 -DENABLE_NCURSES=ON
111                 -DENABLE_ALIAS=$(usex alias)
112                 -DENABLE_BUFLIST=$(usex buflist)
113                 -DENABLE_CHARSET=$(usex charset)
114                 -DENABLE_DOC=$(usex doc)
115                 -DENABLE_EXEC=$(usex exec)
116                 -DENABLE_FIFO=$(usex fifo)
117                 -DENABLE_FSET=$(usex fset)
118                 -DENABLE_GNUTLS=$(usex ssl)
119                 -DENABLE_GUILE=$(usex guile)
120                 -DENABLE_IRC=$(usex irc)
121                 -DENABLE_LOGGER=$(usex logger)
122                 -DENABLE_LUA=$(usex lua)
123                 -DENABLE_MAN=$(usex man)
124                 -DENABLE_NLS=$(usex nls)
125                 -DENABLE_PERL=$(usex perl)
126                 -DENABLE_PHP=$(usex php)
127                 -DENABLE_PYTHON=$(usex python)
128                 -DENABLE_RELAY=$(usex relay)
129                 -DENABLE_RUBY=$(usex ruby)
130                 -DENABLE_SCRIPT=$(usex scripts)
131                 -DENABLE_SCRIPTS=$(usex scripts)
132                 -DENABLE_SPELL=$(usex spell)
133                 -DENABLE_TCL=$(usex tcl)
134                 -DENABLE_TESTS=$(usex test)
135                 -DENABLE_TRIGGER=$(usex trigger)
136                 -DENABLE_XFER=$(usex xfer)
137         )
138
139         if use python; then
140                 python_is_python3 || mycmakeargs+=( -DENABLE_PYTHON2=ON )
141         fi
142
143         cmake-utils_src_configure
144 }
145
146 pkg_postinst() {
147         xdg_desktop_database_update
148         xdg_icon_cache_update
149         xdg_mimeinfo_database_update
150 }
151
152 pkg_postrm() {
153         xdg_desktop_database_update
154         xdg_icon_cache_update
155         xdg_mimeinfo_database_update
156 }