summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonnie Berkholz <dberkholz@gentoo.org>2009-07-27 06:26:01 +0000
committerDonnie Berkholz <dberkholz@gentoo.org>2009-07-27 06:26:01 +0000
commit25cfa1a5d51d0db7a14e7700934bd677260a016c (patch)
tree53da7a7f8dd6180cdadadc70e28d00b8fafb3c0e /sci-chemistry
parentSet svn revision (diff)
downloadgentoo-2-25cfa1a5d51d0db7a14e7700934bd677260a016c.tar.gz
gentoo-2-25cfa1a5d51d0db7a14e7700934bd677260a016c.tar.bz2
gentoo-2-25cfa1a5d51d0db7a14e7700934bd677260a016c.zip
Pull in Justin Lecher's fixes from the science overlay, except for ARIA.
(Portage version: 2.1.6.13/cvs/Linux x86_64)
Diffstat (limited to 'sci-chemistry')
-rw-r--r--sci-chemistry/cns/ChangeLog8
-rw-r--r--sci-chemistry/cns/cns-1.2.1-r1.ebuild190
-rw-r--r--sci-chemistry/cns/files/1.2.1-gentoo.patch72
3 files changed, 269 insertions, 1 deletions
diff --git a/sci-chemistry/cns/ChangeLog b/sci-chemistry/cns/ChangeLog
index 4e8649e27420..357d0e1dd09c 100644
--- a/sci-chemistry/cns/ChangeLog
+++ b/sci-chemistry/cns/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for sci-chemistry/cns
# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sci-chemistry/cns/ChangeLog,v 1.15 2009/07/07 23:26:17 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/sci-chemistry/cns/ChangeLog,v 1.16 2009/07/27 06:26:01 dberkholz Exp $
+
+*cns-1.2.1-r1 (27 Jul 2009)
+
+ 27 Jul 2009; Donnie Berkholz <dberkholz@gentoo.org>;
+ +files/1.2.1-gentoo.patch, +cns-1.2.1-r1.ebuild:
+ Pull in Justin Lecher's fixes from the science overlay, except for ARIA.
07 Jul 2009; Diego E. Pettenò <flameeyes@gentoo.org> cns-1.2.1.ebuild:
Use elog for fetch error.
diff --git a/sci-chemistry/cns/cns-1.2.1-r1.ebuild b/sci-chemistry/cns/cns-1.2.1-r1.ebuild
new file mode 100644
index 000000000000..006c3c763e8d
--- /dev/null
+++ b/sci-chemistry/cns/cns-1.2.1-r1.ebuild
@@ -0,0 +1,190 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sci-chemistry/cns/cns-1.2.1-r1.ebuild,v 1.1 2009/07/27 06:26:01 dberkholz Exp $
+
+EAPI="2"
+
+inherit eutils fortran toolchain-funcs versionator flag-o-matic
+
+MY_PN="${PN}_solve"
+MY_PV="$(delete_version_separator 2)"
+MY_P="${MY_PN}_${MY_PV}"
+
+DESCRIPTION="Crystallography and NMR System"
+HOMEPAGE="http://cns.csb.yale.edu/"
+SRC_URI="${MY_P}_all-mp.tar.gz"
+
+SLOT="0"
+LICENSE="cns"
+KEYWORDS="~amd64 ~x86"
+IUSE="openmp"
+
+RDEPEND="app-shells/tcsh
+ !app-text/dos2unix"
+DEPEND="${RDEPEND}"
+
+RESTRICT="fetch"
+S="${WORKDIR}/${MY_P}"
+
+FORTRAN="g77 gfortran"
+
+pkg_nofetch() {
+ elog "Fill out the form at http://cns.csb.yale.edu/cns_request/"
+ elog "and place these files:"
+ elog ${A}
+ elog "in ${DISTDIR}."
+}
+
+pkg_setup() {
+ fortran_pkg_setup
+
+ if [[ $(tc-getCC)$ == *gcc* ]] &&
+ ( [[ $(gcc-major-version)$(gcc-minor-version) -lt 42 ]] ||
+ ! built_with_use sys-devel/gcc openmp )
+ then
+ ewarn "You are using gcc and OpenMP is only available with gcc >= 4.2 "
+ ewarn "Switch CC to an OpenMP capable compiler"
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PV}-gentoo.patch
+
+ append-fflags -fopenmp
+
+ # the code uses Intel-compiler-specific directives
+ epatch "${FILESDIR}"/${PV}-allow-gcc-openmp.patch
+
+ OMPLIB="-lgomp"
+
+ use amd64 && \
+ append-cflags "-DINTEGER='long long int'" && \
+ append-fflags -fdefault-integer-8
+
+ # Set up location for the build directory
+ # Uses obsolete `sort` syntax, so we set _POSIX2_VERSION
+ cp "${FILESDIR}"/cns_solve_env_sh "${T}"/
+ sed -i \
+ -e "s:_CNSsolve_location_:${S}:g" \
+ -e "17 s:\(.*\):\1\nsetenv _POSIX2_VERSION 199209:g" \
+ "${S}"/cns_solve_env
+ sed -i \
+ -e "s:_CNSsolve_location_:${S}:g" \
+ -e "17 s:\(.*\):\1\nexport _POSIX2_VERSION; _POSIX2_VERSION=199209:g" \
+ "${T}"/cns_solve_env_sh
+}
+
+src_compile() {
+ local GLOBALS
+ local MALIGN
+ if [[ ${FORTRANC} = g77 ]]; then
+ GLOBALS="-fno-globals"
+ MALIGN='\$(CNS_MALIGN_I86)'
+ fi
+
+ # Set up the compiler to use
+ pushd instlib/machine/unsupported/g77-unix 2>/dev/null
+ ln -s Makefile.header Makefile.header.${FORTRANC} || die
+ popd 2>/dev/null
+
+ # make install really means build, since it's expected to be used in-place
+ emake \
+ CC="$(tc-getCC)" \
+ F77="${FORTRANC}" \
+ LD="${FORTRANC}" \
+ CCFLAGS="${CFLAGS} -DCNS_ARCH_TYPE_\$(CNS_ARCH_TYPE) \$(EXT_CCFLAGS)" \
+ LDFLAGS="${LDFLAGS}" \
+ F77OPT="${FFLAGS:- -O2} ${MALIGN}" \
+ F77STD="${GLOBALS}" \
+ OMPLIB="${OMPLIB}" \
+ g77install \
+ || die "emake failed"
+
+}
+
+src_test() {
+ # We need to force on g77 manually, because we can't get aliases working
+ # when we source in a -c
+ einfo "Running tests ..."
+ sh -c \
+ "export CNS_G77=ON; source ${T}/cns_solve_env_sh; make run_tests" \
+ || die "tests failed"
+ einfo "Displaying test results ..."
+ cat "${S}"/*_g77/test/*.diff-test
+}
+
+src_install() {
+ # Install to locations resembling FHS
+ sed -i \
+ -e "s:${S}:usr:g" \
+ -e "s:^\(setenv CNS_SOLVE.*\):\1\nsetenv CNS_ROOT /usr:g" \
+ -e "s:^\(setenv CNS_SOLVE.*\):\1\nsetenv CNS_DATA \$CNS_ROOT/share/data:g" \
+ -e "s:^\(setenv CNS_SOLVE.*\):\1\nsetenv CNS_DOC \$CNS_ROOT/share/doc/${PF}:g" \
+ -e "s:CNS_LIB \$CNS_SOLVE/libraries:CNS_LIB \$CNS_DATA/libraries:g" \
+ -e "s:CNS_MODULE \$CNS_SOLVE/modules:CNS_MODULE \$CNS_DATA/modules:g" \
+ -e "s:CNS_HELPLIB \$CNS_SOLVE/helplib:CNS_HELPLIB \$CNS_DATA/helplib:g" \
+ -e "s:\$CNS_SOLVE/bin/cns_info:\$CNS_DATA/cns_info:g" \
+ "${S}"/cns_solve_env
+ # I don't entirely understand why the sh version requires a leading /
+ # for CNS_SOLVE and CNS_ROOT, but it does
+ sed -i \
+ -e "s:${S}:/usr:g" \
+ -e "s:^\(^[[:space:]]*CNS_SOLVE=.*\):\1\nexport CNS_ROOT=/usr:g" \
+ -e "s:^\(^[[:space:]]*CNS_SOLVE=.*\):\1\nexport CNS_DATA=\$CNS_ROOT/share/cns:g" \
+ -e "s:^\(^[[:space:]]*CNS_SOLVE=.*\):\1\nexport CNS_DOC=\$CNS_ROOT/share/doc/${PF}:g" \
+ -e "s:CNS_LIB=\$CNS_SOLVE/libraries:CNS_LIB=\$CNS_DATA/libraries:g" \
+ -e "s:CNS_MODULE=\$CNS_SOLVE/modules:CNS_MODULE=\$CNS_DATA/modules:g" \
+ -e "s:CNS_HELPLIB=\$CNS_SOLVE/helplib:CNS_HELPLIB=\$CNS_DATA/helplib:g" \
+ -e "s:\$CNS_SOLVE/bin/cns_info:\$CNS_DATA/cns_info:g" \
+ "${T}"/cns_solve_env_sh
+
+ # Get rid of setup stuff we don't need in the installed script
+ sed -i \
+ -e "83,$ d" \
+ -e "37,46 d" \
+ "${S}"/cns_solve_env
+ sed -i \
+ -e "84,$ d" \
+ -e "39,50 d" \
+ "${T}"/cns_solve_env_sh
+
+ newbin "${S}"/*_g77/bin/cns_solve* cns_solve \
+ || die "install cns_solve failed"
+
+ # Can be run by either cns_solve or cns
+ dosym cns_solve /usr/bin/cns
+
+ # Don't want to install this
+ rm -f "${S}"/*_g77/utils/Makefile
+
+ dobin "${S}"/*_g77/utils/* || die "install utils failed"
+
+ sed -i \
+ -e "s:\$CNS_SOLVE/doc/:\$CNS_SOLVE/share/doc/${PF}/:g" \
+ "${S}"/bin/cns_web
+
+ dobin "${S}"/bin/cns_{edit,header,transfer,web} || die "install bin failed"
+
+ insinto /usr/share/cns
+ doins -r "${S}"/libraries "${S}"/modules "${S}"/helplib
+ doins "${S}"/bin/cns_info
+
+ insinto /etc/profile.d
+ newins "${S}"/cns_solve_env cns_solve_env.csh
+ newins "${T}"/cns_solve_env_sh cns_solve_env.sh
+
+ dohtml \
+ -A iq,cgi,csh,cv,def,fm,gif,hkl,inp,jpeg,lib,link,list,mask,mtf,param,pdb,pdf,pl,ps,sc,sca,sdb,seq,tbl,top \
+ -f all_cns_info_template,omac,def \
+ -r doc/html/*
+}
+
+pkg_info() {
+ elog "Set OMP_NUM_THREADS to the number of threads you want."
+ elog "If you get segfaults on large structures, set the GOMP_STACKSIZE"
+ elog "variable if using gcc (16384 should be good)."
+}
+
+pkg_postinst() {
+ pkg_info
+}
diff --git a/sci-chemistry/cns/files/1.2.1-gentoo.patch b/sci-chemistry/cns/files/1.2.1-gentoo.patch
new file mode 100644
index 000000000000..45f5c318155f
--- /dev/null
+++ b/sci-chemistry/cns/files/1.2.1-gentoo.patch
@@ -0,0 +1,72 @@
+--- cns_solve_1.21/instlib/source/Makefile.proto 2000-09-07 20:35:33.000000000 +0200
++++ cns_solve_1.21/instlib/source/Makefile.proto.new 2009-07-14 09:18:37.000000000 +0200
+@@ -11,6 +11,8 @@
+
+ SHELL=/bin/sh
+
++cns_string=`date "+%y%m%d%H%M"`
++
+ # commands
+ RM = /bin/rm
+
+@@ -25,26 +27,20 @@
+
+ # rule for the fortran routines
+ $(OBJS):
+- @ echo "compiling: $(@:.o=.f)"; \
+- $(F77) -c $(F77FLAGS) $(@:.o=.f)
++ $(F77) -c $(F77FLAGS) $(@:.o=.f)
+
+ # rule for the dynamic memory allocation C routines
+ dmemory.o: dmemory.c
+- @ echo ; echo "compiling: $?"
+- @ $(CC) -c $(CCFLAGS) $?
++ $(CC) -c $(CCFLAGS) $?
+
+ # rule for the machine specific C routines
+ machine_c.o: machine_c.c
+- @ echo ; echo "compiling: $?"
+- @ $(CC) -c $(CCFLAGS) $?
++ $(CC) -c $(CCFLAGS) $?
+
+ # rule for the executable itself
+ ../bin/cns_solve: $(DEPENDS)
+- @ echo ; echo "linking: cns_solve"; echo
+- @ cns_string=`date "+%y%m%d%H%M"`; \
+- $(LD) -o cns_solve-$$cns_string.exe $(OBJS) dmemory.o machine_c.o \
+- $(LDFLAGS) \
+- $(CNS_FFTDIR) $(CNS_FFTLIB); \
++ $(LD) $(LDFLAGS) -o cns_solve-$$cns_string.exe $(OBJS) dmemory.o machine_c.o \
++ $(CNS_FFTDIR) $(CNS_FFTLIB) $(OMPLIB); \
+ if [ -x cns_solve-$$cns_string.exe ]; \
+ then echo "created executable file cns_solve-$$cns_string.exe"; \
+ echo ""; cd ../bin; $(RM) -f cns_solve; $(RM) -f cns; \
+@@ -59,7 +55,7 @@
+ @ echo; echo "flags:"; \
+ echo " fortran -> [$(F77)] $(F77FLAGS)"; \
+ echo " c -> [$(CC)] $(CCFLAGS)"; \
+- echo " link -> [$(LD)] $(LDFLAGS) $(CNS_FFTDIR) $(CNS_FFTLIB)"; \
++ echo " link -> [$(LD)] $(LDFLAGS) $(CNS_FFTDIR) $(CNS_FFTLIB) $(OMP_LIB)"; \
+ echo
+
+ # regenerate makefiles
+--- cns_solve_1.21/instlib/utils/Makefile 2004-08-30 00:40:35.000000000 +0200
++++ cns_solve_1.21/instlib/utils/Makefile.new 2009-07-14 09:50:27.000000000 +0200
+@@ -22,14 +22,14 @@
+ make clean
+
+ .f:
+- $(F77) -o $@ $(F77FLAGS) $(@).f $(F77LINK)
++ $(F77) $(LDFLAGS) -o $@ $(F77FLAGS) $(@).f $(F77LINK)
+
+ .c:
+- $(CC) -o $@ $(CCFLAGS) $(@).c $(CCLINK)
++ $(CC) $(LDFLAGS) -o $@ $(CCFLAGS) $(@).c $(CCLINK)
+
+ .l:
+ lex $(@).l
+- $(CC) $(CCFLAGS) -o $@ lex.yy.c $(CCLINK) -l$(LEXLIB)
++ $(CC) $(LDFLAGS) $(CCFLAGS) -o $@ lex.yy.c $(CCLINK) -l$(LEXLIB)
+
+ relink:
+ @ cd $(CNS_INST)/utils; touch x; rm -f x `ls * | grep -v Makefile`