From 3b57be16db46bf1f3a563e561c8a2366535475c6 Mon Sep 17 00:00:00 2001 From: Jerry James Date: Tue, 20 Jun 2023 08:45:17 -0600 Subject: [PATCH] Enable OCaml support. Add patch for OCaml 5.0.0. --- swig-ocaml-5.0.patch | 43 +++++++++++++++++++++++++++++++++++++++++++ swig.spec | 21 +++++++++++++++++++-- 2 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 swig-ocaml-5.0.patch diff --git a/swig-ocaml-5.0.patch b/swig-ocaml-5.0.patch new file mode 100644 index 0000000..820921a --- /dev/null +++ b/swig-ocaml-5.0.patch @@ -0,0 +1,43 @@ +--- swig-4.1.1/Lib/ocaml/ocamlrundec.swg.orig 2022-11-30 00:35:05.000000000 -0700 ++++ swig-4.1.1/Lib/ocaml/ocamlrundec.swg 2023-07-04 07:09:10.733716151 -0600 +@@ -14,7 +14,7 @@ SWIGEXT { + #else + #define SWIGEXT + #endif +-#define value caml_value_t ++#define caml_value_t value + #define CAML_VALUE caml_value_t + #define CAML_NAME_SPACE + #include +@@ -80,11 +80,15 @@ SWIGEXT { + /* Also an l-value. */ + #endif + ++#ifndef CAML_LOCAL_ROOTS ++#define CAML_LOCAL_ROOTS caml_local_roots ++#endif ++ + #ifdef CAMLreturn0 + #undef CAMLreturn0 + #endif + #define CAMLreturn0 do{ \ +- caml_local_roots = caml__frame; \ ++ CAML_LOCAL_ROOTS = caml__frame; \ + return; \ + }while (0) + +@@ -93,12 +97,12 @@ SWIGEXT { + #endif + #define CAMLreturn(result) do{ \ + caml_value_t caml__temp_result = (result); \ +- caml_local_roots = caml__frame; \ ++ CAML_LOCAL_ROOTS = caml__frame; \ + return (caml__temp_result); \ + }while(0) + + #define CAMLreturn_type(result) do{ \ +- caml_local_roots = caml__frame; \ ++ CAML_LOCAL_ROOTS = caml__frame; \ + return result; \ + }while(0) + diff --git a/swig.spec b/swig.spec index c488fa6..7647153 100644 --- a/swig.spec +++ b/swig.spec @@ -13,6 +13,7 @@ %global octave 0 %global Rlang 0 %global javalang 0 +%global ocamllang 0 %endif %{!?tcl:%global tcl 1} @@ -26,6 +27,7 @@ %endif %{!?rubylang:%global rubylang 1} %{!?python3lang:%global python3lang 1} +%{!?ocamllang:%global ocamllang 1} %if 0%{?rhel} %{!?golang:%global golang 0} @@ -56,9 +58,9 @@ Summary: Connects C/C++/Objective C to some high-level programming languages Name: swig Version: 4.1.1 -Release: 6%{?dist} +Release: 7%{?dist} License: GPL-3.0-or-later AND BSD-3-Clause -URL: http://swig.sourceforge.net/ +URL: https://www.swig.org/ Source0: http://downloads.sourceforge.net/project/swig/swig/swig-%{version}/swig-%{version}.tar.gz # Define the part of man page sections Source1: description.h2m @@ -71,6 +73,9 @@ Patch0: swig-configure-c99.patch # Octave 8.1 support # https://patch-diff.githubusercontent.com/raw/swig/swig/pull/2512.patch Patch1: swig-octave-8.1.patch +# OCaml 5.0 support +# https://github.com/swig/swig/pull/2649 +Patch2: swig-ocaml-5.0.patch BuildRequires: coreutils BuildRequires: findutils @@ -127,6 +132,10 @@ BuildRequires: java, java-devel %if %{phplang} BuildRequires: php, php-devel %endif +%if %{ocamllang} +BuildRequires: ocaml +BuildRequires: ocaml-findlib +%endif %description Simplified Wrapper and Interface Generator (SWIG) is a software @@ -189,7 +198,11 @@ done # AC_CHECK_PROGS requires just the name, so use for configure # --with-python3=python3 --with-2to3=2to3 %configure \ +%if %{ocamllang} + --with-ocaml \ +%else --without-ocaml \ +%endif %if %{python3lang} --with-python3=python3 \ --with-2to3=2to3 \ @@ -349,6 +362,10 @@ install -pm 644 Tools/swig.gdb %{buildroot}%{_datadir}/%{name}/gdb %{_datadir}/%{name}/gdb %changelog +* Tue Jun 20 2023 Jerry James - 4.1.1-7 +- Enable OCaml support +- Add patch for OCaml 5.0.0 + * Sat Apr 08 2023 Orion Poplawski - 4.1.1-6 - Rebuild with octave 8.1.0