cvc3-2.4.1-r1.ebuild 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  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? ( >=sci-mathematics/isabelle-2011.1-r1:= )"
  15. DEPEND="${RDEPEND}
  16. doc? (
  17. app-doc/doxygen
  18. media-gfx/graphviz
  19. )
  20. emacs? (
  21. virtual/emacs
  22. )"
  23. SITEFILE="50${PN}-gentoo.el"
  24. PATCHES=( "${FILESDIR}/${P}-gccv6-fix.patch" )
  25. src_prepare() {
  26. default
  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. use doc && emake -C doc
  49. if use emacs; then
  50. pushd emacs >/dev/null || die
  51. elisp-compile *.el || die "emacs elisp compile failed"
  52. popd >/dev/null || die
  53. fi
  54. use test && emake -C test
  55. }
  56. src_test() {
  57. pushd test >/dev/null || die
  58. ./bin/test || die "Testsuite failed"
  59. popd >/dev/null || die
  60. }
  61. src_install() {
  62. use doc && local HTML_DOCS=( doc/html/*.{html,gif,png,css} )
  63. default
  64. if use emacs; then
  65. elisp-install ${PN} emacs/*.{el,elc}
  66. cp "${FILESDIR}"/${SITEFILE} "${S}" || die "Failed to copy Emacs files"
  67. elisp-site-file-install ${SITEFILE}
  68. fi
  69. if use isabelle; then
  70. ISABELLE_HOME="$(isabelle getenv ISABELLE_HOME | cut -d'=' -f 2)" \
  71. || die "isabelle getenv ISABELLE_HOME failed"
  72. [[ -n "${ISABELLE_HOME}" ]] || die "ISABELLE_HOME empty"
  73. dodir "${ISABELLE_HOME}/contrib/${PN}-${PV}/etc"
  74. cat >> settings <<- EOF || die "Failed to create Isabelle configuration for CVC3"
  75. CVC3_COMPONENT="\$COMPONENT"
  76. CVC3_HOME="${EPREFIX}/usr/bin"
  77. CVC3_SOLVER="\$CVC3_HOME/cvc3"
  78. CVC3_REMOTE_SOLVER="cvc3"
  79. CVC3_INSTALLED="yes"
  80. EOF
  81. insinto "${ISABELLE_HOME}/contrib/${PN}-${PV}/etc"
  82. doins settings
  83. fi
  84. }
  85. pkg_postinst() {
  86. use emacs && elisp-site-regen
  87. if use isabelle; then
  88. if [[ -f "${EROOT%/}/etc/isabelle/components" ]]; then
  89. if egrep "contrib/${PN}-[0-9.]*" "${EROOT%/}/etc/isabelle/components"; then
  90. sed -e "/contrib\/${PN}-[0-9.]*/d" \
  91. -i "${EROOT%/}/etc/isabelle/components" || die "Failed to remove old CVC3 registrations in Isabelle"
  92. fi
  93. cat >> "${EROOT%/}/etc/isabelle/components" <<- EOF || die "Failed to register CVC3 with Isabelle"
  94. contrib/${PN}-${PV}
  95. EOF
  96. fi
  97. fi
  98. if use zchaff; then
  99. einfo "This copy of CVC3 is also configured to use the SAT solver zchaff whose"
  100. einfo "copyright is owned by Princeton University and is more restrictive."
  101. einfo "Specifically, it may be used for internal, noncommercial, research purposes"
  102. einfo "only. See the copyright notices from the zchaff source files which are"
  103. einfo "included in the LICENSE file."
  104. einfo "To build CVC3 without these files, please build cvc3 without the zchaff"
  105. einfo "use flag (note: zchaff is disabled by default):"
  106. einfo "USE=-zchaff emerge sci-mathemathematics/cvc3"
  107. fi
  108. }
  109. pkg_postrm() {
  110. use emacs && elisp-site-regen
  111. if use isabelle; then
  112. if [[ ! -f "${EROOT%/}/usr/bin/cvc3" && -f "${EROOT%/}/etc/isabelle/components" ]]; then
  113. # Note: this sed should only match the version of this ebuild
  114. # Which is what we want as we do not want to remove the line
  115. # of a new CVC3 being installed during an upgrade.
  116. sed -e "/contrib\/${PN}-${PV}/d" \
  117. -i "${EROOT%/}/etc/isabelle/components" || die "Failed to unregister CVC3 from Isabelle"
  118. fi
  119. fi
  120. }