Spec file cleanup.
- Add -emacs patch to adapt to Emacs 27.1. - Build documentation with odoc. - Fix non-Unicode man page. - Generate autoloads for the Emacs interface. - Byte compile the Emacs interface.
This commit is contained in:
parent
3fe10ae709
commit
3585e93217
|
@ -0,0 +1,31 @@
|
|||
--- a/tools/ocp-indent.el 2019-10-23 07:04:10.000000000 -0600
|
||||
+++ b/tools/ocp-indent.el 2021-02-23 09:00:39.282453922 -0700
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
;;; Code:
|
||||
|
||||
-(require 'cl)
|
||||
+(require 'cl-lib)
|
||||
|
||||
(defgroup ocp-indent nil
|
||||
"ocp-indent OCaml indenter binding configuration"
|
||||
@@ -76,8 +76,8 @@ are blanks."
|
||||
(list "--numeric"
|
||||
"--lines" (format "%d-%d" start-line end-line))
|
||||
(if ocp-indent-config (list "--config" ocp-indent-config) nil)
|
||||
- (reduce (lambda (acc syn) (list* "--syntax" syn acc))
|
||||
- ocp-indent-syntax :initial-value nil)))
|
||||
+ (cl-reduce #'(lambda (acc syn) (cl-list* "--syntax" syn acc))
|
||||
+ ocp-indent-syntax :initial-value nil)))
|
||||
|
||||
(defun ocp-indent-file-to-string (file)
|
||||
(replace-regexp-in-string
|
||||
@@ -126,7 +126,7 @@ buffer."
|
||||
(delete-file errfile))
|
||||
(save-excursion
|
||||
(goto-char start)
|
||||
- (mapcar
|
||||
+ (mapc
|
||||
#'(lambda (indent) (indent-line-to indent) (forward-line))
|
||||
indents))
|
||||
(when (ocp-in-indentation-p) (back-to-indentation))))
|
|
@ -1,44 +1,46 @@
|
|||
Name: ocaml-ocp-indent
|
||||
%ifnarch %{ocaml_native_compiler}
|
||||
%global debug_package %{nil}
|
||||
%endif
|
||||
|
||||
%global srcname ocp-indent
|
||||
|
||||
Name: ocaml-%{srcname}
|
||||
Version: 1.8.2
|
||||
Release: 5%{?dist}
|
||||
Summary: A simple tool to indent OCaml programs
|
||||
|
||||
%global libname %(echo %{name} | sed -e 's/^ocaml-//')
|
||||
|
||||
# The entire source code is LGPLv2 with exceptions except
|
||||
# src/approx_tokens.ml is QPL
|
||||
License: (LGPLv2 with exceptions) and QPL
|
||||
URL: https://github.com/OCamlPro/%{libname}
|
||||
Source0: https://github.com/OCamlPro/%{libname}/archive/%{version}/%{libname}-%{version}.tar.gz
|
||||
URL: https://www.typerex.org/ocp-indent.html
|
||||
Source0: https://github.com/OCamlPro/%{srcname}/archive/%{version}/%{srcname}-%{version}.tar.gz
|
||||
# Update the Emacs interface for Emacs 27.1
|
||||
Patch0: %{name}-emacs.patch
|
||||
|
||||
BuildRequires: ocaml
|
||||
BuildRequires: ocaml-dune
|
||||
BuildRequires: ocaml-findlib-devel
|
||||
BuildRequires: ocaml-cmdliner-devel
|
||||
BuildRequires: ocaml-result-devel
|
||||
# Required for tests, not available in Fedora
|
||||
#BuildRequires: craml
|
||||
BuildRequires: emacs
|
||||
# For byte-compile elisp
|
||||
#BuildRequires: emacs-auto-complete
|
||||
#BuildRequires: emacs-tuareg
|
||||
# The following two are not yet available in Fedora.
|
||||
# So byte compilation is disabled
|
||||
#BuildRequires: emacs-company
|
||||
#BuildRequires: emacs-iedit
|
||||
BuildRequires: emacs-tuareg
|
||||
BuildRequires: ocaml
|
||||
BuildRequires: ocaml-cmdliner-devel >= 1.0.0
|
||||
BuildRequires: ocaml-dune >= 1.0
|
||||
BuildRequires: ocaml-findlib-devel
|
||||
BuildRequires: ocaml-odoc
|
||||
BuildRequires: vim-enhanced
|
||||
|
||||
Requires: emacs-filesystem >= %{_emacs_version}
|
||||
Requires: vim-filesystem
|
||||
|
||||
%description
|
||||
Ocp-indent is based on an approximate, tolerant OCaml parser and a simple stack
|
||||
machine ; this is much faster and more reliable than using regexps. Presets and
|
||||
configuration options available, with the possibility to set them project-wide.
|
||||
Supports most common syntax extensions, and extensible for others.
|
||||
Ocp-indent is a simple tool and library to indent OCaml code. It is
|
||||
based on an approximate, tolerant OCaml parser and a simple stack
|
||||
machine; this is much faster and more reliable than using regexps.
|
||||
Presets and configuration options are available, with the possibility to
|
||||
set them project-wide. Ocp-indent supports most common syntax
|
||||
extensions, and is extensible for others.
|
||||
|
||||
Includes:
|
||||
|
||||
- An indentor program, callable from the command-line or from within editors
|
||||
- An indentor program, callable from the command-line or from within
|
||||
editors
|
||||
- Bindings for popular editors
|
||||
- A library that can be directly used by editor writers, or just for
|
||||
fault-tolerant/approximate parsing.
|
||||
|
@ -51,63 +53,93 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
|
|||
The %{name}-devel package contains libraries and signature files for
|
||||
developing applications that use %{name}.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q -n %{libname}-%{version}
|
||||
|
||||
%autosetup -n %{srcname}-%{version} -p1
|
||||
|
||||
%build
|
||||
dune build %{?_smp_mflags} --profile=release
|
||||
|
||||
dune build %{?_smp_mflags} @doc
|
||||
|
||||
%install
|
||||
dune install \
|
||||
--destdir=%{buildroot} \
|
||||
--prefix=%{_prefix} \
|
||||
--libdir=%{_libdir}/ocaml \
|
||||
--mandir=%{_mandir}
|
||||
dune install --destdir=%{buildroot}
|
||||
|
||||
chmod 755 %{buildroot}%{_libdir}/ocaml/%{libname}/*/*.cmxs
|
||||
# We do not want the dune markers
|
||||
find _build/default/_doc/_html -name .dune-keep -delete
|
||||
|
||||
# We do not want the ml files
|
||||
find %{buildroot}%{_libdir}/ocaml -name \*.ml -delete
|
||||
|
||||
# We install the documentation with the doc macro
|
||||
rm -fr %{buildroot}%{_prefix}/doc
|
||||
|
||||
%ifarch %{ocaml_native_compiler}
|
||||
# Add missing executable bits
|
||||
find %{buildroot}%{_libdir}/ocaml -name \*.cmxs -exec chmod a+x {} \+
|
||||
%endif
|
||||
|
||||
# The man page has A0 bytes for non-breaking spaces, but this is invalid UTF-8
|
||||
sed -i 's/\xa0/\\ /g' %{buildroot}%{_mandir}/man1/ocp-indent.1
|
||||
|
||||
# Reinstall vim files to Fedora default location
|
||||
mkdir -p %{buildroot}%{vimfiles_root}
|
||||
mv %{buildroot}%{_datadir}/%{libname}/vim/* %{buildroot}%{vimfiles_root}
|
||||
rmdir %{buildroot}%{_datadir}/%{libname}/vim
|
||||
rmdir %{buildroot}%{_datadir}/%{libname}
|
||||
# Reinstall documents using %%doc later
|
||||
rm -fr %{buildroot}%{_prefix}/doc
|
||||
mv %{buildroot}%{_datadir}/%{srcname}/vim/* %{buildroot}%{vimfiles_root}
|
||||
rm -fr %{buildroot}%{_datadir}/%{srcname}
|
||||
|
||||
# Generate the autoload file for the Emacs interface and byte compile
|
||||
cd %{buildroot}%{_emacs_sitelispdir}
|
||||
emacs -batch --no-init-file --no-site-file \
|
||||
--eval "(progn (setq generated-autoload-file \"$PWD/ocp-indent-autoloads.el\" backup-inhibited t) (update-directory-autoloads \".\"))"
|
||||
mkdir -p %{buildroot}%{_emacs_sitestartdir}
|
||||
mv ocp-indent-autoloads.el %{buildroot}%{_emacs_sitestartdir}
|
||||
%_emacs_bytecompile ocp-indent.el
|
||||
cd -
|
||||
|
||||
%check
|
||||
#Tests only run on a git checkout
|
||||
# ./tests/test.sh
|
||||
|
||||
|
||||
%files
|
||||
%doc README.md CHANGELOG
|
||||
%license LICENSE
|
||||
%{_bindir}/*
|
||||
%{_libdir}/ocaml/%{libname}
|
||||
%{_bindir}/ocp-indent
|
||||
%dir %{_libdir}/ocaml/%{srcname}/
|
||||
%dir %{_libdir}/ocaml/%{srcname}/dynlink/
|
||||
%dir %{_libdir}/ocaml/%{srcname}/lexer/
|
||||
%dir %{_libdir}/ocaml/%{srcname}/lib/
|
||||
%dir %{_libdir}/ocaml/%{srcname}/utils/
|
||||
%{_libdir}/ocaml/%{srcname}/META
|
||||
%{_libdir}/ocaml/%{srcname}/*/*.cma
|
||||
%{_libdir}/ocaml/%{srcname}/*/*.cmi
|
||||
%ifarch %{ocaml_native_compiler}
|
||||
%exclude %{_libdir}/ocaml/%{libname}/*/*.a
|
||||
%exclude %{_libdir}/ocaml/%{libname}/*/*.cmxa
|
||||
%exclude %{_libdir}/ocaml/%{libname}/*/*.cmx
|
||||
%{_libdir}/ocaml/%{srcname}/*/*.cmxs
|
||||
%endif
|
||||
%exclude %{_libdir}/ocaml/%{libname}/*/*.mli
|
||||
%exclude %{_libdir}/ocaml/%{libname}/*/*.ml
|
||||
%{_emacs_sitelispdir}/*
|
||||
%{vimfiles_root}/*/*
|
||||
%{_mandir}/man1/%{libname}*
|
||||
%{_emacs_sitelispdir}/ocp-indent.el{,c}
|
||||
%{_emacs_sitestartdir}/ocp-indent-autoloads.el
|
||||
%{vimfiles_root}/indent/ocaml.vim
|
||||
%{_mandir}/man1/%{srcname}.1*
|
||||
|
||||
%files devel
|
||||
%doc _build/default/_doc/*
|
||||
%{_libdir}/ocaml/%{srcname}/dune-package
|
||||
%{_libdir}/ocaml/%{srcname}/opam
|
||||
%ifarch %{ocaml_native_compiler}
|
||||
%{_libdir}/ocaml/%{libname}/*/*.a
|
||||
%{_libdir}/ocaml/%{libname}/*/*.cmxa
|
||||
%{_libdir}/ocaml/%{libname}/*/*.cmx
|
||||
%{_libdir}/ocaml/%{srcname}/*/*.a
|
||||
%{_libdir}/ocaml/%{srcname}/*/*.cmx
|
||||
%{_libdir}/ocaml/%{srcname}/*/*.cmxa
|
||||
%endif
|
||||
%{_libdir}/ocaml/%{libname}/*/*.mli
|
||||
%{_libdir}/ocaml/%{libname}/*/*.ml
|
||||
%{_libdir}/ocaml/%{srcname}/*/*.cmt
|
||||
%{_libdir}/ocaml/%{srcname}/*/*.cmti
|
||||
%{_libdir}/ocaml/%{srcname}/*/*.mli
|
||||
|
||||
%changelog
|
||||
* Tue Feb 23 2021 Jerry James <loganjerry@gmail.com> - 1.8.2-5
|
||||
- Spec file cleanup
|
||||
- Add -emacs patch to adapt to Emacs 27.1
|
||||
- Build documentation with odoc
|
||||
- Fix non-Unicode man page
|
||||
- Generate autoloads for the Emacs interface
|
||||
- Byte compile the Emacs interface
|
||||
|
||||
* Sat Feb 20 2021 Jerry James <loganjerry@gmail.com> - 1.8.2-5
|
||||
- Rebuild for changed dynlink dependency
|
||||
|
||||
|
|
Loading…
Reference in New Issue