diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57789d0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/ocaml-sedlex-1.99.4.tar.gz diff --git a/README.md b/README.md deleted file mode 100644 index 7ef7c51..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# ocaml-sedlex - -The ocaml-sedlex package \ No newline at end of file diff --git a/native_debug.diff b/native_debug.diff new file mode 100644 index 0000000..9f99f50 --- /dev/null +++ b/native_debug.diff @@ -0,0 +1,29 @@ +diff --git a/src/lib/Makefile b/src/lib/Makefile +index 0544095..e584557 100644 +--- a/src/lib/Makefile ++++ b/src/lib/Makefile +@@ -12,8 +12,8 @@ sedlexing.cma: $(MODS:.cmo=.mli) $(MODS:.cmo=.ml) + ocamlfind ocamlc -package gen -a -o sedlexing.cma $(MODS) + + sedlexing.cmxa: $(MODS:.cmo=.mli) $(MODS:.cmo=.ml) +- ocamlfind ocamlopt -package gen -safe-string -c $(MODS:.cmo=.mli) $(MODS:.cmo=.ml) +- ocamlfind ocamlopt -package gen -a -o sedlexing.cmxa $(MODS:.cmo=.cmx) ++ ocamlfind ocamlopt -g -package gen -safe-string -c $(MODS:.cmo=.mli) $(MODS:.cmo=.ml) ++ ocamlfind ocamlopt -g -package gen -a -o sedlexing.cmxa $(MODS:.cmo=.cmx) + + doc: + rm -rf ../../libdoc +diff --git a/src/syntax/Makefile b/src/syntax/Makefile +index ec5b86f..f5d1016 100644 +--- a/src/syntax/Makefile ++++ b/src/syntax/Makefile +@@ -7,7 +7,7 @@ include $(shell ocamlc -where)/Makefile.config + SRCS=sedlex_cset.mli sedlex_cset.ml unicode63.mli unicode63.ml sedlex.mli sedlex.ml ppx_sedlex.ml + + OCAMLC=ocamlfind ocamlc +-OCAMLOPT=ocamlfind ocamlopt ++OCAMLOPT=ocamlfind ocamlopt -g + PACKAGES=-package ppx_tools_versioned.metaquot_405 -package ocaml-migrate-parsetree + OCAMLFLAGS=$(PACKAGES) -linkall -w +A-4-9-42 -annot + + diff --git a/ocaml-sedlex.spec b/ocaml-sedlex.spec new file mode 100644 index 0000000..2ee9b02 --- /dev/null +++ b/ocaml-sedlex.spec @@ -0,0 +1,91 @@ +Name: ocaml-sedlex +Version: 1.99.4 +Release: 1%{?dist} +Summary: Unicode-friendly lexer generator + +License: MIT +URL: https://github.com/alainfrisch/sedlex +Source0: https://github.com/alainfrisch/sedlex/archive/v%{version}/%{name}-%{version}.tar.gz + +# add -g when calling ocamlopt +Patch0: native_debug.diff + +BuildRequires: ocaml +BuildRequires: ocaml-findlib +BuildRequires: ocaml-ocamldoc +BuildRequires: ocaml-result-devel +BuildRequires: ocaml-migrate-parsetree-devel +BuildRequires: ocaml-ppx-tools-versioned-devel +BuildRequires: ocaml-gen-devel + +%description +A lexer generator for OCaml, similar to ocamllex, but supporting Unicode. +Contrary to ocamllex, lexer specifications for sedlex are embedded in +regular OCaml source files. + + +%package devel +Summary: Development files for %{name} +Group: Development/Libraries +Requires: %{name}%{?_isa} = %{version}-%{release} + + +%description devel +The %{name}-devel package contains libraries and signature +files for developing applications that use %{name}. + + +%prep +%setup -q -n sedlex-%{version} +%patch0 -p1 + +# spurious-executable-perm +chmod a-x src/syntax/sedlex_cset.ml + +%build +%make_build + +%ifarch %{ocaml_native_compiler} +%make_build opt +%endif + +%install +export DESTDIR=$RPM_BUILD_ROOT +export OCAMLFIND_DESTDIR=$RPM_BUILD_ROOT%{_libdir}/ocaml +mkdir -p $OCAMLFIND_DESTDIR + +# don't use make_install macro since it passes INSTALL, +# which is used differently in the Makefile +%ifarch %{ocaml_native_compiler} +make install +%else +make install_byteonly +%endif + +# Makes *.cmxs and *.opt executable such that they will be stripped. +find $RPM_BUILD_ROOT -name '*.{cmxs,opt}' -exec chmod 0755 {} \; + +%files +%doc README.md CHANGES +%license LICENSE +%{_libdir}/ocaml/* +%ifarch %{ocaml_native_compiler} +%exclude %{_libdir}/ocaml/*/*.a +%exclude %{_libdir}/ocaml/*/*.cmxa +%exclude %{_libdir}/ocaml/*/*.cmx +%endif + + +%files devel +%doc README.md CHANGES +%license LICENSE +%ifarch %{ocaml_native_compiler} +%{_libdir}/ocaml/*/*.a +%{_libdir}/ocaml/*/*.cmxa +%{_libdir}/ocaml/*/*.cmx +%endif + + +%changelog +* Fri Jan 12 2018 Andy Li - 1.99.4-1 +- Initial RPM release. diff --git a/sources b/sources new file mode 100644 index 0000000..3ac5249 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (ocaml-sedlex-1.99.4.tar.gz) = 83bddb03e25b015bc71fb59e3b0e0e097e899c681c8033663c17936f28fde8599a82eaab9c26eafd645c401c106e65fcf173d9fb889eb8999eb1b064ff8b6149