jdbc-postgresql-9.3_p1100.ebuild 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 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-java/ant-junit
  24. dev-db/postgresql[server]
  25. )"
  26. RDEPEND=">=virtual/jre-1.6"
  27. S="${WORKDIR}/postgresql-jdbc-${MY_PV}.src"
  28. java_prepare() {
  29. find -name "*.class" -type f -exec rm -v {} + || die
  30. }
  31. JAVA_ANT_REWRITE_CLASSPATH="yes"
  32. EANT_DOC_TARGET="publicapi"
  33. src_compile() {
  34. java-pkg-2_src_compile
  35. # There is a task that creates this doc but I didn't find a way how to use system catalog
  36. # to lookup the stylesheet so the 'doc' target is rewritten here to use system call instead.
  37. if use doc; then
  38. mkdir -p "${S}/build/doc"
  39. xsltproc -o "${S}/build/doc/pgjdbc.html" http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl \
  40. "${S}/doc/pgjdbc.xml"
  41. fi
  42. }
  43. src_test() {
  44. einfo "In order to run the tests successfully, you have to have:"
  45. einfo "1) PostgreSQL server running"
  46. einfo "2) database 'test' defined with user 'test' with password 'password'"
  47. einfo " as owner of the database"
  48. einfo "3) plpgsql support in the 'test' database"
  49. einfo
  50. einfo "You can find a general info on how to perform these steps at"
  51. einfo "https://wiki.gentoo.org/wiki/PostgreSQL"
  52. ANT_TASKS="ant-junit" eant test -Dgentoo.classpath=$(java-pkg_getjars --build-only junit)
  53. }
  54. src_install() {
  55. java-pkg_newjar jars/postgresql.jar jdbc-postgresql.jar
  56. if use doc ; then
  57. java-pkg_dojavadoc build/publicapi
  58. dohtml build/doc/pgjdbc.html
  59. fi
  60. use source && java-pkg_dosrc org
  61. }