[packages/box2d] - revert back to 2.4.1 and add pkgconfig file
baggins
baggins at pld-linux.org
Sat Nov 14 10:20:54 CET 2026
commit c382307ded23bf6a76dbc7482a22fa20a98ffe2e
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Sat Nov 14 10:18:39 2026 +0100
- revert back to 2.4.1 and add pkgconfig file
Next time upgrading this, please fix dependecies first.
3.x depends on a bunch of libraries we don't have packaged and it tries
to fetch them at build time.
Also libreoffice depends on 2.4.x.
box2d.spec | 11 +++++----
pkgconfig.patch | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 80 insertions(+), 4 deletions(-)
---
diff --git a/box2d.spec b/box2d.spec
index 426a095..3d1e3a7 100644
--- a/box2d.spec
+++ b/box2d.spec
@@ -2,12 +2,13 @@ Summary: Box2D - 2D physics engine for games
Summary(pl.UTF-8): Box2D - silnik fizyki 2D dla gier
Name: box2d
Version: 2.4.1
-Release: 1
+Release: 2
License: MIT
Group: Libraries
#Source0Download: https://github.com/erincatto/box2d/releases
Source0: https://github.com/erincatto/box2d/archive/v%{version}/%{name}-%{version}.tar.gz
# Source0-md5: 00d2c9c66da494aed947e03bff73e080
+Patch0: pkgconfig.patch
URL: https://box2d.org/
BuildRequires: cmake >= 3.8
BuildRequires: rpmbuild(macros) >= 1.605
@@ -33,6 +34,7 @@ Pliki nagłówkowe biblioteki box2d.
%prep
%setup -q
+%patch -P0 -p1
%build
%cmake -B build \
@@ -55,11 +57,12 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
%doc CHANGELOG.md README.md
-%attr(755,root,root) %{_libdir}/libbox2d.so.*.*.*
-%attr(755,root,root) %ghost %{_libdir}/libbox2d.so.2
+%{_libdir}/libbox2d.so.*.*.*
+%ghost %{_libdir}/libbox2d.so.2
%files devel
%defattr(644,root,root,755)
-%attr(755,root,root) %{_libdir}/libbox2d.so
+%{_libdir}/libbox2d.so
%{_libdir}/cmake/box2d
%{_includedir}/box2d
+%{_pkgconfigdir}/box2d.pc
diff --git a/pkgconfig.patch b/pkgconfig.patch
new file mode 100644
index 0000000..a1ac32a
--- /dev/null
+++ b/pkgconfig.patch
@@ -0,0 +1,73 @@
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 4f402473e..9cbb45b6e 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -260,3 +260,51 @@ install(
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/box2dConfigVersion.cmake"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/box2d"
+ )
++
++# Anchor every path to the .pc file itself so the install tree can be relocated,
++# by cmake --install --prefix or by moving it afterwards
++file(RELATIVE_PATH PKGCONFIG_PREFIX_REL "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig" "${CMAKE_INSTALL_PREFIX}")
++string(REGEX REPLACE "/$" "" PKGCONFIG_PREFIX_REL "${PKGCONFIG_PREFIX_REL}")
++file(RELATIVE_PATH PKGCONFIG_LIBDIR_REL "${CMAKE_INSTALL_PREFIX}" "${CMAKE_INSTALL_FULL_LIBDIR}")
++file(RELATIVE_PATH PKGCONFIG_INCLUDEDIR_REL "${CMAKE_INSTALL_PREFIX}" "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
++
++# The file has to carry every PUBLIC define the exported target carries, or consumers
++# compile against different headers than the library was built with. Keep in sync
++# with the defines above.
++set(PKGCONFIG_CFLAGS "")
++if (BOX2D_DOUBLE_PRECISION)
++ string(APPEND PKGCONFIG_CFLAGS " -DBOX2D_DOUBLE_PRECISION")
++endif()
++if (WIN32 AND BUILD_SHARED_LIBS)
++ # base.h keys the dllimport off _WIN32, so MinGW needs this as much as MSVC
++ string(APPEND PKGCONFIG_CFLAGS " -DBOX2D_DLL")
++endif()
++string(APPEND PKGCONFIG_CFLAGS "$<$<CONFIG:RELWITHDEBINFO>: -DB2_ENABLE_ASSERT>")
++
++set(PKGCONFIG_LIBNAME "box2d$<$<CONFIG:Debug>:${CMAKE_DEBUG_POSTFIX}>")
++
++# Plain pkg-config --libs skips Libs.private, and Box2D builds static by default, so
++# public link deps belong on the main line unless we are actually building a shared lib
++set(PKGCONFIG_LIBS "")
++set(PKGCONFIG_LIBS_PRIVATE "")
++if(UNIX AND NOT APPLE AND NOT EMSCRIPTEN)
++ if(BUILD_SHARED_LIBS)
++ set(PKGCONFIG_LIBS_PRIVATE "-lm")
++ else()
++ set(PKGCONFIG_LIBS " -lm")
++ endif()
++endif()
++
++configure_file(box2d.pc.in box2d.pc.gen @ONLY)
++
++# The library name and the assert define vary by config, so finish the substitution
++# per config instead of once at configure time
++file(GENERATE
++ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/$<CONFIG>/box2d.pc"
++ INPUT "${CMAKE_CURRENT_BINARY_DIR}/box2d.pc.gen"
++)
++
++install(
++ FILES "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/$<CONFIG>/box2d.pc"
++ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
++)
+diff --git a/src/box2d.pc.in b/src/box2d.pc.in
+new file mode 100644
+index 000000000..01a507b87
+--- /dev/null
++++ b/src/box2d.pc.in
+@@ -0,0 +1,11 @@
++prefix=${pcfiledir}/@PKGCONFIG_PREFIX_REL@
++exec_prefix=${prefix}
++libdir=${prefix}/@PKGCONFIG_LIBDIR_REL@
++includedir=${prefix}/@PKGCONFIG_INCLUDEDIR_REL@
++
++Name: @PROJECT_NAME@
++Description: @PROJECT_DESCRIPTION@
++Version: @PROJECT_VERSION@
++Libs: -L${libdir} -l at PKGCONFIG_LIBNAME@@PKGCONFIG_LIBS@
++Libs.private: @PKGCONFIG_LIBS_PRIVATE@
++Cflags: -I${includedir}@PKGCONFIG_CFLAGS@
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/box2d.git/commitdiff/c382307ded23bf6a76dbc7482a22fa20a98ffe2e
More information about the pld-cvs-commit
mailing list