isabelle-2016.1.ebuild 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="6"
  4. inherit eutils check-reqs java-pkg-2 versionator
  5. MY_PN="Isabelle"
  6. MY_PV=$(replace_all_version_separators '-')
  7. MY_P="${MY_PN}${MY_PV}"
  8. BP_PV="1.2.1"
  9. BP_PN="bash_process"
  10. BP_P="${BP_PN}-${BP_PV}"
  11. BP_IC_PN="${BP_PN}-isabelle-component"
  12. BP_IC_P="${BP_IC_PN}-${BP_PV}"
  13. # csdp is used in the compile of HOL_ex in
  14. # Library/Sum_of_Squares/sos_wrapper.ML where it execs $ISABELLE_CSDP
  15. CSDP_PV="6.x"
  16. CSDP_PN="csdp"
  17. CSDP_P="${CSDP_PN}-${CSDP_PV}"
  18. CSDP_IC_PN="${CSDP_PN}-isabelle-component"
  19. CSDP_IC_P="${CSDP_IC_PN}-${CSDP_PV}"
  20. ISABELLE_FONTS_PV="20160830"
  21. ISABELLE_FONTS_PN="isabelle_fonts"
  22. ISABELLE_FONTS_P="${ISABELLE_FONTS_PN}-${ISABELLE_FONTS_PV}"
  23. ISABELLE_FONTS_IC_PN="${ISABELLE_FONTS_PN}-isabelle-component"
  24. ISABELLE_FONTS_IC_P="${ISABELLE_FONTS_IC_PN}-${ISABELLE_FONTS_PV}"
  25. JEDIT_PV="20161024"
  26. JEDIT_PN="jedit_build"
  27. JEDIT_P="${JEDIT_PN}-${JEDIT_PV}"
  28. JEDIT_IC_PN="${JEDIT_PN}-isabelle-component"
  29. JEDIT_IC_P="${JEDIT_IC_PN}-${JEDIT_PV}"
  30. JORTHO_PV="1.0-2"
  31. JORTHO_PN="jortho"
  32. JORTHO_P="${JORTHO_PN}-${JORTHO_PV}"
  33. JORTHO_IC_PN="${JORTHO_PN}-isabelle-component"
  34. JORTHO_IC_P="${JORTHO_IC_PN}-${JORTHO_PV}"
  35. JFREECHART_PV="1.0.14-1"
  36. JFREECHART_PN="jfreechart"
  37. JFREECHART_P="${JFREECHART_PN}-${JFREECHART_PV}"
  38. JFREECHART_IC_PN="${JFREECHART_PN}-isabelle-component"
  39. JFREECHART_IC_P="${JFREECHART_IC_PN}-${JFREECHART_PV}"
  40. POLYML_PV="5.6-1"
  41. POLYML_PN="polyml"
  42. POLYML_P="${POLYML_PN}-${POLYML_PV}"
  43. POLYML_IC_PN="${POLYML_PN}-isabelle-component"
  44. POLYML_IC_P="${POLYML_IC_PN}-${POLYML_PV}"
  45. SSH_JAVA_PV="20161009"
  46. SSH_JAVA_PN="ssh-java"
  47. SSH_JAVA_P="${SSH_JAVA_PN}-${SSH_JAVA_PV}"
  48. SSH_JAVA_IC_PN="${SSH_JAVA_PN}-isabelle-component"
  49. SSH_JAVA_IC_P="${SSH_JAVA_IC_PN}-${SSH_JAVA_PV}"
  50. XZ_JAVA_PV="1.5"
  51. XZ_JAVA_PN="xz-java"
  52. XZ_JAVA_P="${XZ_JAVA_PN}-${XZ_JAVA_PV}"
  53. XZ_JAVA_IC_PN="${XZ_JAVA_PN}-isabelle-component"
  54. XZ_JAVA_IC_P="${XZ_JAVA_IC_PN}-${XZ_JAVA_PV}"
  55. SS="2.11"
  56. DESCRIPTION="Isabelle is a generic proof assistant"
  57. HOMEPAGE="http://www.cl.cam.ac.uk/research/hvg/Isabelle/index.html"
  58. SRC_URI="http://isabelle.in.tum.de/website-${MY_P}/dist/${MY_P}.tar.gz
  59. http://isabelle.in.tum.de/dist/contrib/${BP_P}.tar.gz -> ${BP_IC_P}.tar.gz
  60. http://dev.gentoo.org/~gienah/snapshots/${CSDP_IC_P}.tar.gz
  61. http://isabelle.in.tum.de/dist/contrib/${ISABELLE_FONTS_P}.tar.gz -> ${ISABELLE_FONTS_IC_P}.tar.gz
  62. http://isabelle.in.tum.de/components/${JORTHO_P}.tar.gz -> ${JORTHO_IC_P}.tar.gz
  63. http://isabelle.in.tum.de/components/${JEDIT_P}.tar.gz -> ${JEDIT_IC_P}.tar.gz
  64. http://isabelle.in.tum.de/dist/contrib/${JFREECHART_P}.tar.gz -> ${JFREECHART_IC_P}.tar.gz
  65. http://dev.gentoo.org/~gienah/snapshots/${POLYML_IC_P}.tar.gz
  66. http://isabelle.in.tum.de/dist/contrib/${SSH_JAVA_P}.tar.gz -> ${SSH_JAVA_IC_P}.tar.gz
  67. http://dev.gentoo.org/~gienah/snapshots/${XZ_JAVA_IC_P}.tar.gz"
  68. LICENSE="BSD"
  69. SLOT="0/${PV}"
  70. KEYWORDS="~amd64 ~x86"
  71. IUSE="doc graphbrowsing ledit readline"
  72. #upstream says
  73. #bash 2.x/3.x, Poly/ML 5.x, Perl 5.x,
  74. #for document preparation: complete LaTeX
  75. DEPEND=">=app-shells/bash-3.0:*
  76. >=dev-java/jcommon-1.0.18:1.0
  77. dev-java/jortho:0
  78. >=dev-java/jfreechart-1.0.14:1.0
  79. >=dev-java/itext-2.1.5:0
  80. dev-java/xz-java:0
  81. >=dev-lang/ghc-7.6.3
  82. >=dev-lang/polyml-5.6:=[-portable]
  83. >=dev-lang/perl-5.8.8-r2
  84. >=dev-lang/swi-prolog-6.6.6
  85. sci-libs/coinor-csdp
  86. =sci-mathematics/z3-4.4*[isabelle]
  87. >=virtual/jdk-1.8
  88. doc? (
  89. virtual/latex-base
  90. dev-tex/rail
  91. )
  92. >=dev-lang/scala-2.11.8:${SS}
  93. ledit? (
  94. app-misc/ledit
  95. )
  96. readline? (
  97. app-misc/rlwrap
  98. )"
  99. RDEPEND="dev-perl/libwww-perl
  100. sci-mathematics/sha1-polyml
  101. >=virtual/jre-1.8
  102. ${DEPEND}"
  103. S="${WORKDIR}"/Isabelle${MY_PV}
  104. TARGETDIR="/usr/share/Isabelle"
  105. # Notes on QA warnings: * Class files not found via DEPEND in package.env
  106. # Stuff with $ in the name appear to be spurious:
  107. # isabelle/Markup_Tree$$anonfun$results$1$1.class
  108. # scala/tools/nsc/backend/jvm/GenJVM$BytecodeGenerator$$anonfun$computeLocalVarsIndex$1.class
  109. # It wants javafx, I am unsure how to fix this. I test isabelle with the Sun JDK:
  110. # javafx/application/Platform.class javafx
  111. # Presumably the user can provide the jEdit plugins if they are necessary:
  112. # marker/MarkerSetsPlugin.class http://plugins.jedit.org/plugins/?MarkerSets
  113. # projectviewer/gui/OptionPaneBase.class http://plugins.jedit.org/plugins/?ProjectViewer
  114. JAVA_GENTOO_CLASSPATH="itext,jcommon-1.0,jortho,jfreechart-1.0,scala-${SS},xz-java"
  115. CHECKREQS_MEMORY="8192M"
  116. CHECKREQS_DISK_BUILD="17G"
  117. CHECKREQS_DISK_USR="8G"
  118. src_unpack() {
  119. unpack "${MY_P}.tar.gz"
  120. cd "${S}/contrib" || die
  121. unpack ${BP_IC_P}.tar.gz
  122. unpack ${CSDP_IC_P}.tar.gz
  123. unpack ${ISABELLE_FONTS_IC_P}.tar.gz
  124. unpack ${JEDIT_IC_P}.tar.gz
  125. unpack ${JORTHO_IC_P}.tar.gz
  126. unpack ${JFREECHART_IC_P}.tar.gz
  127. unpack ${POLYML_IC_P}.tar.gz
  128. unpack ${SSH_JAVA_IC_P}.tar.gz
  129. unpack ${XZ_JAVA_IC_P}.tar.gz
  130. }
  131. pkg_setup() {
  132. java-pkg-2_pkg_setup
  133. check-reqs_pkg_setup
  134. }
  135. src_prepare() {
  136. java-pkg-2_src_prepare
  137. java-pkg_getjars ${JAVA_GENTOO_CLASSPATH}
  138. rm -rf "${S}/contrib/${BP_P}/{x86-cygwin,x86-darwin,x86_64-darwin,x86-linux,x86_64-linux}" \
  139. || die "Could not remove bash_process binaries"
  140. rm -f "${S}/contrib/${JORTHI_P}/${JORTHO_PN}.jar" \
  141. || die "Could not remove contrib/${JORTHI_P}/${JORTHO_PN}.jar"
  142. eapply "${FILESDIR}/${PN}-2016-classpath.patch"
  143. eapply "${FILESDIR}/${PN}-2016-jfreechart-classpath.patch"
  144. eapply "${FILESDIR}/${PN}-2016.1-bash_process-1.2.1-settings.patch"
  145. eapply "${FILESDIR}/${PN}-2012-graphbrowser.patch"
  146. eapply "${FILESDIR}/${PN}-2016.1-libsha1.patch"
  147. eapply "${FILESDIR}/${PN}-2016.1-smt_timeout.patch"
  148. eapply "${FILESDIR}/${PN}-2016.1-smt_read_only_certificates.patch"
  149. eapply "${FILESDIR}/${PN}-2016.1-disable-jedit-build-after-install.patch"
  150. eapply "${FILESDIR}/${PN}-2016.1-jortho-1.0-2-classpath.patch"
  151. local polymlver=$(poly -v | cut -d' ' -f2)
  152. local polymlarch=$(poly -v | cut -d' ' -f9 | cut -d'-' -f1)
  153. cat <<- EOF >> "${S}/etc/settings"
  154. # Poly/ML Gentoo (${polymlarch,,})
  155. ML_PLATFORM=${polymlarch,,}-linux
  156. ML_HOME="${ROOT}usr/bin"
  157. ML_SYSTEM=polyml-${polymlver}
  158. ML_OPTIONS="-H 1000"
  159. ML_SOURCES="${ROOT}usr/src/debug/dev-lang/polyml-${polymlver}"
  160. ISABELLE_GHC="${ROOT}usr/bin/ghc"
  161. ISABELLE_OCAML="${ROOT}usr/bin/ocaml"
  162. ISABELLE_SWIPL="${ROOT}usr/bin/swipl"
  163. ISABELLE_JDK_HOME="\$(java-config --jdk-home)"
  164. ISABELLE_BUILD_JAVA_OPTIONS="-Djava.awt.headless=true"
  165. SCALA_HOME="${ROOT}usr/share/scala-${SS}"
  166. SHA1_HOME="${ROOT}usr/$(get_libdir)/sha1-polyml"
  167. EOF
  168. local Z3_P="$(best_version sci-mathematics/z3 | sed 's:sci-mathematics/::')"
  169. cat <<- EOF >> "${S}/etc/components"
  170. #bundled components
  171. contrib/${BP_P}
  172. contrib/${CSDP_P}
  173. contrib/${ISABELLE_FONTS_P}
  174. contrib/${JEDIT_P}
  175. contrib/${JORTHO_P}
  176. contrib/${JFREECHART_P}
  177. contrib/${POLYML_P}
  178. contrib/${SSH_JAVA_P}
  179. contrib/${XZ_JAVA_P}
  180. contrib/${Z3_P}
  181. EOF
  182. local Z3_RC="${ROOT}usr/share/Isabelle/contrib/${Z3_P}"
  183. [ -d "${Z3_RC}" ] \
  184. || die "z3 isabelle component directory ${Z3_RC} does not exist"
  185. ln -s "${Z3_RC}" \
  186. "${S}/contrib/${Z3_P}" \
  187. || die "Failed to create z3 isabelle component symbolic link"
  188. if use ledit && ! use readline; then
  189. eapply "${FILESDIR}/${PN}-2012-reverse-line-editor-order.patch"
  190. fi
  191. rm -f "${S}/contrib/${JFREECHART_P}/lib"/*.jar \
  192. || die "Could not rm bundled jar files supplied by Gentoo"
  193. }
  194. src_compile() {
  195. unset DISPLAY
  196. einfo "Building Isabelle. This may take some time."
  197. pushd contrib/${BP_P} || die "Could not cd to contrib/${BP_P}"
  198. $(tc-getCC) ${CFLAGS} ${LDFLAGS} -o ${BP_PN} ${BP_PN}.c \
  199. || die "Could not build ${BP_PN}"
  200. popd || die
  201. if use graphbrowsing
  202. then
  203. rm -f "${S}/lib/browser/GraphBrowser.jar" \
  204. || die "failed cleaning graph browser directory"
  205. pushd "${S}/lib/browser" \
  206. || die "Could not change directory to lib/browser"
  207. ./build || die "failed building the graph browser"
  208. popd
  209. fi
  210. ./bin/isabelle jedit -b -f || die "pide build failed"
  211. pushd "${S}"/src/Pure || die "Could not change directory to src/Pure"
  212. ../../bin/isabelle env ./build-jars -f || die "build-jars failed"
  213. popd || die
  214. ./bin/isabelle build -a -b -s -v || die "isabelle build failed"
  215. }
  216. src_install() {
  217. local Z3_P="$(best_version sci-mathematics/z3 | sed 's:sci-mathematics/::')"
  218. rm "${S}/contrib/${Z3_P}" \
  219. || die "Failed to remove z3 isabelle component symbolic link"
  220. insinto ${TARGETDIR}
  221. doins -r src
  222. doins -r lib
  223. doins -r contrib
  224. doins ROOTS
  225. docompress -x /usr/share/doc/${PF}
  226. dodoc -r doc
  227. if use doc; then
  228. dosym /usr/share/doc/${PF}/doc "${TARGETDIR}/doc"
  229. # The build of sci-mathematics/haskabelle with use doc requires
  230. # sci-mathematics/isabelle[doc?]. The haskabelle doc build requires
  231. # the src/Doc directory stuff in the isabelle package.
  232. doins -r src/Doc
  233. for i in $(find ./src/Doc -type f -executable -print)
  234. do
  235. exeinto $(dirname "${TARGETDIR}/${i}")
  236. doexe ${i}
  237. done
  238. fi
  239. for i in $(find \
  240. ./{bin,lib,"contrib/${BP_P}/${BP_PN}",src/HOL,src/Pure,src/Tools} \
  241. -type f -executable -print)
  242. do
  243. exeinto $(dirname "${TARGETDIR}/${i}")
  244. doexe ${i}
  245. done
  246. insinto /etc/isabelle
  247. doins -r etc/*
  248. dosym /etc/isabelle "${TARGETDIR}/etc"
  249. local LIBDIR="/usr/"$(get_libdir)"/Isabelle"${MY_PV}
  250. dosym "${LIBDIR}/heaps" "${TARGETDIR}/heaps"
  251. insinto ${LIBDIR}
  252. doins -r heaps
  253. ./bin/isabelle install -d ${TARGETDIR} "${ED}usr/bin" \
  254. || die "isabelle install failed"
  255. newicon lib/icons/"${PN}.xpm" "${PN}.xpm"
  256. newicon lib/icons/"${PN}-mini.xpm" "${PN}-mini.xpm"
  257. java-pkg_regjar \
  258. $(find . -type f -name \*.jar -print | sed -e "s@^\.@${ED}${TARGETDIR}@g")
  259. local DOCS=( "ANNOUNCE" "CONTRIBUTORS" "COPYRIGHT" "NEWS" "README" )
  260. einstalldocs
  261. }
  262. pkg_postinst() {
  263. # If any of the directories in /etc/isabelle/components do not exist, then
  264. # even isabelle getenv ISABELLE_HOME fails. Hence it is necessary to
  265. # to delete any non-existing directories. If an old Isabelle version was
  266. # installed with component ebuilds like sci-mathematics/e, then the
  267. # Isabelle version is upgraded, then the contrib directories will not
  268. # exist initially, it is necessary to delete them from /etc/isabelle/components.
  269. # Then these components are rebuilt (creating these directories) using the
  270. # EAPI=5 subslot depends.
  271. for i in $(egrep '^[^#].*$' "${ROOT}etc/isabelle/components")
  272. do
  273. if [ ! -d ${TARGETDIR}/${i} ]; then
  274. sed -e "\@${i}@d" -i "${ROOT}etc/isabelle/components"
  275. fi
  276. done
  277. if use ledit && use readline; then
  278. elog "Both readline and ledit use flags specified. The default setting"
  279. elog "if both are installed is to use readline (rlwrap), this can be"
  280. elog "modfied by editing the ISABELLE_LINE_EDITOR setting in"
  281. elog "${ROOT}/etc/isabelle/settings"
  282. fi
  283. elog "Please ensure you have a pdf viewer installed, for example:"
  284. elog "As root: emerge app-text/zathura-pdf-poppler"
  285. elog "Please configure your preferred pdf viewer, something like:"
  286. elog "As normal user: xdg-mime default zathura.desktop application/pdf"
  287. elog "Or alternatively by editing the PDF_VIEWER variable in the system"
  288. elog "settings file ${ROOT}etc/isabelle/settings and/or the user"
  289. elog "settings file \$HOME/.isabelle/${MY_P}/etc/settings"
  290. elog "For nitpick it is necessary to install:"
  291. elog "emerge sci-mathematics/kodkodi"
  292. }