public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/coldet] rawhide: Rebase coldet to version 2.0
@ 2026-07-15 19:18 Michal Schorm
  0 siblings, 0 replies; only message in thread
From: Michal Schorm @ 2026-07-15 19:18 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/coldet
            Branch : rawhide
            Commit : df7e7ffb740de05bc0cbce6cf672e63e1c017f81
            Author : Michal Schorm <mschorm@redhat.com>
            Date   : 2026-07-14T22:25:28+02:00
            Stats  : +149/-109 in 7 file(s)
            URL    : https://src.fedoraproject.org/rpms/coldet/c/df7e7ffb740de05bc0cbce6cf672e63e1c017f81?branch=rawhide

            Log:
            Rebase coldet to version 2.0

Upstream release dates: 1.2 (2007-03-05), 2.0 (2013-05-16).

Upstream changes (1.2 -> 2.0):
- New multi-object collision system with sweep-and-prune broad phase
- Bounding sphere radius query via 'getRadius()'
- 'const'-correctness improvements in public API
- File renames: 'math3d.h' -> 'cdmath3d.h', 'makefile.g++' -> 'makefile',
  'coldet.dsp' replaced by 'libcoldet.vcxproj'

Patch changes:
- Dropped 'coldet-1.2-forward-declare.patch' (fixed upstream by code
  reorganization in version 2.0)
- Refreshed 'coldet-2.0-fixes.patch': extern C brace fix, 'getTriangleIndex()'
  undefined behavior fix, missing '#include <cstddef>', missing newline in
  'mytritri.h'
- Refreshed 'coldet-2.0-shared-lib.patch': build shared 'libcoldet.so.0'
  instead of static 'libcoldet.a'

ABI: soname unchanged ('libcoldet.so.0'). Zero reverse dependencies
in Fedora — no rebuilds required.

License: correct SPDX tag from 'LicenseRef-Callaway-LGPLv2+' to
'LGPL-2.0-or-later'. The 'COPYING' file contains the LGPL-2.0 text
with "or any later version" clause, unchanged between 1.2 and 2.0.

Co-Authored-By: Claude AI <noreply@anthropic.com>

