From a44c92c8f56a56295a6c8ce91cda4ac1c0af912a Mon Sep 17 00:00:00 2001 From: Sertonix <sertonix@posteo.net> Date: Sun, 9 Mar 2025 18:22:26 +0100 Subject: [PATCH] community/freeimage: enable on s390x --- community/freeimage/APKBUILD | 4 +- community/freeimage/big-endian.patch | 57 ++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 community/freeimage/big-endian.patch diff --git a/community/freeimage/APKBUILD b/community/freeimage/APKBUILD index c50da97ab3e4..bb0cb6b95606 100644 --- a/community/freeimage/APKBUILD +++ b/community/freeimage/APKBUILD @@ -6,7 +6,7 @@ pkgver=3.18.0 pkgrel=4 pkgdesc="Open Source library project for developers who would like to support popular graphics image formats." url="https://freeimage.sourceforge.net/" -arch="all !s390x" # build fails on s390x +arch="all" license="GPL-2.0-or-later FIPL" makedepends="dos2unix" subpackages="$pkgname-dev" @@ -16,6 +16,7 @@ source="https://downloads.sourceforge.net/$pkgname/${_pkgname}${pkgver//.}.zip 0005-makefile-gnu.patch CVE-2019-12211_3.patch fix-build.patch + big-endian.patch " builddir="$srcdir/$_pkgname" options="!check" @@ -49,4 +50,5 @@ ef88862593bd8d271d11f86ec389c8a92c131ffb03fb7028e87dfddc7ae74e22bef50327175a7dce 18fba0dc68f94365ffbe7070594825b7e8f77f462ece31d96971de18f085b5110f3c3bdff780a02aa162ee9a64dd20c5fda7871d8759c8eeaa20d7bf3dddd72e 0005-makefile-gnu.patch de88bbf9f5d43f2b5be4d4df3baabb895ba6dca1d28308909f825f973634bdf8bc10bda61b2ce90e48f67d024cf6ab75f797ce42474101fa6a0896ee42107770 CVE-2019-12211_3.patch e3d2897c70121a67c93ceb941729a7238a1bed3b016492927d6e92c53ae8685a099787323111978be6db7c009249608ac625fff0d07f27e193d0c06eaf646058 fix-build.patch +73a98bd6526d0ed01635416fb5407e8cb475d406e5b807608612ec5a243384a5f2a4ff225c2b8b1609e07101563ecdc72c5081445e846edadac1d8150c16e636 big-endian.patch " diff --git a/community/freeimage/big-endian.patch b/community/freeimage/big-endian.patch new file mode 100644 index 000000000000..091ee8549c0e --- /dev/null +++ b/community/freeimage/big-endian.patch @@ -0,0 +1,57 @@ +Patch-Source: https://sourceforge.net/p/freeimage/svn/1809/ + +--- a/Source/FreeImage/PluginBMP.cpp ++++ b/Source/FreeImage/PluginBMP.cpp +@@ -518,7 +518,7 @@ + io->read_proc(FreeImage_GetPalette(dib), used_colors * sizeof(RGBQUAD), 1, handle); + #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB + RGBQUAD *pal = FreeImage_GetPalette(dib); +- for(int i = 0; i < used_colors; i++) { ++ for(unsigned i = 0; i < used_colors; i++) { + INPLACESWAP(pal[i].rgbRed, pal[i].rgbBlue); + } + #endif +@@ -1419,7 +1419,7 @@ + + free(buffer); + #ifdef FREEIMAGE_BIGENDIAN +- } else if (bpp == 16) { ++ } else if (dst_bpp == 16) { + int padding = dst_pitch - dst_width * sizeof(WORD); + WORD pad = 0; + WORD pixel; +@@ -1440,7 +1440,7 @@ + } + #endif + #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_RGB +- } else if (bpp == 24) { ++ } else if (dst_bpp == 24) { + int padding = dst_pitch - dst_width * sizeof(FILE_BGR); + DWORD pad = 0; + FILE_BGR bgr; +@@ -1461,7 +1461,7 @@ + } + } + } +- } else if (bpp == 32) { ++ } else if (dst_bpp == 32) { + FILE_BGRA bgra; + for(unsigned y = 0; y < dst_height; y++) { + BYTE *line = FreeImage_GetScanLine(dib, y); +--- a/Source/FreeImage/PluginDDS.cpp ++++ b/Source/FreeImage/PluginDDS.cpp +@@ -356,14 +356,6 @@ + for(int i=0; i<11; i++) { + SwapLong(&header->surfaceDesc.dwReserved1[i]); + } +- SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwSize); +- SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwFlags); +- SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwFourCC); +- SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwRGBBitCount); +- SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwRBitMask); +- SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwGBitMask); +- SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwBBitMask); +- SwapLong(&header->surfaceDesc.ddpfPixelFormat.dwRGBAlphaBitMask); + SwapLong(&header->surfaceDesc.ddsCaps.dwCaps1); + SwapLong(&header->surfaceDesc.ddsCaps.dwCaps2); + SwapLong(&header->surfaceDesc.ddsCaps.dwReserved[0]); -- GitLab