summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /sci-chemistry/cns
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'sci-chemistry/cns')
-rw-r--r--sci-chemistry/cns/Manifest4
-rw-r--r--sci-chemistry/cns/cns-1.2.1-r8.ebuild233
-rw-r--r--sci-chemistry/cns/cns-1.3_p7-r1.ebuild216
-rw-r--r--sci-chemistry/cns/files/1.2.1-allow-gcc-openmp.patch20
-rw-r--r--sci-chemistry/cns/files/1.2.1-aria2.3.patch22
-rw-r--r--sci-chemistry/cns/files/1.2.1-gentoo.patch63
-rw-r--r--sci-chemistry/cns/files/1.2.1-ifort.patch126
-rw-r--r--sci-chemistry/cns/files/1.2.1-parallel.patch17
-rw-r--r--sci-chemistry/cns/files/1.3_p7-delete.patch13
-rw-r--r--sci-chemistry/cns/files/1.3_p7-gentoo.patch80
-rw-r--r--sci-chemistry/cns/files/cns_solve_env_sh221
-rw-r--r--sci-chemistry/cns/files/cns_solve_env_sh-1.3_p7229
-rw-r--r--sci-chemistry/cns/metadata.xml21
13 files changed, 1265 insertions, 0 deletions
diff --git a/sci-chemistry/cns/Manifest b/sci-chemistry/cns/Manifest
new file mode 100644
index 000000000000..d0d2b7b0dc55
--- /dev/null
+++ b/sci-chemistry/cns/Manifest
@@ -0,0 +1,4 @@
+DIST aria2.3.1.tar.gz 1833973 SHA256 cc45ed2d66182cf0ee197a7cf3bc7edd8d5043d95cdcd19e1cec9aeb82c2fdbc SHA512 79a2cd89e2120acecb04f286a153dbf52c16500e8956c9dad49b1e1ed94a7b2449c7b044bae6f87e0d2b452a1467a2c02de74f0fa85b0eae66042386e2f5e2d5 WHIRLPOOL 2ff003322601b42bec0d2431e2f1f85819b3982f8da612ff778bb404e51f0fcbca3faa6998e9c0635f9e73899609bb1e273420cac182952aa744364c20299723
+DIST aria2.3.2.tar.gz 1836270 SHA256 30727ea8bdc2e3b44e5970545008fcfa07fa59aa28b76824956a2aa71daa9615 SHA512 009a1d0079f5cc162dc732749ddd2b33297268f0d988b2f37bda4ed50c7764ceef7ae5b56b322c7ac79427a4a2a92d1239199891445cb5e2b3d0908ed670e2aa WHIRLPOOL f18af5b751e79c92e04f4dc12b6b806a1c505b269559a2342bdd6280b790f9f0df9bb4afe366af03beaf09af0128c6b68c39bc66603d51ad24914c78b2579cf3
+DIST cns_solve_1.21_all-mp.tar.gz 32748040 SHA256 7ab464e20932eb024ba6378738da77a4a03642d63b0ca9772b612a7cf27baec1 SHA512 383324d771570b501e388fba9bf20789f483a3a4044eb3334c7a7e7835e0c345b784e0d344b22d20a10fe1c33ed21c9013adb1af5912808af480b96abe275857 WHIRLPOOL fecd0b2dfba43e5525a9fcc8543a55867602b376744848ddafd4c132bcdfc32225780f543742fa225b5e0f0ce658c1029a9ca8b80d5ee3f2491b6d63e8ad91b0
+DIST cns_solve_1.3_all.tar.gz 64167735 SHA256 2ee368022c5ecabf66ce7d32059d93cd7d885ad2d684a094b87c64f6b3dfea0d SHA512 4fe73820e96999bb33a59ff6da979794628552f49bc03cdebcb9439b57e6042b92190e04bb7e4079157adf06a6facc5c16b8ae91621bd24a4b35ee382e53ae37 WHIRLPOOL b3cd14ab7a8a29a44f6e6c3cbc22ee2c665eb8c8565969337b24deffb2a1fd007fae11c5eb73ac38ddf9a38e850948e3b2df2548931722a2a383d5e8c72607a1
diff --git a/sci-chemistry/cns/cns-1.2.1-r8.ebuild b/sci-chemistry/cns/cns-1.2.1-r8.ebuild
new file mode 100644
index 000000000000..d9cc723f98b3
--- /dev/null
+++ b/sci-chemistry/cns/cns-1.2.1-r8.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils fortran-2 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
+ aria? ( aria2.3.2.tar.gz )"
+
+SLOT="0"
+LICENSE="cns"
+KEYWORDS="amd64 x86 ~amd64-linux ~x86-linux"
+IUSE="aria openmp"
+
+RDEPEND="app-shells/tcsh"
+DEPEND="${RDEPEND}"
+
+FORTRAN_NEED_OPENMP=1
+
+S="${WORKDIR}/${MY_P}"
+
+RESTRICT="fetch test"
+
+pkg_nofetch() {
+ elog "Fill out the form at http://cns.csb.yale.edu/cns_request/"
+ use aria && elog "and http://aria.pasteur.fr/"
+ elog "and place these files:"
+ elog ${A}
+ elog "in ${DISTDIR}."
+}
+
+get_fcomp() {
+ case $(tc-getFC) in
+ *gfortran* )
+ FCOMP="gfortran" ;;
+ ifort )
+ FCOMP="ifc" ;;
+ * )
+ FCOMP=$(tc-getFC) ;;
+ esac
+}
+
+pkg_setup() {
+ fortran-2_pkg_setup
+ get_fcomp
+}
+
+get_bitness() {
+ echo > "${T}"/test.c
+ $(tc-getCC) ${CFLAGS} -c "${T}"/test.c -o "${T}"/test.o
+ case $(file "${T}"/test.o) in
+ *64-bit*|*ppc64*|*x86_64*) export _bitness="64";;
+ *32-bit*|*ppc*|*i386*) export _bitness="32";;
+ *) die "Failed to detect whether your arch is 64bits or 32bits, disable distcc if you're using it, please";;
+ esac
+}
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/${PV}-gentoo.patch \
+ "${FILESDIR}"/${PV}-parallel.patch
+
+ get_bitness
+
+ if use aria; then
+ pushd "${WORKDIR}"/aria* >& /dev/null
+ # Update the cns sources in aria for version 1.2.1
+ epatch "${FILESDIR}"/1.2.1-aria2.3.patch
+
+ # Update the code with aria specific things
+ cp -rf cns/src/* "${S}"/source/ || die
+ popd >& /dev/null
+ fi
+
+ # the code uses Intel-compiler-specific directives
+ if [[ $(tc-getFC) =~ gfortran ]]; then
+ epatch "${FILESDIR}"/${PV}-allow-gcc-openmp.patch
+ use openmp && \
+ append-flags -fopenmp && append-ldflags -fopenmp
+ COMP="gfortran"
+ [[ ${_bitness} == 64 ]] && \
+ append-fflags -fdefault-integer-8
+ elif [[ $(tc-getFC) == if* ]]; then
+ epatch "${FILESDIR}"/${PV}-ifort.patch
+ use openmp && \
+ append-flags -openmp && append-ldflags -openmp
+ COMP="ifort"
+ [[ ${_bitness} == 64 ]] && append-fflags -i8
+ fi
+
+ [[ ${_bitness} == 64 ]] && \
+ append-cflags "-DINTEGER='long long int'"
+
+ # Set up location for the build directory
+ # Uses obsolete `sort` syntax, so we set _POSIX2_VERSION
+ cp "${FILESDIR}"/cns_solve_env_sh "${T}"/ || die
+ sed \
+ -e "s:_CNSsolve_location_:${S}:g" \
+ -e "17 s:\(.*\):\1\nsetenv _POSIX2_VERSION 199209:g" \
+ -i "${S}"/cns_solve_env || die
+ sed \
+ -e "s:_CNSsolve_location_:${S}:g" \
+ -e "17 s:\(.*\):\1\nexport _POSIX2_VERSION; _POSIX2_VERSION=199209:g" \
+ -i "${T}"/cns_solve_env_sh || die
+
+ einfo "Fixing shebangs..."
+ find "${S}" -type f \
+ -exec sed "s:/bin/csh:${EPREFIX}/bin/csh:g" -i '{}' + || die
+}
+
+src_compile() {
+ local GLOBALS
+ local MALIGN
+ if [[ $(tc-getFC) =~ g77 ]]; then
+ GLOBALS="-fno-globals"
+ MALIGN='\$(CNS_MALIGN_I86)'
+ fi
+
+ # Set up the compiler to use
+ ln -s Makefile.header instlib/machine/unsupported/g77-unix/Makefile.header.${FCOMP} || die
+
+ # make install really means build, since it's expected to be used in-place
+ # -j1 doesn't mean we do no respect MAKEOPTS!
+ emake -j1 \
+ CC="$(tc-getCC)" \
+ F77=$(tc-getFC) \
+ LD=$(tc-getFC) \
+ CCFLAGS="${CFLAGS} -DCNS_ARCH_TYPE_\$(CNS_ARCH_TYPE) \$(EXT_CCFLAGS)" \
+ LDFLAGS="${LDFLAGS}" \
+ F77OPT="${FCFLAGS} ${MALIGN}" \
+ F77STD="${GLOBALS}" \
+ OMPLIB="${OMPLIB}" \
+ compiler="${COMP}" \
+ install
+}
+
+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 ..."
+ csh -c \
+ "export CNS_G77=ON; source ${S}/cns_solve_env; make run_tests" \
+ || die "tests failed"
+ einfo "Displaying test results ..."
+ cat "${S}"/*_g77/test/*.diff-test
+}
+
+src_install() {
+ # Install to locations resembling FHS
+ sed \
+ -e "s:${S}:usr:g" \
+ -e "s:^\(setenv CNS_SOLVE.*\):\1\nsetenv CNS_ROOT ${EPREFIX}/usr:g" \
+ -e "s:^\(setenv CNS_SOLVE.*\):\1\nsetenv CNS_DATA \$CNS_ROOT/share/cns: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" \
+ -e "/^g77on/d" \
+ -i "${S}"/cns_solve_env || die
+ # I don't entirely understand why the sh version requires a leading /
+ # for CNS_SOLVE and CNS_ROOT, but it does
+ sed \
+ -e "s:${S}:/usr:g" \
+ -e "s:^\(^[[:space:]]*CNS_SOLVE=.*\):\1\nexport CNS_ROOT=${EPREFIX}/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" \
+ -e "/^g77on/d" \
+ -e "/^g77off/d" \
+ -i "${T}"/cns_solve_env_sh || die
+
+ # Get rid of setup stuff we don't need in the installed script
+ sed \
+ -e "83,$ d" \
+ -e "37,46 d" \
+ -i "${S}"/cns_solve_env || die
+ sed \
+ -e "84,$ d" \
+ -e "39,50 d" \
+ -i "${T}"/cns_solve_env_sh || die
+
+ newbin "${S}"/*linux*/bin/cns_solve* cns_solve
+
+ # Can be run by either cns_solve or cns
+ dosym cns_solve /usr/bin/cns
+
+ # Don't want to install this
+ rm -f "${S}"/*linux*/utils/Makefile || die
+
+ dobin "${S}"/*linux*/utils/*
+
+ sed \
+ -e "s:\$CNS_SOLVE/doc/:\$CNS_SOLVE/share/doc/${PF}/:g" \
+ -i "${S}"/bin/cns_web || die
+
+ dobin "${S}"/bin/cns_{edit,header,transfer,web}
+
+ 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/*
+ # Conflits with app-text/dos2unix
+ rm -f "${D}"/usr/bin/dos2unix || die
+}
+
+pkg_postinst() {
+ if use openmp; then
+ 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)."
+ fi
+}
diff --git a/sci-chemistry/cns/cns-1.3_p7-r1.ebuild b/sci-chemistry/cns/cns-1.3_p7-r1.ebuild
new file mode 100644
index 000000000000..724c62f7e98c
--- /dev/null
+++ b/sci-chemistry/cns/cns-1.3_p7-r1.ebuild
@@ -0,0 +1,216 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils fortran-2 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/p7}_all.tar.gz
+ aria? ( aria2.3.1.tar.gz )"
+
+SLOT="0"
+LICENSE="cns"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="aria openmp"
+
+RDEPEND="app-shells/tcsh"
+DEPEND="${RDEPEND}"
+
+FORTRAN_NEED_OPENMP=1
+
+S="${WORKDIR}/${MY_P/p7}"
+
+RESTRICT="fetch"
+
+pkg_nofetch() {
+ elog "Fill out the form at http://cns.csb.yale.edu/cns_request/"
+ use aria && elog "and http://aria.pasteur.fr/"
+ elog "and place these files:"
+ elog ${A}
+ elog "in ${DISTDIR}."
+}
+
+get_fcomp() {
+ case $(tc-getFC) in
+ *gfortran* )
+ FCOMP="gfortran" ;;
+ ifort )
+ FCOMP="ifc" ;;
+ * )
+ FCOMP=$(tc-getFC) ;;
+ esac
+}
+
+pkg_setup() {
+ fortran-2_pkg_setup
+ get_fcomp
+}
+
+get_bitness() {
+ echo > "${T}"/test.c
+ $(tc-getCC) ${CFLAGS} -c "${T}"/test.c -o "${T}"/test.o
+ case $(file "${T}"/test.o) in
+ *64-bit*|*ppc64*|*x86_64*) export _bitness="64";;
+ *32-bit*|*ppc*|*i386*) export _bitness="32";;
+ *) die "Failed to detect whether your arch is 64bits or 32bits, disable distcc if you're using it, please";;
+ esac
+}
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/${PV}-gentoo.patch \
+ "${FILESDIR}"/${PV}-delete.patch
+
+ get_bitness
+
+ if use aria; then
+ pushd "${WORKDIR}"/aria* >& /dev/null
+ # Update the cns sources in aria for version 1.2.1
+ epatch "${FILESDIR}"/1.2.1-aria2.3.patch
+
+ # Update the code with aria specific things
+ cp -rf cns/src/* "${S}"/source/ || die
+ popd >& /dev/null
+ fi
+
+ # the code uses Intel-compiler-specific directives
+ if [[ $(tc-getFC) =~ gfortran ]]; then
+ use openmp && \
+ append-flags -fopenmp && append-ldflags -fopenmp
+ COMP="gfortran"
+ [[ ${_bitness} == 64 ]] && \
+ append-fflags -fdefault-integer-8
+ elif [[ $(tc-getFC) == if* ]]; then
+ use openmp && \
+ append-flags -openmp && append-ldflags -openmp
+ COMP="ifort"
+ [[ ${_bitness} == 64 ]] && append-fflags -i8
+ fi
+
+ [[ ${_bitness} == 64 ]] && \
+ append-cflags "-DINTEGER='long long int'"
+
+ # Set up location for the build directory
+ # Uses obsolete `sort` syntax, so we set _POSIX2_VERSION
+ cp "${FILESDIR}"/cns_solve_env_sh-${PV} "${T}"/cns_solve_env_sh || die
+ sed \
+ -e "s:_CNSsolve_location_:${S}:g" \
+ -e "17 s:\(.*\):\1\nsetenv _POSIX2_VERSION 199209:g" \
+ -i "${S}"/cns_solve_env || die
+ sed \
+ -e "s:_CNSsolve_location_:${S}:g" \
+ -e "17 s:\(.*\):\1\nexport _POSIX2_VERSION; _POSIX2_VERSION=199209:g" \
+ -e "s:setenv OMP_STACKSIZE 256m:export OMP_STACKSIZE=256m:g" \
+ -e "s:^limit:^ulimit:g" \
+ -i "${T}"/cns_solve_env_sh || die
+
+ ebegin "Fixing shebangs..."
+ find "${S}" -type f \
+ -exec sed "s:/bin/csh:${EPREFIX}/bin/csh:g" -i '{}' + || die
+ find . -name "Makefile*" \
+ -exec \
+ sed \
+ -e "s:^SHELL=/bin/sh:SHELL=${EPREFIX}/bin/sh:g" \
+ -e "s:/bin/ls:ls:g" \
+ -e "s:/bin/rm:rm:g" \
+ -i '{}' + || die
+ eend
+}
+
+src_compile() {
+ local GLOBALS
+ local MALIGN
+
+ # Set up the compiler to use
+ ln -s Makefile.header instlib/machine/unsupported/g77-unix/Makefile.header.${FCOMP} || die
+
+ # make install really means build, since it's expected to be used in-place
+ # -j1 doesn't mean we do no respect MAKEOPTS!
+ emake -j1 \
+ CC="$(tc-getCC)" \
+ CXX="$(tc-getCXX)" \
+ F77=$(tc-getFC) \
+ LD=$(tc-getFC) \
+ CCFLAGS="${CFLAGS} -DCNS_ARCH_TYPE_\$(CNS_ARCH_TYPE) \$(EXT_CCFLAGS)" \
+ CXXFLAGS="${CXXFLAGS} -DCNS_ARCH_TYPE_\$(CNS_ARCH_TYPE) \$(EXT_CCFLAGS)" \
+ LDFLAGS="${LDFLAGS}" \
+ F77OPT="${FCFLAGS} ${MALIGN}" \
+ F77STD="${GLOBALS}" \
+ OMPLIB="${OMPLIB}" \
+ compiler="${COMP}" \
+ install
+}
+
+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() {
+ cat >> "${T}"/66cns <<- EOF
+ CNS_SOLVE="${EPREFIX}/usr"
+ CNS_ROOT="${EPREFIX}/usr"
+ CNS_DATA="${EPREFIX}/usr/share/cns"
+ CNS_DOC="${EPREFIX}/usr/share/doc/cns-1.3"
+ CNS_LIB="${EPREFIX}/usr/share/cns/libraries"
+ CNS_MODULE="${EPREFIX}/usr/share/cns/modules"
+ CNS_TOPPAR="${EPREFIX}/usr/share/cns/libraries/toppar"
+ CNS_CONFDB="${EPREFIX}/usr/share/cns/libraries/confdb"
+ CNS_XTALLIB="${EPREFIX}/usr/share/cns/libraries/xtal"
+ CNS_NMRLIB="${EPREFIX}/usr/share/cns/libraries/nmr"
+ CNS_XRAYLIB="${EPREFIX}/usr/share/cns/libraries/xray"
+ CNS_XTALMODULE="${EPREFIX}/usr/share/cns/modules/xtal"
+ CNS_NMRMODULE="${EPREFIX}/usr/share/cns/modules/nmr"
+ CNS_HELPLIB="${EPREFIX}/usr/share/cns/helplib"
+ EOF
+
+ doenvd "${T}"/66cns || die
+
+ # Don't want to install this
+ rm -f "${S}"/*linux*/utils/Makefile || die
+
+ sed \
+ -e "s:\$CNS_SOLVE/doc/:\$CNS_SOLVE/share/doc/${PF}/:g" \
+ -i "${S}"/bin/cns_web || die
+
+ newbin "${S}"/*linux*/bin/cns_solve* cns_solve
+
+ # Can be run by either cns_solve or cns
+ dosym cns_solve /usr/bin/cns
+
+ dobin \
+ "${S}"/*linux*/utils/* \
+ "${S}"/bin/cns_{edit,header,import_cif,transfer,web}
+
+ insinto /usr/share/cns
+ doins -r "${S}"/libraries "${S}"/modules "${S}"/helplib "${S}"/bin/cns_info
+
+ 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/*
+ # Conflits with app-text/dos2unix
+ rm -f "${D}"/usr/bin/dos2unix || die
+}
+
+pkg_postinst() {
+ if use openmp; then
+ 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)."
+ fi
+}
diff --git a/sci-chemistry/cns/files/1.2.1-allow-gcc-openmp.patch b/sci-chemistry/cns/files/1.2.1-allow-gcc-openmp.patch
new file mode 100644
index 000000000000..42b9b0572231
--- /dev/null
+++ b/sci-chemistry/cns/files/1.2.1-allow-gcc-openmp.patch
@@ -0,0 +1,20 @@
+--- source/xfft.f.orig 2008-08-03 00:36:52.000000000 -0700
++++ source/xfft.f 2008-08-03 00:37:06.000000000 -0700
+@@ -514,7 +514,7 @@
+ LOGICAL QHERM
+ DOUBLE PRECISION XRCELL(9), MAPR
+ C local
+-!$ integer omp_get_max_threads, kmp_get_stacksize
++!$ integer omp_get_max_threads
+ LOGICAL DONE
+ DOUBLE PRECISION ZERO
+ PARAMETER (ZERO=0.0D0)
+@@ -537,7 +537,7 @@
+ NBPP=1
+ ! The following command is only relevant for the ifort compiler (if -openmp option is used).
+ ! If your compiler is not ifort, and gives an error, just comment the next line out:
+-!$ if (kmp_get_stacksize().lt.2**23) call kmp_set_stacksize(2**23)
++! if (kmp_get_stacksize().lt.2**23) call kmp_set_stacksize(2**23)
+ ! Explanation: the default KMP_STACKSIZE of ifort is 2**21 bytes (2Mb) for 32bit,
+ ! and 2**22 bytes (4Mb) for 64bit.
+ ! This may be low for big structures, which leads to segmentation faults!
diff --git a/sci-chemistry/cns/files/1.2.1-aria2.3.patch b/sci-chemistry/cns/files/1.2.1-aria2.3.patch
new file mode 100644
index 000000000000..8c6939d8eb92
--- /dev/null
+++ b/sci-chemistry/cns/files/1.2.1-aria2.3.patch
@@ -0,0 +1,22 @@
+diff --git a/cns/src/cns.f b/cns/src/cns.f
+index a3c2cbe..51a34f8 100644
+--- a/cns/src/cns.f
++++ b/cns/src/cns.f
+@@ -470,6 +470,7 @@ C local
+ INTEGER HNLEN, TMP, PTRSZ, STLEN
+ CHARACTER*(1) CNSPTMP
+ CHARACTER*(4) ST
++!$ integer omp_get_max_threads
+ C
+ C write header
+ WRITE(6,'(10X,A)')
+@@ -526,6 +527,9 @@ C
+ WRITE(6,'(10X,7A)')
+ & ' Running on machine: ',HOSTNM(1:HNLEN),
+ & ' (',SYSNM(1:TMP),',',ST(1:STLEN),'-bit)'
++!$ write(6,'(31x,a,i3,a)') 'with',omp_get_max_threads(),
++!$ & ' threads'
++!$C (to change use setenv OMP_NUM_THREADS x)
+ C
+ CALL GETNAM(USERNM,12,TMP)
+ WRITE(6,'(10X,2A)')
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..2b47bfcc7d86
--- /dev/null
+++ b/sci-chemistry/cns/files/1.2.1-gentoo.patch
@@ -0,0 +1,63 @@
+--- 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); \
+ 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; \
+--- 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`
diff --git a/sci-chemistry/cns/files/1.2.1-ifort.patch b/sci-chemistry/cns/files/1.2.1-ifort.patch
new file mode 100644
index 000000000000..ba44bebd1b68
--- /dev/null
+++ b/sci-chemistry/cns/files/1.2.1-ifort.patch
@@ -0,0 +1,126 @@
+diff --git a/source/angledb.f b/source/angledb.f
+index 28ad657..eaa847d 100644
+--- a/source/angledb.f
++++ b/source/angledb.f
+@@ -1416,10 +1416,10 @@ C include files
+ C local variables
+ INTEGER COUNT, SPTR, OLDCLASS, OLDMAXANGLEDBS
+ INTEGER THETYPE, CURPSIS, CURPHIS
+- INTEGER CLASSINDEX
++ INTEGER CLASINDEX
+ DOUBLE PRECISION K1, CUTOFF
+ CHARACTER*4 THENAME
+- CHARACTER*20 CLASSNAME
++ CHARACTER*20 CLASNAME
+ C begin
+ C
+ IF (ANGLEDBFLAG) THEN
+@@ -1450,10 +1450,10 @@ C
+ ELSE IF (WD(1:4).EQ.'CLAS') THEN
+ OLDCLASS = CURANGLEDBCLASS
+ CALL NEXTWD('class name =')
+- CLASSNAME = WD(1:20)
++ CLASNAME = WD(1:20)
+ ANGLEDBMODE = NEW
+ DO COUNT = 1, NANGLEDBCLASSES
+- IF (ANGDBCLASSNAMES(COUNT).EQ.CLASSNAME) THEN
++ IF (ANGDBCLASSNAMES(COUNT).EQ.CLASNAME) THEN
+ ANGLEDBMODE = UPDATE
+ CURANGLEDBCLASS = COUNT
+ END IF
+@@ -1472,7 +1472,7 @@ C
+ END IF
+ NANGLEDBCLASSES = NANGLEDBCLASSES + 1
+ CURANGLEDBCLASS = NANGLEDBCLASSES
+- ANGDBCLASSNAMES(CURANGLEDBCLASS) = CLASSNAME
++ ANGDBCLASSNAMES(CURANGLEDBCLASS) = CLASNAME
+ ANGLEDBASSNDX(CURANGLEDBCLASS) = NANGLEDBS
+ END IF
+ C
+@@ -1733,16 +1733,16 @@ C
+ & HEAP(ANGLEDBTPTR))
+ ELSE IF (WD(1:4).EQ.'CLAS') THEN
+ CALL NEXTWD('Class name>')
+- CLASSNAME = WD(1:20)
+- CLASSINDEX = 0
++ CLASNAME = WD(1:20)
++ CLASINDEX = 0
+ DO COUNT = 1, NANGLEDBCLASSES
+ IF (ANGDBCLASSNAMES(COUNT).EQ.
+- & CLASSNAME) THEN
++ & CLASNAME) THEN
+ PRINTTHISCLASS(COUNT) = .TRUE.
+- CLASSINDEX = COUNT
++ CLASINDEX = COUNT
+ END IF
+ END DO
+- IF (CLASSINDEX.EQ.0) THEN
++ IF (CLASINDEX.EQ.0) THEN
+ CALL DSPERR('ANGLEDB',
+ & 'unknown class. Using first.')
+ PRINTTHISCLASS(1) = .TRUE.
+diff --git a/source/rama.f b/source/rama.f
+index c5d14f2..3063e7b 100644
+--- a/source/rama.f
++++ b/source/rama.f
+@@ -1468,11 +1468,11 @@ C include files
+ C local variables
+ INTEGER COUNT, SPTR, OLDCLASS, OLDMAXRAMAS,
+ & THETYPE, CURPSIS, CURPHIS,
+- & CURCHIS, CURTHTS, CLASSINDEX
++ & CURCHIS, CURTHTS, CLASINDEX
+ INTEGER CLEN
+ DOUBLE PRECISION K1, CUTOFF
+ CHARACTER*4 THENAME
+- CHARACTER*50 CLASSNAME
++ CHARACTER*50 CLASNAME
+ C begin
+ C
+ C this is used by READRAMA2 to hold the selection
+@@ -1503,10 +1503,10 @@ C
+ ELSE IF (WD(1:4).EQ.'CLAS') THEN
+ OLDCLASS = CURRAMACLASS
+ CALL NEXTWD('class name =')
+- CLASSNAME = WD(1:50)
++ CLASNAME = WD(1:50)
+ RAMAMODE = NEW
+ DO COUNT = 1, NRAMACLASSES
+- IF (RAMACLASSNAMES(COUNT).EQ.CLASSNAME) THEN
++ IF (RAMACLASSNAMES(COUNT).EQ.CLASNAME) THEN
+ RAMAMODE = UPDATE
+ CURRAMACLASS = COUNT
+ END IF
+@@ -1525,7 +1525,7 @@ C
+ END IF
+ NRAMACLASSES = NRAMACLASSES + 1
+ CURRAMACLASS = NRAMACLASSES
+- RAMACLASSNAMES(CURRAMACLASS) = CLASSNAME
++ RAMACLASSNAMES(CURRAMACLASS) = CLASNAME
+ END IF
+ C
+ C set force constant for current class,
+@@ -1954,18 +1954,18 @@ C
+ & HEAP(RAMAATOMPTR), 0)
+ ELSE IF (WD(1:4).EQ.'CLAS') THEN
+ CALL NEXTWD('Class name>')
+- CLASSINDEX = 0
++ CLASINDEX = 0
+ DO COUNT = 1, NRAMACLASSES
+- IF (RAMACLASSNAMES(COUNT).EQ.CLASSNAME)
+- & CLASSINDEX = COUNT
++ IF (RAMACLASSNAMES(COUNT).EQ.CLASNAME)
++ & CLASINDEX = COUNT
+ END DO
+- IF (CLASSINDEX.EQ.0) THEN
++ IF (CLASINDEX.EQ.0) THEN
+ CALL DSPERR('RAMA',
+ & 'unknown class. Using first.')
+- CLASSINDEX = 1
++ CLASINDEX = 1
+ END IF
+ CALL PRINTRAMAS(CUTOFF, HEAP(CALCRAMAPTR),
+- & HEAP(RAMAATOMPTR), CLASSINDEX)
++ & HEAP(RAMAATOMPTR), CLASINDEX)
+ ELSE
+ CALL DSPERR('RAMA',
+ & 'Expected ALL or CLASs.')
diff --git a/sci-chemistry/cns/files/1.2.1-parallel.patch b/sci-chemistry/cns/files/1.2.1-parallel.patch
new file mode 100644
index 000000000000..dfaa40021d66
--- /dev/null
+++ b/sci-chemistry/cns/files/1.2.1-parallel.patch
@@ -0,0 +1,17 @@
+diff --git a/instlib/source/Makefile.proto b/instlib/source/Makefile.proto
+index 0d0dd3e..ae9e422 100644
+--- a/instlib/source/Makefile.proto
++++ b/instlib/source/Makefile.proto
+@@ -19,9 +19,9 @@ DEPENDS = $(OBJS) dmemory.o machine_c.o
+
+ # the default is to make the cns executable
+ cns_solve:
+- @ make -k printflags F77BUG="$(debug)" DEBUG="$(debug)"
+- @ make -k ../bin/cns_solve F77BUG="$(debug)" DEBUG="$(debug)"
+- @ make -k exepurge
++ @ make printflags F77BUG="$(debug)" DEBUG="$(debug)"
++ @ make ${MAKEOPTS} ../bin/cns_solve F77BUG="$(debug)" DEBUG="$(debug)"
++ @ make exepurge
+
+ # rule for the fortran routines
+ $(OBJS):
diff --git a/sci-chemistry/cns/files/1.3_p7-delete.patch b/sci-chemistry/cns/files/1.3_p7-delete.patch
new file mode 100644
index 000000000000..cbddf4289158
--- /dev/null
+++ b/sci-chemistry/cns/files/1.3_p7-delete.patch
@@ -0,0 +1,13 @@
+diff --git a/utils/cluster_struc.cpp b/utils/cluster_struc.cpp
+index b64467a..5f727db 100644
+--- a/utils/cluster_struc.cpp
++++ b/utils/cluster_struc.cpp
+@@ -173,7 +173,7 @@ int main(int argc, char *argv[]) {
+ for (int i = 0; i < nrstruc; i++) {
+ delete[] neighbor[i];
+ }
+- delete[] neighbor, neighborcount;
++ delete[] neighbor, delete[] neighborcount;
+ return 5;
+ }
+ if (rmsd < cutoff) {
diff --git a/sci-chemistry/cns/files/1.3_p7-gentoo.patch b/sci-chemistry/cns/files/1.3_p7-gentoo.patch
new file mode 100644
index 000000000000..7942c55abfb9
--- /dev/null
+++ b/sci-chemistry/cns/files/1.3_p7-gentoo.patch
@@ -0,0 +1,80 @@
+diff --git a/instlib/source/Makefile.proto b/instlib/source/Makefile.proto
+index 0d0dd3e..dd4b680 100644
+--- a/instlib/source/Makefile.proto
++++ b/instlib/source/Makefile.proto
+@@ -11,6 +11,8 @@
+
+ SHELL=/bin/sh
+
++cns_string=`date "+%y%m%d%H%M"`
++
+ # commands
+ RM = /bin/rm
+
+@@ -19,32 +21,26 @@ DEPENDS = $(OBJS) dmemory.o machine_c.o
+
+ # the default is to make the cns executable
+ cns_solve:
+- @ make -k printflags F77BUG="$(debug)" DEBUG="$(debug)"
+- @ make -k ../bin/cns_solve F77BUG="$(debug)" DEBUG="$(debug)"
+- @ make -k exepurge
++ @ make printflags F77BUG="$(debug)" DEBUG="$(debug)"
++ @ make ${MAKEOPTS} ../bin/cns_solve F77BUG="$(debug)" DEBUG="$(debug)"
++ @ make exepurge
+
+ # 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); \
+ 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; \
+diff --git a/instlib/utils/Makefile b/instlib/utils/Makefile
+index 98de84f..4f32b34 100644
+--- a/instlib/utils/Makefile
++++ b/instlib/utils/Makefile
+@@ -22,17 +22,17 @@ utils:
+ 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)
+
+ .cpp:
+- $(CPP) -o $@ $(CCFLAGS) $(@).cpp $(CCLINK)
++ $(CXX) $(LDFLAGS) -o $@ $(CXXFLAGS) $(@).cpp $(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`
diff --git a/sci-chemistry/cns/files/cns_solve_env_sh b/sci-chemistry/cns/files/cns_solve_env_sh
new file mode 100644
index 000000000000..34e1a2b635cf
--- /dev/null
+++ b/sci-chemistry/cns/files/cns_solve_env_sh
@@ -0,0 +1,221 @@
+#!/bin/sh
+#
+# This file sets up the appropriate environmental variables and paths
+# for CNSsolve. In the case of the same machines with different versions
+# of the OS, backward compatibility is assumed - ie. a later version will
+# be setup for a previous version of the OS if nothing else is available.
+#
+# written by: Paul Adams
+#
+# copyright Yale University
+#
+# ==========================================================================
+#
+# >>>>>> Important: define the location of the CNSsolve directory <<<<<<
+#
+# CHANGE THE NEXT LINE TO POINT TO THE LOCATION OF THE CNSsolve DIRECTORY
+
+ CNS_SOLVE=_CNSsolve_location_
+
+#
+# ==========================================================================
+#
+# full expansion of the CNS_SOLVE variable prior to use.
+#
+export CNS_SOLVE; CNS_SOLVE=$CNS_SOLVE
+#
+# ==========================================================================
+#
+# set the number of threads for SGI multiprocessors
+# if this causes a problem on other systems it can be commented out
+#
+export MP_SET_NUMTHREADS; MP_SET_NUMTHREADS=1
+#
+# ==========================================================================
+#
+# get the machine architecture
+#
+if [ -d $CNS_SOLVE ]; then
+ if [ ! "$CNS_ARCH" ]; then
+ export CNS_ARCH; CNS_ARCH=`$CNS_SOLVE/bin/getarch`
+ fi
+else
+ export CNS_ARCH; CNS_ARCH='unknown'
+fi
+#
+# system variables (this is needed for openmp)
+#
+ulimit -s unlimited
+# ==========================================================================
+#
+# general environmental variables
+#
+export CNS_LIB; CNS_LIB=$CNS_SOLVE/libraries
+export CNS_MODULE; CNS_MODULE=$CNS_SOLVE/modules
+export CNS_TOPPAR; CNS_TOPPAR=$CNS_LIB/toppar
+export CNS_CONFDB; CNS_CONFDB=$CNS_LIB/confdb
+export CNS_XTALLIB; CNS_XTALLIB=$CNS_LIB/xtal
+export CNS_NMRLIB; CNS_NMRLIB=$CNS_LIB/nmr
+export CNS_XRAYLIB; CNS_XRAYLIB=$CNS_LIB/xray
+export CNS_XTALMODULE; CNS_XTALMODULE=$CNS_MODULE/xtal
+export CNS_NMRMODULE; CNS_NMRMODULE=$CNS_MODULE/nmr
+export CNS_HELPLIB; CNS_HELPLIB=$CNS_SOLVE/helplib
+#
+# general user aliases
+#
+cns_web () { $CNS_SOLVE/bin/cns_web; }
+cns_header () { $CNS_SOLVE/bin/cns_header; }
+cns_info () { cat $CNS_SOLVE/bin/cns_info; }
+cns_transfer () { $CNS_SOLVE/bin/cns_transfer; }
+if [ -x $CNS_SOLVE/bin/cns_edit_local ]; then
+ cns_edit () { $CNS_SOLVE/bin/cns_edit_local; }
+else
+ cns_edit () { $CNS_SOLVE/bin/cns_edit; }
+fi
+run_tutorial () { "csh -f tutorial.csh"; }
+#
+# g77 compilation and use
+#
+g77on () { CNS_G77=ON; . $CNS_SOLVE/.cns_solve_env_sh; }
+g77off () { unset CNS_G77; . $CNS_SOLVE/.cns_solve_env_sh; }
+#
+# developer aliases
+#
+run_tests () { $CNS_SOLVE/bin/run_tests; }
+run_diffs () { $CNS_SOLVE/bin/run_diffs; }
+maketar () { $CNS_SOLVE/bin/maketar; }
+create_patch () { $CNS_SOLVE/bin/create_patch; }
+#
+#
+# ==========================================================================
+#
+# to do expansions - unset noglob just in case user has it otherwise
+#
+set +f
+#
+# try to set up appropriate path
+#
+# first strip off any trailing information (eg. _g77)
+#
+CNS_ARCH=`echo ${CNS_ARCH} | sed -e 's/_g77//g'`
+#
+cns_vendor=`echo $CNS_ARCH | awk 'BEGIN{FS="-"}{print $1}'`
+cns_cpu=`echo $CNS_ARCH | awk 'BEGIN{FS="-"}{print $2}'`
+cns_os=`echo $CNS_ARCH | awk 'BEGIN{FS="-"}{print $3}'`
+cns_major=`echo $CNS_ARCH | awk 'BEGIN{FS="-"}{print $4}'`
+cns_minor=`echo $cns_major | sed -e 's/\./ /g'`
+#
+# if we are looking for a specific type of setup then limit search
+#
+cns_dirs=""
+if [ ! "$CNS_G77" ]; then
+ if /bin/ls -d $CNS_SOLVE/$cns_vendor-* >/dev/null 2>&1 ; then
+ cns_dirs="`/bin/ls -d $CNS_SOLVE/$cns_vendor-* 2>&1 | awk 'BEGIN{FS="/"}{print $NF}' | sort -t\- -n -r -k 3 -k 4`"
+ fi
+else
+ CNS_ARCH="${CNS_ARCH}_g77"
+ if /bin/ls -d $CNS_SOLVE/$cns_vendor-*_g77 >/dev/null 2>&1 ; then
+ cns_dirs="`/bin/ls -d $CNS_SOLVE/$cns_vendor-*_g77 2>&1 | awk 'BEGIN{FS="/"}{print $NF}' | sort -t\- -n -r -k 3 -k 4`"
+ fi
+fi
+#
+# first look for an exact match (with os version)
+#
+#
+cns_found=0
+if [ -n "$cns_dirs" ]; then
+ for cns_dir in $cns_dirs ; do
+ cns_tmp_major=`echo $cns_dir | awk 'BEGIN{FS="-"}{print $4}'`
+ if [ -f $CNS_SOLVE/$cns_dir/bin/cns_solve ]; then
+ if [ $cns_dir = ${cns_vendor}-${cns_cpu}-${cns_os}-${cns_major} -o \
+ $cns_dir = ${cns_vendor}-${cns_cpu}-${cns_os}-${cns_major}_g77 ]; then
+ cns_archenv=$cns_dir
+ cns_found=1
+ fi
+ fi
+ done
+#
+#
+# now look for an exact match (without os version)
+#
+ if [ $cns_found -eq 0 ]; then
+ for cns_dir in $cns_dirs ; do
+ if [ -f $CNS_SOLVE/$cns_dir/bin/cns_solve ]; then
+ if [ $cns_dir = ${cns_vendor}-${cns_cpu}-${cns_os} -o \
+ $cns_dir = ${cns_vendor}-${cns_cpu}-${cns_os}_g77 ]; then
+ cns_archenv=$cns_dir
+ cns_found=1
+ fi
+ fi
+ done
+ fi
+#
+# now look for a backwards compatible match (with os version major/minor)
+#
+ if [ $cns_found -eq 0 ]; then
+ for cns_dir in $cns_dirs ; do
+ if [ $cns_found -eq 0 ]; then
+ cns_tmp_major=`echo $cns_dir | awk 'BEGIN{FS="-"}{print $4}' | sed 's/_g77//g'`
+ if [ -f $CNS_SOLVE/$cns_dir/bin/cns_solve ]; then
+ if [ $cns_dir = ${cns_vendor}-${cns_cpu}-${cns_os}-* ]; then
+ osv_test=`echo $cns_major $cns_tmp_major | awk '{if ($1 > $2) print 1}'`
+ if [ $osv_test -eq 1 ]; then
+ cns_archenv=$cns_dir
+ cns_found=1
+ fi
+ fi
+ fi
+ fi
+ done
+ fi
+#
+# now look for a wildcard match on cpu
+#
+ if [ $cns_found -eq 0 ]; then
+ cpu_cpu=`echo $cns_cpu | sed 's/[0-9]*\.*[0-9]*$//'`
+ cpu_ver=`echo $cns_cpu | sed 's/[A-Za-z]*//'`
+ for cns_dir in $cns_dirs ; do
+ if [ $cns_found -eq 0 ]; then
+ cns_tmp_cpu=`echo $cns_dir | awk 'BEGIN{FS="-"}{print $2}' | sed 's/[0-9]*\.*[0-9]*$//'`
+ cns_tmp_ver=`echo $cns_dir | awk 'BEGIN{FS="-"}{print $2}' | sed 's/[A-Za-z]*//'`
+ if [ -f $CNS_SOLVE/$cns_dir/bin/cns_solve ]; then
+ if [ $cns_dir = ${cns_vendor}-${cpu_cpu}*-${cns_os}-${cns_major} -o \
+ $cns_dir = ${cns_vendor}-${cpu_cpu}*-${cns_os}-${cns_major}_g77 ]; then
+ cpu_test=`echo $cpu_ver $cns_tmp_ver | awk '{if ($1 > $2) print 1}'`
+ if [ $cpu_test -eq 1 ]; then
+ cns_archenv=$cns_dir
+ cns_found=1
+ fi
+ fi
+ fi
+ fi
+ done
+ fi
+fi
+#
+# if found set environment
+#
+if [ $cns_found -eq 1 ]; then
+ #
+ # set installation and source directory
+ #
+ export CNS_INST; CNS_INST=$CNS_SOLVE/$cns_archenv
+ export CNS_SOURCE; CNS_SOURCE=$CNS_INST/source
+ #
+ # path for CNSsolve utility programs
+ #
+ if [ -d $CNS_SOLVE/$cns_archenv/utils ]; then
+ export PATH; PATH=`$CNS_SOLVE/bin/modify_path -sh $CNS_SOLVE/$cns_archenv/utils`
+ fi
+ #
+ # path for CNSsolve executable if installed
+ #
+ if [ -d $CNS_SOLVE/$cns_archenv/bin ]; then
+ export PATH; PATH=`$CNS_SOLVE/bin/modify_path -sh $CNS_SOLVE/$cns_archenv/bin`
+ fi
+fi
+#
+unset cns_vendor cns_cpu cns_os cns_major cns_minor cns_tmp_major cns_tmp_minor
+unset cns_dir cns_dirs cns_found cns_archenv cns_diff cns_count cns_same
+unset cpu_cpu cpu_ver cns_tmp_cpu cns_tmp_ver cpu_test osv_test
+#
diff --git a/sci-chemistry/cns/files/cns_solve_env_sh-1.3_p7 b/sci-chemistry/cns/files/cns_solve_env_sh-1.3_p7
new file mode 100644
index 000000000000..12368f87b596
--- /dev/null
+++ b/sci-chemistry/cns/files/cns_solve_env_sh-1.3_p7
@@ -0,0 +1,229 @@
+#!/bin/sh
+#
+# This file sets up the appropriate environmental variables and paths
+# for CNSsolve. In the case of the same machines with different versions
+# of the OS, backward compatibility is assumed - ie. a later version will
+# be setup for a previous version of the OS if nothing else is available.
+#
+# written by: Paul Adams
+#
+# copyright Yale University
+#
+# ==========================================================================
+#
+# >>>>>> Important: define the location of the CNSsolve directory <<<<<<
+#
+# CHANGE THE NEXT LINE TO POINT TO THE LOCATION OF THE CNSsolve DIRECTORY
+
+ CNS_SOLVE=_CNSsolve_location_
+
+#
+# ==========================================================================
+#
+# full expansion of the CNS_SOLVE variable prior to use.
+#
+export CNS_SOLVE; CNS_SOLVE=$CNS_SOLVE
+#
+# ==========================================================================
+#
+# get the machine architecture
+#
+if [ -d $CNS_SOLVE ]; then
+ if [ ! "$CNS_ARCH" ]; then
+ export CNS_ARCH; CNS_ARCH=`$CNS_SOLVE/bin/getarch`
+ fi
+else
+ export CNS_ARCH; CNS_ARCH='unknown'
+fi
+#
+# ==========================================================================
+#
+# system variables for OpenMP
+#
+# The default stack sizes are usually insufficient, especially when
+# CNS is compiled using OpenMP. If the stack sizes are too
+# small segfaults may occur. Recommended setting for "stacksize":
+limit stacksize unlimited
+#
+# KMP_STACKSIZE is specific for Intel ifort, icc:
+##setenv KMP_STACKSIZE 256m
+#
+# OMP_STACKSIZE is used by all compilers:
+setenv OMP_STACKSIZE 256m
+#
+# Uncomment the following line and change as appropriate to set the number
+# of processors (threads) to use.
+###setenv OMP_NUM_THREADS 4
+#
+# ==========================================================================
+#
+# general environmental variables
+#
+export CNS_LIB; CNS_LIB=$CNS_SOLVE/libraries
+export CNS_MODULE; CNS_MODULE=$CNS_SOLVE/modules
+export CNS_TOPPAR; CNS_TOPPAR=$CNS_LIB/toppar
+export CNS_CONFDB; CNS_CONFDB=$CNS_LIB/confdb
+export CNS_XTALLIB; CNS_XTALLIB=$CNS_LIB/xtal
+export CNS_NMRLIB; CNS_NMRLIB=$CNS_LIB/nmr
+export CNS_XRAYLIB; CNS_XRAYLIB=$CNS_LIB/xray
+export CNS_XTALMODULE; CNS_XTALMODULE=$CNS_MODULE/xtal
+export CNS_NMRMODULE; CNS_NMRMODULE=$CNS_MODULE/nmr
+export CNS_HELPLIB; CNS_HELPLIB=$CNS_SOLVE/helplib
+#
+# general user aliases
+#
+cns_web () { $CNS_SOLVE/bin/cns_web; }
+cns_header () { $CNS_SOLVE/bin/cns_header; }
+cns_info () { cat $CNS_SOLVE/bin/cns_info; }
+cns_transfer () { $CNS_SOLVE/bin/cns_transfer; }
+if [ -x $CNS_SOLVE/bin/cns_edit_local ]; then
+ cns_edit () { $CNS_SOLVE/bin/cns_edit_local; }
+else
+ cns_edit () { $CNS_SOLVE/bin/cns_edit; }
+fi
+#
+# g77 compilation and use
+#
+g77on () { CNS_G77=ON; . $CNS_SOLVE/.cns_solve_env_sh; }
+g77off () { unset CNS_G77; . $CNS_SOLVE/.cns_solve_env_sh; }
+#
+# developer aliases
+#
+run_tests () { $CNS_SOLVE/bin/run_tests; }
+run_diffs () { $CNS_SOLVE/bin/run_diffs; }
+maketar () { $CNS_SOLVE/bin/maketar; }
+create_patch () { $CNS_SOLVE/bin/create_patch; }
+#
+#
+# ==========================================================================
+#
+# to do expansions - unset noglob just in case user has it otherwise
+#
+set +f
+#
+# try to set up appropriate path
+#
+# first strip off any trailing information (eg. _g77)
+#
+CNS_ARCH=`echo ${CNS_ARCH} | sed -e 's/_g77//g'`
+#
+cns_vendor=`echo $CNS_ARCH | awk 'BEGIN{FS="-"}{print $1}'`
+cns_cpu=`echo $CNS_ARCH | awk 'BEGIN{FS="-"}{print $2}'`
+cns_os=`echo $CNS_ARCH | awk 'BEGIN{FS="-"}{print $3}'`
+cns_major=`echo $CNS_ARCH | awk 'BEGIN{FS="-"}{print $4}'`
+cns_minor=`echo $cns_major | sed -e 's/\./ /g'`
+#
+# if we are looking for a specific type of setup then limit search
+#
+cns_dirs=""
+if [ ! "$CNS_G77" ]; then
+ if /bin/ls -d $CNS_SOLVE/$cns_vendor-* >/dev/null 2>&1 ; then
+ cns_dirs="`/bin/ls -d $CNS_SOLVE/$cns_vendor-* 2>&1 | awk 'BEGIN{FS="/"}{print $NF}' | sort -t\- -n -r -k 3 -k 4`"
+ fi
+else
+ CNS_ARCH="${CNS_ARCH}_g77"
+ if /bin/ls -d $CNS_SOLVE/$cns_vendor-*_g77 >/dev/null 2>&1 ; then
+ cns_dirs="`/bin/ls -d $CNS_SOLVE/$cns_vendor-*_g77 2>&1 | awk 'BEGIN{FS="/"}{print $NF}' | sort -t\- -n -r -k 3 -k 4`"
+ fi
+fi
+#
+# first look for an exact match (with os version)
+#
+#
+cns_found=0
+if [ -n "$cns_dirs" ]; then
+ for cns_dir in $cns_dirs ; do
+ cns_tmp_major=`echo $cns_dir | awk 'BEGIN{FS="-"}{print $4}'`
+ if [ -f $CNS_SOLVE/$cns_dir/bin/cns_solve ]; then
+ if [ $cns_dir = ${cns_vendor}-${cns_cpu}-${cns_os}-${cns_major} -o \
+ $cns_dir = ${cns_vendor}-${cns_cpu}-${cns_os}-${cns_major}_g77 ]; then
+ cns_archenv=$cns_dir
+ cns_found=1
+ fi
+ fi
+ done
+#
+#
+# now look for an exact match (without os version)
+#
+ if [ $cns_found -eq 0 ]; then
+ for cns_dir in $cns_dirs ; do
+ if [ -f $CNS_SOLVE/$cns_dir/bin/cns_solve ]; then
+ if [ $cns_dir = ${cns_vendor}-${cns_cpu}-${cns_os} -o \
+ $cns_dir = ${cns_vendor}-${cns_cpu}-${cns_os}_g77 ]; then
+ cns_archenv=$cns_dir
+ cns_found=1
+ fi
+ fi
+ done
+ fi
+#
+# now look for a backwards compatible match (with os version major/minor)
+#
+ if [ $cns_found -eq 0 ]; then
+ for cns_dir in $cns_dirs ; do
+ if [ $cns_found -eq 0 ]; then
+ cns_tmp_major=`echo $cns_dir | awk 'BEGIN{FS="-"}{print $4}' | sed 's/_g77//g'`
+ if [ -f $CNS_SOLVE/$cns_dir/bin/cns_solve ]; then
+ if [ $cns_dir = ${cns_vendor}-${cns_cpu}-${cns_os}-* ]; then
+ osv_test=`echo $cns_major $cns_tmp_major | awk '{if ($1 > $2) print 1}'`
+ if [ $osv_test -eq 1 ]; then
+ cns_archenv=$cns_dir
+ cns_found=1
+ fi
+ fi
+ fi
+ fi
+ done
+ fi
+#
+# now look for a wildcard match on cpu
+#
+ if [ $cns_found -eq 0 ]; then
+ cpu_cpu=`echo $cns_cpu | sed 's/[0-9]*\.*[0-9]*$//'`
+ cpu_ver=`echo $cns_cpu | sed 's/[A-Za-z]*//'`
+ for cns_dir in $cns_dirs ; do
+ if [ $cns_found -eq 0 ]; then
+ cns_tmp_cpu=`echo $cns_dir | awk 'BEGIN{FS="-"}{print $2}' | sed 's/[0-9]*\.*[0-9]*$//'`
+ cns_tmp_ver=`echo $cns_dir | awk 'BEGIN{FS="-"}{print $2}' | sed 's/[A-Za-z]*//'`
+ if [ -f $CNS_SOLVE/$cns_dir/bin/cns_solve ]; then
+ if [ $cns_dir = ${cns_vendor}-${cpu_cpu}*-${cns_os}-${cns_major} -o \
+ $cns_dir = ${cns_vendor}-${cpu_cpu}*-${cns_os}-${cns_major}_g77 ]; then
+ cpu_test=`echo $cpu_ver $cns_tmp_ver | awk '{if ($1 > $2) print 1}'`
+ if [ $cpu_test -eq 1 ]; then
+ cns_archenv=$cns_dir
+ cns_found=1
+ fi
+ fi
+ fi
+ fi
+ done
+ fi
+fi
+#
+# if found set environment
+#
+if [ $cns_found -eq 1 ]; then
+ #
+ # set installation and source directory
+ #
+ export CNS_INST; CNS_INST=$CNS_SOLVE/$cns_archenv
+ export CNS_SOURCE; CNS_SOURCE=$CNS_INST/source
+ #
+ # path for CNSsolve utility programs
+ #
+ if [ -d $CNS_SOLVE/$cns_archenv/utils ]; then
+ export PATH; PATH=`$CNS_SOLVE/bin/modify_path -sh $CNS_SOLVE/$cns_archenv/utils`
+ fi
+ #
+ # path for CNSsolve executable if installed
+ #
+ if [ -d $CNS_SOLVE/$cns_archenv/bin ]; then
+ export PATH; PATH=`$CNS_SOLVE/bin/modify_path -sh $CNS_SOLVE/$cns_archenv/bin`
+ fi
+fi
+#
+unset cns_vendor cns_cpu cns_os cns_major cns_minor cns_tmp_major cns_tmp_minor
+unset cns_dir cns_dirs cns_found cns_archenv cns_diff cns_count cns_same
+unset cpu_cpu cpu_ver cns_tmp_cpu cns_tmp_ver cpu_test osv_test
+#
diff --git a/sci-chemistry/cns/metadata.xml b/sci-chemistry/cns/metadata.xml
new file mode 100644
index 000000000000..a9cb92ec3f79
--- /dev/null
+++ b/sci-chemistry/cns/metadata.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-chemistry</herd>
+ <maintainer>
+ <email>jlec@gentoo.org</email>
+ </maintainer>
+ <use>
+ <flag name="aria"> Support patch for sci-chemistry/aria</flag>
+ </use>
+ <longdescription>
+Crystallography and NMR System (CNS) is the result of an international
+collaborative effort among several research groups. The program has
+been designed to provide a flexible multi-level hierachical approach for the
+most commonly used algorithms in macromolecular structure determination.
+Highlights include heavy atom searching, experimental phasing (including
+MAD and MIR), density modification, crystallographic refinement with maximum
+likelihood targets, and NMR structure calculation using NOEs, J-coupling,
+chemical shift, and dipolar coupling data.
+</longdescription>
+</pkgmetadata>