# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/sci-misc/boinc/boinc-6.2.15.ebuild,v 1.5.1 2008/09/16 06:23:00 teodoro Exp $ inherit eutils wxwidgets flag-o-matic subversion depend.apache autotools MYVER=${PV//./_} DESCRIPTION="The Berkeley Open Infrastructure for Network Computing" HOMEPAGE="http://boinc.ssl.berkeley.edu/" ESVN_REPO_URI="http://boinc.berkeley.edu/svn/tags/boinc_core_release_$MYVER" SRC_URI="!svnrepo? ( bindist? ( amd64? ( http://boincdl.ssl.berkeley.edu/dl/boinc_${PV}_x86_64-pc-linux-gnu.sh ) x86? ( http://boincdl.ssl.berkeley.edu/dl/boinc_${PV}_i686-pc-linux-gnu.sh ) ) !bindist? ( mirror://gentoo/${P}.tar.bz2 ) ) " IUSE="server X bindist svnrepo debug custom-cflags" LICENSE="LGPL-2.1" SLOT="0" KEYWORDS="~amd64 ~ia64 ~ppc ~sparc ~x86" RDEPEND="sys-libs/zlib >=net-misc/curl-7.15.5 >=dev-libs/openssl-0.9.7 X? ( =x11-libs/wxGTK-2.8* ) server? ( >=virtual/mysql-4.0 virtual/php >=dev-lang/python-2.2.3 >=dev-python/mysql-python-0.9.2 )" DEPEND=">=sys-devel/gcc-3.0.4 >=sys-devel/autoconf-2.58 >=sys-devel/automake-1.8 >=dev-util/pkgconfig-0.15 >=sys-devel/m4-1.4 X? ( x11-libs/libXmu x11-libs/libXt x11-libs/libX11 x11-proto/xproto virtual/glut virtual/glu media-libs/jpeg ) server? ( virtual/imap-c-client ) svnrepo? ( dev-util/subversion ) ${RDEPEND}" want_apache server LANGS="af_ZA ar be bg ca cs cs_CZ da de el en_US es eu fi fr hr hu it ja ko_KR lt lv nb nl pl pt pt_BR ro ru sk sl sv_SE tr uk zh_CN zh_TW" for X in ${LANGS}; do IUSE="${IUSE} linguas_${X}" done src_unpack() { forcecompile=1 if use bindist ; then if use svnrepo ; then ewarn "Conflicting use flags between bindist and svnrepo. Using svnrepo." else forcecompile=0 ewarn "Using binary distribution path" if ! use amd64 && ! use x86 ; then eerror "Binary distribution for this arch is not supported" die "unsupported arch needs compile" fi fi fi if [[ forcecompile -eq 1 ]] ; then if use svnrepo ; then subversion_src_unpack else if [[ ! -e "${DISTDIR}"/${P}.tar.bz2 ]] ; then eerror "Failed to retrieve ${P}.tar.bz2" die "fetch failed" fi unpack "${A}" fi cd "${S}" rm -rf `find . -type d -name .svn` # silence config.h redefinitions when compiling against # external projects epatch "${FILESDIR}"/boinc-6.2.15-mute-extern-proj-redefs.patch # strip off client cflags use custom-cflags && epatch "${FILESDIR}"/boinc-6.2.15-strip-cflags.patch # fix min size for project list epatch "${FILESDIR}"/boinc-6.2.15-fix-project-list-size.patch # Just run the necessary tools directly rm "${S}"/m4/libtool.m4 AT_M4DIR="m4" eautoreconf || die "eautoreconf failed" else archtarget="" if use amd64 ; then archtarget="x86_64" elif use x86 ; then archtarget="i686" fi cp "${DISTDIR}"/boinc_${PV}_${archtarget}-pc-linux-gnu.sh "${WORKDIR}" cd "${WORKDIR}" sh boinc_${PV}_${archtarget}-pc-linux-gnu.sh fi } src_compile() { if [[ forcecompile -eq 1 ]] ; then if use X ; then if ! built_with_use x11-libs/wxGTK debug && use debug ; then eerror "The GUI component will not build as requested." eerror "Either USE=debug re-emerge x11-libs/wxGTK or set USE=-X re-emerge boinc." die "debug gui build will fail" fi fi if ! use custom-cflags ; then filter-flags -O* strip-flags #upstream recommendation for flags append-flags -O3 -funroll-loops -fforce-addr -ffast-math fi use debug && strip-flags local wxconf="" 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 econf \ --enable-client \ --with-ssl \ ${wxconf} \ --enable-unicode \ $(use_enable server) \ $(use_with X x) \ $(use_enable debug) || die "econf failed" # Make it link to the compiled libs, not the installed ones sed -e "s|LDFLAGS = |LDFLAGS = -L../lib |g" -i */Makefile || \ die "sed failed" # Force -j1 - bug 136374. emake -j1 || die "emake failed" fi } src_install() { mkdir -p "${D}"/var/lib/boinc/ chown boinc:boinc "${D}"/var/lib/boinc newinitd "${FILESDIR}"/boinc.init boinc if [[ forcecompile -eq 1 ]] ; then cp "${S}"/curl/ca-bundle.crt "${D}"/var/lib/boinc fowners boinc:boinc /var/lib/boinc/ca-bundle.crt make install DESTDIR="${D}" || die "make install failed" newconfd "${FILESDIR}"/boinc.conf boinc #install missing icons mkdir -p "${D}"/usr/share/boinc ICONRES="16x16 32x32 48x48" for X in ${ICONRES}; do mkdir -p "${D}"/usr/share/icons/hicolor/$X/apps cp "${S}"/sea/boincmgr.$X.png "${D}"/usr/share/icons/hicolor/$X/apps/boinc.png done newicon "${S}"/sea/boincmgr.48x48.png boinc.png #wrapper to allow gui to load gui_rpc_auth.cfg because boinc devs assume curdir to be datadir for boinc_gui mv "${D}"/usr/bin/boinc_gui "${D}"/usr/bin/boincmgr echo "cd \"/var/lib/boinc\" && exec /usr/bin/boincmgr \$@" > "${D}"/usr/bin/boinc_gui chmod 755 "${D}"/usr/bin/boinc_gui make_desktop_entry boinc_gui BOINC boinc "Education;Science" /var/lib/boinc #install missing translations mkdir -p "${D}"/usr/share/boinc/locale insopts -m0644 insinto /usr/share/boinc/locale dosym /usr/share/boinc/locale /var/lib/boinc/locale for X in ${LANGS}; do use linguas_${X} && doins -r "${S}"/locale/client/$X done #required headers by setiathome insopts -m0644 insinto /usr/include/BOINC doins "${S}"/api/{reduce.h,graphics_api.h,graphics_data.h,boinc_gl.h} else cp "${WORKDIR}"/BOINC/ca-bundle.crt "${D}"/var/lib/boinc fowners boinc:boinc /var/lib/boinc/ca-bundle.crt cp "${FILESDIR}"/boinc.conf "${T}" sed -i -e "s|/usr/bin/boinc_client|/opt/boinc/boinc|g" "${T}"/boinc.conf newconfd "${T}"/boinc.conf boinc make_desktop_entry /opt/boinc/run_manager BOINC /opt/boinc/boincmgr.32x32.png "Education;Science" /var/lib/boinc cd "${WORKDIR}"/BOINC sed -i -e "s|${WORKDIR}/BOINC|/var/lib/boinc|g" -e "s|./boinc|/opt/boinc/boinc|g" run_client sed -i -e "s|${WORKDIR}/BOINC|/var/lib/boinc|g" -e "s|./boincmgr|/opt/boinc/boincmgr|g" run_manager mkdir -p "${D}"/opt/boinc insopts -m0644 insinto /opt/boinc doins "${WORKDIR}"/BOINC/*.png exeopts -m0755 exeinto /opt/boinc doexe "${WORKDIR}"/BOINC/{boinc,boinc_cmd,boinccmd,boincmgr,run_client,run_manager} fowners 0:boinc /opt/boinc/{boinc,boinc_cmd,boinccmd,boincmgr,run_client,run_manager} #translations mkdir -p "${D}"/opt/boinc/locale insopts -m0644 insinto /opt/boinc/locale dosym /opt/boinc/locale /var/lib/boinc/locale for X in ${LANGS}; do use linguas_${X} && doins -r "${WORKDIR}"/BOINC/locale/$X done fi } pkg_preinst() { enewgroup boinc enewuser boinc -1 -1 /var/lib/boinc boinc } pkg_postinst() { if use bindist; then if ! use svnrepo ; then einfo "You are using the binary distributed version." einfo "The manager can be found at /opt/boinc/run_manager" fi fi einfo "You need to attach to a project to do anything useful with boinc." einfo "You can do this by running /etc/init.d/boinc attach" einfo "BOINC The howto for configuration is located at:" einfo "http://boinc.berkeley.edu/anonymous_platform.php" if use server;then echo einfo "You have chosen to enable server mode. this ebuild has installed" einfo "the necessary packages to be a server. You will need to have a" einfo "project. Contact BOINC directly for further information." fi echo # Add warning about the new password for the client, bug 121896. einfo "If you need to use the graphical client the password is in " einfo "/var/lib/boinc/gui_rpc_auth.cfg which is randomly generated " einfo "by BOINC. You can change this to something more memorable." echo }