kodkod-1.5.2.ebuild 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  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. LIBDIR="/usr/"$(get_libdir)"/${PN}"
  25. pkg_setup() {
  26. python-any-r1_pkg_setup
  27. java-pkg-2_pkg_setup
  28. }
  29. src_unpack() {
  30. unpack "${A% *}"
  31. cp "${DISTDIR}/${A#* }" "${S}/waf" || die "Could not copy waf"
  32. }
  33. src_prepare() {
  34. java-pkg-2_src_prepare
  35. chmod u+x waf \
  36. || die "Could not set execute permisions on waf file"
  37. sed -e 's@private N parent, left, right@protected N parent, left, right@' \
  38. -e 's@private boolean color@protected boolean color@' \
  39. -i "${S}/src/kodkod/util/ints/IntTree.java" \
  40. || die "Could not change private to protected in IntTree.java"
  41. sed -e 's@conf.env.LINKFLAGS =@conf.env.LINKFLAGS +=@' \
  42. -i "${S}/lib/cryptominisat-2.9.1/wscript" \
  43. -i "${S}/lib/lingeling-276/wscript" \
  44. || die "Could not fix wscripts to respect LDFLAGS"
  45. # Fix bug 453162 - sci-mathematics/kodkod-1.5.2: fails to build
  46. epatch "${FILESDIR}/${PN}-1.5.2-changes-in-most-specific-varargs-method-selection.patch"
  47. # Fix Bug 458462 sci-mathematics/kodkod-1.5.2: fails to build with JAVA_PKG_STRICT
  48. local x=""
  49. for i in $JAVACFLAGS
  50. do
  51. if [ "${x}" == "" ]; then
  52. x="'${i}'"
  53. else
  54. x="${x}, '${i}'"
  55. fi
  56. done
  57. for j in $(find . -name wscript -print)
  58. do
  59. sed -e "s@def configure(conf):@def configure(conf):\n conf.env.JAVACFLAGS = [${x}]@" \
  60. -i "${j}" \
  61. || die "Could not set JAVACFLAGS in ${j}"
  62. done
  63. }
  64. # note: kodkod waf fails when passed --libdir:
  65. # waf: error: no such option: --libdir
  66. src_configure() {
  67. ${WAF_BINARY:="${S}/waf"}
  68. tc-export AR CC CPP CXX RANLIB
  69. echo "CCFLAGS=\"${CFLAGS}\" LINKFLAGS=\"${LDFLAGS}\" \"${WAF_BINARY}\" --prefix=${EPREFIX}/usr $@ configure"
  70. CCFLAGS="${CFLAGS}" LINKFLAGS="${LDFLAGS}" "${WAF_BINARY}" \
  71. "--prefix=${EPREFIX}/usr" \
  72. "$@" \
  73. configure || die "configure failed"
  74. }
  75. src_compile() {
  76. waf-utils_src_compile
  77. if has doc ${JAVA_PKG_IUSE} && use doc; then
  78. pushd src/kodkod || die "Could not cd to src/kodkod"
  79. local doclint="-Xdoclint:none"
  80. local jv="$(javac -version 2>&1 | cut -d' ' -f 2)"
  81. if [[ "${jv}" == 1.6* ]] || [[ "${jv}" == 1.7* ]]; then
  82. doclint=""
  83. fi
  84. javadoc ${doclint} -sourcepath "${S}"/src/kodkod:"${S}"/build/src/kodkod \
  85. -classpath $(find "${PWD}" -name \*.jar -print | xargs | sed -e 's@ @:@g') \
  86. $(find . -name \*.java -print) \
  87. || die "javadoc failed"
  88. popd
  89. fi
  90. }
  91. src_install() {
  92. insinto "/usr/"$(get_libdir)
  93. dodir ${LIBDIR}
  94. exeinto ${LIBDIR}
  95. for i in $(find . \( -name \*.so -o -name plingeling \) -print | xargs); do
  96. doexe $i
  97. done
  98. for i in $(find . \( -name kodkod.jar -o -name org.sat4j.core.jar \) -print | xargs); do
  99. einfo "java-pkg_dojar $i"
  100. java-pkg_dojar $i
  101. done
  102. # javadoc
  103. if has doc ${JAVA_PKG_IUSE} && use doc; then
  104. java-pkg_dojavadoc src/kodkod
  105. fi
  106. # dosrc
  107. if has source ${JAVA_PKG_IUSE} && use source; then
  108. local srcdirs=""
  109. if [[ ${JAVA_SRC_DIR} ]]; then
  110. local parent child
  111. for parent in ${JAVA_SRC_DIR}; do
  112. for child in ${parent}/*; do
  113. srcdirs="${srcdirs} ${child}"
  114. done
  115. done
  116. else
  117. # take all directories actually containing any sources
  118. srcdirs="$(cut -d/ -f1 ${sources} | sort -u)"
  119. fi
  120. java-pkg_dosrc ${srcdirs}
  121. fi
  122. }