x11-wm/xpra: Fix deps for x264 x265 encoders
[gentoo.git] / sci-biology / foldingathome / foldingathome-7.5.1.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit versionator user systemd
7
8 DESCRIPTION="Folding@Home is a distributed computing project for protein folding"
9 HOMEPAGE="https://foldingathome.org/"
10 SRC_URI="https://download.foldingathome.org/releases/public/release/fahclient/centos-6.7-64bit/v$(get_version_component_range 1-2)/fahclient_${PV}-64bit-release.tar.bz2"
11
12 RESTRICT="mirror bindist strip"
13
14 LICENSE="FAH-EULA-2014 FAH-special-permission"
15 SLOT="0"
16 KEYWORDS="~amd64"
17 IUSE=""
18 # Expressly listing all deps, as this is a binpkg and it is doubtful whether
19 # i.e. uclibc or clang can provide what is necessary at runtime
20 DEPEND="dev-util/patchelf"
21 RDEPEND="app-arch/bzip2
22         =dev-libs/openssl-1.0*:*
23         sys-devel/gcc
24         sys-libs/glibc
25         sys-libs/zlib"
26
27 S="${WORKDIR}/fahclient_${PV}-64bit-release"
28
29 QA_PREBUILT="opt/foldingathome/*"
30
31 pkg_setup() {
32         elog ""
33         elog "Special permission is hereby granted to the Gentoo project to provide an"
34         elog "automated installer package which downloads and installs the Folding@home client"
35         elog "software. Permission is also granted for future Gentoo installer packages on the"
36         elog "condition that they continue to adhere to all of the terms of the accompanying"
37         elog "Folding@home license agreements and display this notice."
38         elog "-- Vijay S. Pande, Stanford University, 07 May 2013"
39         elog ""
40         elog "(ref: http://foldingforum.org/viewtopic.php?f=16&t=22524&p=241992#p241992 )"
41         elog ""
42
43         enewuser foldingathome -1 -1 "${EPREFIX}"/opt/foldingathome
44 }
45
46 src_install() {
47         patchelf --set-rpath "${EPREFIX}/opt/foldingathome" FAHClient || die
48         patchelf --set-rpath "${EPREFIX}/opt/foldingathome" FAHCoreWrapper || die
49
50         dosym "../../usr/$(get_libdir)/libssl.so.1.0.0" /opt/foldingathome/libssl.so.10
51         dosym "../../usr/$(get_libdir)/libcrypto.so.1.0.0" /opt/foldingathome/libcrypto.so.10
52
53         exeinto /opt/foldingathome
54         doexe {FAHClient,FAHCoreWrapper}
55
56         insinto /opt/foldingathome
57         doins sample-config.xml
58
59         newconfd "${FILESDIR}"/7.3/folding-conf.d foldingathome
60         cat <<EOF >"${T}"/fah-init
61 #!/sbin/openrc-run
62 # Copyright 1999-2017 Gentoo Foundation
63 # Distributed under the terms of the GNU General Public License v2
64
65 start_stop_daemon_args="--chdir \"${EPREFIX}/opt/foldingathome\""
66 command="${EPREFIX}/opt/foldingathome/FAHClient"
67 command_args="\${FOLD_OPTS}"
68 command_user=foldingathome
69 command_background=1
70 pidfile="\${PIDFILE}"
71 EOF
72         newinitd "${T}"/fah-init foldingathome
73
74         cat <<EOF >"${T}"/fah-init.service
75 [Unit]
76 Description=Folding@Home V7 Client
77 Documentation=https://foldingathome.org
78
79 [Service]
80 Type=simple
81 User=foldingathome
82 WorkingDirectory=${EPREFIX}/opt/foldingathome
83 PIDFile=/run/fahclient.pid
84 ExecStart=${EPREFIX}/opt/foldingathome/FAHClient -v start
85 ExecReload=${EPREFIX}/opt/foldingathome/FAHClient -v restart
86 ExecStop=${EPREFIX}/opt/foldingathome/FAHClient -v stop
87 KillMode=process
88
89 [Install]
90 WantedBy=multi-user.target
91 EOF
92         systemd_newunit "${T}"/fah-init.service foldingathome.service
93
94         fowners -R foldingathome:foldingathome /opt/foldingathome
95 }
96
97 pkg_postinst() {
98         elog "To run Folding@home in the background at boot:"
99         elog "(openrc)\trc-update add foldingathome default"
100         elog "(systemd)\tsystemctl enable foldingathome"
101         elog ""
102         if [ ! -e "${EPREFIX}"/opt/foldingathome/config.xml ]; then
103                 elog "No config.xml file found -- please run"
104                 elog "emerge --config ${P} to configure your client, or specify"
105                 elog "all necessary runtime options in FOLD_OPTS within"
106                 elog "${EPREFIX}/etc/conf.d/foldingathome"
107                 elog ""
108         fi
109         if [[ -n ${REPLACING_VERSIONS} ]]; then
110                 elog "NOTE, the 'initfolding' helper script has been dropped, please"
111                 elog "use emerge --config ${P} or run FAHClient --configure directly"
112                 elog "and adjust file permissions and ownership yourself"
113                 elog ""
114         fi
115         elog "Please see ${EPREFIX}/opt/foldingathome/FAHClient --help for more details."
116         einfo ""
117         einfo "The original package maintainer encourages you to acquire a username and join team 36480."
118         einfo "http://folding.stanford.edu/English/Download#ntoc2"
119         einfo ""
120 }
121
122 pkg_postrm() {
123         elog "Folding@home data files were not removed."
124         elog "Remove them manually from ${EPREFIX}/opt/foldingathome"
125 }
126
127 pkg_config() {
128         cd "${EPREFIX}"/opt/foldingathome || die
129         su foldingathome -s /bin/sh -c "./FAHClient --configure"
130 }