aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Chvatal <scarabeus@gentoo.org>2009-01-24 14:08:37 +0100
committerTomas Chvatal <scarabeus@gentoo.org>2009-01-24 14:08:37 +0100
commitff61e46b9d341ce3b83d9d6b0327eba1b8348724 (patch)
tree5030c7cbfc1fd3f251c3afe55d6413e9259dcd55 /sci-misc
parentUpdate comments. (diff)
downloadsci-ff61e46b9d341ce3b83d9d6b0327eba1b8348724.tar.gz
sci-ff61e46b9d341ce3b83d9d6b0327eba1b8348724.tar.bz2
sci-ff61e46b9d341ce3b83d9d6b0327eba1b8348724.zip
First pass for boinc, NOTE: install is not done yet :]
Diffstat (limited to 'sci-misc')
-rw-r--r--sci-misc/boinc/ChangeLog10
-rw-r--r--sci-misc/boinc/Manifest6
-rw-r--r--sci-misc/boinc/boinc-6.4.5.ebuild131
-rw-r--r--sci-misc/boinc/files/boinc.conf28
-rw-r--r--sci-misc/boinc/files/boinc.init116
-rw-r--r--sci-misc/boinc/metadata.xml16
6 files changed, 307 insertions, 0 deletions
diff --git a/sci-misc/boinc/ChangeLog b/sci-misc/boinc/ChangeLog
new file mode 100644
index 000000000..67e5dc432
--- /dev/null
+++ b/sci-misc/boinc/ChangeLog
@@ -0,0 +1,10 @@
+# ChangeLog for sci-misc/boinc
+# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
+# $Header: $
+
+*boinc-6.4.5 (24 Jan 2009)
+
+ 24 Jan 2009; Tomas Chvatal <scarabeus@gentoo.org> +files/boinc.conf,
+ +files/boinc.init, +metadata.xml, +boinc-6.4.5.ebuild:
+ Initial commit
+
diff --git a/sci-misc/boinc/Manifest b/sci-misc/boinc/Manifest
new file mode 100644
index 000000000..aa01f7f24
--- /dev/null
+++ b/sci-misc/boinc/Manifest
@@ -0,0 +1,6 @@
+AUX boinc.conf 706 RMD160 dc1a8faaabae2441bbaa23c4a07e9a1f9658ae38 SHA1 5239bdb08fb0ad16944ea68e8b54d3940ac3b091 SHA256 feac94f8f6a893f32908031d0df9dac0c7e0c65448b85c819ff0dd487b4b834a
+AUX boinc.init 2808 RMD160 65ce2f47a2fcc21476cab17eabcfaa4593eaa4c3 SHA1 14defce8894f5f1afcf7e56d14904e3a5b369e41 SHA256 63b0edd80ac82edd866a0c9578d7bec0e7a9afab3f7398707b7943dcabe4377c
+DIST boinc-6.4.5.tar.bz2 7641082 RMD160 5d2cb9e645aec52c91fcf791eac8146a202594ca SHA1 6038e13c828b411b18a0f255454c3210d3581deb SHA256 f2ec1a11cc455b3f445470d5261ab37d76ffde53e98ecf3dbc6463793de58363
+EBUILD boinc-6.4.5.ebuild 3270 RMD160 a9b1cdb5dc9a60acd6e252e9516414a0dd1b4e64 SHA1 1588114117e8dfe753f906528e2fa6068f28a791 SHA256 a6e8b44b829aa7956f9790710d0e27f7aa808cac91a67e1e17d8db8e0cd1a00e
+MISC ChangeLog 289 RMD160 a5b083d7c09f9733d6287c799966f443a0fd4f7b SHA1 0f66f6c05b7dd6fdae3a01d77b7556fa682d90d9 SHA256 1c09db09d8fab8f415d9a5a298d7a822bc2b0bd1549c3c77af8c04d89b0f60aa
+MISC metadata.xml 471 RMD160 891334e296d850fe56e50b9544c0a7b733740a75 SHA1 adeee8a2ad636bfb0a4306f9abf6a4236aa28560 SHA256 38bca554773db57e79011dea226228dfdc5ea90a3047693b5d47b4bf924af9ea
diff --git a/sci-misc/boinc/boinc-6.4.5.ebuild b/sci-misc/boinc/boinc-6.4.5.ebuild
new file mode 100644
index 000000000..6e6a995f6
--- /dev/null
+++ b/sci-misc/boinc/boinc-6.4.5.ebuild
@@ -0,0 +1,131 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+#
+# Don't forget to keep things in sync with binary boinc package!
+#
+
+EAPI="2"
+
+inherit flag-o-matic depend.apache eutils wxwidgets
+
+DESCRIPTION="The Berkeley Open Infrastructure for Network Computing"
+HOMEPAGE="http://boinc.ssl.berkeley.edu/"
+SRC_URI="http://dev.gentooexperimental.org/~scarabeus/${P}.tar.bz2"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~ia64 ~ppc ~sparc ~x86"
+IUSE="X cuda server"
+
+RDEPEND="
+ !sci-misc/boinc
+ app-misc/ca-certificates
+ dev-libs/openssl
+ net-misc/curl
+ sys-apps/util-linux
+ sys-libs/zlib
+ cuda? (
+ >=dev-util/nvidia-cuda-toolkit-2.1
+ >=x11-drivers/nvidia-drivers-180.22
+ )
+ server? (
+ >=virtual/mysql-5.0
+ dev-python/mysql-python
+ )
+ "
+DEPEND="${RDEPEND}
+ server? ( virtual/imap-c-client )
+ X? (
+ media-libs/freeglut
+ media-libs/jpeg
+ x11-libs/wxGTK:2.8[X,opengl]
+ )
+ "
+
+LANGS="ar be bg ca cs da de el en_US es eu fi fr hr hu it ja lt lv nb nl pl pt
+pt_BR ro ru sk sl sv_SE tr uk zh_CN zh_TW"
+for LNG in ${LANGS}; do
+ IUSE="${IUSE} linguas_${LNG}"
+done
+
+src_configure() {
+ local wxconf=""
+ local config=""
+
+ # define preferable CFLAGS (recommended by upstream)
+ append-flags -O3 -funroll-loops -fforce-addr -ffast-math
+
+ # look for wxGTK
+ if use X; then
+ WX_GTK_VER="2.8"
+ need-wxwidgets unicode
+ wxconf="${wxconf} --with-wx-config=${WX_CONFIG}"
+ else
+ wxconf="${wxconf} --without-wxdir"
+ fi
+
+ # nonstandard enable
+ use server || config="--disable-server"
+
+ # configure
+ econf \
+ --disable-dependency-tracking \
+ --with-gnu-ld \
+ --enable-unicode \
+ --enable-client \
+ --with-ssl \
+ ${wxconf} \
+ ${config} \
+ $(use_with X x)
+
+ # Fix LDFLAGS. Link to compiled stuff and not to installed one
+ sed -i \
+ -e "s|LDFLAGS = |LDFLAGS = -L../lib |g" \
+ */Makefile || die "sed failed"
+}
+
+src_compile() {
+ # disable paralel build.
+ emake -j1 || die "emake failed"
+}
+
+src_install() {
+ # TODO: no time to test now.
+ emake DESTDIR="${D}" install || die "make install failed"
+ mkdir -p "${D}"/var/lib/boinc/
+ # certificates
+ dosym /etc/ssl/certs/ca-certificates.crt /opt/${MY_PN}/ca-bundle.crt
+ # cuda
+ use cuda && dosym /opt/cuda/lib/libcudart.so /opt/${MY_PN}/libcudart.so
+}
+
+pkg_preinst() {
+ enewgroup ${MY_PN}
+ if use cuda; then
+ enewuser ${MY_PN} -1 -1 /var/lib/${MY_PN} "${MY_PN},video"
+ else
+ enewuser ${MY_PN} -1 -1 /var/lib/${MY_PN} "${MY_PN}"
+ fi
+}
+
+pkg_postinst() {
+ echo
+ elog "You are using the source compiled version."
+ elog "The manager can be found at /opt/bin/${MY_PN}"
+ elog
+ elog "You need to attach to a project to do anything useful with ${MY_PN}."
+ elog "You can do this by running /etc/init.d/${MY_PN} attach"
+ elog "The howto for configuration is located at:"
+ elog "http://${MY_PN}.berkeley.edu/anonymous_platform.php"
+ elog
+ # Add warning about the new password for the client, bug 121896.
+ elog "If you need to use the graphical client the password is in:"
+ elog "/var/lib/${MY_PN}/gui_rpc_auth.cfg"
+ elog "Where /var/lib/ is default RUNTIMEDIR, that can be changed in:"
+ elog "/etc/conf.d/${MY_PN}"
+ elog "You should change this to something more memorable (can be even blank)."
+ elog
+ elog "Remember to launch init script before using manager. Or changing the password."
+}
diff --git a/sci-misc/boinc/files/boinc.conf b/sci-misc/boinc/files/boinc.conf
new file mode 100644
index 000000000..884189a37
--- /dev/null
+++ b/sci-misc/boinc/files/boinc.conf
@@ -0,0 +1,28 @@
+# Config file for /etc/init.d/boinc
+
+# Owner of BOINC process (must be existing)
+USER="boinc"
+GROUP="boinc"
+
+# Directory with runtime data: Work units, project binaries, user info etc.
+RUNTIMEDIR="/var/lib/boinc"
+
+# Location of the boinc command line binary
+BOINCBIN="/opt/boinc/boinc"
+
+# Logfile (/dev/null for nowhere)
+LOGFILE="/var/log/boinc.log"
+
+# Allow remote gui RPC yes or no
+ALLOW_REMOTE_RPC="no"
+
+# nice level
+NICELEVEL="19"
+
+# scheduling parameters, arguments to chrt(1)
+SCHED_PARAM="--batch 0"
+
+# Relative CPU allocation for boinc user, default is 1024,
+# requires CONFIG_FAIR_GROUP_SCHED and CONFIG_USER_SCHED,
+# see /usr/src/linux/Documentation/scheduler/sched-design-CFS.txt
+CPU_SHARE="128"
diff --git a/sci-misc/boinc/files/boinc.init b/sci-misc/boinc/files/boinc.init
new file mode 100644
index 000000000..54812d104
--- /dev/null
+++ b/sci-misc/boinc/files/boinc.init
@@ -0,0 +1,116 @@
+#!/sbin/runscript
+
+opts="${opts} attach"
+
+depend() {
+ # we can use dns and net, but we can also in most cases live without them
+ use dns net
+}
+
+create_work_directory() {
+ if [[ ! -d $RUNTIMEDIR ]]; then
+ einfo "Directory $RUNTIMEDIR not existing, creating now."
+ mkdir $RUNTIMEDIR
+ chown ${USER}:${GROUP} $RUNTIMEDIR
+ if [[ ! -d $RUNTIMEDIR ]]; then
+ eeror "Directory $RUNTIMEDIR could not be created!"
+ return 1
+ fi
+ ln -s /etc/ssl/certs/ca-certificates.crt $RUNTIMEDIR/ca-bundle.crt
+ fi
+}
+
+generate_logs() {
+ if [[ ! -f $LOGFILE ]]; then
+ einfo "No $LOGFILE around. Creating new..."
+ einfo "For good log rotation is great tool app-admin/logrotate"
+ touch $LOGFILE
+ chown ${USER}:${GROUP} $LOGFILE
+ fi
+}
+
+cuda_check() {
+ if [[ -f /opt/boinc/libcudart.so ]]; then
+ # user wanted cuda so lets enable it
+ ln -s /opt/cuda/lib/libcudart.so $WORKDIR/libcudart.so
+ fi
+}
+
+start() {
+ ebegin "Starting BOINC"
+
+ create_work_directory
+
+ cd $RUNTIMEDIR
+
+ if [[ ! -f lockfile ]]; then
+ einfo "File $RUNTIMEDIR/lockfile does not exist, assuming first run."
+ einfo "You need to setup an account on the BOINC project homepage beforehand!"
+ einfo "Go to http://boinc.berkeley.edu/ and locate your project."
+ einfo "Then either run /etc/init.d/boinc attach or connect with a gui client"
+ einfo "and attach to a project with that."
+ echo
+ ewarn "Note that for attaching to some project you need your network up and running."
+ ewarn "network is needed only for jobs fetching afterwards"
+ fi
+
+ generate_logs
+
+ if [[ ${ALLOW_REMOTE_RPC} = "yes" ]]; then
+ ARGS="${ARGS} -allow_remote_gui_rpc"
+ fi
+
+ # sys-apps/util-linux
+ CHRT="/usr/bin/chrt ${SCHED_PARAM}"
+
+ ${CHRT} start-stop-daemon \
+ --quiet --start --chdir ${RUNTIMEDIR} \
+ --exec ${BOINCBIN} --chuid ${USER}:${GROUP} \
+ --background --stdout ${LOGFILE} --stderr ${LOGFILE} \
+ --nicelevel ${NICELEVEL} -- ${ARGS}
+
+ RESULT=$?
+
+ if [ "${CPU_SHARE}" -a -d /sys/kernel/uids ]; then
+ BUID=`id -u ${USER}`
+ # It might take a moment for start-stop-daemon to chuid
+ [[ -d /sys/kernel/uids/${BUID} ]] || sleep 5 # 5 was working always here
+ if [[ -w /sys/kernel/uids/${BUID}/cpu_share ]]; then
+ echo ${CPU_SHARE} > /sys/kernel/uids/${BUID}/cpu_share
+ fi
+ fi
+
+ eend $RESULT
+}
+
+attach() {
+ printf " Enter the Project URL: "
+ read url
+ printf " Enter your Account Key: "
+ read key
+
+ RC_QUIET_STDOUT="yes" svc_status
+ if [[ $? = 1 ]]; then
+ svc_start
+ fi
+ ebegin "Attaching to project"
+ # we have to work in runtime directory
+ cd $RUNTIMEDIR
+ # boinc does not return 1 when it fails currently
+ $BOINCBIN --attach_project $url $key &> /dev/null
+ eend $?
+
+ sleep 10
+ tail $LOGFILE
+}
+
+stop() {
+ ebegin "Stopping BOINC"
+ start-stop-daemon --stop --retry 3 --quiet --exec $BOINCBIN
+ eend $?
+}
+
+restart() {
+ svc_stop
+ svc_start
+}
diff --git a/sci-misc/boinc/metadata.xml b/sci-misc/boinc/metadata.xml
new file mode 100644
index 000000000..031688039
--- /dev/null
+++ b/sci-misc/boinc/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>sci</herd>
+<maintainer>
+ <email>scarabeus@gentoo.org</email>
+ <name>Tomas Chvatal</name>
+</maintainer>
+<use>
+ <flag name="cuda">
+ Use nvidia cuda toolkit for speeding up computations.
+ NOTE: works only for subset of nvidia graphic cards so make sure your card
+ is supported before opening bug about it.
+ </flag>
+</use>
+</pkgmetadata>