openfoam-2.3.0-r1.ebuild 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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.3"
  13. KEYWORDS="~amd64 ~x86"
  14. IUSE="doc examples opendx src paraview"
  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. paraview? ( ~sci-visualization/paraview-4.1.0[development] )"
  27. DEPEND="${DEPEND}
  28. doc? ( app-doc/doxygen[dot] )"
  29. S=${WORKDIR}/${MY_P}
  30. INSDIR="/usr/$(get_libdir)/${MY_PN}/${MY_P}"
  31. pkg_setup() {
  32. # just to be sure the right profile is selected (gcc-config)
  33. if ! version_is_at_least 4.3 $(gcc-version) ; then
  34. die "${PN} requires >=sys-devel/gcc-4.3 to compile."
  35. fi
  36. elog
  37. elog "In order to use ${MY_PN} you should add the following line to ~/.bashrc :"
  38. elog
  39. elog "alias startOF$(delete_all_version_separators ${MY_PV})='source ${INSDIR}/etc/bashrc'"
  40. elog
  41. elog "And everytime you want to use OpenFOAM you have to execute startOF$(delete_all_version_separators ${MY_PV})"
  42. ewarn
  43. ewarn "FoamX is deprecated since ${MY_PN}-1.5! "
  44. ewarn
  45. }
  46. src_configure() {
  47. if has_version sys-cluster/mpich2 ; then
  48. export WM_MPLIB=MPICH
  49. elif has_version sys-cluster/openmpi ; then
  50. export WM_MPLIB=OPENMPI
  51. else
  52. die "You need one of the following mpi implementations: openmpi or mpich2"
  53. fi
  54. sed -i -e "s|WM_MPLIB:=OPENMPI|WM_MPLIB:="${WM_MPLIB}"|" etc/bashrc
  55. sed -i -e "s|setenv WM_MPLIB OPENMPI|setenv WM_MPLIB "${WM_MPLIB}"|" etc/cshrc
  56. sed -i -e "s|^foamInstall=\$HOME|foamInstall=/usr/$(get_libdir)|" etc/bashrc
  57. sed -i -e "s|^set foamInstall = \$HOME|set foamInstall = /usr/$(get_libdir)|" etc/cshrc
  58. sed -i -e 's|^export ParaView_DIR=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$paraviewArchName|export ParaView_DIR=/usr|' etc/config/paraview.sh
  59. sed -i -e 's|^setenv ParaView_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$paraviewArchName|setenv ParaView_DIR /usr|' etc/config/paraview.csh
  60. }
  61. src_compile() {
  62. export WM_NCOMPPROCS=$(makeopts_jobs)
  63. export FOAM_INST_DIR=${WORKDIR}
  64. source etc/bashrc
  65. find wmake -name dirToString -exec rm -rf {} +
  66. find wmake -name wmkdep -exec rm -rf {}+
  67. ./Allwmake || die "could not build"
  68. if use doc ; then
  69. doc/Allwmake || die "could not build"
  70. fi
  71. }
  72. # Doesn't do anything sane
  73. #src_test() {
  74. # cd bin
  75. # ./foamInstallationTest
  76. #}
  77. src_install() {
  78. insinto ${INSDIR}
  79. doins -r etc
  80. use examples && doins -r tutorials
  81. use src && doins -r src
  82. insopts -m0755
  83. doins -r bin applications platforms wmake
  84. dodoc README.html doc/Guides-a4/*.pdf
  85. if use doc ; then
  86. dohtml -r doc/Doxygen
  87. fi
  88. }