09b853b
%global opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0)
09b853b
%global debug_package %{nil}
09b853b
%global tar_base_name coq-%{version}
09b853b
%global tex_dir %{_texmf_vendor}/tex/latex/misc
09b853b
70caa8f
# Upstream includes option for generation of optimized binaries,
70caa8f
# however, specifically generates bytecode versions for certain
70caa8f
# executables even when optimized option is set, namely the following:
70caa8f
70caa8f
# coq-tex, coq_makefile, coq-interface, coqwc, coqdoc, parser, coqdep,
70caa8f
# gallina
70caa8f
70caa8f
# (coqtop.byte, coqide.byte binaries are also made available.)
70caa8f
70caa8f
# .coqide-gtk2rc also produces an rpmlint warning due to its name,
70caa8f
# however, this name is proper as per the Coq documentation
70caa8f
f181a00
Name:           coq
9abe3a9
Version:        8.3pl2
cb1e9d8
Release:        2%{?dist}
09b853b
Summary:        Proof management system
f181a00
f181a00
Group:          Applications/Engineering
f181a00
License:        LGPLv2
f181a00
URL:            http://coq.inria.fr/
f181a00
Source0:        http://coq.inria.fr/V%{version}/files/%{tar_base_name}.tar.gz
f181a00
Source1:        coqide.desktop
f181a00
Source2:        README.coq-emacs
09b853b
Source3:        README.coq-xemacs
dd74bac
Source4:        coq.xml
09b853b
# This patch was suggested by upstream to workaround a camlp5 bug (691913).
09b853b
# Remove this once ocaml-camlp5 > 6.02.2 is available.
09b853b
Patch0:         coq-camlp5-bug.patch
09b853b
09b853b
BuildRequires:  ocaml >= 3.10.0, ocaml-camlp5-devel, ocaml-lablgtk-devel
09b853b
BuildRequires:  desktop-file-utils, emacs-nox, xemacs-nox
09b853b
BuildRequires:  emacs-proofgeneral, xemacs-proofgeneral
f181a00
# For documentation
09b853b
BuildRequires:  tex(latex), hevea
09b853b
Requires(posttrans): tex(tex)
09b853b
Requires(postun): tex(tex)
09b853b
9abe3a9
# This should always match the list in the ocaml spec file.
9abe3a9
# TODO: ppc64 is NOT currently on this list, due to a missing hevea package.
9abe3a9
ExclusiveArch: alpha armv4l %{ix86} ia64 x86_64 ppc sparc sparcv9
70caa8f
70caa8f
%description
70caa8f
Coq is a formal proof management system. It allows for the development
70caa8f
of theorems through first order logic that are mechanically checked by
70caa8f
the machine. Sets of definitions and theorems can be saved as compiled
70caa8f
modules and loaded into the system.
70caa8f
70caa8f
This package provides the main Coq binary without an optional IDE,
70caa8f
Coqide.
70caa8f
70caa8f
# The IDE's package name will become "coq-coqide".  That way,
70caa8f
# searching for either "coqide" (the Ubuntu/Debian package name, and
70caa8f
# also the full name of the IDE) or "coq" and "ide" will find
70caa8f
# this. (If the package were named "coq-ide", the former would fail.)
70caa8f
%package coqide
f181a00
Group:          Applications/Engineering
f181a00
Summary:        Coqide IDE for Coq proof management system
09b853b
Requires:       %{name} = %{version}-%{release}, xdg-utils
70caa8f
70caa8f
%description coqide
70caa8f
Coq is a formal proof management system. It allows for the development
70caa8f
of theorems through first order logic that are mechanically checked by
70caa8f
the machine. Sets of definitions and theorems can be saved as compiled
70caa8f
modules and loaded into the system.
70caa8f
70caa8f
This package provides Coqide, a lightweight IDE for Coq.
70caa8f
70caa8f
%package doc
f181a00
Group:          Applications/Engineering
f181a00
License:        Open Publication
f181a00
Summary:        Documentation for Coq proof management system
09b853b
BuildArch:      noarch
70caa8f
70caa8f
%description doc
70caa8f
Coq is a formal proof management system. It allows for the development
70caa8f
of theorems through first order logic that are mechanically checked by
70caa8f
the machine. Sets of definitions and theorems can be saved as compiled
70caa8f
modules and loaded into the system.
70caa8f
70caa8f
This package provides documentation and tutorials for the system. The
70caa8f
main documentation comes in two parts: the main Library documentation,
09b853b
which describes all Coq.* modules, and the Reference Manual, which
70caa8f
gives a more complete description of the whole system. Included are
70caa8f
also HTML versions of both. Furthermore, there are two tutorials, the
70caa8f
main one, and one specifically on recursive types. The example code
70caa8f
for the latter is also included.
70caa8f
70caa8f
%package emacs
f181a00
Group:          Applications/Engineering
09b853b
Summary:        GNU Emacs support for Coq proof management system
09b853b
Requires:       %{name} = %{version}-%{release}
09b853b
Requires:       emacs(bin) >= %{_emacs_version}
09b853b
Requires:       emacs-proofgeneral
09b853b
BuildArch:      noarch
70caa8f
70caa8f
%description emacs
09b853b
This package provides GNU Emacs mode files for formatting Coq input.
70caa8f
09b853b
%package emacs-el
09b853b
Group:          Applications/Engineering
09b853b
Summary:        Elisp source files for Coq proof management system
09b853b
Requires:       %{name}-emacs = %{version}-%{release}
09b853b
BuildArch:      noarch
70caa8f
09b853b
%description emacs-el
09b853b
This package contains the Elisp source files for Coq's Emacs support.
09b853b
This package is not needed to use the Emacs interface.
70caa8f
09b853b
%package xemacs
09b853b
Group:          Applications/Engineering
09b853b
Summary:        XEmacs support for Coq proof management system
09b853b
Requires:       %{name} = %{version}-%{release}
09b853b
Requires:       xemacs(bin) >= %{_xemacs_version}
09b853b
Requires:       xemacs-proofgeneral
09b853b
BuildArch:      noarch
70caa8f
09b853b
%description xemacs
09b853b
This package provides XEmacs mode files for formatting Coq input.
70caa8f
09b853b
%package xemacs-el
09b853b
Group:          Applications/Engineering
09b853b
Summary:        Elisp source files for Coq proof management system
09b853b
Requires:       %{name}-xemacs = %{version}-%{release}
09b853b
BuildArch:      noarch
70caa8f
09b853b
%description xemacs-el
09b853b
This package contains the Elisp source files for Coq's XEmacs support.
09b853b
This package is not needed to use the XEmacs interface.
affd8f0
09b853b
%prep
09b853b
%setup -q -n %{tar_base_name}
09b853b
%patch0
8dd82f7
70caa8f
# Fix some files that are not in UTF-8 encoding
70caa8f
09b853b
for f in CHANGES CREDITS doc/LICENSE; do
09b853b
  iconv -f ISO-8859-1 -t UTF-8 -o $f.utf8 $f
