kodkodi-1.5.2-r1.ebuild 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="6"
  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:=
  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. src_prepare() {
  26. default
  27. sed -e 's@exec "$ISABELLE_TOOL" java $KODKODI_JAVA_OPT@java@' \
  28. -i "${S}/bin/kodkodi" || die "Could not patch bin/kodkodi"
  29. rm -f jar/*.jar || die "Could not rm jar files"
  30. }
  31. src_compile() {
  32. JAVA_SRC_DIR="src"
  33. TARGETDIR="/usr/share/${P}"
  34. KODKOD_LIBDIR="/usr/"$(get_libdir)"/kodkod"
  35. java-pkg-simple_src_compile
  36. pushd "${S}/target/classes" > /dev/null || die
  37. jar -uf "${S}"/${PN}.jar $(find -name '*.class') || die
  38. popd > /dev/null
  39. }
  40. src_install() {
  41. java-pkg-simple_src_install
  42. dodoc README HISTORY manual/${PN}.pdf LICENSES/Kodkodi
  43. insinto ${TARGETDIR}
  44. if use examples; then
  45. doins -r examples
  46. fi
  47. if use isabelle; then
  48. ISABELLE_HOME="$(isabelle getenv ISABELLE_HOME | cut -d'=' -f 2)" \
  49. || die "isabelle getenv ISABELLE_HOME failed"
  50. [[ -n "${ISABELLE_HOME}" ]] || die "ISABELLE_HOME empty"
  51. dodir "${ISABELLE_HOME}/contrib/${PN}-${PV}/etc"
  52. cat <<- EOF >> "${S}/settings"
  53. KODKODI="\$COMPONENT"
  54. KODKODI_VERSION="${PV}"
  55. KODKODI_PLATFORM=\$ISABELLE_PLATFORM
  56. KODKODI_CLASSPATH="$(java-config --classpath=antlr:3):${ROOT}usr/share/${PN}-${SLOT}/lib/kodkodi.jar:$(java-config --classpath=kodkod)"
  57. KODKODI_JAVA_LIBRARY_PATH="${KODKOD_LIBDIR}"
  58. EOF
  59. insinto "${ISABELLE_HOME}/contrib/${PN}-${PV}/etc"
  60. doins "${S}/settings"
  61. dodir "${ISABELLE_HOME}/contrib/${PN}-${PV}/bin"
  62. exeinto "${ISABELLE_HOME}/contrib/${PN}-${PV}/bin"
  63. doexe bin/kodkodi
  64. fi
  65. }
  66. pkg_postinst() {
  67. if use isabelle; then
  68. if [ -f "${ROOT}etc/isabelle/components" ]; then
  69. if egrep "contrib/${PN}-[0-9.]*" "${ROOT}etc/isabelle/components"; then
  70. sed -e "/contrib\/${PN}-[0-9.]*/d" \
  71. -i "${ROOT}etc/isabelle/components"
  72. fi
  73. cat <<- EOF >> "${ROOT}etc/isabelle/components"
  74. contrib/${PN}-${PV}
  75. EOF
  76. fi
  77. fi
  78. }
  79. pkg_postrm() {
  80. if use isabelle; then
  81. if [ ! -f "${ROOT}usr/bin/kodkodi" ]; then
  82. if [ -f "${ROOT}etc/isabelle/components" ]; then
  83. # Note: this sed should only match the version of this ebuild
  84. # Which is what we want as we do not want to remove the line
  85. # of a new kodkodi being installed during an upgrade.
  86. sed -e "/contrib\/${PN}-${PV}/d" \
  87. -i "${ROOT}etc/isabelle/components"
  88. fi
  89. fi
  90. fi
  91. }