# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/sci-astronomy/astropulse/astropulse-4.28.ebuild,v 1.5.1 2008/09/16 06:23:00 teodoro Exp $ inherit autotools subversion flag-o-matic BOINCVER="6.2.15" DESCRIPTION="AstroPulse" HOMEPAGE="http://setiathome.berkeley.edu/beta/" ESVN_REPO_URI="https://setisvn.ssl.berkeley.edu/svn/astropulse@319" IUSE="+opengl +svnrepo debug custom-cflags sse sse2 sse3 mmx 3dnow fast-math pic" SLOT="0" LICENSE="GPL-2" KEYWORDS="~alpha ~amd64 ~ia64 ~ppc ~sparc ~x86" DEPEND=">=sci-astronomy/setiathome-enhanced-6.03 >=sys-libs/glibc-2.3.2 >=sci-misc/boinc-${BOINCVER} opengl? ( virtual/opengl virtual/glu virtual/glut >=media-libs/jpeg-6b ) >=sci-libs/fftw-3 svnrepo? ( dev-util/subversion ) " RDEPEND="X? ( x11-base/xorg-x11 ) ${DEPEND}" src_unpack() { if built_with_use sci-misc/boinc bindist ; then eerror "sci-misc/boinc requires use flag -bindist" die "incorrect use flag" fi if use svnrepo ; then ewarn "Using mainline source that doesn't match snapshot. Breakage might occur." subversion_src_unpack S="${S}"/client fi cd "${S}" epatch "${FILESDIR}"/astropulse-4.28-boinc-ac-test.patch epatch "${FILESDIR}"/astropulse-4.28-bypass-boinc-chk.patch epatch "${FILESDIR}"/astropulse-4.28-bypass-sah-chk-1.patch epatch "${FILESDIR}"/astropulse-4.28-optimization-m4-del-old-archs.patch epatch "${FILESDIR}"/astropulse-4.28-makefile-incl-cflags.patch epatch "${FILESDIR}"/astropulse-4.28-makefile-am-cflags.patch epatch "${FILESDIR}"/astropulse-4.28-configure-ac-cflags.patch ! use pic && epatch "${FILESDIR}"/astropulse-4.28-no-pic.patch rm "${S}"/m4/libtool.m4 AT_M4DIR="m4" eautoreconf || die "eautoreconf failed" VER="`grep -r -e 'VERSION' ap_config.h | awk '{ print $3 }' | head -n 2 | tail -n 1 | sed 's|\"||g'`" MAJVER="`grep -r -e 'VERSION_MAJOR' ap_config.h | awk '{ print $3 }'`" MAIVER="`grep -r -e 'VERSION_MINOR' ap_config.h | awk '{ print $3 }'`" if [[ "${PV:0:4}" != "$VER" ]]; then eerror "ebuild version (${PV:0:4}) and source version ($VER) don't match." die "version mismatch" fi } src_compile() { #ap autoconfigures cflags if use debug || ! use custom-cflags ; then filter-flags -O* strip-flags ! use debug && append-flags -O2 fi econf $(use_enable opengl graphics) \ $(use_enable sse) \ $(use_enable sse2) \ $(use_enable sse3) \ $(use_enable mmx) \ $(use_enable 3dnow) \ $(use_enable altivec) \ $(use_enable fast-math) \ || die "failed to configure ${PN}" emake || die "Error: failed to make ${PN}" } src_install() { mkdir -p "${D}"/var/lib/boinc/projects/setiathome.berkeley.edu INSTDIR="/var/lib/boinc/projects/setiathome.berkeley.edu" mydebug="" use debug && mydebug=".debug" BINNAME="astropulse-${MAJVER}.${MAIVER}.${CHOST}$mydebug" exeinto "${INSTDIR}" doexe "${S}"/${BINNAME} use opengl && doexe "${S}"/ap_graphics insinto "${INSTDIR}" use opengl && doins "${S}"/ap.jpg cp "${FILESDIR}"/app_info.sam.ap "${T}" sed -i -e "s|NODOTVERSION|${VER/./}|g" \ -e "s|BINNAME|${BINNAME}|g" \ "${T}"/app_info.sam.ap \ || die "Setting app_info.xml.ap failed." if ! use opengl ; then sed -i -e 8,+6d -e 21,+7d "${T}"/app_info.sam.ap \ || die "Slicing app_info.xml.ap failed." fi #merge cp "${FILESDIR}"/app_info.xml "${T}" if [[ -f "${INSTDIR}"/app_info.sam.sah ]] ; then sed -i "//r ${INSTDIR}/app_info.sam.sah" "${T}"/app_info.xml fi if [[ -f "${T}"/app_info.sam.ap ]] ; then sed -i "//r ${T}/app_info.sam.ap" "${T}"/app_info.xml fi insinto "${INSTDIR}" doins "${T}"/app_info.sam.ap doins "${T}"/app_info.xml chown -R boinc:boinc "${D}"/var/lib/boinc }