gdl-0.9.6-r2.ebuild 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. WX_GTK_VER="3.0"
  5. PYTHON_COMPAT=( python2_7 )
  6. inherit cmake-utils eutils python-r1 wxwidgets toolchain-funcs virtualx
  7. DESCRIPTION="GNU Data Language"
  8. HOMEPAGE="http://gnudatalanguage.sourceforge.net/"
  9. SRC_URI="mirror://sourceforge/gnudatalanguage/${P}v2.tgz"
  10. LICENSE="GPL-2"
  11. SLOT="0"
  12. KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
  13. IUSE="+eigen fftw graphicsmagick grib gshhs hdf hdf5 +imagemagick netcdf openmp
  14. png proj postscript python static-libs udunits wxwidgets"
  15. RDEPEND="
  16. dev-cpp/antlr-cpp:2=
  17. sci-libs/gsl:0=
  18. sci-libs/plplot:0=[-dynamic]
  19. sys-libs/ncurses:0=
  20. sys-libs/readline:0=
  21. sys-libs/zlib:0=
  22. x11-libs/libX11:0=
  23. fftw? ( sci-libs/fftw:3.0= )
  24. grib? ( sci-libs/grib_api:0= )
  25. gshhs? ( sci-geosciences/gshhs-data sci-geosciences/gshhs:0= )
  26. hdf? ( sci-libs/hdf:0= )
  27. hdf5? ( sci-libs/hdf5:0= )
  28. imagemagick? (
  29. !graphicsmagick? ( media-gfx/imagemagick:=[cxx] )
  30. graphicsmagick? ( media-gfx/graphicsmagick:=[cxx] )
  31. )
  32. netcdf? ( sci-libs/netcdf )
  33. proj? ( sci-libs/proj )
  34. postscript? ( dev-libs/pslib )
  35. python? (
  36. ${PYTHON_DEPS}
  37. dev-python/numpy[${PYTHON_USEDEP}]
  38. )
  39. udunits? ( sci-libs/udunits )
  40. wxwidgets? ( x11-libs/wxGTK:${WX_GTK_VER}[X] )"
  41. DEPEND="${RDEPEND}
  42. dev-java/antlr:0[java(+),script(+)]
  43. virtual/pkgconfig
  44. eigen? ( dev-cpp/eigen:3 )"
  45. REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
  46. PATCHES=(
  47. "${FILESDIR}"/0.9.2-include.patch
  48. "${FILESDIR}"/0.9.5-antlr.patch
  49. "${FILESDIR}"/0.9.5-png.patch
  50. "${FILESDIR}"/0.9.6-fix-file-move.patch
  51. "${FILESDIR}"/0.9.6-fix-python-function-call.patch
  52. "${FILESDIR}"/0.9.6-fun-fix.patch
  53. "${FILESDIR}"/0.9.6-python-use-path-and-startup.patch
  54. "${FILESDIR}"/0.9.6-disable-tests-hanging-under-xvfb-run.patch
  55. "${FILESDIR}"/0.9.6-gcc6.patch
  56. "${FILESDIR}"/0.9.6-formats.patch
  57. )
  58. pkg_pretend() {
  59. [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
  60. }
  61. pkg_setup() {
  62. [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
  63. }
  64. src_prepare() {
  65. use wxwidgets && need-wxwidgets unicode
  66. use hdf5 && has_version sci-libs/hdf5[mpi] && export CXX=mpicxx
  67. # make sure antlr includes are from system and rebuild the sources with it
  68. # https://sourceforge.net/tracker/?func=detail&atid=618685&aid=3465878&group_id=97659
  69. rm -r src/antlr || die
  70. einfo "Regenerating grammar"
  71. pushd src >/dev/null || die
  72. local i
  73. for i in *.g; do
  74. antlr ${i} || die
  75. done
  76. popd >/dev/null || die
  77. # gentoo: avoid install files in datadir directory
  78. # and manually install them in src_install
  79. sed -e '/AUTHORS/d' -i CMakeLists.txt || die
  80. cmake-utils_src_prepare
  81. }
  82. src_configure() {
  83. # MPI is still very buggy
  84. # x11=off does not compile
  85. local mycmakeargs=(
  86. -DMPICH=OFF
  87. -DBUNDLED_ANTLR=OFF
  88. -DX11=ON
  89. -DEIGEN3="$(usex eigen)"
  90. -DFFTW="$(usex fftw)"
  91. -DGRIB="$(usex grib)"
  92. -DGSHHS="$(usex gshhs)"
  93. -DHDF="$(usex hdf)"
  94. -DHDF5="$(usex hdf5)"
  95. -DLIBPROJ4="$(usex proj)"
  96. -DNETCDF="$(usex netcdf)"
  97. -DOPENMP="$(usex openmp)"
  98. -DPNGLIB="$(usex png)"
  99. -DPSLIB="$(usex postscript)"
  100. -DUDUNITS="$(usex udunits)"
  101. -DWXWIDGETS="$(usex wxwidgets)"
  102. )
  103. if use imagemagick; then
  104. if use graphicsmagick; then
  105. mycmakeargs+=( -DGRAPHICSMAGICK=ON -DMAGICK=OFF )
  106. else
  107. mycmakeargs+=( -DGRAPHICSMAGICK=OFF -DMAGICK=ON )
  108. fi
  109. else
  110. mycmakeargs+=( -DGRAPHICSMAGICK=OFF -DMAGICK=OFF )
  111. fi
  112. configuration() {
  113. mycmakeargs+=( $@ )
  114. cmake-utils_src_configure
  115. }
  116. configuration -DPYTHON_MODULE=OFF -DPYTHON=OFF
  117. use python && python_foreach_impl configuration -DPYTHON_MODULE=ON -DPYTHON=ON
  118. }
  119. src_compile() {
  120. cmake-utils_src_compile
  121. use python && python_foreach_impl cmake-utils_src_make
  122. }
  123. src_test() {
  124. # there is check target instead of the ctest to define some LDPATH
  125. virtx emake -C "${BUILD_DIR}" check
  126. }
  127. src_install() {
  128. cmake-utils_src_install
  129. if use python; then
  130. installation() {
  131. mv src/libgdl.so GDL.so || die
  132. python_domodule GDL.so
  133. }
  134. python_foreach_impl run_in_build_dir installation
  135. dodoc PYTHON.txt
  136. fi
  137. #dodoc AUTHORS README
  138. echo "GDL_PATH=\"+${EPREFIX}/usr/share/gnudatalanguage\"" > 50gdl || die
  139. doenvd 50gdl
  140. }