cvc3-2.4.1.ebuild 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  4. inherit elisp-common
  5. DESCRIPTION="CVC3 is a theorem prover for Satisfiability Modulo Theories (SMT) problems"
  6. HOMEPAGE="http://www.cs.nyu.edu/acsys/cvc3/index.html"
  7. SRC_URI="http://www.cs.nyu.edu/acsys/cvc3/releases/2.4.1/${P}.tar.gz"
  8. LICENSE="BSD MIT HPND zchaff? ( zchaff )"
  9. RESTRICT="mirror zchaff? ( bindist )"
  10. SLOT="0/${PV}"
  11. KEYWORDS="~amd64 ~x86"
  12. IUSE="doc emacs isabelle test zchaff"
  13. RDEPEND="dev-libs/gmp:0=
  14. isabelle? (
  15. >=sci-mathematics/isabelle-2011.1-r1:=
  16. )"
  17. DEPEND="${RDEPEND}
  18. doc? (
  19. app-doc/doxygen
  20. media-gfx/graphviz
  21. )
  22. emacs? (
  23. virtual/emacs
  24. )"
  25. SITEFILE=50${PN}-gentoo.el
  26. src_prepare() {
  27. sed -e 's#prefix=@prefix@#prefix=$(patsubst %/,%,$(DESTDIR))@prefix@#' \
  28. -e 's#libdir=@libdir@#libdir=$(patsubst %/,%,$(DESTDIR))@libdir@#' \
  29. -e 's#mandir=@mandir@#mandir=$(patsubst %/,%,$(DESTDIR))@mandir@#' \
  30. -i "${S}/Makefile.local.in" \
  31. || die "Could not set DESTDIR in Makefile.local.in"
  32. }
  33. src_configure() {
  34. # --enable-static disables building of shared libraries, statically
  35. # links /usr/bin/cvc3 and installs static libraries.
  36. # --enable-static --enable-sharedlibs behaves the same as just --enable-static
  37. econf \
  38. --enable-dynamic \
  39. $(use_enable zchaff)
  40. if use test; then
  41. sed -e 's@LD_LIBS = @LD_LIBS = -L'"${S}"'/lib -Wl,-R'"${S}"'/lib @' \
  42. -i "${S}/test/Makefile" \
  43. || die "Could not set library paths in test/Makefile"
  44. fi
  45. }
  46. src_compile() {
  47. emake
  48. if use doc; then
  49. pushd doc || die "Could not cd to doc"
  50. emake
  51. popd
  52. fi
  53. if use emacs ; then
  54. pushd "${S}/emacs" || die "Could change directory to emacs"
  55. elisp-compile *.el || die "emacs elisp compile failed"
  56. popd
  57. fi
  58. if use test; then
  59. pushd test || die "Could not cd to test"
  60. emake
  61. popd
  62. fi
  63. }
  64. src_test() {
  65. pushd test || die "Could not cd to test"
  66. ./bin/test || die "tests failed"
  67. popd
  68. }
  69. src_install() {
  70. emake DESTDIR="${D}" install
  71. if use doc; then
  72. pushd "${S}"/doc/html || die "Could not cd to doc/html"
  73. dohtml *.html
  74. insinto /usr/share/doc/${PF}/html
  75. doins *.css *.gif *.png
  76. popd
  77. fi
  78. if use emacs ; then
  79. elisp-install ${PN} emacs/*.{el,elc}
  80. cp "${FILESDIR}"/${SITEFILE} "${S}"
  81. elisp-site-file-install ${SITEFILE}
  82. fi
  83. if use isabelle; then
  84. ISABELLE_HOME="$(isabelle getenv ISABELLE_HOME | cut -d'=' -f 2)" \
  85. || die "isabelle getenv ISABELLE_HOME failed"
  86. [[ -n "${ISABELLE_HOME}" ]] || die "ISABELLE_HOME empty"
  87. dodir "${ISABELLE_HOME}/contrib/${PN}-${PV}/etc"
  88. cat <<- EOF >> "${S}/settings"
  89. CVC3_COMPONENT="\$COMPONENT"
  90. CVC3_HOME="${ROOT}usr/bin"
  91. CVC3_SOLVER="\$CVC3_HOME/cvc3"
  92. CVC3_REMOTE_SOLVER="cvc3"
  93. CVC3_INSTALLED="yes"
  94. EOF
  95. insinto "${ISABELLE_HOME}/contrib/${PN}-${PV}/etc"
  96. doins "${S}/settings"
  97. fi
  98. }
  99. pkg_postinst() {
  100. use emacs && elisp-site-regen
  101. if use isabelle; then
  102. if [ -f "${ROOT}etc/isabelle/components" ]; then
  103. if egrep "contrib/${PN}-[0-9.]*" "${ROOT}etc/isabelle/components"; then
  104. sed -e "/contrib\/${PN}-[0-9.]*/d" \
  105. -i "${ROOT}etc/isabelle/components"
  106. fi
  107. cat <<- EOF >> "${ROOT}etc/isabelle/components"
  108. contrib/${PN}-${PV}
  109. EOF
  110. fi
  111. fi
  112. if use zchaff; then
  113. einfo "This copy of CVC3 is also configured to use the SAT solver zchaff whose"
  114. einfo "copyright is owned by Princeton University and is more restrictive."
  115. einfo "Specifically, it may be used for internal, noncommercial, research purposes"
  116. einfo "only. See the copyright notices from the zchaff source files which are"
  117. einfo "included in the LICENSE file."
  118. einfo "To build CVC3 without these files, please build cvc3 without the zchaff"
  119. einfo "use flag (note: zchaff is disabled by default):"
  120. einfo "USE=-zchaff emerge sci-mathemathematics/cvc3"
  121. fi
  122. }
  123. pkg_postrm() {
  124. use emacs && elisp-site-regen
  125. if use isabelle; then
  126. if [ ! -f "${ROOT}usr/bin/cvc3" ]; then
  127. if [ -f "${ROOT}etc/isabelle/components" ]; then
  128. # Note: this sed should only match the version of this ebuild
  129. # Which is what we want as we do not want to remove the line
  130. # of a new CVC3 being installed during an upgrade.
  131. sed -e "/contrib\/${PN}-${PV}/d" \
  132. -i "${ROOT}etc/isabelle/components"
  133. fi
  134. fi
  135. fi
  136. }