add patch to fix hamlib

OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/swig?expand=0&rev=155
This commit is contained in:
Klaus Kämpf 2024-12-09 13:31:59 +00:00 committed by Git OBS Bridge
commit b7e40f70d6
8 changed files with 2246 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

3
swig-4.2.1.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fa045354e2d048b2cddc69579e4256245d4676894858fcf0bab2290ecf59b7d8
size 8364050

View File

@ -0,0 +1,55 @@
From 4e315cdd7c9072fd33ac1df3d208a0990b8231c3 Mon Sep 17 00:00:00 2001
From: Olly Betts <olly@survex.com>
Date: Sun, 27 Oct 2024 10:02:11 +1300
Subject: [PATCH] Fix precedence of casts
Casts should have the same high precedence as unary plus and minus, but
actually had a lower precedence than anything else.
This could lead to the wrong type being deduced in obscure cases, but
also prevented SWIG deducing a type for expressions such as (0)*1+2
which SWIG parses as a cast and then fixes up afterwards.
A bug fixed in 4.3.0 made this latter problem manifest more often
(previously type deduction happened to work for (0)*1+2 due to an
internal field not getting cleared properly).
Fixes #3058
Index: swig-4.3.0/Examples/test-suite/cpp11_auto_variable.i
===================================================================
--- swig-4.3.0.orig/Examples/test-suite/cpp11_auto_variable.i
+++ swig-4.3.0/Examples/test-suite/cpp11_auto_variable.i
@@ -62,3 +62,11 @@ static auto wstring_lit_len2 = sizeof("1
//static auto constexpr greeting = "Hello";
%}
+
+%inline %{
+/* Regression test for #3058 */
+auto CAST_HAD_WRONG_PRECEDENCE1 = (0)*1+2;
+auto CAST_HAD_WRONG_PRECEDENCE2 = (0)&1|2;
+auto CAST_HAD_WRONG_PRECEDENCE3 = (0)-1|2;
+auto CAST_HAD_WRONG_PRECEDENCE4 = (0)+1|2;
+%}
Index: swig-4.3.0/Source/CParse/parser.y
===================================================================
--- swig-4.3.0.orig/Source/CParse/parser.y
+++ swig-4.3.0/Source/CParse/parser.y
@@ -1793,7 +1793,6 @@ static String *add_qualifier_to_declarat
%token <str> DOXYGENSTRING
%token <str> DOXYGENPOSTSTRING
-%precedence CAST
%left QUESTIONMARK
%left LOR
%left LAND
@@ -1809,7 +1808,7 @@ static String *add_qualifier_to_declarat
%left LSHIFT RSHIFT
%left PLUS MINUS
%left STAR SLASH MODULO
-%precedence UMINUS NOT LNOT
+%precedence UMINUS NOT LNOT CAST
%token DCOLON
%type <node> program interface declaration swig_directive ;

3
swig-4.3.0.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f7203ef796f61af986c70c05816236cbd0d31b7aa9631e5ab53020ab7804aa9e
size 8616205

1964
swig.changes Normal file

File diff suppressed because it is too large Load Diff

1
swig.rpmlintrc Normal file
View File

@ -0,0 +1 @@
addFilter("devel-file-in-non-devel-package .*/usr/share/swig/.*/.*/.*")

196
swig.spec Normal file
View File

