@@ -0,0 +1,52 @@
1+{ stdenv, fetchgit, emacs, texinfo, texLive, perl, which, automake, enableDoc ? false }:
2+
3+stdenv.mkDerivation (rec {
4+ name = "ProofGeneral-HEAD";
5+
6+ src = fetchgit {
7+ url = "https://github.com/ProofGeneral/PG.git";
8+ rev = "16991280fb09743ae7320aef77f6a166afb907d7";
9+ sha256 = "08zhfl6xbl4q7lrl7wdp72xr155k06778by0d60g28mfx59b7sqc";
10+ };
11+
12+ buildInputs = [ emacs texinfo perl which ] ++ stdenv.lib.optional enableDoc texLive;
13+
14+ prePatch =
15+ '' sed -i "Makefile" \
16+ -e "s|^\(\(DEST_\)\?PREFIX\)=.*$|\1=$out|g ; \
17+ s|/sbin/install-info|install-info|g"
18+
19+
20+ sed -i "bin/proofgeneral" -e's/which/type -p/g'
21+
22+ # @image{ProofGeneral} fails, so remove it.
23+ sed -i '94d' doc/PG-adapting.texi
24+ sed -i '96d' doc/ProofGeneral.texi
25+ '';
26+
27+ patches = [ ./pg.patch ];
28+
29+ preBuild = ''
30+ make clean;
31+ '';
32+
33+ installPhase =
34+ if enableDoc
35+ then
36+ # Copy `texinfo.tex' in the right place so that `texi2pdf' works.
37+ '' cp -v "${automake}/share/"automake-*/texinfo.tex doc
38+ make install install-doc
39+ ''
40+ else "make install";
41+
42+ meta = {
43+ description = "Proof General, an Emacs front-end for proof assistants";
44+ longDescription = ''
45+ Proof General is a generic front-end for proof assistants (also known as
46+ interactive theorem provers), based on the customizable text editor Emacs.
47+ '';
48+ homepage = http://proofgeneral.inf.ed.ac.uk;
49+ license = stdenv.lib.licenses.gpl2Plus;
50+ platforms = stdenv.lib.platforms.unix; # arbitrary choice
51+ };
52+})