openfoam-2.4.0-r1.ebuild 3.1 KB

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