---
diff --git a/.gitignore b/.gitignore
index 76d381a..20cb71e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1 @@
-coldet12.zip
+/*.zip

diff --git a/coldet-1.1-fixes.patch b/coldet-1.1-fixes.patch
deleted file mode 100644
index 8d7c2fa..0000000
--- a/coldet-1.1-fixes.patch
+++ /dev/null
@@ -1,82 +0,0 @@
-diff -ur coldet.orig/src/box.cpp coldet/src/box.cpp
---- coldet.orig/src/box.cpp	2001-02-23 21:21:20.000000000 +0100
-+++ coldet/src/box.cpp	2006-06-26 09:11:12.000000000 +0200
-@@ -228,7 +228,7 @@
- extern "C" { 
- int tri_tri_intersect(float V0[3],float V1[3],float V2[3],
-                       float U0[3],float U1[3],float U2[3]);
--};
-+}
- 
- Triangle::Triangle(const Vector3D& _1, const Vector3D& _2, const Vector3D& _3)
- : v1(_1), v2(_2), v3(_3), center((1.0f/3.0f)*(_1+_2+_3)) 
-diff -ur coldet.orig/src/coldetimpl.h coldet/src/coldetimpl.h
---- coldet.orig/src/coldetimpl.h	2001-02-23 21:21:20.000000000 +0100
-+++ coldet/src/coldetimpl.h	2006-06-26 09:11:12.000000000 +0200
-@@ -73,7 +73,7 @@
- 
-   int getTriangleIndex(BoxedTriangle* bt)
-   {
--    return int(bt-&(*m_Triangles.begin()));
-+    return (int)(bt-&(m_Triangles[0]));
-   }
- 
-   /** Stores all the actual triangles.  Other objects will use
-diff -ur coldet.orig/src/makefile.g++ coldet/src/makefile.g++
---- coldet.orig/src/makefile.g++	2001-02-23 21:21:20.000000000 +0100
-+++ coldet/src/makefile.g++	2006-06-26 09:21:22.000000000 +0200
-@@ -1,8 +1,8 @@
- PROJECT=coldet
--LIB=libcoldet.a
-+LIB=libcoldet.so.0
- CC=g++
- OPT=-O2
--CFLAGS=-c $(OPT) -DGCC
-+CFLAGS=-c $(OPT) -fPIC -DPIC -DGCC
- OBJS= \
- coldet.o \
- coldet_bld.o \
-@@ -16,9 +16,7 @@
- all: $(LIB)
- 
- $(LIB): $(OBJS)
--	rm -f $(LIB)
--	ar cr $(LIB) $(OBJS)
--	ranlib $(LIB)
-+	$(CC) -g -shared -o $(LIB) -Wl,-soname,$(LIB) $(OBJS)
- 
- coldet.o: coldet.cpp
- 	$(CC) $(CFLAGS) coldet.cpp
-@@ -33,7 +31,7 @@
- 	$(CC) $(CFLAGS) box_bld.cpp
- 
- tritri.o: tritri.c
--	$(CC) $(CFLAGS) tritri.c
-+	gcc $(CFLAGS) tritri.c
- 
- mytritri.o: mytritri.cpp
- 	$(CC) $(CFLAGS) mytritri.cpp
-diff -ur coldet.orig/src/math3d.h coldet/src/math3d.h
---- coldet.orig/src/math3d.h	2001-02-23 21:21:20.000000000 +0100
-+++ coldet/src/math3d.h	2006-06-26 09:18:39.000000000 +0200
-@@ -99,6 +99,10 @@
-   float& operator() (int i, int j)       { return m[i][j]; }
- };
- 
-+Matrix3D PitchMatrix3D(const float theta);
-+Matrix3D YawMatrix3D(const float theta);
-+Matrix3D RollMatrix3D(const float theta);
-+
- /** 4x4 matrix, used for transformations. */
- struct Matrix3D
- {
-diff -ur coldet.orig/src/mytritri.h coldet/src/mytritri.h
---- coldet.orig/src/mytritri.h	2001-02-23 21:21:20.000000000 +0100
-+++ coldet/src/mytritri.h	2006-06-26 09:21:07.000000000 +0200
-@@ -93,4 +93,4 @@
- 
- 
- 
--#endif // H_MYTRITRI
-\ No newline at end of file
-+#endif // H_MYTRITRI

diff --git a/coldet-1.2-gcc46.patch b/coldet-1.2-gcc46.patch
deleted file mode 100644
index a7f638a..0000000
--- a/coldet-1.2-gcc46.patch
+++ /dev/null
@@ -1,11 +0,0 @@
-diff -up coldet/src/box.h~ coldet/src/box.h
---- coldet/src/box.h~	2001-02-23 19:08:22.000000000 +0100
-+++ coldet/src/box.h	2011-02-13 19:52:56.049850991 +0100
-@@ -25,6 +25,7 @@
- #define H_BOX
- 
- #include <vector>
-+#include <cstddef>
- #include "math3d.h"
- #include "sysdep.h"
- 

diff --git a/coldet-2.0-fixes.patch b/coldet-2.0-fixes.patch
new file mode 100644
index 0000000..04593c7
--- /dev/null
+++ b/coldet-2.0-fixes.patch
@@ -0,0 +1,51 @@
+Fix build errors with modern GCC.
+
+- 'box.cpp': extra semicolon after 'extern "C"' closing brace is
+  an error in pedantic mode
+- 'coldetimpl.h': 'getTriangleIndex()' used address-of on a
+  dereferenced iterator ('&(*begin())'), which is undefined for
+  empty vectors; use '&v[0]' instead
+- 'box.h': missing '#include <cstddef>' for 'size_t' (required
+  since GCC 11+ with stricter implicit-include behavior)
+- 'mytritri.h': missing newline at end of file
+--- coldet/src/box.cpp	2026-07-14 20:23:43.674577933 +0200
++++ coldet/src/box.cpp	2026-07-14 20:23:54.497980561 +0200
+@@ -228,7 +228,7 @@
+ extern "C" { 
+ int tri_tri_intersect(float V0[3],float V1[3],float V2[3],
+                       float U0[3],float U1[3],float U2[3]);
+-};
++}
+ 
+ Triangle::Triangle(const Vector3D& _1, const Vector3D& _2, const Vector3D& _3)
+ : v1(_1), v2(_2), v3(_3), center((1.0f/3.0f)*(_1+_2+_3)) 
+--- coldet/src/coldetimpl.h	2026-07-14 20:23:43.665541551 +0200
++++ coldet/src/coldetimpl.h	2026-07-14 20:23:54.499980890 +0200
+@@ -76,7 +76,7 @@
+ 
+   int getTriangleIndex(BoxedTriangle* bt)
+   {
+-    return int(bt-&(*m_Triangles.begin()));
++    return (int)(bt-&(m_Triangles[0]));
+   }
+ 
+   /** Stores all the actual triangles.  Other objects will use
+--- coldet/src/box.h	2026-07-14 20:23:43.673298001 +0200
++++ coldet/src/box.h	2026-07-14 20:23:54.501656432 +0200
+@@ -25,6 +25,7 @@
+ #define H_BOX
+ 
+ #include <vector>
++#include <cstddef>
+ #include "cdmath3d.h"
+ #include "sysdep.h"
+ 
+--- coldet/src/mytritri.h	2026-07-14 20:23:43.656533983 +0200
++++ coldet/src/mytritri.h	2026-07-14 20:23:54.504689622 +0200
+@@ -95,4 +95,4 @@
+ 
+ __CD__END
+ 
+-#endif // H_MYTRITRI
+\ No newline at end of file
++#endif // H_MYTRITRI

diff --git a/coldet-2.0-shared-lib.patch b/coldet-2.0-shared-lib.patch
new file mode 100644
index 0000000..c03040a
--- /dev/null
+++ b/coldet-2.0-shared-lib.patch
@@ -0,0 +1,73 @@
+Build a shared library with a soname instead of a static archive.
+
+Upstream ships a static-only build ('libcoldet.a'). Fedora policy
+requires shared libraries for packages with reverse dependencies.
+This patch converts the makefile to produce 'libcoldet.so.0' and
+parameterizes the compiler and flags so that 'RPM_OPT_FLAGS' are
+respected via the 'OPT' variable, and adds an 'LDFLAGS' variable
+so that linker flags ('-Wl,-z,now', '-Wl,-pie') reach the final
+shared object.
+
+Soname 'libcoldet.so.0' is unchanged from the Fedora 1.2 package.
+--- coldet/src/makefile	2026-07-14 20:23:43.663033633 +0200
++++ coldet/src/makefile	2026-07-14 20:28:54.093826745 +0200
+@@ -1,3 +1,10 @@
++PROJECT=coldet
++LIB=libcoldet.so.0
++CC=g++
++OPT=-O2
++CFLAGS=-c $(OPT) -fPIC -DPIC -DGCC
++LDFLAGS=
++
+ OBJS=\
+ box.o\
+ box_bld.o\
+@@ -9,34 +16,34 @@
+ sysdep.o\
+ tritri.o
+ 
+-libcoldet.a: $(OBJS)
+-	ar cr libcoldet.a $(OBJS)
+-	
++all: $(LIB)
++
++$(LIB): $(OBJS)
++	$(CC) -g -shared $(LDFLAGS) -o $(LIB) -Wl,-soname,$(LIB) $(OBJS)
++
+ box.o: box.cpp
+-	g++ -c -DGCC -O2 box.cpp
++	$(CC) $(CFLAGS) box.cpp
+ 
+ box_bld.o: box_bld.cpp
+-	g++ -c -DGCC -O2 box_bld.cpp
++	$(CC) $(CFLAGS) box_bld.cpp
+ 
+ cdmath3d.o: cdmath3d.cpp
+-	g++ -c -DGCC -O2 cdmath3d.cpp
++	$(CC) $(CFLAGS) cdmath3d.cpp
+ 
+ coldet.o: coldet.cpp
+-	g++ -c -DGCC -O2 coldet.cpp
++	$(CC) $(CFLAGS) coldet.cpp
+ 
+ coldet_bld.o: coldet_bld.cpp
+-	g++ -c -DGCC -O2 coldet_bld.cpp
++	$(CC) $(CFLAGS) coldet_bld.cpp
+ 
+ multiobject.o: multiobject.cpp
+-	g++ -c -DGCC -O2 multiobject.cpp
++	$(CC) $(CFLAGS) multiobject.cpp
+ 
+ mytritri.o: mytritri.cpp
+-	g++ -c -DGCC -O2 mytritri.cpp
++	$(CC) $(CFLAGS) mytritri.cpp
+ 
+ sysdep.o: sysdep.cpp
+-	g++ -c -DGCC -O2 sysdep.cpp
++	$(CC) $(CFLAGS) sysdep.cpp
+ 
+ tritri.o: tritri.c
+-	gcc -c -DGCC -O2 tritri.c
+-	
+-	
++	gcc $(CFLAGS) tritri.c

diff --git a/coldet.spec b/coldet.spec
index 5392124..7d864ec 100644
--- a/coldet.spec
+++ b/coldet.spec
@@ -1,16 +1,18 @@
 Name:           coldet
-Version:        1.2
-Release:        40%{?dist}
+Version:        2.0
+Release:        1%{?dist}
 Summary:        3D Collision Detection Library
-# Automatically converted from old format: LGPLv2+ - review is highly recommended.
-License:        LicenseRef-Callaway-LGPLv2+
-URL:            http://coldet.sourceforge.net/
-Source0:        http://downloads.sourceforge.net/coldet/coldet12.zip
-Patch0:         coldet-1.1-fixes.patch
-Patch1:         coldet-1.2-gcc46.patch
+License:        LGPL-2.0-or-later
+URL:            https://sourceforge.net/projects/coldet/
+Source0:        https://downloads.sourceforge.net/coldet/coldet20.zip
+# Code fixes: extern C brace, getTriangleIndex, #include <cstddef>, mytritri.h newline
+Patch0:         coldet-2.0-fixes.patch
+# Build shared library with soname instead of static library
+Patch1:         coldet-2.0-shared-lib.patch
 
 BuildRequires:  gcc-c++
-BuildRequires: make
+BuildRequires:  make
+
 %description
 This library is an effort to provide a free collision detection library for
 generic polyhedra. Its purpose is mainly for 3D games where accurate detection
@@ -28,6 +30,7 @@ Features:
     * Segment-Model collision test.
     * Sphere-Model collision test.
     * Ray-Sphere and Sphere-Sphere primitive collision tests.
+    * Multi-object collision system with sweep-and-prune broad phase.
 
 
 %package devel
@@ -41,7 +44,9 @@ applications which use coldet.
 
 %prep
 %setup -q -n %{name}
-%patch -P0 -p1 -z .fixes
+# Convert CRLF line endings to LF
+find src -type f -exec sed -i 's/\r$//' {} \;
+%patch -P0 -p1
 %patch -P1 -p1
 # for %doc
 sed -i 's/\r//' readme.txt COPYING doc/quickstart.html doc/html/{*.html,*.css}
@@ -50,17 +55,15 @@ mv doc/quickstart.html doc/html
 
 %build
 pushd src
-make %{?_smp_mflags} -f makefile.g++ OPT="$RPM_OPT_FLAGS"
+make %{?_smp_mflags} OPT="$RPM_OPT_FLAGS" LDFLAGS="%{build_ldflags}"
 popd
 
 
 %install
-rm -rf $RPM_BUILD_ROOT
 mkdir -p $RPM_BUILD_ROOT%{_libdir} $RPM_BUILD_ROOT%{_includedir}/%{name}
 install -m 755 src/lib%{name}.so.0 $RPM_BUILD_ROOT%{_libdir}
 ln -s lib%{name}.so.0 $RPM_BUILD_ROOT%{_libdir}/lib%{name}.so
-install -m 644 src/coldet.h src/math3d.h $RPM_BUILD_ROOT%{_includedir}/%{name}
-
+install -m 644 src/coldet.h src/cdmath3d.h $RPM_BUILD_ROOT%{_includedir}/%{name}
 
 
 %ldconfig_scriptlets
@@ -77,6 +80,12 @@ install -m 644 src/coldet.h src/math3d.h $RPM_BUILD_ROOT%{_includedir}/%{name}
 
 
 %changelog
+* Tue Jul 14 2026 Michal Schorm <mschorm@redhat.com> - 2.0-1
+- Rebase to version 2.0
+- New upstream features: multi-object collision system with sweep-and-prune
+  broad phase, bounding sphere radius query, const-correctness improvements
+- Correct SPDX license tag to 'LGPL-2.0-or-later'
+
 * Fri Jan 16 2026 Fedora Release Engineering <releng@fedoraproject.org> - 1.2-40
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild
 

diff --git a/sources b/sources
index 09bb765..51d4859 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-069ceb36333f8d88e099a44d19ebc061  coldet12.zip
+SHA512 (coldet20.zip) = 5ffa07301436f443de35a00d236e36cc25093ab9926ac73f8e4b1a2b8f8dd8d4ab7434d3abdec1527fab004a7b21ba749c93a8b74e5cc7bfcd602f3a6e88ca1f

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-15 19:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-15 19:18 [rpms/coldet] rawhide: Rebase coldet to version 2.0 Michal Schorm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox