!2 [sync] PR-1: 初始化ocaml-csexp

Merge pull request !2 from openeuler-sync-bot/sync-pr1-master-to-openEuler-22.03-LTS-Next
This commit is contained in:
openeuler-ci-bot 2022-01-21 03:54:17 +00:00 committed by Gitee
commit 74ccef576b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 143 additions and 0 deletions

BIN
csexp-1.5.1.tbz Normal file

Binary file not shown.

139
ocaml-csexp.spec Normal file
View File

@ -0,0 +1,139 @@
%ifnarch %{ocaml_native_compiler}
%global debug_package %{nil}
%endif
%bcond_with dune
Name: ocaml-csexp
Version: 1.5.1
Release: 1
Summary: Parsing and printing of S-expressions in canonical form
License: MIT
URL: https://github.com/ocaml-dune/csexp
Source0: https://github.com/ocaml-dune/csexp/releases/download/%{version}/csexp-%{version}.tbz
BuildRequires: ocaml >= 4.03.0
%if %{with dune}
BuildRequires: ocaml-dune >= 1.11
BuildRequires: ocaml-odoc
%endif
%description
This project provides minimal support for parsing and printing
S-expressions in canonical form, which is a very simple and canonical
binary encoding of S-expressions.
%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 -n csexp-%{version}
%build
%if %{with dune}
dune build %{?_smp_mflags} --display=verbose @install
dune build %{?_smp_mflags} @doc
%else
OFLAGS="-strict-sequence -strict-formats -short-paths -keep-locs -g"
OCFLAGS="$OFLAGS -bin-annot"
cd src
ocamlc $OCFLAGS -output-obj csexp.mli
ocamlc $OCFLAGS -a -o csexp.cma csexp.ml
%ifarch %{ocaml_native_compiler}
ocamlopt $OFLAGS -ccopt "%{build_cflags}" -cclib "%{build_ldflags}" -a \
-o csexp.cmxa csexp.ml
ocamlopt $OFLAGS -ccopt "%{build_cflags}" -cclib "%{build_ldflags}" -shared \
-o csexp.cmxs csexp.ml
%endif
cd -
%endif
%install
%if %{with dune}
dune install --destdir=%{buildroot}
find _build/default/_doc/_html -name .dune-keep -delete
find %{buildroot}%{_libdir}/ocaml -name \*.ml -delete
rm -fr %{buildroot}%{_prefix}/doc
%else
mkdir -p %{buildroot}%{_libdir}/ocaml/csexp
cp -p src/csexp.{cma,cmi,cmt,cmti,mli} %{buildroot}%{_libdir}/ocaml/csexp
%ifarch %{ocaml_native_compiler}
cp -p src/csexp.{a,cmx,cmxa,cmxs} %{buildroot}%{_libdir}/ocaml/csexp
%endif
cp -p csexp.opam %{buildroot}%{_libdir}/ocaml/csexp/opam
cat >> %{buildroot}%{_libdir}/ocaml/csexp/META << EOF
version = "%{version}"
description = "Parsing and printing of S-expressions in canonical form"
archive(byte) = "csexp.cma"
%ifarch %{ocaml_native_compiler}
archive(native) = "csexp.cmxa"
%endif
plugin(byte) = "csexp.cma"
%ifarch %{ocaml_native_compiler}
plugin(native) = "csexp.cmxs"
%endif
EOF
cat >> %{buildroot}%{_libdir}/ocaml/csexp/dune-package << EOF
(lang dune 2.8)
(name csexp)
(version %{version})
(library
(name csexp)
(kind normal)
%ifarch %{ocaml_native_compiler}
(archives (byte csexp.cma) (native csexp.cmxa))
(plugins (byte csexp.cma) (native csexp.cmxs))
(native_archives csexp.a)
%else
(archives (byte csexp.cma))
(plugins (byte csexp.cma))
%endif
(main_module_name Csexp)
%ifarch %{ocaml_native_compiler}
(modes byte native)
%else
(modes byte)
%endif
(modules
(singleton (name Csexp) (obj_name csexp) (visibility public) (impl) (intf))))
EOF
%endif
%files
%doc README.md
%license LICENSE.md
%dir %{_libdir}/ocaml/csexp/
%{_libdir}/ocaml/csexp/META
%{_libdir}/ocaml/csexp/*.cma
%{_libdir}/ocaml/csexp/*.cmi
%ifarch %{ocaml_native_compiler}
%{_libdir}/ocaml/csexp/*.cmxs
%endif
%files devel
%{_libdir}/ocaml/csexp/dune-package
%{_libdir}/ocaml/csexp/opam
%ifarch %{ocaml_native_compiler}
%{_libdir}/ocaml/csexp/*.a
%{_libdir}/ocaml/csexp/*.cmx
%{_libdir}/ocaml/csexp/*.cmxa
%endif
%{_libdir}/ocaml/csexp/*.cmt
%{_libdir}/ocaml/csexp/*.cmti
%{_libdir}/ocaml/csexp/*.mli
%changelog
* Thu Jan 20 2022 xu_ping <xuping33@huawei.com> - 1.5.1-1
- Package init

4
ocaml-csexp.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: github
src_repo: ocaml-dune/csexp
tag_prefix: "^"
seperator: "."