b29f7289978377e50a2d7a2e124fbbaf0f99eaed
[gentoo.git] / sci-misc / boinc / boinc-7.8.4.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 WX_GTK_VER=3.0-gtk3
7
8 inherit autotools eutils linux-info systemd user versionator wxwidgets
9
10 MY_PV=$(get_version_component_range 1-2)
11
12 DESCRIPTION="The Berkeley Open Infrastructure for Network Computing"
13 HOMEPAGE="http://boinc.ssl.berkeley.edu/"
14 SRC_URI="https://github.com/BOINC/boinc/archive/client_release/${MY_PV}/${PV}.tar.gz -> ${P}.tar.gz
15         X? ( http://boinc.berkeley.edu/logo/boinc_glossy2_512_F.tif -> ${PN}.tif )"
16 RESTRICT="mirror"
17
18 LICENSE="LGPL-2.1"
19 SLOT="0"
20 KEYWORDS="~amd64 ~ia64 ~ppc ~ppc64 ~sparc ~x86"
21 IUSE="X cuda curl_ssl_gnutls curl_ssl_libressl +curl_ssl_openssl static-libs"
22
23 REQUIRED_USE="^^ ( curl_ssl_gnutls curl_ssl_libressl curl_ssl_openssl ) "
24
25 # libcurl must not be using an ssl backend boinc does not support.
26 # If the libcurl ssl backend changes, boinc should be recompiled.
27 RDEPEND="
28         !sci-misc/boinc-bin
29         !app-admin/quickswitch
30         >=app-misc/ca-certificates-20080809
31         net-misc/curl[curl_ssl_gnutls(-)=,curl_ssl_libressl(-)=,-curl_ssl_nss(-),curl_ssl_openssl(-)=,-curl_ssl_axtls(-),-curl_ssl_cyassl(-)]
32         sys-apps/util-linux
33         sys-libs/zlib
34         cuda? (
35                 >=dev-util/nvidia-cuda-toolkit-2.1
36                 >=x11-drivers/nvidia-drivers-180.22
37         )
38         X? (
39                 dev-db/sqlite:3
40                 media-libs/freeglut
41                 sys-libs/glibc:2.2
42                 virtual/jpeg:0=
43                 x11-libs/gtk+:3
44                 >=x11-libs/libnotify-0.7
45                 x11-libs/wxGTK:${WX_GTK_VER}[X,opengl,webkit]
46         )
47 "
48 DEPEND="${RDEPEND}
49         sys-devel/gettext
50         app-text/docbook-xml-dtd:4.4
51         app-text/docbook2X
52         X? ( virtual/imagemagick-tools[png,tiff] )
53 "
54
55 PATCHES=(
56         # >=x11-libs/wxGTK-3.0.2.0-r3 has webview removed, bug 587462
57         "${FILESDIR}"/fix_webview.patch
58 )
59
60 S="${WORKDIR}/${PN}-client_release-${MY_PV}-${PV}"
61
62 pkg_setup() {
63         # Bug 578750
64         if use kernel_linux; then
65                 linux-info_pkg_setup
66                 if ! linux_config_exists; then
67                         ewarn "Can't check the linux kernel configuration."
68                         ewarn "You might be missing vsyscall support."
69                 elif kernel_is -ge 4 4 \
70                     && linux_chkconfig_present LEGACY_VSYSCALL_NONE; then
71                         ewarn "You do not have vsyscall emulation enabled."
72                         ewarn "This will prevent some boinc projects from running."
73                         ewarn "Please enable vsyscall emulation:"
74                         ewarn "    CONFIG_LEGACY_VSYSCALL_EMULATE=y"
75                         ewarn "in /usr/src/linux/.config, to be found at"
76                         ewarn "    Processor type and features --->"
77                         ewarn "        vsyscall table for legacy applications (None) --->"
78                         ewarn "            (X) Emulate"
79                         ewarn "Alternatively, you can enable CONFIG_LEGACY_VSYSCALL_NATIVE."
80                         ewarn "However, this has security implications and is not recommended."
81                 fi
82         fi
83 }
84
85 src_prepare() {
86         default
87
88         # prevent bad changes in compile flags, bug 286701
89         sed -i -e "s:BOINC_SET_COMPILE_FLAGS::" configure.ac || die "sed failed"
90
91         eautoreconf
92
93         use X && need-wxwidgets unicode
94 }
95
96 src_configure() {
97         econf --disable-server \
98                 --enable-client \
99                 --enable-dynamic-client-linkage \
100                 --disable-static \
101                 --enable-unicode \
102                 --with-ssl \
103                 $(use_with X x) \
104                 $(use_enable X manager) \
105                 $(usex X --with-wx-config="${WX_CONFIG}" --without-wxdir)
106 }
107
108 src_install() {
109         default
110
111         keepdir /var/lib/${PN}
112
113         if use X; then
114                 # Create new icons. bug 593362
115                 local s SIZES=(16 22 24 32 36 48 64 72 96 128 192 256)
116                 for s in "${SIZES[@]}"; do
117                         convert "${DISTDIR}"/${PN}.tif -resize ${s}x${s} "${WORKDIR}"/boinc_${s}.png || die
118                         newicon -s $s "${WORKDIR}"/boinc_${s}.png boinc.png
119                 done
120                 make_desktop_entry boincmgr "${PN}" "${PN}" "Math;Science" "Path=/var/lib/${PN}"
121
122                 # Rename the desktop file to boincmgr.desktop to (hot)fix bug 599910
123                 mv "${ED%/}"/usr/share/applications/boincmgr{-${PN},}.desktop || \
124                         die "Failed to rename desktop file"
125         fi
126
127         # cleanup cruft
128         rm -rf "${ED%/}"/etc || die "rm failed"
129
130         sed -e "s/@libdir@/$(get_libdir)/" "${FILESDIR}"/${PN}.init.in > ${PN}.init || die
131         newinitd ${PN}.init ${PN}
132         newconfd "${FILESDIR}"/${PN}.conf ${PN}
133         systemd_dounit "${FILESDIR}"/${PN}.service
134 }
135
136 pkg_preinst() {
137         enewgroup ${PN}
138         # note this works only for first install so we have to
139         # elog user about the need of being in video group
140         local groups="${PN}"
141         if use cuda; then
142                 groups+=",video"
143         fi
144         enewuser ${PN} -1 -1 /var/lib/${PN} "${groups}"
145 }
146
147 pkg_postinst() {
148         elog
149         elog "You are using the source compiled version of boinc."
150         use X && elog "The graphical manager can be found at /usr/bin/boincmgr"
151         elog
152         elog "You need to attach to a project to do anything useful with boinc."
153         elog "You can do this by running /etc/init.d/boinc attach"
154         elog "The howto for configuration is located at:"
155         elog "http://boinc.berkeley.edu/wiki/Anonymous_platform"
156         elog
157         # Add warning about the new password for the client, bug 121896.
158         if use X; then
159                 elog "If you need to use the graphical manager the password is in:"
160                 elog "/var/lib/boinc/gui_rpc_auth.cfg"
161                 elog "Where /var/lib/ is default RUNTIMEDIR, that can be changed in:"
162                 elog "/etc/conf.d/boinc"
163                 elog "You should change this password to something more memorable (can be even blank)."
164                 elog "Remember to launch init script before using manager. Or changing the password."
165                 elog
166         fi
167         if use cuda; then
168                 elog "To be able to use CUDA you should add boinc user to video group."
169                 elog "Run as root:"
170                 elog "gpasswd -a boinc video"
171                 elog
172         fi
173         # Add information about BOINC supporting OpenCL
174         elog "BOINC supports OpenCL. To use it you have to eselect"
175         if use cuda; then
176                 elog "nvidia as the OpenCL implementation, as you are using CUDA."
177         else
178                 elog "the correct OpenCL implementation for your graphic card."
179         fi
180         elog
181 }