kodkod-1.5.2-r1.ebuild 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. PYTHON_COMPAT=( python2_7 )
  6. PYTHON_REQ_USE='threads(+)'
  7. inherit eutils java-pkg-2 python-any-r1 waf-utils
  8. DESCRIPTION="a constraint solver for relational logic"
  9. HOMEPAGE="http://alloy.mit.edu/kodkod/index.html"
  10. SRC_URI="http://alloy.mit.edu/kodkod/${PV}/${P}.zip
  11. https://waf.googlecode.com/files/waf-1.7.16"
  12. LICENSE="MIT"
  13. SLOT="0/${PV}"
  14. KEYWORDS="~amd64 ~x86"
  15. IUSE=""
  16. COMMON_DEP=""
  17. RDEPEND="${COMMON_DEP}
  18. >=virtual/jre-1.6"
  19. DEPEND="${COMMON_DEP}
  20. >=virtual/jdk-1.6
  21. app-arch/unzip"
  22. S="${WORKDIR}/kodkod-1.5"
  23. JAVA_SRC_DIR="src"
  24. pkg_setup() {
  25. python-any-r1_pkg_setup
  26. java-pkg-2_pkg_setup
  27. }
  28. src_unpack() {
  29. unpack "${A% *}"
  30. cp "${DISTDIR}/${A#* }" "${S}/waf" || die "Could not copy waf"
  31. }
  32. src_prepare() {
  33. java-pkg-2_src_prepare
  34. chmod u+x waf \
  35. || die "Could not set execute permisions on waf file"
  36. sed -e 's@private N parent, left, right@protected N parent, left, right@' \
  37. -e 's@private boolean color@protected boolean color@' \
  38. -i "${S}/src/kodkod/util/ints/IntTree.java" \
  39. || die "Could not change private to protected in IntTree.java"
  40. sed -e 's@conf.env.LINKFLAGS =@conf.env.LINKFLAGS +=@' \
  41. -i "${S}/lib/cryptominisat-2.9.1/wscript" \
  42. -i "${S}/lib/lingeling-276/wscript" \
  43. || die "Could not fix wscripts to respect LDFLAGS"
  44. # Fix bug 453162 - sci-mathematics/kodkod-1.5.2: fails to build
  45. epatch "${FILESDIR}/${PN}-1.5.2-changes-in-most-specific-varargs-method-selection.patch"
  46. # Fix Bug 458462 sci-mathematics/kodkod-1.5.2: fails to build with JAVA_PKG_STRICT
  47. local x=""
  48. for i in $JAVACFLAGS
  49. do
  50. if [ "${x}" == "" ]; then
  51. x="'${i}'"
  52. else
  53. x="${x}, '${i}'"
  54. fi
  55. done
  56. for j in $(find . -name wscript -print)
  57. do
  58. sed -e "s@def configure(conf):@def configure(conf):\n conf.env.JAVACFLAGS = [${x}]@" \
  59. -i "${j}" \
  60. || die "Could not set JAVACFLAGS in ${j}"
  61. done
  62. }
  63. # note: kodkod waf fails when passed --libdir:
  64. # waf: error: no such option: --libdir
  65. src_configure() {
  66. ${WAF_BINARY:="${S}/waf"}
  67. tc-export AR CC CPP CXX RANLIB
  68. echo "CCFLAGS=\"${CFLAGS}\" LINKFLAGS=\"${LDFLAGS}\" \"${WAF_BINARY}\" --prefix=${EPREFIX}/usr $@ configure"
  69. CCFLAGS="${CFLAGS}" LINKFLAGS="${LDFLAGS}" "${WAF_BINARY}" \
  70. "--prefix=${EPREFIX}/usr" \
  71. "$@" \
  72. configure || die "configure failed"
  73. }
  74. src_compile() {
  75. waf-utils_src_compile
  76. if has doc ${JAVA_PKG_IUSE} && use doc; then
  77. pushd src/kodkod || die "Could not cd to src/kodkod"
  78. local doclint="-Xdoclint:none"
  79. local jv="$(javac -version 2>&1 | cut -d' ' -f 2)"
  80. if [[ "${jv}" == 1.6* ]] || [[ "${jv}" == 1.7* ]]; then
  81. doclint=""
  82. fi
  83. javadoc ${doclint} -sourcepath "${S}"/src/kodkod:"${S}"/build/src/kodkod \
  84. -classpath $(find "${PWD}" -name \*.jar -print | xargs | sed -e 's@ @:@g') \
  85. $(find . -name \*.java -print) \
  86. || die "javadoc failed"
  87. popd
  88. fi
  89. }
  90. src_install() {
  91. insinto "/usr/"$(get_libdir)
  92. dodir "/usr/"$(get_libdir)"/${PN}"
  93. exeinto "/usr/"$(get_libdir)"/${PN}"
  94. for i in $(find . \( -name \*.so -o -name plingeling \) -print | xargs); do
  95. doexe $i
  96. done
  97. for i in $(find . \( -name kodkod.jar -o -name org.sat4j.core.jar \) -print | xargs); do
  98. einfo "java-pkg_dojar $i"
  99. java-pkg_dojar $i
  100. done
  101. # javadoc
  102. if has doc ${JAVA_PKG_IUSE} && use doc; then
  103. java-pkg_dojavadoc src/kodkod
  104. fi
  105. # dosrc
  106. if has source ${JAVA_PKG_IUSE} && use source; then
  107. local srcdirs=""
  108. if [[ ${JAVA_SRC_DIR} ]]; then
  109. local parent child
  110. for parent in ${JAVA_SRC_DIR}; do
  111. for child in ${parent}/*; do
  112. srcdirs="${srcdirs} ${child}"
  113. done
  114. done
  115. else
  116. # take all directories actually containing any sources
  117. srcdirs="$(cut -d/ -f1 ${sources} | sort -u)"
  118. fi
  119. java-pkg_dosrc ${srcdirs}
  120. fi
  121. }