Blob Blame History Raw
%global opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0)
%global tex_dir %{_datadir}/texmf/tex/latex
%if !%{opt}
%global debug_package %{nil}
%endif

# Upstream includes option for generation of optimized binaries,
# however, specifically generates bytecode versions for certain
# executables even when optimized option is set, namely the following:

# coq-tex, coq_makefile, coq-interface, coqwc, coqdoc, parser, coqdep,
# gallina

# (coqtop.byte, coqide.byte binaries are also made available.)

# .coqide-gtk2rc also produces an rpmlint warning due to its name,
# however, this name is proper as per the Coq documentation

Name:           coq
Version:        8.4pl4
Release:        1%{?dist}
Summary:        Proof management system

Group:          Applications/Engineering
License:        LGPLv2
URL:            http://coq.inria.fr/
Source0:        http://coq.inria.fr/V%{version}/files/%{name}-%{version}.tar.gz
Source1:        coqide.desktop
Source2:        README.coq-emacs
Source4:        coq.xml
Source5:        coqide.appdata.xml

BuildRequires:  ocaml
BuildRequires:  ocaml-camlp5-devel
BuildRequires:  ocaml-lablgtk-devel
BuildRequires:  csdp-tools
BuildRequires:  desktop-file-utils
BuildRequires:  emacs-nox
BuildRequires:  emacs-proofgeneral

# For documentation
BuildRequires:  hevea
BuildRequires:  tex(latex)
BuildRequires:  tex(comment.sty)
BuildRequires:  tex(epic.sty)
BuildRequires:  tex(fullpage.sty)
BuildRequires:  tex(moreverb.sty)
BuildRequires:  tex(multirow.sty)
BuildRequires:  tex(stmaryrd.sty)
BuildRequires:  tex(utf8x.def)
BuildRequires:  tex-cm-super
BuildRequires:  tex-courier
BuildRequires:  tex-ec
BuildRequires:  tex-helvetic
BuildRequires:  tex-symbol
BuildRequires:  tex-times
BuildRequires:  tex-zapfchan
BuildRequires:  tex-zapfding

Requires:       csdp-tools
Requires(posttrans): tex(tex)
Requires(postun): tex(tex)

ExclusiveArch: %{ocaml_arches}

%description
Coq is a formal proof management system. It allows for the development
of theorems through first order logic that are mechanically checked by
the machine. Sets of definitions and theorems can be saved as compiled
modules and loaded into the system.

This package provides the main Coq binary without an optional IDE,
Coqide.

# The IDE's package name will become "coq-coqide".  That way,
# searching for either "coqide" (the Ubuntu/Debian package name, and
# also the full name of the IDE) or "coq" and "ide" will find
# this. (If the package were named "coq-ide", the former would fail.)
%package coqide
Group:          Applications/Engineering
Summary:        Coqide IDE for Coq proof management system
Requires:       %{name} = %{version}-%{release}, xdg-utils

%description coqide
Coq is a formal proof management system. It allows for the development
of theorems through first order logic that are mechanically checked by
the machine. Sets of definitions and theorems can be saved as compiled
modules and loaded into the system.

This package provides Coqide, a lightweight IDE for Coq.

%package doc
Group:          Applications/Engineering
License:        Open Publication
Summary:        Documentation for Coq proof management system
BuildArch:      noarch

%description doc
Coq is a formal proof management system. It allows for the development
of theorems through first order logic that are mechanically checked by
the machine. Sets of definitions and theorems can be saved as compiled
modules and loaded into the system.

This package provides documentation and tutorials for the system. The
main documentation comes in two parts: the main Library documentation,
which describes all Coq.* modules, and the Reference Manual, which
gives a more complete description of the whole system. Included are
also HTML versions of both. Furthermore, there are two tutorials, the
main one, and one specifically on recursive types. The example code
for the latter is also included.

%package emacs
Group:          Applications/Engineering
Summary:        GNU Emacs support for Coq proof management system
Requires:       %{name} = %{version}-%{release}
Requires:       emacs(bin) >= %{_emacs_version}
Requires:       emacs-proofgeneral
BuildArch:      noarch

