postgis-2.2.2-r1.ebuild 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. POSTGRES_COMPAT=( 9.{1,2,3,4,5} )
  5. inherit autotools eutils versionator
  6. MY_PV=$(replace_version_separator 3 '')
  7. MY_P="${PN}-${MY_PV}"
  8. S="${WORKDIR}/${MY_P}"
  9. DESCRIPTION="Geographic Objects for PostgreSQL"
  10. HOMEPAGE="http://postgis.net"
  11. SRC_URI="http://download.osgeo.org/postgis/source/${MY_P}.tar.gz"
  12. LICENSE="GPL-2"
  13. SLOT="0"
  14. KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux"
  15. IUSE="doc gtk static-libs test"
  16. RDEPEND="
  17. || (
  18. dev-db/postgresql:9.5[server]
  19. dev-db/postgresql:9.4[server]
  20. dev-db/postgresql:9.3[server]
  21. dev-db/postgresql:9.2[server]
  22. dev-db/postgresql:9.1[server]
  23. )
  24. dev-libs/json-c
  25. dev-libs/libxml2:2
  26. >=sci-libs/geos-3.5.0
  27. >=sci-libs/proj-4.6.0
  28. >=sci-libs/gdal-1.10.0:=
  29. gtk? ( x11-libs/gtk+:2 )
  30. "
  31. DEPEND="${RDEPEND}
  32. doc? (
  33. app-text/docbook-xsl-stylesheets
  34. app-text/docbook-xml-dtd:4.5
  35. dev-libs/libxslt
  36. virtual/imagemagick-tools[png]
  37. )
  38. virtual/pkgconfig
  39. test? ( dev-util/cunit )
  40. "
  41. PGIS="$(get_version_component_range 1-2)"
  42. REQUIRED_USE="test? ( doc )"
  43. # Needs a running psql instance, doesn't work out of the box
  44. RESTRICT="test"
  45. MAKEOPTS+=' -j1'
  46. # These modules are built using the same *FLAGS that were used to build
  47. # dev-db/postgresql. The right thing to do is to ignore the current
  48. # *FLAGS settings.
  49. QA_FLAGS_IGNORED="usr/lib(64)?/(rt)?postgis-${PGIS}\.so"
  50. postgres_check_slot() {
  51. if ! declare -p POSTGRES_COMPAT &>/dev/null; then
  52. die 'POSTGRES_COMPAT not declared.'
  53. fi
  54. # Don't die because we can't run postgresql-config during pretend.
  55. [[ "$EBUILD_PHASE" = "pretend" \
  56. && -z "$(which postgresql-config 2> /dev/null)" ]] && return 0
  57. local res=$(echo ${POSTGRES_COMPAT[@]} \
  58. | grep -c $(postgresql-config show 2> /dev/null) 2> /dev/null)
  59. if [[ "$res" -eq "0" ]] ; then
  60. eerror "PostgreSQL slot must be set to one of: "
  61. eerror " ${POSTGRES_COMPAT[@]}"
  62. return 1
  63. fi
  64. return 0
  65. }
  66. pkg_pretend() {
  67. postgres_check_slot || die
  68. }
  69. pkg_setup() {
  70. postgres_check_slot || die
  71. export PGSLOT="$(postgresql-config show)"
  72. }
  73. src_prepare() {
  74. epatch "${FILESDIR}/${PN}-2.2.0-arflags.patch"
  75. eapply_user
  76. local AT_M4DIR="macros"
  77. eautoreconf
  78. }
  79. src_configure() {
  80. local myargs=""
  81. use gtk && myargs+=" --with-gui"
  82. econf \
  83. --with-pgconfig="/usr/lib/postgresql-${PGSLOT}/bin/pg_config" \
  84. ${myargs}
  85. }
  86. src_compile() {
  87. emake
  88. emake -C topology
  89. if use doc ; then
  90. emake comments
  91. emake cheatsheets
  92. emake -C doc html
  93. fi
  94. }
  95. src_install() {
  96. emake DESTDIR="${D}" install
  97. use doc && emake DESTDIR="${D}" comments-install
  98. emake -C topology DESTDIR="${D}" install
  99. dobin ./utils/postgis_restore.pl
  100. dodoc CREDITS TODO loader/README.* doc/*txt
  101. use doc && dohtml -r doc/html/*
  102. docinto topology
  103. dodoc topology/{TODO,README}
  104. use static-libs || find "${ED}" -name '*.a' -delete
  105. }
  106. pkg_postinst() {
  107. postgresql-config update
  108. elog "To finish installing PostGIS, follow the directions detailed at:"
  109. elog "http://postgis.net/docs/manual-${PGIS}/postgis_installation.html#create_new_db_extensions"
  110. }