From f399af49c4d88335cb44b39302cc58e816b961a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Sat, 30 Aug 2025 16:16:27 +0700 Subject: [PATCH] glm: update to 1.0.1. --- srcpkgs/glm/files/glm.pc | 7 - srcpkgs/glm/patches/be.patch | 333 ++++++++++++++------------- srcpkgs/glm/patches/cmake.patch | 20 ++ srcpkgs/glm/patches/pkg-config.patch | 25 ++ srcpkgs/glm/patches/werror.patch | 25 ++ srcpkgs/glm/template | 28 +-- 6 files changed, 244 insertions(+), 194 deletions(-) delete mode 100644 srcpkgs/glm/files/glm.pc create mode 100644 srcpkgs/glm/patches/cmake.patch create mode 100644 srcpkgs/glm/patches/pkg-config.patch create mode 100644 srcpkgs/glm/patches/werror.patch diff --git a/srcpkgs/glm/files/glm.pc b/srcpkgs/glm/files/glm.pc deleted file mode 100644 index 9821cc07d6e..00000000000 --- a/srcpkgs/glm/files/glm.pc +++ /dev/null @@ -1,7 +0,0 @@ -prefix=/usr -includedir=${prefix}/include - -Name: GLM -Description: OpenGL Mathematics -Version: 0.9.9.6 -Cflags: -I${includedir} diff --git a/srcpkgs/glm/patches/be.patch b/srcpkgs/glm/patches/be.patch index 737dde75b29..47ca223ebd2 100644 --- a/srcpkgs/glm/patches/be.patch +++ b/srcpkgs/glm/patches/be.patch @@ -1,169 +1,172 @@ -Taken from Adélie Linux. - ---- glm-0.9.9.0/test/gtc/gtc_packing.cpp -+++ glm-0.9.9.0/test/gtc/gtc_packing.cpp -@@ -3,6 +3,7 @@ - #include - #include - #include -+#include - - void print_bits(float const& s) - { -@@ -155,7 +156,7 @@ - - glm::u8vec4 const v0(0xff, 0x77, 0x0, 0x33); - glm::uint32 const p0 = *reinterpret_cast(&v0[0]); -- glm::uint32 const r0 = 0x330077ff; -+ glm::uint32 const r0 = htonl(0xff770033); - - Error += p0 == r0 ? 0 : 1; - ---- glm-0.9.9.0/glm/gtc/packing.inl -+++ glm-0.9.9.0/glm/gtc/packing.inl -@@ -9,6 +9,9 @@ - #include "../detail/type_half.hpp" - #include - #include -+extern "C" { -+#include -+} - - namespace glm{ - namespace detail -@@ -183,9 +186,15 @@ - { - struct - { -+#if BYTE_ORDER == LITTLE_ENDIAN - uint x : 3; - uint y : 3; - uint z : 2; +diff --git a/glm/gtc/packing.inl b/glm/gtc/packing.inl +index 1792760..1c60f5a 100644 +--- a/glm/gtc/packing.inl ++++ b/glm/gtc/packing.inl +@@ -10,6 +10,10 @@ + #include + #include + ++extern "C" { ++#include ++} ++ + namespace glm{ + namespace detail + { +@@ -190,9 +194,15 @@ namespace detail + { + struct Data + { ++#if BYTE_ORDER == LITTLE_ENDIAN + uint x : 3; + uint y : 3; + uint z : 2; +#else -+ uint z : 2; -+ uint y : 3; -+ uint x : 3; ++ uint z : 2; ++ uint y : 3; ++ uint x : 3; +#endif - } data; - uint8 pack; - }; -@@ -194,8 +203,13 @@ - { - struct - { -+#if BYTE_ORDER == LITTLE_ENDIAN - uint x : 4; - uint y : 4; + } data; + uint8 pack; + }; +@@ -201,8 +211,13 @@ namespace detail + { + struct Data + { ++#if BYTE_ORDER == LITTLE_ENDIAN + uint x : 4; + uint y : 4; +#else -+ uint y : 4; -+ uint x : 4; ++ uint y : 4; ++ uint x : 4; +#endif - } data; - uint8 pack; - }; -@@ -204,10 +218,17 @@ - { - struct - { -+#if BYTE_ORDER == LITTLE_ENDIAN - uint x : 4; - uint y : 4; - uint z : 4; - uint w : 4; -+#else -+ uint w : 4; -+ uint z : 4; -+ uint y : 4; -+ uint x : 4; -+#endif - } data; - uint16 pack; - }; -@@ -216,9 +237,15 @@ - { - struct - { -+#if BYTE_ORDER == LITTLE_ENDIAN - uint x : 5; - uint y : 6; - uint z : 5; -+#else -+ uint z : 5; -+ uint y : 6; -+ uint x : 5; -+#endif - } data; - uint16 pack; - }; -@@ -227,10 +254,17 @@ - { - struct - { -+#if BYTE_ORDER == LITTLE_ENDIAN - uint x : 5; - uint y : 5; - uint z : 5; - uint w : 1; -+#else -+ uint w : 1; -+ uint z : 5; -+ uint y : 5; -+ uint x : 5; -+#endif - } data; - uint16 pack; - }; -@@ -239,10 +273,17 @@ - { - struct - { -+#if BYTE_ORDER == LITTLE_ENDIAN - uint x : 10; - uint y : 10; - uint z : 10; - uint w : 2; -+#else -+ uint w : 2; -+ uint z : 10; -+ uint y : 10; -+ uint x : 10; -+#endif - } data; - uint32 pack; - }; -@@ -251,10 +292,17 @@ - { - struct - { -+#if BYTE_ORDER == LITTLE_ENDIAN - int x : 10; - int y : 10; - int z : 10; - int w : 2; -+#else -+ int w : 2; -+ int z : 10; -+ int y : 10; -+ int x : 10; -+#endif - } data; - uint32 pack; - }; -@@ -263,10 +311,17 @@ - { - struct - { -+#if BYTE_ORDER == LITTLE_ENDIAN - uint x : 9; - uint y : 9; - uint z : 9; - uint w : 5; -+#else -+ uint w : 5; -+ uint z : 9; -+ uint y : 9; -+ uint x : 9; -+#endif - } data; - uint32 pack; - }; + } data; + uint8 pack; + }; +@@ -211,10 +226,17 @@ namespace detail + { + struct Data + { ++#if BYTE_ORDER == LITTLE_ENDIAN + uint x : 4; + uint y : 4; + uint z : 4; + uint w : 4; ++#else ++ uint w : 4; ++ uint z : 4; ++ uint y : 4; ++ uint x : 4; ++#endif + } data; + uint16 pack; + }; +@@ -223,9 +245,15 @@ namespace detail + { + struct Data + { ++#if BYTE_ORDER == LITTLE_ENDIAN + uint x : 5; + uint y : 6; + uint z : 5; ++#else ++ uint z : 5; ++ uint y : 6; ++ uint x : 5; ++#endif + } data; + uint16 pack; + }; +@@ -234,10 +262,17 @@ namespace detail + { + struct Data + { ++#if BYTE_ORDER == LITTLE_ENDIAN + uint x : 5; + uint y : 5; + uint z : 5; + uint w : 1; ++#else ++ uint w : 1; ++ uint z : 5; ++ uint y : 5; ++ uint x : 5; ++#endif + } data; + uint16 pack; + }; +@@ -252,10 +287,17 @@ namespace detail + { + struct Data + { ++#if BYTE_ORDER == LITTLE_ENDIAN + uint x : 10; + uint y : 10; + uint z : 10; + uint w : 2; ++#else ++ uint w : 2; ++ uint z : 10; ++ uint y : 10; ++ uint x : 10; ++#endif + } data; + uint32 pack; + }; +@@ -264,10 +306,17 @@ namespace detail + { + struct Data + { ++#if BYTE_ORDER == LITTLE_ENDIAN + int x : 10; + int y : 10; + int z : 10; + int w : 2; ++#else ++ int w : 2; ++ int z : 10; ++ int y : 10; ++ int x : 10; ++#endif + } data; + uint32 pack; + }; +@@ -276,10 +325,17 @@ namespace detail + { + struct Data + { ++#if BYTE_ORDER == LITTLE_ENDIAN + uint x : 9; + uint y : 9; + uint z : 9; + uint w : 5; ++#else ++ uint w : 5; ++ uint z : 9; ++ uint y : 9; ++ uint x : 9; ++#endif + } data; + uint32 pack; + }; +diff --git a/test/gtc/gtc_packing.cpp b/test/gtc/gtc_packing.cpp +index b3fd854..614c0e2 100644 +--- a/test/gtc/gtc_packing.cpp ++++ b/test/gtc/gtc_packing.cpp +@@ -4,6 +4,7 @@ + #include + #include + #include ++#include + + /* + static void print_bits(float const& s) +@@ -157,7 +158,7 @@ static int test_U3x10_1x2() + + glm::u8vec4 const v0(0xff, 0x77, 0x0, 0x33); + glm::uint32 const p0 = *reinterpret_cast(&v0[0]); +- glm::uint32 const r0 = 0x330077ff; ++ glm::uint32 const r0 = htonl(0xff770033); + + Error += p0 == r0 ? 0 : 1; + diff --git a/srcpkgs/glm/patches/cmake.patch b/srcpkgs/glm/patches/cmake.patch new file mode 100644 index 00000000000..1a5f6ed583f --- /dev/null +++ b/srcpkgs/glm/patches/cmake.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -263,7 +263,7 @@ + install( + EXPORT glm + NAMESPACE glm:: +- DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/glm" ++ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/glm" + FILE glmConfig.cmake + ) + include(CMakePackageConfigHelpers) +@@ -273,7 +273,7 @@ + ) + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/glmConfigVersion.cmake" +- DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/glm" ++ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/glm" + ) + + configure_file( diff --git a/srcpkgs/glm/patches/pkg-config.patch b/srcpkgs/glm/patches/pkg-config.patch new file mode 100644 index 00000000000..031e887dab7 --- /dev/null +++ b/srcpkgs/glm/patches/pkg-config.patch @@ -0,0 +1,25 @@ +this is removed in 1.0, but it's still needed by anything trying to find this +with autotools +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -32,6 +32,10 @@ + option(GLM_ENABLE_CXX_17 "Enable C++ 17" OFF) + option(GLM_ENABLE_CXX_20 "Enable C++ 20" OFF) + ++set(GLM_PC ${CMAKE_CURRENT_BINARY_DIR}/glm.pc) ++configure_file(${CMAKE_CURRENT_SOURCE_DIR}/glm.pc.in ${GLM_PC} @ONLY) ++install(FILES ${GLM_PC} DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig") ++ + set(CMAKE_CXX_STANDARD_REQUIRED ON) + + if(GLM_ENABLE_CXX_20) +--- /dev/null ++++ b/glm.pc.in +@@ -0,0 +1,7 @@ ++prefix=@CMAKE_INSTALL_PREFIX@ ++includedir=${prefix}/include ++ ++Name: GLM ++Description: OpenGL Mathematics ++Version: @GLM_VERSION@ ++Cflags: -I${includedir} diff --git a/srcpkgs/glm/patches/werror.patch b/srcpkgs/glm/patches/werror.patch new file mode 100644 index 00000000000..ffff4e54206 --- /dev/null +++ b/srcpkgs/glm/patches/werror.patch @@ -0,0 +1,25 @@ +diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt +index 93abbfa..2ac0df3 100644 +--- a/test/CMakeLists.txt ++++ b/test/CMakeLists.txt +@@ -11,7 +11,6 @@ + endif() + + if(NOT GLM_DISABLE_AUTO_DETECTION) +- add_compile_options(-Werror -Weverything) + endif() + + elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") +@@ -20,12 +19,10 @@ + endif() + + if(NOT GLM_DISABLE_AUTO_DETECTION) +- add_compile_options(-Werror) + # add_compile_options(-Wpedantic) + # add_compile_options(-Wall) + # add_compile_options(-Wextra) + endif() +- add_compile_options(-O2) + #add_compile_options(-Wno-long-long) + elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel") + if(NOT GLM_QUIET) diff --git a/srcpkgs/glm/template b/srcpkgs/glm/template index 5f076e7a3d5..6b35614182b 100644 --- a/srcpkgs/glm/template +++ b/srcpkgs/glm/template @@ -1,33 +1,17 @@ # Template file for 'glm' pkgname=glm -version=0.9.9.8 -revision=2 +version=1.0.1 +revision=1 build_style=cmake -hostmakedepends="dos2unix unzip" +hostmakedepends="unzip" short_desc="C++ mathematics library for graphics programming" maintainer="Orphaned " license="MIT" homepage="http://glm.g-truc.net" -distfiles="https://github.com/g-truc/glm/releases/download/${version}/glm-${version}.zip" -checksum=37e2a3d62ea3322e43593c34bae29f57e3e251ea89f4067506c94043769ade4c - -# No longer has install target -# Install manually -do_install() { - local i - vmkdir usr/include - vcopy glm usr/include - vmkdir usr/lib/cmake - vcopy cmake/glm usr/lib/cmake - vmkdir usr/share/pkgconfig - vinstall ${FILESDIR}/glm.pc 644 usr/share/pkgconfig -} +distfiles="https://github.com/g-truc/glm/releases/download/${version}/glm-${version}-light.zip" +distfiles="https://github.com/g-truc/glm/archive/refs/tags/${version}.tar.gz" +checksum=9f3174561fd26904b23f0db5e560971cbf9b3cbda0b280f04d5c379d03bf234c post_install() { - local f - for f in $(find ${DESTDIR}/usr/include -type f); do - dos2unix "$f" - done - rm "${DESTDIR}/usr/include/glm/CMakeLists.txt" vlicense copying.txt LICENSE }