%description emacs
This package provides GNU Emacs mode files for formatting Coq input.

%package emacs-el
Group:          Applications/Engineering
Summary:        Elisp source files for Coq proof management system
Requires:       %{name}-emacs = %{version}-%{release}
BuildArch:      noarch

%description emacs-el
This package contains the Elisp source files for Coq's Emacs support.
This package is not needed to use the Emacs interface.

%prep
%setup -q

# Fix some files that are not in UTF-8 encoding

for f in CREDITS doc/LICENSE; do
  iconv -f ISO-8859-1 -t UTF-8 -o $f.utf8 $f
  touch -r $f $f.utf8
  mv -f $f.utf8 $f
done

cp -p %SOURCE1 %SOURCE2 .

# Fix a Makefile rule that causes installation to fail
sed -ri '/FULLCONFIGDIR/s/OLDROOT|COQINSTALLPREFIX/&2/g' Makefile.build

# Use full relro due to network use.  Also fix broken CAML_LD_LIBRARY_PATH.
sed -e 's/-lunix/& -ccopt -Wl,-z,relro,-z,now/' \
    -e "s,'\$COQTOP'/kernel,\$COQTOP/kernel," \
    -i configure

%build
# Define opt flag based upon prior opt detection and restrictions
%if %{opt}
%global opt_option -opt
%else
%global opt_option -byte-only
%endif

%global coqdocdir %{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/coq-%{version}}

./configure -prefix %{_prefix}     \
            -libdir %{_libdir}/coq \
            -bindir %{_bindir}     \
            -mandir %{_mandir}     \
            -docdir %{coqdocdir}   \
            -configdir %{_sysconfdir}/xdg/%{name} \
            -emacslib %{_emacs_sitelispdir} \
            -lablgtkdir %{_libdir}/ocaml/lablgtk2 \
            -coqdocdir %{tex_dir}  \
            -debug                 \
            %{opt_option}          \
            -browser "xdg-open %s" \
            -camlp5dir %{_libdir}/ocaml/camlp5

export CAML_LD_LIBRARY_PATH=$PWD/kernel/byterun:${CAML_LD_LIBRARY_PATH}
make world VERBOSE=1

%install
make COQINSTALLPREFIX="%{buildroot}%{_prefix}" OLDROOT="%{_prefix}" \
     COQINSTALLPREFIX2="%{buildroot}%{_sysconfdir}" OLDROOT2="%{_sysconfdir}" \
     install

# Install desktop icon and menu entry

%global coqdatadir %{_libdir}/coq
%if %(test -d %{buildroot}%{coqdatadir} && echo 1 || echo 0) != 1
mkdir -p %{buildroot}%{coqdatadir}
%endif

sed -i -e 's|ICON-LOCATION-BASE|%{_datadir}/coq/coq.png|' coqide.desktop

desktop-file-install --dir=%{buildroot}%{_datadir}/applications coqide.desktop

# Install AppData file
mkdir -p %{buildroot}%{_datadir}/appdata
install -pm 644 %{SOURCE5} %{buildroot}%{_datadir}/appdata

# Make a MIME type for .v files
mkdir -p %{buildroot}%{_datadir}/mime/packages
cp -p %{SOURCE4} %{buildroot}%{_datadir}/mime/packages

# Install main Coq .v files
for f in `find plugins theories -name '*.v' -type f`; do
mkdir -p %{buildroot}%{coqdatadir}/`dirname $f` && cp -p $f %{buildroot}%{coqdatadir}/`dirname $f`
done

# Install tutorial code
%global tutorialcodedir %{coqdatadir}/RecTutorial
if [ ! -d %{buildroot}%{tutorialcodedir} ]; then
  mkdir -p %{buildroot}%{tutorialcodedir}
fi
cp -p doc/RecTutorial/RecTutorial.v %{buildroot}%{tutorialcodedir}
ln -s %{tutorialcodedir} %{buildroot}%{coqdatadir}/RecTutorial

