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