--- /usr/portage/local/layman/science/sci-chemistry/modeller/modeller-9.3.ebuild 2008-04-11 08:04:35.000000000 +0200 +++ modeller-bin-9.4.ebuild 2008-05-16 12:42:26.000000000 +0200 @@ -2,25 +2,43 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: $ -inherit eutils python +NEED_PYTHON=2.3 + +inherit eutils python distutils MY_PV="${PV/./v}" -LICENSE="modeller" +MY_PN="${PN%-bin}" +LICENSE="MODELLER" KEYWORDS="~amd64 ~x86" -DESCRIPTION="MODELLER is used for homology or comparative modeling of protein three-dimensional structures" -SRC_URI="http://salilab.org/${PN}/${MY_PV}/${PN}-${MY_PV}.tar.gz" -HOMEPAGE="http://salilab.org/${PN}/" -IUSE="" +DESCRIPTION="Protein structure modeling by satisfaction of spatial restraints" +SRC_URI="http://salilab.org/${MY_PN}/${MY_PV}/${MY_PN}-${MY_PV}.tar.gz" +HOMEPAGE="http://salilab.org/${MY_PN}/" +IUSE="doc examples python" RESTRICT="mirror" SLOT="0" -RDEPEND=">=dev-lang/python-2.4" +RDEPEND=">=dev-lang/swig-1.3 + python? ( dev-lang/python:2.3 )" DEPEND="" +S="${WORKDIR}/${MY_PN}-${MY_PV}" + +src_unpack(){ + unpack ${A} + epatch "${FILESDIR}"/${MY_PV}-setup.patch +} + +src_compile(){ + cd src/swig + swig -python -keyword -nodefaultctor -nodefaultdtor -noproxy modeller.i + distutils_src_compile +} + src_install(){ python_version - VER=9v3 + IN_PATH=/opt/${MY_PN} + case ${ARCH} in x86) EXECUTABLE_TYPE="i386-intel8";; amd64) EXECUTABLE_TYPE="x86_64-intel8";; @@ -28,75 +46,90 @@ die "Unsupported Arch";; esac - IN_PATH=/opt/modeller${VER} - - sed -e "s:EXECUTABLE_TYPE${VER}=xxx:EXECUTABLE_TYPE${VER}=${EXECUTABLE_TYPE}:g" \ - -e "s:MODINSTALL${VER}=xxx:MODINSTALL${VER}=\"${IN_PATH}\":g" \ - modeller-${VER}/bin/modscript > "${T}/mod${VER}" + sed -e "s:EXECUTABLE_TYPE${MY_PV}=xxx:EXECUTABLE_TYPE${MY_PV}=${EXECUTABLE_TYPE}:g" \ + -e "s:MODINSTALL${MY_PV}=xxx:MODINSTALL${MY_PV}=\"${IN_PATH}\":g" \ + bin/modscript > "${T}/mod${MY_PV}" exeinto ${IN_PATH}/bin/ - doexe "${T}/mod${VER}" - dosym ${IN_PATH}/bin/mod${VER} /opt/bin/mod${VER} + doexe "${T}/mod${MY_PV}" + dosym ${IN_PATH}/bin/mod${MY_PV} /opt/bin/mod${MY_PV} sed -e "s;@TOPDIR\@;\"${IN_PATH}\";" \ - -e "s;@EXETYPE\@;$EXECUTABLE_TYPE;" \ - modeller-${VER}/bin/modpy.sh.in > "${T}/modpy.sh" + -e "s;@EXETYPE\@;$EXECUTABLE_TYPE;" \ + bin/modpy.sh.in > "${T}/modpy.sh" doexe "${T}/modpy.sh" - insinto ${IN_PATH}/bin/ - doins -r modeller-${VER}/bin/{*top,lib} - exeinto ${IN_PATH}/bin/ - doexe modeller-${VER}/bin/{modslave.py,mod${VER}_${EXECUTABLE_TYPE}} + insinto ${IN_PATH} + doins -r modlib - exeinto /usr/lib/python${PYVER}/site-packages/ - doexe modeller-${VER}/lib/${EXECUTABLE_TYPE}/_modeller.so - dosym ${IN_PATH}/modlib/modeller /usr/lib/python${PYVER}/site-packages/modeller - dosym ${IN_PATH}/lib/${EXECUTABLE_TYPE}/_modeller.so\ - /usr/lib/python${PYVER}/site-packages/_modeller.so + insinto ${IN_PATH}/bin + doins -r bin/{lib,*top} + exeinto ${IN_PATH}/bin + doexe bin/{modslave.py,mod${MY_PV}_${EXECUTABLE_TYPE}} exeinto ${IN_PATH}/lib/${EXECUTABLE_TYPE}/ - doexe modeller-${VER}/lib/${EXECUTABLE_TYPE}/{lib*,_modeller.so} - exeinto ${IN_PATH}/lib/${EXECUTABLE_TYPE}/python${PYVER}/ - doexe modeller-${VER}/lib/${EXECUTABLE_TYPE}/python2.5/_modeller.so - dosym ${IN_PATH}/lib/${EXECUTABLE_TYPE}/libmodeller.so.1 \ - ${IN_PATH}/lib/${EXECUTABLE_TYPE}/libmodeller.so - - insinto ${IN_PATH}/modlib/ - doins -r modeller-${VER}/modlib/{*mat,*lib,*prob,*mdt,*bin,*de,*inp,*ini,modeller} - - insinto ${IN_PATH}/ - doins -r modeller-${VER}/src - - insinto /usr/share/${PN}/ - doins -r modeller-${VER}/examples - dohtml modeller-${VER}/doc/* - dodoc modeller-${VER}/{README,ChangeLog} - - cat >> "${T}/config.py" <<- EOF - install_dir = "${IN_PATH}/" - license = "YOURLICENSEKEY" - EOF - - insinto ${IN_PATH}/modlib/modeller/ - doins "${T}/config.py" -} - -pkg_postinst(){ - #Adapted from BUG #127628 - einfo "" - einfo " If you need to define your own residues" - einfo " read the FAQ and edit the following files:" - einfo "" - einfo " ${MY_D}/modlib/top_heav.lib" - einfo " ${MY_D}/modlib/radii.lib" - einfo " ${MY_D}/modlib/radii14.lib" - einfo " ${MY_D}/modlib/restyp.lib" - einfo "" - einfo " Good Luck and Happy Modeling :D" - einfo "" - echo - echo - ewarn "Obtain a license Key from" - ewarn "http://salilab.org/modeller/registration.html" - ewarn "and change the appropriate line in" - ewarn "${IN_PATH}/modlib/modeller/config.py" + doexe lib/${EXECUTABLE_TYPE}/lib* + dosym libmodeller.so.3 ${IN_PATH}/lib/${EXECUTABLE_TYPE}/libmodeller.so + doexe src/swig/build/lib.linux-$(uname -m)-${PYVER}/_modeller.so + + dodoc README INSTALLATION + if use doc; then + dohtml doc/* + fi + if use examples; then + insinto /usr/share/${PN}/ + doins -r examples + fi + + dosym ${IN_PATH}/lib/${EXECUTABLE_TYPE}/_modeller.so \ + /usr/$(get_libdir)/python${PYVER}/site-packages/_modeller.so +} + +pkg_postinst() { + python_mod_optimize "${ROOT%/}/${IN_PATH}/" + + if [[ ! -e "${IN_PATH}/modlib/modeller/config.py" ]]; then + echo install_dir = '"'"${IN_PATH}/"'"'> ${IN_PATH}/modlib/modeller/config.py + fi + + if grep -q license ${IN_PATH}/modlib/modeller/config.py; then + einfo "A license key file is already present in ${IN_PATH}/modlib/modeller/config.py" + else + ewarn "Obtain a license Key from" + ewarn "http://salilab.org/modeller/registration.html" + ewarn "And run this before using modeller:" + ewarn "emerge --config =${CATEGORY}/${PF}" + ewarn "That way you can [re]enter your license key." + fi +} + +pkg_postrm() { + python_mod_cleanup "${ROOT%/}/${IN_PATH}/" + ewarn "This package leaves a license Key file in ${IN_PATH}/modlib/modeller/config.py" + ewarn "that you need to remove to completely get rid of modeller." +} + +pkg_config() { + ewarn "Your license key is NOT checked for validity here." + ewarn " Make sure you type it in correctly." + eerror "If you CTRL+C out of this, modeller will not run!" + while true + do + einfo "Please enter your license key:" + read license_key1 + einfo "Please re-enter your license key:" + read license_key2 + if [[ "$license_key1" == "" ]] + then + echo "You entered a blank license key. Try again." + else + if [[ "$license_key1" == "$license_key2" ]] + then + echo license = '"'$license_key1'"' >> "${IN_PATH}/modlib/modeller/config.py" + einfo "Thank you!" + break + else + eerror "Your license key entries do not match. Try again." + fi + fi + done }