summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sci-chemistry/cns')
-rw-r--r--sci-chemistry/cns/ChangeLog11
-rw-r--r--sci-chemistry/cns/Manifest28
-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/metadata.xml14
5 files changed, 485 insertions, 17 deletions
diff --git a/sci-chemistry/cns/ChangeLog b/sci-chemistry/cns/ChangeLog
index 2c39184beac2..8709f966b04f 100644
--- a/sci-chemistry/cns/ChangeLog
+++ b/sci-chemistry/cns/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for sci-chemistry/cns
-# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sci-chemistry/cns/ChangeLog,v 1.53 2012/11/27 13:17:37 jlec Exp $
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sci-chemistry/cns/ChangeLog,v 1.54 2013/10/09 14:33:46 jlec Exp $
+
+*cns-1.3_p7-r1 (09 Oct 2013)
+*cns-1.2.1-r8 (09 Oct 2013)
+
+ 09 Oct 2013; Justin Lecher <jlec@gentoo.org> +cns-1.2.1-r8.ebuild,
+ +cns-1.3_p7-r1.ebuild, metadata.xml:
+ Bump EAPI
27 Nov 2012; Justin Lecher <jlec@gentoo.org> cns-1.2.1-r7.ebuild,
cns-1.3_p7.ebuild:
diff --git a/sci-chemistry/cns/Manifest b/sci-chemistry/cns/Manifest
index 962ab9febd67..3fa1ead79d83 100644
--- a/sci-chemistry/cns/Manifest
+++ b/sci-chemistry/cns/Manifest
@@ -1,5 +1,5 @@
-----BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA256
+Hash: SHA512
AUX 1.2.1-allow-gcc-openmp.patch 926 SHA256 8c650b36ef731f7b799397ac9f6abfe9cdf46508df930e7bd3a0f2a0dc2e2275 SHA512 cdaae39096625ff1b84ec76b36d2ec3f2e4e4e532d347fa3f0d3e0aa239e2477301de6c768f14788a9b599694568422009bc1c0298ad677cab28d463e0ea8524 WHIRLPOOL 56af947ac685adb889796416870a365abb4be702b77ca4acf695fc2578e8e876e778376518854fb14e7a2349439fd144def300fe0d45b0fa5f90e4a3b6cdec95
AUX 1.2.1-aria2.3.patch 658 SHA256 c393799beabda5f61a7dcad9aaa4d211c14eb17b1ffd5200c3306c7ef71d19f3 SHA512 54758723bc4900673dff73e3aa4d9ead803c44ee3af514259b21c73f7495aaa077e29efe381e674d2a6c5c8d888d7c9cf4d4a998b6c4b6d91de488dc4526f7e4 WHIRLPOOL 440bc5066864e90211ea2d8faa8f9758a5472108ad7e33a3157a84d62bf5d3f61af743198205669e520e98aee6d11c720660bf8e088d6c4251cfce6fb230ce90
@@ -13,15 +13,27 @@ AUX cns_solve_env_sh-1.3_p7 7332 SHA256 88127d99380544e502dfe3b3a7788102a7f6b30e
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 61789401 SHA256 b7573148d5718c617dfba2c2684a7b28c176893e033aadef0926a381c61f2c7a SHA512 4b04e42c4bad5e2b5e74cf0089697283f319bfb9a43a485e6374420609c9ae41362c513e821d10253913934a425d8f7b067194f957c78632781c65d786ea6d1a WHIRLPOOL 5640df95263d40964bfbb87e05cfe5b957d056659ea0aa0ee8c5c284d1b97763355b73205b3b28850ed95bcebe78a85281b7295c7fbacc66a0abe31f023c63cc
+DIST cns_solve_1.3_all.tar.gz 64167735 SHA256 2ee368022c5ecabf66ce7d32059d93cd7d885ad2d684a094b87c64f6b3dfea0d SHA512 4fe73820e96999bb33a59ff6da979794628552f49bc03cdebcb9439b57e6042b92190e04bb7e4079157adf06a6facc5c16b8ae91621bd24a4b35ee382e53ae37 WHIRLPOOL b3cd14ab7a8a29a44f6e6c3cbc22ee2c665eb8c8565969337b24deffb2a1fd007fae11c5eb73ac38ddf9a38e850948e3b2df2548931722a2a383d5e8c72607a1
EBUILD cns-1.2.1-r7.ebuild 6839 SHA256 222d9d7039c07fa2288982f61314088bd5278b6d3ad2c6f6168c7490b8f2dd10 SHA512 1c260b28b1179cd509584139855085d95020b332809c4dee4b7d53d41b526ff5eb8a8e9a9b14dfbfbaa8eb85f056c137e7b85581a3212d4ebf6a64c1e89d066b WHIRLPOOL 3b7e5b12fabe172dcdfb1b0a09524ad1c1d259d345de15fcee729758d4af6280a68d0ea0c87c5eccc490f0478c00a0fed947d2108058b0711fcf834962b861f4
+EBUILD cns-1.2.1-r8.ebuild 6696 SHA256 31d94704612bfd8f1860a54b6f86f4773770846e219bd56790f048fcdab2dfea SHA512 06323b90c716dce4684ecb677189731e3caa8684034f62ca2863b6b2ccf9f6aab6bbd62015746952a9c1046e16761654c71f9d9e13f82490c9900a23660b0eff WHIRLPOOL c1a20ccdf00c691cb77d83d80897747cc8b8904a7acf95a029f1410f9535ad1020d3ba3e1a18cee624c6fbcce411c488c975772f34835aa67846484c715d40af
+EBUILD cns-1.3_p7-r1.ebuild 5921 SHA256 d6931d304e290cc5179c0cc7ceee2ffc544f6241f0a7b9d06adcc8d495cd0536 SHA512 27dbfa050c2c9971920e4aecec971d6f8dc6c014d7bc21031b18a8e2aec2f17f7b1ed9e566c12626d3ef247f4d02bc9320bbc3f99f4cd06b08713eaf5f2923cd WHIRLPOOL aaa9dee47a5af62f0dca0effd824578730ba03632ba96a6f69040a9a68efd558b06ba29485d767289e803635e8b019046368f03d0248c730aa02dff75f2f0717
EBUILD cns-1.3_p7.ebuild 6074 SHA256 e03acde82b5e79f09b83dbd532ece05282646f27e350b1eb2aab03173568b012 SHA512 69c118f7ffc718f56af93ded165fdc8119af82da6bc3659a84e1d8033c00c4a2be1345d261d995e9a75a57d011f9ae87e89ef42288ca5c1a47ac0f38564aafc9 WHIRLPOOL a9dd5f686bcaa2cd0c2cb7ebe177d91dab9c807fa5c10ab666bf93cd5844fb87515ee9eae0622140c62ee8d9ba8a63991f5f24fcfcd003986f68da33445c7338
-MISC ChangeLog 9259 SHA256 d8d79632fd86d6b9f4c4501cd341a9137add03d1aa7389ad3ba39009f492387a SHA512 4b3148546ba3154ef1339efb762cd205aaa8444b3734cd09fe09af1ee14c45d7e051a35829582c14ad7a72b8962ba65e313a3968e05f1c92a973a57fe1808623 WHIRLPOOL 42bd64255df19205a3428a50c9518563df8016a4136056d6f411daca6f6d3912ddb136513c15c80c788a58f0f490c1276aab114f8978f9bbbaa91ca8d729c069
-MISC metadata.xml 309 SHA256 b324f51d14838e35c102e299cbb7b5c3d777c91ffdbe011fbc085a117226b189 SHA512 e1f0a9275cfcdd6b840ac8d7b39109ce5e8e2eef79acd1648de6b760b1416ac15cf2260bae84d4fbb7d66c37b165d0159c783aed1b408b5d0cc2924a44a196f0 WHIRLPOOL bcec37dc5fcce1aab1e052dbf7ed93f8ab0f7541893ad615774af5e4f2858ad79d09a6579e6afd23505969c4a6f6b26bc95fdb4224e061e0b7794184563b8115
+MISC ChangeLog 9438 SHA256 0ac0da17940ca8a2e21288aa946cddb0758d2f968fc18909e95c618ad21f8f73 SHA512 d896953c84fb166ae7bfdaa7b9475ca8494847578852247932a00fd9f39f6e63e3cbc4a6a24502a8f392d518b103ba2d7d5996520a5eb2ae06b4961139e6687c WHIRLPOOL 16b799d95b5b3dddad96f1d61390f97a72a73d9e5374f4d11aa7c2aa1e131c5d0af9901734ed17c787a6b2a1950c28b89717040b9d6958175f0dfbc9924b75de
+MISC metadata.xml 318 SHA256 c984e77dbbfa53aeb6e9f2daa6f094f62b26a949362036ce6b3397f179a5e9bf SHA512 3d1377c87412734557a940495ca91cd8677363757955b68ab550ce4a27ccb53ec61b55df763f57c04cec99d84af1ed16dd2932b5885099e972240e9b31238bda WHIRLPOOL 625d186f4ce104d14f808d511d5dd61f37aa15914f4ebf65d608cc5ba8c60268822d601497fd97bf8cafbb813af28a9f0d40a40140f6ec6ed872aa40c378f58b
-----BEGIN PGP SIGNATURE-----
-Version: GnuPG v2.0.19 (GNU/Linux)
+Version: GnuPG v2.0.22 (GNU/Linux)
-iEYEAREIAAYFAlC0vXIACgkQgAnW8HDreRZFFQCaA4/6DGXwQU1Mu9lAG75HPGJS
-4dIAoI3XB797jkMnVO8jOQecN+jLk/GN
-=Xlud
+iQIcBAEBCgAGBQJSVWlLAAoJELnU8jG9FVirhr8P/2aNEMZxnbdf+rypfABGz17h
+9D0JgXs1toseDsiDVBQkCoh3BEZRrh/lm7hwZ/GLR75sqjfQmoxn5nnR8hYzA9Zd
+lQTi7SombjH2ea1de/EGQCy50h1kltv61uxexfuAAajrOXTkSrrp3faoltw9Rwz6
+tWZbtlZX4/IB2aUXFe0ASFbEwkdeem1uOfNKJ5DGrKOuLiP2dWZ8fpniqc2etdut
+qAUp43t2x/Orc1VAYRJUPnGZoipvIjnJ7tUgjnaHBvpYFu1wDLb3PJmy4g1j2iXZ
+VldIJ/drAIi5S9kyE5NX8KnLEEs/y7fxZLYU8/gc9L89wXHaRYnJRd1nfrgsDhm3
+Y/mX2TYJScoYXJ8EU3ic3H3O5inqECkKXoOqty+5HQiLtZZxRKMnkBVGvRAUqCE/
+9OBZzaNv2avzt4CLDzTVA6PQjQ7X7NP/qhblSzOtICrBApwkUjXo/fbKl+dZv3KZ
+0mXAMGfK6i/GSuN5jxOpqssmiu7iZ9jjSrHkKi06/z+Vb+O7MjAREm51lccid4z+
+EMgH3KisMI8fhgAalNkKLZ0KQF0voZdjJnB71fO/+R5tOtClBrgthVsEFewzZUM3
+OA0ICtzucrVPIWwn7+qV/6r1shic42tpNKrSu+rm/DBPEpaQczaYsrWF7ycbAADk
+juFZa+SO+UEuKrlgWxQu
+=8aLD
-----END PGP SIGNATURE-----
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..b9d5407b364f
--- /dev/null
+++ b/sci-chemistry/cns/cns-1.2.1-r8.ebuild
@@ -0,0 +1,233 @@
+# Copyright 1999-2013 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-r8.ebuild,v 1.1 2013/10/09 14:33:46 jlec Exp $
+
+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..091b006e58fc
--- /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
+# $Header: /var/cvsroot/gentoo-x86/sci-chemistry/cns/cns-1.3_p7-r1.ebuild,v 1.1 2013/10/09 14:33:46 jlec Exp $
+
+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/metadata.xml b/sci-chemistry/cns/metadata.xml
index 3fbfefd30233..3102a32e4dd1 100644
--- a/sci-chemistry/cns/metadata.xml
+++ b/sci-chemistry/cns/metadata.xml
@@ -1,11 +1,11 @@
<?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>
+ <herd>sci-chemistry</herd>
+ <maintainer>
+ <email>jlec@gentoo.org</email>
+ </maintainer>
+ <use>
+ <flag name="aria"> Support patch for sci-chemistry/aria</flag>
+ </use>
</pkgmetadata>