jdbc-postgresql-9.4_p1205.ebuild 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  4. JAVA_PKG_IUSE="doc source"
  5. inherit eutils java-pkg-2 java-ant-2
  6. MY_PN="postgresql-jdbc"
  7. MY_PV="${PV/_p/-}"
  8. MY_P="${MY_PN}-${MY_PV}.src"
  9. DESCRIPTION="JDBC Driver for PostgreSQL"
  10. SRC_URI="http://jdbc.postgresql.org/download/${MY_P}.tar.gz"
  11. HOMEPAGE="http://jdbc.postgresql.org/"
  12. LICENSE="POSTGRESQL"
  13. SLOT="0"
  14. KEYWORDS="~amd64 ~ppc64 ~x86"
  15. IUSE="test"
  16. DEPEND="
  17. >=virtual/jdk-1.6
  18. doc? (
  19. dev-libs/libxslt
  20. app-text/docbook-xsl-stylesheets
  21. )
  22. test? (
  23. >=dev-db/postgresql-9.3[server]
  24. dev-java/ant-junit
  25. dev-java/junit:4
  26. dev-java/xml-commons
  27. )"
  28. RDEPEND=">=virtual/jre-1.6"
  29. RESTRICT="test" # Requires external postgresql server setup
  30. S="${WORKDIR}/postgresql-jdbc-${MY_PV}.src"
  31. JAVA_ANT_REWRITE_CLASSPATH="yes"
  32. EANT_DOC_TARGET="publicapi"
  33. java_prepare() {
  34. # Strip build.xml of maven deps
  35. sed -i -e '/<classpath.*dependency\.compile\.classpath/c\' build.xml || die
  36. sed -i -e '/<classpath.*dependency\.runtime\.classpath/c\' build.xml || die
  37. sed -i -e '/<classpath.*dependency\.test\.classpath/c\' build.xml || die
  38. sed -i -e '/<target name="artifact-version"/,/<[/]target>/{s/depends="maven-dependencies"//}' build.xml || die
  39. sed -i -e '/<target name="compile"/ s/,maven-dependencies//' build.xml || die
  40. # Remove SSPI, it pulls in Waffle-JNA and is only used on Windows
  41. sed -i -e '/<include.*sspi/c\' build.xml || die
  42. rm -vrf org/postgresql/sspi || die "Error removing sspi"
  43. epatch "${FILESDIR}"/${PN}-9.4_p1204-remove-sspi.patch
  44. # FIXME @someone who cares: enable through osgi flag?
  45. sed -i -e '/<include.*osgi/c\' build.xml || die
  46. sed -i -e '/<test.*osgi/c\' build.xml || die
  47. rm -vrf org/postgresql/osgi || die "Error removing osgi"
  48. rm -vrf org/postgresql/test/osgi || die "Error removing osgi tests"
  49. epatch "${FILESDIR}"/${PN}-9.4_p1201-remove-osgi.patch
  50. java-pkg_clean
  51. }
  52. src_compile() {
  53. EANT_BUILD_TARGET="release-version jar"
  54. java-pkg-2_src_compile
  55. # There is a task that creates this doc but I didn't find a way how to use system catalog
  56. # to lookup the stylesheet so the 'doc' target is rewritten here to use system call instead.
  57. if use doc; then
  58. mkdir -p "${S}/build/doc" || die
  59. xsltproc -o "${S}/build/doc/pgjdbc.html" http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl \
  60. "${S}/doc/pgjdbc.xml" || die
  61. fi
  62. }
  63. src_test() {
  64. einfo "In order to run the tests successfully, you have to have:"
  65. einfo "1) PostgreSQL server running"
  66. einfo "2) database 'test' defined with user 'test' with password 'test'"
  67. einfo " as owner of the database"
  68. einfo "3) plpgsql support in the 'test' database"
  69. einfo
  70. einfo "You can find a general info on how to perform these steps at"
  71. einfo "https://wiki.gentoo.org/wiki/PostgreSQL"
  72. ANT_TASKS="ant-junit" eant test -Dgentoo.classpath=$(java-pkg_getjars --build-only "junit-4,xml-commons")
  73. }
  74. src_install() {
  75. java-pkg_newjar build/jars/postgresql*.jar jdbc-postgresql.jar
  76. if use doc ; then
  77. java-pkg_dojavadoc build/publicapi
  78. dohtml build/doc/pgjdbc.html
  79. fi
  80. use source && java-pkg_dosrc org
  81. }