diff options
Diffstat (limited to 'biology/distribfold/Makefile')
-rw-r--r-- | biology/distribfold/Makefile | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/biology/distribfold/Makefile b/biology/distribfold/Makefile new file mode 100644 index 000000000000..a8b93ba7e881 --- /dev/null +++ b/biology/distribfold/Makefile @@ -0,0 +1,116 @@ +# New ports collection makefile for: folding@home client +# Date created: Sun Sep 29 19:48:01 UTC 2002 +# Whom: Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org> +# +# $FreeBSD$ +# + +PORTNAME= distribfold +PORTVERSION= 0.1 +CATEGORIES= misc net +MASTER_SITES= ftp://ftp.mshri.on.ca/pub/distribfold/download/ +DISTNAME= distribfold-current-FreeBSD + +MAINTAINER= lioux@FreeBSD.org + +ONLY_FOR_ARCHS= i386 +USE_REINPLACE= yes +NO_BUILD= yes + +WRKSRC= ${WRKDIR}/distribfold + +# files to install +SCRIPT_FILES= distrib-update foldit +PROGRAM_FILES= foldtrajlite +# installation dir +DESTINATION_DIR= ${PREFIX}/distribfold + +# default users +DNETFOLD_USER=dnetfold +DNETFOLD_GROUP=dnetfold + +# default number of processors +WITH_NCPU?= 1 + +post-patch: + @${REINPLACE_CMD} -E -e 's|%%DESTINATION_DIR%%|${DESTINATION_DIR}|' \ + ${WRKSRC}/foldit + +pre-install: +# create users + @${SETENV} PKG_PREFIX=${PREFIX} ${SH} \ + ${PKGINSTALL} ${PKGNAME} POST-INSTALL + +do-install: +# remove any patch scrap files +.for ext in bak orig + @${RM} -f ${WRKSRC}/*.${ext} +.endfor +# strip binaries +.for file in ${PROGRAM_FILES} + @${STRIP_CMD} ${WRKSRC}/${file} +.endfor +# install startup script + @${INSTALL_SCRIPT} ${WRKDIR}/distribfold.sh ${PREFIX}/etc/rc.d +# for every cpu directory + @ncpu=`${CAT} ${WRKDIR}/ncpu` ; \ + for dir in `${FILESDIR}/number_of_dirs.sh $${ncpu}` ; do \ + DESTINATION_DIR=${DESTINATION_DIR}/cpu$${dir} ; \ + ${MKDIR} $${DESTINATION_DIR} ; \ + ${INSTALL_DATA} ${WRKSRC}/* $${DESTINATION_DIR} ; \ + ${CHGRP} -R ${DNETFOLD_GROUP} $${DESTINATION_DIR} ; \ + ${CHMOD} g+w $${DESTINATION_DIR} ; \ + ${CHOWN} ${DNETFOLD_USER} $${DESTINATION_DIR}/* ; \ + ${CHMOD} u+w $${DESTINATION_DIR}/* ; \ + for file in ${PROGRAM_FILES} ${SCRIPT_FILES} ; do \ + ${CHMOD} 0755 $${DESTINATION_DIR}/$${file} ; \ + done ; \ + done +# display package message + @${CAT} ${PKGMESSAGE} + +post-install: cook-install-plist + +.include <bsd.port.pre.mk> + +pre-everything:: +.if ${WITH_NCPU} < 1 + @${ECHO_MSG} "===> Number of processors HAS to be at least 1" + @${ECHO_MSG} "===> (${WITH_NCPU}) IS NOT" + @${FALSE} +.endif + @${ECHO_MSG} "=======> ATTENTION <=======" + @${ECHO_MSG} "===> If you want to have multiple copies of this program" + @${ECHO_MSG} "===> running in order to make better use of your SMP" + @${ECHO_MSG} "===> system, set WITH_CPU to the number of cpus" + @${ECHO_MSG} "===> available in your system" + @${ECHO_MSG} "===> For example, 2 cpus. \"make WITH_CPU=2\"" + @${ECHO_MSG} "===> Do not use this variable if you do not have a SMP" + @${ECHO_MSG} "===> system. There is no advantage otherwise." + +do-configure: +# prepare startup script + @${SED} -e 's|%%DNETFOLD_USER%%|${DNETFOLD_USER}|' \ + -e 's|%%DESTINATION_DIR%%|${DESTINATION_DIR}|' \ + -e 's|%%NCPU%%|${WITH_NCPU}|' \ + ${FILESDIR}/distribfold.sh > ${WRKDIR}/distribfold.sh +# record number of cpus + @${ECHO} ${WITH_NCPU} > ${WRKDIR}/ncpu + +cook-install-plist: generate-plist +.if ${WITH_NCPU} > 1 + @${GREP} cpu0 ${TMPPLIST} > ${WRKDIR}/plist + @${TAIL} -n 2 ${TMPPLIST} > ${WRKDIR}/plist.end + @${CP} /dev/null ${WRKDIR}/plistN +# for every cpu directory + @ncpu=`${CAT} ${WRKDIR}/ncpu` ; \ + for dir in `${FILESDIR}/number_of_dirs.sh $${ncpu}` ; do \ + ${SED} -e "s|cpu0|cpu$${dir}|" ${WRKDIR}/plist >> ${WRKDIR}/plistN ; \ + done + @${CP} /dev/null ${TMPPLIST} +.for file in plistN plist.end + @${CAT} ${WRKDIR}/${file} >> ${TMPPLIST} +.endfor +.endif + +.include <bsd.port.post.mk> |