@ -0,0 +1,196 @@
#
# spec file for package swig
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2024 Andreas Stieger <Andreas.Stieger@gmx.de>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%bcond_with swig_ocaml
%if 0%{?fedora} + 0%{?rhel_version} + 0%{?centos_version} > 0
%define docpath %{_docdir}/%{name}-%{version}
BuildRequires: perl-Test-Simple
BuildRequires: perl-devel
%if 0%{?centos_version} < 800
BuildRequires: ruby
%endif
%endif
%if 0%{?suse_version} > 0
%define docpath %{_docdir}/%{name}
BuildRequires: ruby-devel
%endif
Name: swig
Version: 4.3.0
Release: 0
Summary: Simplified Wrapper and Interface Generator
License: BSD-3-Clause AND GPL-3.0-or-later
Group: Development/Languages/C and C++
URL: https://www.swig.org/
Source: https://prdownloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
Source1: %{name}.rpmlintrc
Patch0: swig-4.3.0-Fix-precedence-of-casts.patch
BuildRequires: fdupes
BuildRequires: pcre2-devel
BuildRequires: perl
BuildRequires: pkgconfig
%if 0%{?suse_version} < 1600
BuildRequires: gcc12
BuildRequires: gcc12-c++
%else
BuildRequires: gcc
BuildRequires: gcc-c++
%endif
%if 0%{?centos_version} >= 800
BuildRequires: boost-devel
BuildRequires: python3-devel
BuildRequires: python3-tools
%else
%if 0%{?suse_version} >= 1500
BuildRequires: libboost_headers-devel
BuildRequires: python3-devel
BuildRequires: python3-tools
%else
BuildRequires: boost-devel
BuildRequires: python-devel > 2.6
%endif
%endif
%if %{with swig_ocaml}
BuildRequires: ncurses-devel
BuildRequires: ocaml >= 3.12.0
BuildRequires: ocaml-camlp4-devel
BuildRequires: ocaml-findlib
%endif
# for swig-4.3.0-Fix-precedence-of-casts.patch
BuildRequires: bison
%description
SWIG is a compiler that attempts to make it easy to integrate C, C++,
or Objective-C code with scripting languages including Perl, Tcl, and
Python. In a nutshell, you give it a bunch of ANSI C/C++ declarations
and it generates an interface between C and your favorite scripting
language. However, this is only scratching the surface of what SWIG
can do--some of its more advanced features include automatic
documentation generation, module and library management, extensive
customization options, and more.
%package doc
Summary: SWIG Manual
License: BSD-3-Clause
Group: Documentation/Man
Requires: swig
BuildArch: noarch
%description doc
SWIG is a compiler that attempts to make it easy to integrate C, C++,
or Objective-C code with scripting languages including Perl, Tcl, and
Python. In a nutshell, you give it a bunch of ANSI C/C++ declarations
and it generates an interface between C and your favorite scripting
language. However, this is only scratching the surface of what SWIG
can do--some of its more advanced features include automatic
documentation generation, module and library management, extensive
customization options, and more.
This package contains the SWIG manual.
%package examples
Summary: SWIG example files
License: BSD-3-Clause
Group: Documentation/Howto
Requires: swig
BuildArch: noarch
%description examples
SWIG is a compiler that attempts to make it easy to integrate C, C++,
or Objective-C code with scripting languages including Perl, Tcl, and
Python. In a nutshell, you give it a bunch of ANSI C/C++ declarations
and it generates an interface between C and your favorite scripting
language. However, this is only scratching the surface of what SWIG
can do--some of its more advanced features include automatic
documentation generation, module and library management, extensive
customization options, and more.
This package contains SWIG examples, useful both for testing and
understandig SWIG usage.
%prep
%autosetup -p1 -n %{name}-%{version}
%build
%if 0%{?suse_version} < 1600
export CC=gcc-12
export CXX=g++-12
%endif
%ifarch s390 s390x
export CCSHARED="-fPIC"
%endif
%configure \
%if %{without swig_ocaml}
--without-ocaml \
%endif
--disable-ccache
%make_build
%check
%if 0%{?suse_version} >= 1500 || 0%{?centos_version} >= 800
export PY3=true
%endif
%if 0%{?suse_version} < 1600
export CC=gcc-12
export CXX=g++-12
%endif
%make_build check EXTRA_CXXFLAGS="-fexcess-precision=fast"
%install
%make_install
install -d %{buildroot}%{docpath}
cp -a TODO ANNOUNCE CHANGES* README Doc/{Devel,Manual} \
%{buildroot}%{docpath}
install -d %{buildroot}%{_datadir}/swig
cp -a Examples %{buildroot}%{_datadir}/swig/examples
rm -rf %{buildroot}%{_datadir}/swig/examples/test-suite
# rm files that are not needed for running or rebuilding the examples
find %{buildroot}%{_datadir}/swig \
-name '*.dsp' -o -name '*.vcproj' -o -name '*.sln' -o \
-name '*.o' -o -name '*_wrap.c' | xargs rm
# fix perms
chmod -x %{buildroot}%{docpath}/Manual/*
find %{buildroot}%{_datadir}/swig -name '*.h' -perm /111 | \
xargs --no-run-if-empty chmod -x
ln -s %{_datadir}/swig/examples %{buildroot}%{docpath}/Examples
%fdupes %{buildroot}
%files
%license LICENSE
%dir %{docpath}
%{docpath}/[A-Z][A-Z]*
%{_datadir}/swig
%exclude %{_datadir}/swig/examples
%attr(755,root,root) %{_bindir}/swig
%files doc
%license LICENSE
%{docpath}/Devel
%{docpath}/Manual
%files examples
%license LICENSE
%{docpath}/Examples
%{_datadir}/swig/examples
%changelog