kodkodi-1.5.2.ebuild 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. # Copyright 1999-2014 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-pkg-simple multilib
  6. DESCRIPTION="A text front-end for the Kodkod Java library"
  7. HOMEPAGE="http://www21.in.tum.de/~blanchet/#software"
  8. SRC_URI="http://www21.in.tum.de/~blanchet/${P}.tgz"
  9. LICENSE="BSD"
  10. SLOT="0/${PV}"
  11. KEYWORDS="~amd64 ~x86"
  12. IUSE="isabelle examples"
  13. COMMON_DEP="dev-java/antlr:3
  14. =sci-mathematics/kodkod-1.5*:="
  15. RDEPEND="${COMMON_DEP}
  16. isabelle? (
  17. >=sci-mathematics/isabelle-2011-r1:=
  18. )
  19. >=virtual/jre-1.6"
  20. DEPEND="${COMMON_DEP}
  21. >=virtual/jdk-1.6
  22. app-arch/unzip"
  23. S="${WORKDIR}/${P}"
  24. JAVA_GENTOO_CLASSPATH="kodkod,antlr-3"
  25. java_prepare() {
  26. sed -e 's@exec "$ISABELLE_TOOL" java $KODKODI_JAVA_OPT@java@' \
  27. -i "${S}/bin/kodkodi" || die "Could not patch bin/kodkodi"
  28. rm -f jar/*.jar || die "Could not rm jar files"
  29. }
  30. src_compile() {
  31. JAVA_SRC_DIR="src"
  32. TARGETDIR="/usr/share/${P}"
  33. KODKOD_LIBDIR="/usr/"$(get_libdir)"/kodkod"
  34. java-pkg-simple_src_compile
  35. pushd "${S}/target/classes" > /dev/null || die
  36. jar -uf "${S}"/${PN}.jar $(find -name '*.class') || die
  37. popd > /dev/null
  38. }
  39. src_install() {
  40. java-pkg-simple_src_install
  41. dodoc README HISTORY manual/${PN}.pdf LICENSES/Kodkodi
  42. insinto ${TARGETDIR}
  43. if use examples; then
  44. doins -r examples
  45. fi
  46. if use isabelle; then
  47. ISABELLE_HOME="$(isabelle getenv ISABELLE_HOME | cut -d'=' -f 2)" \
  48. || die "isabelle getenv ISABELLE_HOME failed"
  49. [[ -n "${ISABELLE_HOME}" ]] || die "ISABELLE_HOME empty"
  50. dodir "${ISABELLE_HOME}/contrib/${PN}-${PV}/etc"
  51. cat <<- EOF >> "${S}/settings"
  52. KODKODI="\$COMPONENT"
  53. KODKODI_VERSION="${PV}"
  54. KODKODI_PLATFORM=\$ISABELLE_PLATFORM
  55. KODKODI_CLASSPATH="$(java-config --classpath=antlr:3):${ROOT}usr/share/${PN}-${SLOT}/lib/kodkodi.jar:$(java-config --classpath=kodkod)"
  56. KODKODI_JAVA_LIBRARY_PATH="${KODKOD_LIBDIR}"
  57. EOF
  58. insinto "${ISABELLE_HOME}/contrib/${PN}-${PV}/etc"
  59. doins "${S}/settings"
  60. dodir "${ISABELLE_HOME}/contrib/${PN}-${PV}/bin"
  61. exeinto "${ISABELLE_HOME}/contrib/${PN}-${PV}/bin"
  62. doexe bin/kodkodi
  63. fi
  64. }
  65. pkg_postinst() {
  66. if use isabelle; then
  67. if [ -f "${ROOT}etc/isabelle/components" ]; then
  68. if egrep "contrib/${PN}-[0-9.]*" "${ROOT}etc/isabelle/components"; then
  69. sed -e "/contrib\/${PN}-[0-9.]*/d" \
  70. -i "${ROOT}etc/isabelle/components"
  71. fi
  72. cat <<- EOF >> "${ROOT}etc/isabelle/components"
  73. contrib/${PN}-${PV}
  74. EOF
  75. fi
  76. fi
  77. }
  78. pkg_postrm() {
  79. if use isabelle; then
  80. if [ ! -f "${ROOT}usr/bin/kodkodi" ]; then
  81. if [ -f "${ROOT}etc/isabelle/components" ]; then
  82. # Note: this sed should only match the version of this ebuild
  83. # Which is what we want as we do not want to remove the line
  84. # of a new kodkodi being installed during an upgrade.
  85. sed -e "/contrib\/${PN}-${PV}/d" \
  86. -i "${ROOT}etc/isabelle/components"
  87. fi
  88. fi
  89. fi
  90. }