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