Initial import.
This commit is contained in:
parent
f5618850e7
commit
daade3543d
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/ppx_tools-*.tar.gz
|
41
ocaml-ppx-tools-build.patch
Normal file
41
ocaml-ppx-tools-build.patch
Normal file
@ -0,0 +1,41 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -8,8 +8,8 @@ PACKAGE = ppx_tools
|
||||
VERSION = 5.3
|
||||
# Don't forget to change META file as well
|
||||
|
||||
-OCAMLC = ocamlc -bin-annot
|
||||
-OCAMLOPT = ocamlopt
|
||||
+OCAMLC = ocamlc -bin-annot -g
|
||||
+OCAMLOPT = ocamlopt -bin-annot -g
|
||||
COMPFLAGS = -w +A-4-17-44-45 -I +compiler-libs -safe-string
|
||||
|
||||
.PHONY: all
|
||||
@@ -22,6 +22,19 @@ all: ppx_tools.cmxs
|
||||
endif
|
||||
endif
|
||||
|
||||
+ifneq ($(ARCH),none)
|
||||
+genlifter$(EXE): ppx_tools.cmxa genlifter.cmx
|
||||
+ $(OCAMLOPT) $(COMPFLAGS) -o genlifter$(EXE) ocamlcommon.cmxa ppx_tools.cmxa genlifter.cmx
|
||||
+
|
||||
+dumpast$(EXE): dumpast.cmx
|
||||
+ $(OCAMLOPT) $(COMPFLAGS) -o dumpast$(EXE) ocamlcommon.cmxa ocamlbytecomp.cmxa ast_lifter.cmx dumpast.cmx
|
||||
+
|
||||
+ppx_metaquot$(EXE): ppx_metaquot.cmx
|
||||
+ $(OCAMLOPT) $(COMPFLAGS) -o ppx_metaquot$(EXE) ocamlcommon.cmxa ppx_tools.cmxa ast_lifter.cmx ppx_metaquot.cmx
|
||||
+
|
||||
+rewriter$(EXE): rewriter.cmx
|
||||
+ $(OCAMLOPT) $(COMPFLAGS) -o rewriter$(EXE) ocamlcommon.cmxa rewriter.cmx
|
||||
+else
|
||||
genlifter$(EXE): ppx_tools.cma genlifter.cmo
|
||||
$(OCAMLC) $(COMPFLAGS) -o genlifter$(EXE) ocamlcommon.cma ppx_tools.cma genlifter.cmo
|
||||
|
||||
@@ -33,6 +46,7 @@ ppx_metaquot$(EXE): ppx_metaquot.cmo
|
||||
|
||||
rewriter$(EXE): rewriter.cmo
|
||||
$(OCAMLC) $(COMPFLAGS) -o rewriter$(EXE) ocamlcommon.cma rewriter.cmo
|
||||
+endif
|
||||
|
||||
ast_lifter.ml: genlifter$(EXE)
|
||||
./genlifter$(EXE) -I +compiler-libs Parsetree.expression > ast_lifter.ml || rm -rf ast_lifter.ml
|
70
ocaml-ppx-tools-ocaml-4.10.patch
Normal file
70
ocaml-ppx-tools-ocaml-4.10.patch
Normal file
@ -0,0 +1,70 @@
|
||||
--- a/ast_mapper_class.ml
|
||||
+++ b/ast_mapper_class.ml
|
||||
@@ -162,6 +162,10 @@ module CT = struct
|
||||
(List.map (sub # class_type_field) pcsig_fields)
|
||||
end
|
||||
|
||||
+let map_functor_param sub = function
|
||||
+ | Unit -> Unit
|
||||
+ | Named (s, mt) -> Named (map_loc sub s, sub # module_type mt)
|
||||
+
|
||||
module MT = struct
|
||||
(* Type expressions for the module language *)
|
||||
|
||||
@@ -173,10 +177,10 @@ module MT = struct
|
||||
| Pmty_ident s -> ident ~loc ~attrs (map_loc sub s)
|
||||
| Pmty_alias s -> alias ~loc ~attrs (map_loc sub s)
|
||||
| Pmty_signature sg -> signature ~loc ~attrs (sub # signature sg)
|
||||
- | Pmty_functor (s, mt1, mt2) ->
|
||||
- functor_ ~loc ~attrs (map_loc sub s)
|
||||
- (map_opt (sub # module_type) mt1)
|
||||
- (sub # module_type mt2)
|
||||
+ | Pmty_functor (param, mt) ->
|
||||
+ functor_ ~loc ~attrs
|
||||
+ (map_functor_param sub param)
|
||||
+ (sub # module_type mt)
|
||||
| Pmty_with (mt, l) ->
|
||||
with_ ~loc ~attrs (sub # module_type mt)
|
||||
(List.map (sub # with_constraint) l)
|
||||
@@ -227,9 +231,9 @@ module M = struct
|
||||
match desc with
|
||||
| Pmod_ident x -> ident ~loc ~attrs (map_loc sub x)
|
||||
| Pmod_structure str -> structure ~loc ~attrs (sub # structure str)
|
||||
- | Pmod_functor (arg, arg_ty, body) ->
|
||||
- functor_ ~loc ~attrs (map_loc sub arg)
|
||||
- (map_opt (sub # module_type) arg_ty)
|
||||
+ | Pmod_functor (param, body) ->
|
||||
+ functor_ ~loc ~attrs
|
||||
+ (map_functor_param sub param)
|
||||
(sub # module_expr body)
|
||||
| Pmod_apply (m1, m2) ->
|
||||
apply ~loc ~attrs (sub # module_expr m1) (sub # module_expr m2)
|
||||
--- a/genlifter.ml
|
||||
+++ b/genlifter.ml
|
||||
@@ -50,7 +50,7 @@ module Main : sig end = struct
|
||||
if Hashtbl.mem printed ty then ()
|
||||
else let tylid = Longident.parse ty in
|
||||
let td =
|
||||
- try Env.find_type (Env.lookup_type tylid env) env
|
||||
+ try snd (Env.lookup_type ~loc:(mknoloc tylid).loc tylid env)
|
||||
with Not_found ->
|
||||
Format.eprintf "** Cannot resolve type %s@." ty;
|
||||
exit 2
|
||||
--- a/ppx_tools.opam
|
||||
+++ b/ppx_tools.opam
|
||||
@@ -10,6 +10,6 @@ tags: [ "syntax" ]
|
||||
build: [[make "all"]]
|
||||
install: [[make "install"]]
|
||||
depends: [
|
||||
- "ocaml" {>= "4.08.0"}
|
||||
+ "ocaml" {>= "4.10.0"}
|
||||
"ocamlfind" {build & >= "1.5.0"}
|
||||
]
|
||||
--- a/.travis.yml
|
||||
+++ b/.travis.yml
|
||||
@@ -9,4 +9,4 @@ env:
|
||||
- PACKAGE="ppx_tools"
|
||||
- PRE_INSTALL_HOOK="cd /home/opam/opam-repository && git pull origin master && opam update -u -y"
|
||||
matrix:
|
||||
- - DISTRO=ubuntu-16.04 OCAML_VERSION=4.08.0
|
||||
+ - DISTRO=ubuntu-16.04 OCAML_VERSION=4.10.0+beta1 OCAML_BETA=enable
|
5
ocaml-ppx-tools.rpmlintrc
Normal file
5
ocaml-ppx-tools.rpmlintrc
Normal file
@ -0,0 +1,5 @@
|
||||
# THIS FILE IS FOR WHITELISTING RPMLINT ERRORS AND WARNINGS IN TASKOTRON
|
||||
# https://fedoraproject.org/wiki/Taskotron/Tasks/dist.rpmlint#Whitelisting_errors
|
||||
|
||||
# The dictionary is missing some technical terms
|
||||
addFilter(r'W: spelling-error .* rewriters')
|
88
ocaml-ppx-tools.spec
Normal file
88
ocaml-ppx-tools.spec
Normal file
@ -0,0 +1,88 @@
|
||||
%ifnarch %{ocaml_native_compiler}
|
||||
%global debug_package %{nil}
|
||||
%endif
|
||||
|
||||
%global srcname ppx-tools
|
||||
%global upname ppx_tools
|
||||
%global ocamlvr 4.08.0
|
||||
|
||||
Name: ocaml-%{srcname}
|
||||
Version: 5.3
|
||||
Release: 1%{?dist}
|
||||
Summary: Tools for authors of ppx rewriters
|
||||
|
||||
License: MIT
|
||||
URL: https://github.com/ocaml-ppx/%{upname}
|
||||
Source0: %{url}/archive/%{version}+%{ocamlvr}/%{upname}-%{version}.tar.gz
|
||||
# Build with debug information. Build the binaries natively when possible.
|
||||
Patch0: %{name}-build.patch
|
||||
# Adapt to OCaml 4.10.
|
||||
# https://github.com/ocaml-ppx/ppx_tools/pull/79
|
||||
Patch1: %{name}-ocaml-4.10.patch
|
||||
|
||||
BuildRequires: ocaml >= %{ocamlvr}
|
||||
BuildRequires: ocaml-findlib
|
||||
BuildRequires: ocaml-ocamldoc
|
||||
|
||||
%description
|
||||
Tools for authors of syntactic tools (such as ppx rewriters).
|
||||
|
||||
%package devel
|
||||
Summary: Development files for %{name}
|
||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||
|
||||
%description devel
|
||||
The %{name}-devel package contains libraries and signature files for
|
||||
developing applications that use %{name}.
|
||||
|
||||
%prep
|
||||
%autosetup -n %{upname}-%{version}-%{ocamlvr} -p1
|
||||
|
||||
# Generate debuginfo
|
||||
sed -ri 's/OCAML(C|OPT) = .*/& -g/' Makefile
|
||||
|
||||
%build
|
||||
# Parallel build does not work reliably
|
||||
make
|
||||
|
||||
# Build the documentation
|
||||
mkdir html
|
||||
ocamldoc -html -d html -I +compiler-libs *.mli
|
||||
|
||||
%install
|
||||
export DESTDIR=%{buildroot}
|
||||
export OCAMLFIND_DESTDIR=%{buildroot}%{_libdir}/ocaml
|
||||
mkdir -p %{buildroot}%{_libdir}/ocaml
|
||||
make install
|
||||
cp -p %{upname}.opam %{buildroot}%{_libdir}/ocaml/%{upname}/opam
|
||||
|
||||
%files
|
||||
%doc README.md
|
||||
%license LICENSE
|
||||
%dir %{_libdir}/ocaml/%{upname}/
|
||||
%{_libdir}/ocaml/%{upname}/META
|
||||
%{_libdir}/ocaml/%{upname}/dumpast
|
||||
%{_libdir}/ocaml/%{upname}/genlifter
|
||||
%{_libdir}/ocaml/%{upname}/ppx_metaquot
|
||||
%{_libdir}/ocaml/%{upname}/rewriter
|
||||
%{_libdir}/ocaml/%{upname}/*.cma
|
||||
%{_libdir}/ocaml/%{upname}/*.cmi
|
||||
%ifarch %{ocaml_native_compiler}
|
||||
%{_libdir}/ocaml/%{upname}/*.cmxs
|
||||
%endif
|
||||
|
||||
%files devel
|
||||
%doc html/*
|
||||
%{_libdir}/ocaml/%{upname}/opam
|
||||
%ifarch %{ocaml_native_compiler}
|
||||
%{_libdir}/ocaml/%{upname}/*.a
|
||||
%{_libdir}/ocaml/%{upname}/*.cmx
|
||||
%{_libdir}/ocaml/%{upname}/*.cmxa
|
||||
%endif
|
||||
%{_libdir}/ocaml/%{upname}/*.cmt
|
||||
%{_libdir}/ocaml/%{upname}/*.cmti
|
||||
%{_libdir}/ocaml/%{upname}/*.mli
|
||||
|
||||
%changelog
|
||||
* Wed Feb 5 2020 Jerry James <loganjerry@gmail.com> - 5.3-1
|
||||
- Initial RPM
|
Loading…
Reference in New Issue
Block a user