SHA256
1
0
forked from pool/coq
coq/coq.spec

203 lines
6.7 KiB
RPMSpec
Raw Normal View History

#
# spec file for package coq
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2012-2018 Peter Trommler, peter.trommler at ohm-hochschule.de
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: coq
Version: 8.9.1
Release: 0
Summary: Proof Assistant based on the Calculus of Inductive Constructions
License: LGPL-2.1-only
Group: Productivity/Scientific/Math
URL: https://coq.inria.fr/
Source: https://github.com/coq/coq/archive/V%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: coq.desktop
Source2: coq.xml
Source100: %{name}-rpmlintrc
BuildRequires: desktop-file-utils
# Required for standard coq:
BuildRequires: make >= 3.81
BuildRequires: ocaml >= 3.10.2
BuildRequires: ocaml-camlp5-devel >= 5.08
# TODO: Build docs when antlr4-python3-runtime becomes available.
#BuildRequires: python3-Sphinx
#BuildRequires: python3-pexpect
#BuildRequires: antlr4-python3-runtime
#BuildRequires: python3-beautifulsoup4
# Required for coq-ide:
BuildRequires: ocaml-findlib
BuildRequires: ocamlfind(lablgtk2)
BuildRequires: update-desktop-files
%global __requires_exclude ocaml\\\((Interface|Sos_types|GtkSourceView2_types)\\\)
%description
Proof assistant which allows to handle calculus assertions, check mechanically
proofs of these assertions, helps to find formal proofs and extracts a certified
program from the constructive proof of its formal specification.
This package contains shared files and the command line interface.
For a graphical interface install %{name}-ide.
%package ide
Summary: IDE for The Coq Proof Assistant
Group: Productivity/Scientific/Math
Requires: %{name} = %{version}-%{release}
%description ide
The Coq Integrated Development Interface is a graphical interface for the Coq proof assistant.
%package devel
Summary: Development files for coq
Group: Development/Libraries/Other
Requires: %{name} = %{version}-%{release}
Requires: ocaml >= 3.10.2
%description devel
This package contains development files for Coq.
%prep
%setup -q
%build
export CFLAGS='%{optflags}'
./configure \
-bindir %{_bindir} \
-libdir %{_libdir}/coq \
-mandir %{_mandir} \
-datadir %{_datadir}/%{name} \
-docdir %{_docdir}/%{name} \
-configdir %{_sysconfdir}/xdg/%{name} \
-coqdocdir %{_datadir}/texmf/tex/latex/misc \
-native-compiler yes \
-natdynlink yes \
-browser "xdg-open %s"
jobs=%{_smp_build_ncpus}
max_jobs=$(awk '/MemAvailable/ { print int($2 / 750000) }' /proc/meminfo)
test $max_jobs -lt $jobs && jobs="$max_jobs" && \
echo "Warning: Reducing number of jobs to $max_jobs because of memory limits"
make -j $jobs world
%install
make COQINSTALLPREFIX=%{buildroot} install
%suse_update_desktop_file -i %{SOURCE1}
install -D -m 644 %{SOURCE1} %{buildroot}%{_datadir}/applications/coq.desktop
install -D -m 644 %{SOURCE2} %{buildroot}%{_datadir}/mime/packages/coq.xml
install -D -m 644 ide/coq.png %{buildroot}%{_datadir}/icons/hicolor/256x256/apps/coq.png
# Sometimes we get identical x and x.opt files, replace by symlink x -> x.opt.
for bin in %{buildroot}%{_bindir}/*.opt
do
if [ -f ${bin%.opt} ] && diff $bin ${bin%.opt}
then
rm ${bin%.opt}
ln -s ${bin#%{buildroot}} ${bin%.opt}
fi
done
# Fix executable bit and shebangs, preferring python3.
# (https://www.python.org/dev/peps/pep-0394/#for-python-runtime-distributors)
chmod -x %{buildroot}%{_libdir}/%{name}/tools/TimeFileMaker.py
sed -i '1s|^#!/usr/bin/env *|#!/usr/bin/|;1s|^#!/usr/bin/python$|#!/usr/bin/python3|' \
%{buildroot}%{_libdir}/%{name}/tools/make-{one-time-file,both-{time,single-timing}-files}.py
# Remove superfluous man page.
rm %{buildroot}%{_mandir}/man1/coqtop.byte.1
# Build lists of runtime and devel files by ending.
# Compiled theories and shared objects are needed at runtime.
find %{buildroot}%{_libdir}/coq/{plugins,theories} -type d | \
sed "s|%{buildroot}|%%dir |g" >runtime.list
find %{buildroot}%{_libdir}/coq -name '*.cmxs' \
-or -name '*.so' \
-or -name '*.vo' | sed "s|%{buildroot}||g" >>runtime.list
# Object files, static libraries and import definitions are only needed for development.
# For now, we also put the standard library Coq sources here, since the runtime
# package contains the HTML documentation for the standard library.
find %{buildroot}%{_libdir}/coq -type d | sed "s|%{buildroot}|%%dir |g" >devel.list
find %{buildroot}%{_libdir}/coq -name '*.a' \
-or -name '*.cma' \
-or -name '*.cmi' \
-or -name '*.cmx' \
-or -name '*.cmxa' \
-or -name '*.glob' \
-or -name '*.o' \
-or -name '*.v' | sed "s|%{buildroot}||g" >>devel.list
%files -f runtime.list
%license LICENSE CREDITS
%doc CHANGES.md README.md
%{_docdir}/%{name}/FAQ-CoqIde
%{_bindir}/coq-tex
%{_bindir}/coq_makefile
%{_bindir}/coqc
%{_bindir}/coqchk
%{_bindir}/coqdep
%{_bindir}/coqdoc
%{_bindir}/coqpp
%{_bindir}/coqproofworker.opt
%{_bindir}/coqqueryworker.opt
%{_bindir}/coqtacticworker.opt
%{_bindir}/coqtop
%{_bindir}/coqtop.opt
%{_bindir}/coqwc
%{_bindir}/coqworkmgr
%dir %{_libdir}/coq
%{_libdir}/coq/META
%dir %{_libdir}/coq/kernel
%dir %{_libdir}/coq/kernel/byterun
%{_libdir}/coq/plugins/micromega/csdpcert
%{_libdir}/coq/tools
%exclude %{_libdir}/coq/tools/CoqMakefile.in
%dir %{_libdir}/coq/user-contrib
%{_mandir}/man1/coq-tex.1%{ext_man}
%{_mandir}/man1/coq_makefile.1%{ext_man}
%{_mandir}/man1/coqc.1%{ext_man}
%{_mandir}/man1/coqchk.1%{ext_man}
%{_mandir}/man1/coqdep.1%{ext_man}
%{_mandir}/man1/coqdoc.1%{ext_man}
%{_mandir}/man1/coqtop.1%{ext_man}
%{_mandir}/man1/coqtop.opt.1%{ext_man}
%{_mandir}/man1/coqwc.1%{ext_man}
%{_datadir}/%{name}
%dir %{_datadir}/texmf
%dir %{_datadir}/texmf/tex
%dir %{_datadir}/texmf/tex/latex
%dir %{_datadir}/texmf/tex/latex/misc
%{_datadir}/texmf/tex/latex/misc/coqdoc.sty
%files ide
%{_bindir}/coqide
%{_bindir}/coqidetop
%{_bindir}/coqidetop.opt
%{_mandir}/man1/coqide.1%{ext_man}
%{_datadir}/applications/coq.desktop
%{_datadir}/icons/hicolor/256x256/apps/coq.png
%{_datadir}/mime/packages/coq.xml
%files devel -f devel.list
%{_libdir}/coq/tools/CoqMakefile.in
%changelog