From: Richard W.M. Jones Date: Tue, 27 Jun 2023 17:12:59 +0000 (+0100) Subject: Unbundle libyaml X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=5e5e89d9d3f2773dc3d23f91100f43b1f2382933;p=fedora-reviews.git Unbundle libyaml --- diff --git a/ocaml-yaml/fix-yaml.h.patch b/ocaml-yaml/fix-yaml.h.patch new file mode 100644 index 0000000..953a85e --- /dev/null +++ b/ocaml-yaml/fix-yaml.h.patch @@ -0,0 +1,121 @@ +--- a/vendor/yaml.h 2020-06-01 22:34:52.000000000 +0100 ++++ b/vendor/yaml.h 2023-06-27 17:28:03.073472871 +0100 +@@ -272,28 +272,28 @@ + yaml_token_type_t type; + + /** The token data. */ +- union { ++ union data_u { + + /** The stream start (for @c YAML_STREAM_START_TOKEN). */ +- struct { ++ struct stream_start_s { + /** The stream encoding. */ + yaml_encoding_t encoding; + } stream_start; + + /** The alias (for @c YAML_ALIAS_TOKEN). */ +- struct { ++ struct alias_s { + /** The alias value. */ + yaml_char_t *value; + } alias; + + /** The anchor (for @c YAML_ANCHOR_TOKEN). */ +- struct { ++ struct anchor_s { + /** The anchor value. */ + yaml_char_t *value; + } anchor; + + /** The tag (for @c YAML_TAG_TOKEN). */ +- struct { ++ struct tag_s { + /** The tag handle. */ + yaml_char_t *handle; + /** The tag suffix. */ +@@ -301,7 +301,7 @@ + } tag; + + /** The scalar value (for @c YAML_SCALAR_TOKEN). */ +- struct { ++ struct scalar_s { + /** The scalar value. */ + yaml_char_t *value; + /** The length of the scalar value. */ +@@ -311,7 +311,7 @@ + } scalar; + + /** The version directive (for @c YAML_VERSION_DIRECTIVE_TOKEN). */ +- struct { ++ struct version_directive_s { + /** The major version number. */ + int major; + /** The minor version number. */ +@@ -389,21 +389,21 @@ + yaml_event_type_t type; + + /** The event data. */ +- union { ++ union event_data_u { + + /** The stream parameters (for @c YAML_STREAM_START_EVENT). */ +- struct { ++ struct event_stream_start_s { + /** The document encoding. */ + yaml_encoding_t encoding; + } stream_start; + + /** The document parameters (for @c YAML_DOCUMENT_START_EVENT). */ +- struct { ++ struct event_document_start_s { + /** The version directive. */ + yaml_version_directive_t *version_directive; + + /** The list of tag directives. */ +- struct { ++ struct event_tag_directives_s { + /** The beginning of the tag directives list. */ + yaml_tag_directive_t *start; + /** The end of the tag directives list. */ +@@ -415,19 +415,19 @@ + } document_start; + + /** The document end parameters (for @c YAML_DOCUMENT_END_EVENT). */ +- struct { ++ struct event_document_end_s { + /** Is the document end indicator implicit? */ + int implicit; + } document_end; + + /** The alias parameters (for @c YAML_ALIAS_EVENT). */ +- struct { ++ struct event_alias_s { + /** The anchor. */ + yaml_char_t *anchor; + } alias; + + /** The scalar parameters (for @c YAML_SCALAR_EVENT). */ +- struct { ++ struct event_scalar_s { + /** The anchor. */ + yaml_char_t *anchor; + /** The tag. */ +@@ -445,7 +445,7 @@ + } scalar; + + /** The sequence parameters (for @c YAML_SEQUENCE_START_EVENT). */ +- struct { ++ struct event_sequence_start_s { + /** The anchor. */ + yaml_char_t *anchor; + /** The tag. */ +@@ -457,7 +457,7 @@ + } sequence_start; + + /** The mapping parameters (for @c YAML_MAPPING_START_EVENT). */ +- struct { ++ struct event_mapping_start_s { + /** The anchor. */ + yaml_char_t *anchor; + /** The tag. */ diff --git a/ocaml-yaml/ocaml-yaml.spec b/ocaml-yaml/ocaml-yaml.spec index c479d80..15c1dcb 100644 --- a/ocaml-yaml/ocaml-yaml.spec +++ b/ocaml-yaml/ocaml-yaml.spec @@ -7,6 +7,10 @@ License: ISC URL: https://avsm.github.io/ocaml-yaml/ Source0: https://github.com/avsm/ocaml-yaml/releases/download/v%{version}/yaml-%{version}.tbz +# These are used to unbundle libyaml. +Patch1: fix-yaml.h.patch +Source1: unbundled-dune + BuildRequires: ocaml >= 4.13.0 BuildRequires: ocaml-bos-devel BuildRequires: ocaml-ctypes-devel >= 0.14.0 @@ -14,6 +18,7 @@ BuildRequires: ocaml-dune >= 2.0 BuildRequires: ocaml-dune-configurator-devel BuildRequires: ocaml-ppx-sexp-conv-devel >= 0.9.0 BuildRequires: ocaml-sexplib-devel +BuildRequires: libyaml-devel # Test dependencies # Fedora does not have crowbar, ezjsonm, or junit_alcotest @@ -27,10 +32,6 @@ BuildRequires: ocaml-logs-devel BuildRequires: ocaml-mdx-devel >= 2.10 %endif -# The bundled version of libyaml has been modified for better integration -# with ocaml-ctypes -Provides: bundled(libyaml) = 0.2.5 - %description This is an OCaml library to parse and generate the YAML file format. It is intended to be interoperable with the Ezjsonm @@ -67,7 +68,17 @@ The %{name}-sexp-devel package contains libraries and signature files for developing applications that use %{name}-sexp. %prep -%autosetup -n yaml-%{version} +%setup -n yaml-%{version} + +# Unbundle the included copy of libyaml. +# https://bugzilla.redhat.com/show_bug.cgi?id=2217729#c4 +rm vendor/*.c vendor/yaml.h vendor/yaml_private.h vendor/dune +cp %{_includedir}/yaml.h vendor/yaml.h +%patch -P1 -p1 +touch vendor/dummy.c +cp %{SOURCE1} vendor/dune + +sed -i 's|../../vendor/yaml_private.h||g' ffi/lib/dune %build %dune_build diff --git a/ocaml-yaml/unbundled-dune b/ocaml-yaml/unbundled-dune new file mode 100644 index 0000000..e1351f9 --- /dev/null +++ b/ocaml-yaml/unbundled-dune @@ -0,0 +1,20 @@ +(library + (name yaml_c) + (public_name yaml.c) + (preprocess no_preprocessing) + (flags + (:standard -safe-string)) + (foreign_archives yaml_c_stubs)) + +(rule + (targets libyaml_c_stubs%{ext_lib} dllyaml_c_stubs%{ext_dll}) + (deps dummy%{ext_obj}) + (action + (run ocamlmklib -o yaml_c_stubs %{deps} -lyaml))) + +(rule + (targets dummy%{ext_obj}) + (deps + (:c dummy.c)) + (action + (run %{cc} %{read-lines:../config/cflags} -Wall -DHAVE_CONFIG_H -I. -c %{c})))