eclipse-ecj-4.2.1.ebuild 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="4"
  4. inherit java-pkg-2
  5. MY_PN="ecj"
  6. DMF="R-${PV}-201209141800"
  7. DESCRIPTION="Eclipse Compiler for Java"
  8. HOMEPAGE="http://www.eclipse.org/"
  9. SRC_URI="http://download.eclipse.org/eclipse/downloads/drops4/${DMF}/${MY_PN}src-${PV}.jar"
  10. LICENSE="EPL-1.0"
  11. KEYWORDS="amd64 ppc64 x86 ~x86-fbsd ~amd64-linux ~x86-linux ~x86-solaris"
  12. SLOT="4.2"
  13. IUSE="+ant userland_GNU"
  14. COMMON_DEP="
  15. app-eselect/eselect-java"
  16. RDEPEND="${COMMON_DEP}
  17. >=virtual/jre-1.4"
  18. DEPEND="${COMMON_DEP}
  19. >=virtual/jdk-1.6
  20. app-arch/unzip
  21. userland_GNU? ( sys-apps/findutils )"
  22. PDEPEND="
  23. ant? ( ~dev-java/ant-eclipse-ecj-${PV} )"
  24. S="${WORKDIR}"
  25. JAVA_PKG_WANT_SOURCE=1.4
  26. JAVA_PKG_WANT_TARGET=1.4
  27. java_prepare() {
  28. # These have their own package.
  29. rm -f org/eclipse/jdt/core/JDTCompilerAdapter.java || die
  30. rm -fr org/eclipse/jdt/internal/antadapter || die
  31. }
  32. src_compile() {
  33. local javac_opts javac java jar
  34. javac_opts="$(java-pkg_javac-args) -encoding ISO-8859-1"
  35. javac="$(java-config -c)"
  36. java="$(java-config -J)"
  37. jar="$(java-config -j)"
  38. find org/ -path org/eclipse/jdt/internal/compiler/apt -prune -o \
  39. -path org/eclipse/jdt/internal/compiler/tool -prune -o -name '*.java' \
  40. -print > sources-1.4
  41. find org/eclipse/jdt/internal/compiler/{apt,tool} -name '*.java' > sources-1.6
  42. mkdir -p bootstrap || die
  43. cp -pPR org META-INF bootstrap || die
  44. cd "${S}/bootstrap" || die
  45. einfo "bootstrapping ${MY_PN} with ${javac} ..."
  46. ${javac} ${javac_opts} @../sources-1.4 || die
  47. ${javac} -encoding ISO-8859-1 -source 1.6 -target 1.6 @../sources-1.6 || die
  48. find org/ META-INF/ \( -name '*.class' -o -name '*.properties' -o -name '*.rsc' -o -name '*.inf' -o -name '*.props' \) \
  49. -exec ${jar} cf ${MY_PN}.jar {} + || die
  50. cd "${S}" || die
  51. einfo "building ${MY_PN} with bootstrapped ${MY_PN} ..."
  52. ${java} -classpath bootstrap/${MY_PN}.jar \
  53. org.eclipse.jdt.internal.compiler.batch.Main \
  54. ${javac_opts} -nowarn @sources-1.4 || die
  55. ${java} -classpath bootstrap/${MY_PN}.jar \
  56. org.eclipse.jdt.internal.compiler.batch.Main \
  57. -encoding ISO-8859-1 -source 1.6 -target 1.6 -nowarn @sources-1.6 || die
  58. find org/ META-INF/ \( -name '*.class' -o -name '*.properties' -o -name '*.rsc' -o -name '*.inf' -o -name '*.props' \) \
  59. -exec ${jar} cf ${MY_PN}.jar {} + || die
  60. }
  61. src_install() {
  62. java-pkg_dolauncher ${MY_PN}-${SLOT} --main \
  63. org.eclipse.jdt.internal.compiler.batch.Main
  64. # disable the class version verify, this has intentionally
  65. # some classes with 1.6, but most is 1.4
  66. JAVA_PKG_STRICT="" java-pkg_dojar ${MY_PN}.jar
  67. }
  68. pkg_postinst() {
  69. einfo "To select between slots of ECJ..."
  70. einfo " # eselect ecj"
  71. eselect ecj update ecj-${SLOT}
  72. }
  73. pkg_postrm() {
  74. eselect ecj update
  75. }