# Install documentation not installed by install-doc in Makefile
for f in CHANGES COMPATIBILITY COPYRIGHT CREDITS README;
do cp -p $f %{buildroot}%{coqdocdir};
done

# We don't need both PostScript and PDF documentation
rm -fr %{buildroot}%{coqdocdir}/ps

# Don't install libcoqrun.a (it might not exist, but get rid of it if it does)
rm -f %{buildroot}%{coqdatadir}/libcoqrun.a

# Move Emacs support files to a subdir and byte compile
mkdir -p %{buildroot}%{_emacs_sitelispdir}/coq
cd %{buildroot}%{_emacs_sitelispdir}/coq
mv ../*.el .
%{_emacs_bytecompile} *.el

%post
mktexlsr &> /dev/null || :
update-mime-database %{_datadir}/mime &> /dev/null || :
update-desktop-database -q &> /dev/null || :

%postun
update-desktop-database -q &> /dev/null
update-mime-database %{_datadir}/mime &> /dev/null || :
mktexlsr &> /dev/null

# Note: we want to keep both coqtop.opt and coqtop.byte because the
# byte compiled version can be used to compile new version through
# coqmktop

# Exclude libcoqrun.a only when it is installed (this appears to be
# only for the native compile case)

%files
# DON'T use the doc macro here or else it wipes out all the other documentation installed!
%{_mandir}/man1/*
%{coqdatadir}
%{_datadir}/%{name}/
%{_bindir}/coq*
%{_bindir}/gallina
%exclude %{_bindir}/coqide*
%exclude %{coqdatadir}/ide
%if %{opt}
%exclude %{coqdatadir}/*/*.cmxa
%exclude %{coqdatadir}/*/*.a
%endif
%{tex_dir}/coqdoc.sty
# A few documentation files here should stay in the main package (and
# are excluded from doc), but the bulk of the documentation is in the
# doc subpackage
%dir %{coqdocdir}
%{coqdocdir}/CHANGES
%{coqdocdir}/COMPATIBILITY
%{coqdocdir}/COPYRIGHT
%{coqdocdir}/CREDITS
%{coqdocdir}/LICENSE.doc
%{coqdocdir}/README

%files coqide
%doc INSTALL.ide
%{_bindir}/coqide*
%{_sysconfdir}/xdg/%{name}/
%{coqdatadir}/ide
%exclude %{coqdatadir}/ide/ide.cmxa
%exclude %{coqdatadir}/ide/ide.a
%{_datadir}/appdata/coqide.appdata.xml
%{_datadir}/applications/coqide.desktop
%{_datadir}/mime/packages/coq.xml

%files doc
%{coqdocdir}/*
%exclude %{coqdocdir}/CHANGES
%exclude %{coqdocdir}/COMPATIBILITY
%exclude %{coqdocdir}/COPYRIGHT
%exclude %{coqdocdir}/CREDITS
%exclude %{coqdocdir}/LICENSE.doc
%exclude %{coqdocdir}/README

%files emacs
%dir %{_emacs_sitelispdir}/coq
%{_emacs_sitelispdir}/coq/*.elc
%doc README.coq-emacs

%files emacs-el
%{_emacs_sitelispdir}/coq/*.el

%changelog
* Tue May 13 2014 Jerry James <loganjerry@gmail.com> - 8.4pl4-1
- New upstream release

* Thu Jan 23 2014 Jerry James <loganjerry@gmail.com> - 8.4pl3-2
- Rebuild with fixed hevea package to get good HTML docs
- Hevea is now available on all architectures that support ocaml
- Drop Fedora 18 compatibility now that F-18 has reached EOL
- Add AppData file

* Mon Dec 16 2013 Jerry James <loganjerry@gmail.com> - 8.4pl3-1
- New upstream release

* Wed Oct 02 2013 Richard W.M. Jones <rjones@redhat.com> - 8.4pl2-4
- Rebuild for ocaml-lablgtk 2.18.

* Mon Sep 16 2013 Jerry James <loganjerry@gmail.com> - 8.4pl2-3
- Rebuild for OCaml 4.01.0
- Enable debuginfo

* Fri Jul 26 2013 Ville Skyttä <ville.skytta@iki.fi> - 8.4pl2-2
- Install docs to %%{_pkgdocdir} where available.

* Tue May 14 2013 Jerry James <loganjerry@gmail.com> - 8.4pl2-1
- New upstream release
- Harden the build due to network use

* Sat Feb 23 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 8.4pl1-3
- Remove --vendor from desktop-file-install in F19+  https://fedorahosted.org/fesco/ticket/1077

* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 8.4pl1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Mon Jan  7 2013 Jerry James <loganjerry@gmail.com> - 8.4pl1-1
- New upstream release
- Drop upstreamed GDK patch
- Adapt configure arguments to new version
- Add csdp-tools requirement to get csdp binary

* Thu Dec 13 2012 Jerry James <loganjerry@gmail.com> - 8.4-3
- Use minimal TeXLive BRs

* Wed Oct 17 2012 Jerry James <loganjerry@gmail.com> - 8.4-2
- Rebuild for OCaml 4.00.1
- Support more GDK key modifiers in the IDE (hyper, meta, release, super)
- New BRs due to the new texlive package layout
- Substitute the geometry package for fullpage.sty, which is not included in
  the latest Fedora TeXLive packages.

* Tue Aug 21 2012 Jerry James <loganjerry@gmail.com> - 8.4-1
- New upstream release
- Drop patch; merged upstream
- Drop workaround for install bug; fixed in 8.4

* Fri Jul 27 2012 Jerry James <loganjerry@gmail.com> - 8.3pl4-3
- ProofGeneral dropped support for XEmacs, so we have to drop it too

* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 8.3pl4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Mon Jun 11 2012 Richard W.M. Jones <rjones@redhat.com> - 8.3pl4-2
- Rebuild for OCaml 4.00.0.

* Sat Jun  9 2012 Jerry James <loganjerry@gmail.com> - 8.3pl4-1
- New upstream release

* Sat Jan  7 2012 Jerry James <loganjerry@gmail.com> - 8.3pl3-2
- Rebuild for Ocaml 3.12.1

* Tue Dec 27 2011 Jerry James <loganjerry@gmail.com> - 8.3pl3-1
- New upstream release

* Tue Dec 06 2011 Adam Jackson <ajax@redhat.com> - 8.3pl2-4
- Rebuild for new libpng

* Thu Oct 27 2011 Jerry James <loganjerry@gmail.com> - 8.3pl2-3
- Rebuild for new ocaml-camlp5; patch for bz 691913 no longer needed
- Drop tar_base_name, no longer necessary
- Drop versioned dependencies for packages that meet the dep in F14
- Build without HTML documentation on arches lacking hevea
- Change ExclusiveArch to %%{ocaml_arches}
- Fix a broken conditional and a typo

* Wed Jun 15 2011 Jerry James <loganjerry@gmail.com> - 8.3pl2-2
- Remove workaround for bad documentation link in 8.3pl1, fixed in 8.3pl2
- Revert change in 8.3pl1-1 to split arch-specific stuff from noarch stuff.
  Coq tactics are written in ocaml, which compiles to arch-specific files,
  and those files are stored in the same place as the noarch proof files.
- Move tutorial code into main package; it is small and we can then leave
  all the rest of the documentation as noarch

* Tue Apr 26 2011 Jerry James <loganjerry@gmail.com> - 8.3pl2-1
- New upstream release
- Change the list of supported arches to match the ocaml list, except for
  ppc64, which is missing hevea

* Mon Apr  4 2011 Jerry James <loganjerry@gmail.com> - 8.3pl1-2
- Change the mime type to application/x-coq, and inherit from text/plain
  (bz 530254)

* Thu Mar 31 2011 Jerry James <loganjerry@gmail.com> - 8.3pl1-1
- New upstream release
- Drop BuildRoot tag and clean section
- Drop all patches (all merged or otherwise fixed upstream)
- Comply with latest Ocaml packaging specs
- Identify xdg-open as the default web browser
- Comply with the emacs packaging guidelines, and build an XEmacs package
- The -doc and -emacs* subpackages are now noarch
- Workaround bug 691913
- Drop PostScript documentation; it's identical to PDF documentation
- Deal with arch-specific files in /usr/share; install everything to libdir,
  then move the noarch stuff to datadir, but leave symlinks behind
- Add a new mime type application/x-coqide and use it in the desktop file
- Add post and postun scripts

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 8.2pl1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Wed Aug 05 2009 Alan Dunn <amdunn@gmail.com> - 8.2pl1-1
- New upstream release
- Eliminated modification of tar_base_name that occurred for only version 8.2
- Added reference to bugzilla bug for ppc64 ExcludeArch
- HTML form of documentation seems to no longer be distributed -> must generate
  Decided for consistency to generate all documentation
- Additional file for iconv - documentation license file
- Changed tutorial directory name, now also using bundled version
  of tutorial

* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 8.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Thu Jun 18 2009 Alan Dunn <amdunn@gmail.com> - 8.2-1
- New upstream release
- Seems documentation license has changed or wasn't explicitly stated
  before, fixed (is ok Fedora license)
- Added versioning to documentation
- Removed special OCaml, TeX logic for Fedora < 9 (no longer relevant)
- Dropped makefile patch for compiling grammar.cma (fixed in Coq 8.2)
- Dropped cmxa-install patch (fixed in Coq 8.2)
- Changed makefile-strip patch and name (not yet fixed upstream...)
- Changed check.patch -> coq-check-(version).patch, slightly changed
  for 8.2 (not yet fixed upstream...)
- Dropped parser-renaming makefile-parser.patch, parser-man.patch
  (fixed in Coq 8.2)
- Dropped coq-lablgtk-2.12.patch (fixed in Coq 8.2)
- Changed way source (.v) files are installed
- Stopped addition of other icon file (icon fixed in Coq 8.2)
- Bytecode executables are now "clean" (not build with custom -> don't
  need to configure prelink around these)
- define -> global
- Added ExcludeArch sparc64

* Wed Jun 17 2009 S390x secondary arch maintainer <fedora-s390x@lists.fedoraproject.org> 8.1pl4-3.1
- ExcludeArch s390, s390x as we don't have OCaml on those archs

* Wed Mar 04 2009 Alan Dunn <amdunn@gmail.com> - 8.1pl4-3
- Minor change to cmxa-install patch instruction
- Fixed to work with lablgtk 2.12

* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 8.1pl4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild 

* Fri Dec  5 2008 Richard W.M. Jones <rjones@redhat.com> - 8.1pl4-1
- New upstream version 8.1pl4.
- Attempt to rebuild against OCaml 3.11.0.
- Run make with VERBOSE=1 so we can see the actual commands.
- Pass -camlp5dir to configure so it uses camlp5 (overriding existence
  of camlp4 if it happens to be installed).

* Wed Oct 22 2008 Alan Dunn <amdunn@gmail.com> 8.1pl3-5
- Added Coq .v files into the main package at user request.

* Tue Sep 09 2008 Alan Dunn <amdunn@gmail.com> 8.1pl3-4
- Added creation of prelink blacklist for any bytecode files.
- Fixed execstack status for binaries.

* Tue Aug 05 2008 Alan Dunn <amdunn@gmail.com> 8.1pl3-3
- Changed parser to coq-parser to avoid name conflict with
  coda-client.
- Made make process noisy again.

* Sun Jul 20 2008 Alan Dunn <amdunn@gmail.com> 8.1pl3-2.1
- Minor bump for Fedora 8 to bring it into line with the rest.

* Thu Jul 17 2008 Alan Dunn <amdunn@gmail.com> 8.1pl3-2
- Added check for Fedora distribution number to allow for Fedora 8 release.

* Wed Jun 11 2008 Alan Dunn <amdunn@gmail.com> 8.1pl3-1
- Initial Fedora RPM version.