09b853b
  touch -r $f $f.utf8
09b853b
  mv -f $f.utf8 $f
70caa8f
done
70caa8f
09b853b
cp -p %SOURCE1 %SOURCE2 %SOURCE3 .
70caa8f
70caa8f
%build
70caa8f
# Define opt flag based upon prior opt detection and restrictions
70caa8f
%if %{opt}
48f8ea1
%global opt_option --opt
70caa8f
%else
48f8ea1
%global opt_option --byte-only
70caa8f
%endif
70caa8f
f181a00
%global coqdocdir %{_defaultdocdir}/coq-%{version}
f181a00
09b853b
./configure -prefix %{_prefix}     \
09b853b
            -libdir %{_libdir}/coq \
09b853b
            -bindir %{_bindir}     \
09b853b
            -mandir %{_mandir}     \
09b853b
            -docdir %{coqdocdir}   \
09b853b
            -emacs %{_emacs_sitelispdir} \
09b853b
            -coqdocdir %{tex_dir}  \
f181a00
            %{opt_option} \
09b853b
            -browser "xdg-open %s" \
09b853b
            -camlp5dir %{_libdir}/ocaml/camlp5
48f8ea1
48f8ea1
export CAML_LD_LIBRARY_PATH=`pwd`/kernel/byterun:${CAML_LD_LIBRARY_PATH}
6826838
make world VERBOSE=1
70caa8f
09b853b
# Strip shared objects (not sure where the best location for a
09b853b
# makefile patch for this would be).
48f8ea1
strip kernel/byterun/dllcoqrun.so
09b853b
find plugins -name \*.cmxs | xargs strip
48f8ea1
70caa8f
%install
09b853b
make COQINSTALLPREFIX="%{buildroot}%{_prefix}" OLDROOT="%{_prefix}" install
70caa8f
70caa8f
# Install desktop icon and menu entry
70caa8f
09b853b
%global coqdatadir %{_libdir}/coq
70caa8f
%if %(test -d %{buildroot}%{coqdatadir} && echo 1 || echo 0) != 1
70caa8f
mkdir -p %{buildroot}%{coqdatadir}
70caa8f
%endif
70caa8f
48f8ea1
sed -i -e 's|ICON-LOCATION-BASE|%{coqdatadir}/ide/coq.png|' coqide.desktop
70caa8f
f181a00
desktop-file-install --vendor="fedora"                  \
f181a00
--dir=%{buildroot}%{_datadir}/applications              \
70caa8f
coqide.desktop
70caa8f
9abe3a9
# Temporary workaround for coq 8.3 install bugs.
09b853b
# These files have to be installed for coq's provides to match its requires.
09b853b
cp -p plugins/dp/fol.cmi %{buildroot}%{coqdatadir}/plugins/dp
09b853b
cp -p plugins/extraction/miniml.cmi %{buildroot}%{coqdatadir}/plugins/extraction
09b853b
cp -p plugins/micromega/sos_lib.cmi %{buildroot}%{coqdatadir}/plugins/micromega
09b853b
cp -p proofs/decl_expr.cmi %{buildroot}%{coqdatadir}/proofs
09b853b
09b853b
# Make a MIME type for .v files
09b853b
mkdir -p %{buildroot}%{_datadir}/mime/packages
09b853b
cp -p %{SOURCE4} %{buildroot}%{_datadir}/mime/packages
09b853b
87f56ea
# Install main Coq .v files
87f56ea
09b853b
for f in `find plugin theories -name '*.v' -type f`; do
48f8ea1
mkdir -p %{buildroot}%{coqdatadir}/`dirname $f` && cp -p $f %{buildroot}%{coqdatadir}/`dirname $f`
87f56ea
done
87f56ea
70caa8f
# Install tutorial code
cb1e9d8
%global tutorialcodedir %{coqdatadir}/RecTutorial
70caa8f
%if %(test -d %{buildroot}%{tutorialcodedir} && echo 1 || echo 0) != 1
70caa8f
mkdir -p %{buildroot}%{tutorialcodedir}
70caa8f
%endif
09b853b
cp -p doc/RecTutorial/RecTutorial.v %{buildroot}%{tutorialcodedir}
09b853b
ln -s %{tutorialcodedir} %{buildroot}%{coqdatadir}/RecTutorial
09b853b
f181a00
# Install documentation not installed by install-doc in Makefile
f181a00
for f in CHANGES COMPATIBILITY COPYRIGHT CREDITS INSTALL LICENSE README;
09b853b
do cp -p $f %{buildroot}%{coqdocdir};
f181a00
done
70caa8f
09b853b
# We don't need both PostScript and PDF documentation
09b853b
rm -fr %{buildroot}%{coqdocdir}/ps
774db2a
f181a00
# Don't install libcoqrun.a (it might not exist, but get rid of it if it does)
f181a00
rm -f %{buildroot}%{coqdatadir}/libcoqrun.a
f181a00
09b853b
# Copy the Emacs support files for XEmacs, and byte compile
09b853b
mkdir -p %{buildroot}%{_xemacs_sitelispdir}/coq
09b853b
cp -p %{buildroot}%{_emacs_sitelispdir}/* %{buildroot}%{_xemacs_sitelispdir}/coq
09b853b
cd %{buildroot}%{_xemacs_sitelispdir}/coq
09b853b
%{_xemacs_bytecompile} *.el
09b853b
09b853b
# Move Emacs support files to a subdir and byte compile
09b853b
mkdir -p %{buildroot}%{_emacs_sitelispdir}/coq
09b853b
cd %{buildroot}%{_emacs_sitelispdir}/coq
09b853b
mv ../*.el .
09b853b
%{_emacs_bytecompile} *.el
09b853b
09b853b
%posttrans
09b853b
mktexlsr &> /dev/null || :
09b853b
update-mime-database %{_datadir}/mime &> /dev/null || :
09b853b
update-desktop-database -q &> /dev/null || :
09b853b
09b853b
%postun
09b853b
if [ $1 -eq 0 ]; then
09b853b
  update-desktop-database -q &> /dev/null
09b853b
  update-mime-database %{_datadir}/mime &> /dev/null || :
09b853b
  mktexlsr &> /dev/null
09b853b
fi
70caa8f
70caa8f
# Note: we want to keep both coqtop.opt and coqtop.byte because the
70caa8f
# byte compiled version can be used to compile new version through
70caa8f
# coqmktop
70caa8f
48f8ea1
# Exclude libcoqrun.a only when it is installed (this appears to be
48f8ea1
# only for the native compile case)
48f8ea1
70caa8f
%files
70caa8f
%defattr(-,root,root,-)
f181a00
# DON'T use the doc macro here or else it wipes out all the other documentation installed!
f181a00
%{_mandir}/man1/*
87f56ea
%{coqdatadir}
70caa8f
%{_bindir}/coq*
70caa8f
%{_bindir}/gallina
70caa8f
%exclude %{_bindir}/coqide*
87f56ea
%exclude %{coqdatadir}/ide
70caa8f
%if %{opt}
cb1e9d8
%exclude %{coqdatadir}/*/*.cmxa
cb1e9d8
%exclude %{coqdatadir}/*/*.a
70caa8f
%endif
70caa8f
%{tex_dir}/coq*
f181a00
# A few documentation files here should stay in the main package (and
f181a00
# are excluded from doc), but the bulk of the documentation is in the
f181a00
# doc subpackage
f181a00
%dir %{coqdocdir}
f181a00
%{coqdocdir}/CHANGES
f181a00
%{coqdocdir}/COMPATIBILITY
f181a00
%{coqdocdir}/COPYRIGHT
f181a00
%{coqdocdir}/CREDITS
f181a00
%{coqdocdir}/INSTALL
f181a00
%{coqdocdir}/LICENSE
f181a00
%{coqdocdir}/README
70caa8f
70caa8f
%files coqide
70caa8f
%defattr(-,root,root,-)
70caa8f
%doc INSTALL.ide
70caa8f
%{_bindir}/coqide*
48f8ea1
%{coqdatadir}/ide
cb1e9d8
%exclude %{coqdatadir}/ide/ide.cmxa
cb1e9d8
%exclude %{coqdatadir}/ide/ide.a
70caa8f
70caa8f
# Is it ok to assume this is what desktop-file-install renames coqide.desktop to?
70caa8f
%{_datadir}/applications/fedora-coqide.desktop
dd74bac
%{_datadir}/mime/packages/coq.xml
70caa8f
70caa8f
%files doc
70caa8f
%defattr(-,root,root,-)
f181a00
%{coqdocdir}/*
f181a00
%exclude %{coqdocdir}/CHANGES
f181a00
%exclude %{coqdocdir}/COMPATIBILITY
f181a00
%exclude %{coqdocdir}/COPYRIGHT
f181a00
%exclude %{coqdocdir}/CREDITS
f181a00
%exclude %{coqdocdir}/INSTALL
f181a00
%exclude %{coqdocdir}/LICENSE
f181a00
%exclude %{coqdocdir}/README
70caa8f
70caa8f
%files emacs
70caa8f
%defattr(-,root,root,-)
09b853b
%dir %{_emacs_sitelispdir}/coq
09b853b
%{_emacs_sitelispdir}/coq/*.elc
70caa8f
%doc README.coq-emacs
70caa8f
09b853b
%files emacs-el
09b853b
%defattr(-,root,root,-)
09b853b
%{_emacs_sitelispdir}/coq/*.el
09b853b
09b853b
%files xemacs
09b853b
%defattr(-,root,root,-)
09b853b
%dir %{_xemacs_sitelispdir}/coq
09b853b
%{_xemacs_sitelispdir}/coq/*.elc
09b853b
%doc README.coq-xemacs
09b853b
09b853b
%files xemacs-el
09b853b
%defattr(-,root,root,-)
09b853b
%{_xemacs_sitelispdir}/coq/*.el
09b853b
70caa8f
%changelog
cb1e9d8
* Wed Jun 15 2011 Jerry James <loganjerry@gmail.com> - 8.3pl2-2
cb1e9d8
- Remove workaround for bad documentation link in 8.3pl1, fixed in 8.3pl2
cb1e9d8
- Revert change in 8.3pl1-1 to split arch-specific stuff from noarch stuff.
cb1e9d8
  Coq tactics are written in ocaml, which compiles to arch-specific files,
cb1e9d8
  and those files are stored in the same place as the noarch proof files.
5f19ebe
- Move tutorial code into main package; it is small and we can then leave
5f19ebe
  all the rest of the documentation as noarch
cb1e9d8
9abe3a9
* Tue Apr 26 2011 Jerry James <loganjerry@gmail.com> - 8.3pl2-1
9abe3a9
- New upstream release
9abe3a9
- Change the list of supported arches to match the ocaml list, except for
9abe3a9
  ppc64, which is missing hevea
9abe3a9
dd74bac
* Mon Apr  4 2011 Jerry James <loganjerry@gmail.com> - 8.3pl1-2
dd74bac
- Change the mime type to application/x-coq, and inherit from text/plain
dd74bac
  (bz 530254)
dd74bac
09b853b
* Thu Mar 31 2011 Jerry James <loganjerry@gmail.com> - 8.3pl1-1
09b853b
- New upstream release
09b853b
- Drop BuildRoot tag and clean section
09b853b
- Drop all patches (all merged or otherwise fixed upstream)
09b853b
- Comply with latest Ocaml packaging specs
09b853b
- Identify xdg-open as the default web browser
09b853b
- Comply with the emacs packaging guidelines, and build an XEmacs package
09b853b
- The -doc and -emacs* subpackages are now noarch
09b853b
- Workaround bug 691913
09b853b
- Drop PostScript documentation; it's identical to PDF documentation
09b853b
- Deal with arch-specific files in /usr/share; install everything to libdir,
09b853b
  then move the noarch stuff to datadir, but leave symlinks behind
09b853b
- Add a new mime type application/x-coqide and use it in the desktop file
09b853b
- Add post and postun scripts
09b853b
f7f5d5b
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 8.2pl1-2
f7f5d5b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
f7f5d5b
f181a00
* Wed Aug 05 2009 Alan Dunn <amdunn@gmail.com> - 8.2pl1-1
f181a00
- New upstream release
f181a00
- Eliminated modification of tar_base_name that occurred for only version 8.2
f181a00
- Added reference to bugzilla bug for ppc64 ExcludeArch
f181a00
- HTML form of documentation seems to no longer be distributed -> must generate
f181a00
  Decided for consistency to generate all documentation
f181a00
- Additional file for iconv - documentation license file
f181a00
- Changed tutorial directory name, now also using bundled version
f181a00
  of tutorial
f181a00
415eedf
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 8.2-2
415eedf
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
415eedf
48f8ea1
* Thu Jun 18 2009 Alan Dunn <amdunn@gmail.com> - 8.2-1
48f8ea1
- New upstream release
48f8ea1
- Seems documentation license has changed or wasn't explicitly stated
48f8ea1
  before, fixed (is ok Fedora license)
48f8ea1
- Added versioning to documentation
48f8ea1
- Removed special OCaml, TeX logic for Fedora < 9 (no longer relevant)
48f8ea1
- Dropped makefile patch for compiling grammar.cma (fixed in Coq 8.2)
48f8ea1
- Dropped cmxa-install patch (fixed in Coq 8.2)
48f8ea1
- Changed makefile-strip patch and name (not yet fixed upstream...)
48f8ea1
- Changed check.patch -> coq-check-(version).patch, slightly changed
48f8ea1
  for 8.2 (not yet fixed upstream...)
48f8ea1
- Dropped parser-renaming makefile-parser.patch, parser-man.patch
48f8ea1
  (fixed in Coq 8.2)
48f8ea1
- Dropped coq-lablgtk-2.12.patch (fixed in Coq 8.2)
48f8ea1
- Changed way source (.v) files are installed
48f8ea1
- Stopped addition of other icon file (icon fixed in Coq 8.2)
48f8ea1
- Bytecode executables are now "clean" (not build with custom -> don't
48f8ea1
  need to configure prelink around these)
48f8ea1
- define -> global
48f8ea1
- Added ExcludeArch sparc64
48f8ea1
57b8a17
* Wed Jun 17 2009 S390x secondary arch maintainer <fedora-s390x@lists.fedoraproject.org> 8.1pl4-3.1
57b8a17
- ExcludeArch s390, s390x as we don't have OCaml on those archs
57b8a17
5ba4127
* Wed Mar 04 2009 Alan Dunn <amdunn@gmail.com> - 8.1pl4-3
8dd82f7
- Minor change to cmxa-install patch instruction
8dd82f7
- Fixed to work with lablgtk 2.12
d76870d
5ba4127
* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 8.1pl4-2
5ba4127
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild 
5ba4127
6826838
* Fri Dec  5 2008 Richard W.M. Jones <rjones@redhat.com> - 8.1pl4-1
6826838
- New upstream version 8.1pl4.
6826838
- Attempt to rebuild against OCaml 3.11.0.
6826838
- Run make with VERBOSE=1 so we can see the actual commands.
6826838
- Pass -camlp5dir to configure so it uses camlp5 (overriding existence
6826838
  of camlp4 if it happens to be installed).
6826838
87f56ea
* Wed Oct 22 2008 Alan Dunn <amdunn@gmail.com> 8.1pl3-5
87f56ea
- Added Coq .v files into the main package at user request.
6826838
774db2a
* Tue Sep 09 2008 Alan Dunn <amdunn@gmail.com> 8.1pl3-4
774db2a
- Added creation of prelink blacklist for any bytecode files.
774db2a
- Fixed execstack status for binaries.
6826838
affd8f0
* Tue Aug 05 2008 Alan Dunn <amdunn@gmail.com> 8.1pl3-3
affd8f0
- Changed parser to coq-parser to avoid name conflict with
affd8f0
  coda-client.
affd8f0
- Made make process noisy again.
6826838
affd8f0
* Sun Jul 20 2008 Alan Dunn <amdunn@gmail.com> 8.1pl3-2.1
affd8f0
- Minor bump for Fedora 8 to bring it into line with the rest.
6826838
82dc51b
* Thu Jul 17 2008 Alan Dunn <amdunn@gmail.com> 8.1pl3-2
82dc51b
- Added check for Fedora distribution number to allow for Fedora 8 release.
6826838
70caa8f
* Wed Jun 14 2008 Alan Dunn <amdunn@gmail.com> 8.1pl3-1
70caa8f
- Initial Fedora RPM version.