openfoam-2.2.1.ebuild 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. # Copyright 1999-2014 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  4. inherit eutils versionator multilib toolchain-funcs multiprocessing
  5. MY_PN="OpenFOAM"
  6. MY_PV=$(get_version_component_range 1-2)
  7. MY_P="${MY_PN}-${PV}"
  8. DESCRIPTION="Open Field Operation and Manipulation - CFD Simulation Toolbox"
  9. HOMEPAGE="http://www.openfoam.org"
  10. SRC_URI="http://downloads.sourceforge.net/foam/${MY_P}.tgz"
  11. LICENSE="GPL-2"
  12. SLOT="2.2"
  13. KEYWORDS="~amd64 ~x86"
  14. IUSE="doc examples opendx src"
  15. RDEPEND="!=sci-libs/openfoam-bin-${MY_PV}*
  16. !=sci-libs/openfoam-kernel-${MY_PV}*
  17. !=sci-libs/openfoam-meta-${MY_PV}*
  18. !=sci-libs/openfoam-solvers-${MY_PV}*
  19. !=sci-libs/openfoam-utilities-${MY_PV}*
  20. !=sci-libs/openfoam-wmake-${MY_PV}*
  21. sci-libs/parmetis
  22. sci-libs/parmgridgen
  23. sci-libs/scotch
  24. virtual/mpi
  25. opendx? ( sci-visualization/opendx )"
  26. DEPEND="${DEPEND}
  27. doc? ( app-doc/doxygen[dot] )"
  28. S=${WORKDIR}/${MY_P}
  29. INSDIR="/usr/$(get_libdir)/${MY_PN}/${MY_P}"
  30. pkg_setup() {
  31. # just to be sure the right profile is selected (gcc-config)
  32. if ! version_is_at_least 4.3 $(gcc-version) ; then
  33. die "${PN} requires >=sys-devel/gcc-4.3 to compile."
  34. fi
  35. elog
  36. elog "In order to use ${MY_PN} you should add the following line to ~/.bashrc :"
  37. elog
  38. elog "alias startOF$(delete_all_version_separators ${MY_PV})='source ${INSDIR}/etc/bashrc'"
  39. elog
  40. elog "And everytime you want to use OpenFOAM you have to execute startOF$(delete_all_version_separators ${MY_PV})"
  41. ewarn
  42. ewarn "FoamX is deprecated since ${MY_PN}-1.5! "
  43. ewarn
  44. }
  45. src_configure() {
  46. if has_version sys-cluster/mpich2 ; then
  47. export WM_MPLIB=MPICH
  48. elif has_version sys-cluster/openmpi ; then
  49. export WM_MPLIB=OPENMPI
  50. else
  51. die "You need one of the following mpi implementations: openmpi or mpich2"
  52. fi
  53. sed -i -e "s|WM_MPLIB:=OPENMPI|WM_MPLIB:="${WM_MPLIB}"|" etc/bashrc
  54. sed -i -e "s|setenv WM_MPLIB OPENMPI|setenv WM_MPLIB "${WM_MPLIB}"|" etc/cshrc
  55. sed -i -e "s|^foamInstall=\$HOME|foamInstall=/usr/$(get_libdir)|" etc/bashrc
  56. sed -i -e "s|^set foamInstall = \$HOME|set foamInstall = /usr/$(get_libdir)|" etc/cshrc
  57. }
  58. src_compile() {
  59. export WM_NCOMPPROCS=$(makeopts_jobs)
  60. export FOAM_INST_DIR=${WORKDIR}
  61. source etc/bashrc
  62. find wmake -name dirToString -exec rm -rf {} +
  63. find wmake -name wmkdep -exec rm -rf {}+
  64. if use doc ; then
  65. ./Allwmake doc || die "could not build"
  66. else
  67. ./Allwmake || die "could not build"
  68. fi
  69. }
  70. src_test() {
  71. cd bin
  72. ./foamInstallationTest
  73. }
  74. src_install() {
  75. insinto ${INSDIR}
  76. doins -r etc
  77. use examples && doins -r tutorials
  78. use src && doins -r src
  79. insopts -m0755
  80. doins -r bin applications platforms wmake
  81. dodoc README.html doc/Guides-a4/*.pdf
  82. if use doc ; then
  83. dohtml -r doc/Doxygen
  84. fi
  85. }