[packages/jxrlib] - new; cmake support and warnings patch taken from Fedora
qboosh
qboosh at pld-linux.org
Sun Mar 9 09:01:52 CET 2025
commit 329e7fa46ce2d36b13f7b00daa0d071d46cd096b
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Sun Mar 9 07:47:33 2025 +0100
- new; cmake support and warnings patch taken from Fedora
jxrlib-CMakeLists.txt | 68 +++++++++++++++++++
jxrlib-warnings.patch | 178 ++++++++++++++++++++++++++++++++++++++++++++++++++
jxrlib.spec | 93 ++++++++++++++++++++++++++
3 files changed, 339 insertions(+)
---
diff --git a/jxrlib.spec b/jxrlib.spec
new file mode 100644
index 0000000..effa1f0
--- /dev/null
+++ b/jxrlib.spec
@@ -0,0 +1,93 @@
+Summary: Library for reading JPEG XR images
+Summary(pl.UTF-8): Biblioteka do odczytu obrazów JPEG XR
+Name: jxrlib
+Version: 1.1
+%define gitref 2019.10.9
+%define rel 1
+Release: 0.%{gitref}.%{rel}
+License: BSD
+Group: Libraries
+#Source0Download: https://github.com/4creators/jxrlib/tags
+Source0: https://github.com/4creators/jxrlib/archive/v%{gitref}/%{name}-%{gitref}.tar.gz
+# Source0-md5: 33d686fdf81e235cd8581c653dafffd6
+Source1: %{name}-CMakeLists.txt
+Patch0: %{name}-warnings.patch
+# originally https://jxrlib.codeplex.com/ but no longer available
+URL: https://github.com/4creators/jxrlib
+BuildRequires: cmake >= 2.8
+BuildRequires: rpmbuild(macros) >= 1.605
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+This device porting kit (DPK) supports the JPEG XR still image format,
+based on technology originally developed by Mirosoft under the name HD
+Photo (formerly Windows Media Photo).
+
+%description -l pl.UTF-8
+Ten pakiet oprogramowania obsługuje format statycznego obrazu JPEG XR,
+oparty na technologii oryginalnie rozwijanej przez Microsoft pod nazwą
+HD Photo (dawniej Windows Media Photo).
+
+%package devel
+Summary: Header files for JXR library
+Summary(pl.UTF-8): Pliki nagłówkowe biblioteki JXR
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+Header files for JXR library.
+
+%description devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki JXR.
+
+%prep
+%setup -q -n %{name}-%{gitref}
+%patch -P0 -p1
+
+cp -p %{SOURCE1} CMakeLists.txt
+
+%{__sed} \
+ -e 's,%%(DIR_INSTALL)s,%{_prefix},' \
+ -e '/^libdir=/ s,/lib,/%{_lib},' \
+ -e 's,%%(JXR_VERSION)s,%{version},' \
+ -e 's,%%(JXR_ENDIAN)s,,' \
+ -e '/^Cflags: / s,: .*,: -I${includedir}/libjxr -D__ANSI__,' \
+ libjxr.pc.in > libjxr.pc
+
+%build
+install -d build
+cd build
+%cmake ..
+
+%{__make}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%{__make} -C build install \
+ DESTDIR=$RPM_BUILD_ROOT
+
+install -Dp libjxr.pc $RPM_BUILD_ROOT%{_pkgconfigdir}/libjxr.pc
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(644,root,root,755)
+%doc LICENSE README.md doc/readme.txt
+%attr(755,root,root) %{_bindir}/JxrDecApp
+%attr(755,root,root) %{_bindir}/JxrEncApp
+%attr(755,root,root) %{_libdir}/libjpegxr.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libjpegxr.so.0
+%attr(755,root,root) %{_libdir}/libjxrglue.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libjxrglue.so.0
+
+%files devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libjpegxr.so
+%attr(755,root,root) %{_libdir}/libjxrglue.so
+%{_includedir}/jxrlib
+%{_pkgconfigdir}/libjxr.pc
diff --git a/jxrlib-CMakeLists.txt b/jxrlib-CMakeLists.txt
new file mode 100644
index 0000000..406da98
--- /dev/null
+++ b/jxrlib-CMakeLists.txt
@@ -0,0 +1,68 @@
+cmake_minimum_required(VERSION 2.8)
+project(jxrlib C)
+
+set(JXRLIB_MAJOR 0)
+set(JXRLIB_MINOR 0)
+
+set(JXRLIB_LIB_VERSION ${JXRLIB_MAJOR}.${JXRLIB_MINOR}.0)
+set(JXRLIB_SO_VERSION ${JXRLIB_MAJOR})
+
+include(TestBigEndian)
+test_big_endian(ISBIGENDIAN)
+if(ISBIGENDIAN)
+ set(DEF_ENDIAN -D_BIG__ENDIAN_)
+endif()
+
+add_definitions(-D__ANSI__ -DDISABLE_PERF_MEASUREMENT ${DEF_ENDIAN})
+
+include_directories(
+ common/include
+ image/sys
+ jxrgluelib
+ jxrtestlib
+)
+
+# JXR Library
+file(GLOB jpegxr_SRC image/sys/*.c image/decode/*.c image/encode/*.c)
+file(GLOB jpegxr_HDR image/sys/*.h image/decode/*.h image/encode/*.h)
+
+add_library(jpegxr ${jpegxr_SRC} ${jpegxr_HDR})
+set_target_properties(jpegxr PROPERTIES VERSION ${JXRLIB_LIB_VERSION} SOVERSION ${JXRLIB_SO_VERSION})
+
+install(TARGETS jpegxr
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib${LIB_SUFFIX}
+ ARCHIVE DESTINATION lib${LIB_SUFFIX}
+)
+
+# JXR-GLUE Library
+file(GLOB jxrglue_SRC jxrgluelib/*.c jxrtestlib/*.c)
+file(GLOB jxrglue_HDR jxrgluelib/*.h jxrtestlib/*.h)
+
+add_library(jxrglue ${jxrglue_SRC} ${jxrglue_HDR})
+set_target_properties(jxrglue PROPERTIES VERSION ${JXRLIB_LIB_VERSION} SOVERSION ${JXRLIB_SO_VERSION})
+target_link_libraries(jxrglue jpegxr m)
+
+install(TARGETS jxrglue
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib${LIB_SUFFIX}
+ ARCHIVE DESTINATION lib${LIB_SUFFIX}
+)
+
+# JxrEncApp Executable
+add_executable(JxrEncApp jxrencoderdecoder/JxrEncApp.c)
+target_link_libraries(JxrEncApp jxrglue)
+install(TARGETS JxrEncApp RUNTIME DESTINATION bin)
+
+# JxrDecApp Executable
+add_executable(JxrDecApp jxrencoderdecoder/JxrDecApp.c)
+target_link_libraries(JxrDecApp jxrglue)
+install(TARGETS JxrDecApp RUNTIME DESTINATION bin)
+
+# Headers
+install(FILES jxrgluelib/JXRGlue.h jxrgluelib/JXRMeta.h jxrtestlib/JXRTest.h image/sys/windowsmediaphoto.h
+ DESTINATION include/jxrlib
+)
+install(DIRECTORY common/include/ DESTINATION include/jxrlib
+ FILES_MATCHING PATTERN "*.h"
+)
diff --git a/jxrlib-warnings.patch b/jxrlib-warnings.patch
new file mode 100644
index 0000000..707d1bd
--- /dev/null
+++ b/jxrlib-warnings.patch
@@ -0,0 +1,178 @@
+diff -rupN jxrlib/image/sys/common.h jxrlib-new/image/sys/common.h
+--- jxrlib/image/sys/common.h 2013-03-21 17:30:54.000000000 +0100
++++ jxrlib-new/image/sys/common.h 2015-09-03 10:31:06.528657911 +0200
+@@ -124,8 +124,8 @@ Void Adapt (CAdaptiveHuffman *pAdHuff, B
+ Void AdaptFixed (CAdaptiveHuffman *pAdHuff);
+ Void AdaptDiscriminant (CAdaptiveHuffman *pAdHuff);
+
+-#ifndef _PREFAST_
+-#pragma warning(disable:4068)
+-#endif
++// #ifndef _PREFAST_
++// #pragma warning(disable:4068)
++// #endif
+
+ #endif // WMI_COMMON_H
+diff -rupN jxrlib/image/sys/strcodec.c jxrlib-new/image/sys/strcodec.c
+--- jxrlib/image/sys/strcodec.c 2013-03-20 19:16:21.000000000 +0100
++++ jxrlib-new/image/sys/strcodec.c 2015-09-03 10:30:31.018971760 +0200
+@@ -668,9 +668,7 @@ ERR detach_SB(SimpleBitIO* pSB)
+ // WinCE ARM and Desktop x86
+ #else
+ // other platform
+-#ifdef _BIG__ENDIAN_
+-#define _byteswap_ulong(x) (x)
+-#else // _BIG__ENDIAN_
++#ifndef _BIG__ENDIAN_
+ U32 _byteswap_ulong(U32 bits)
+ {
+ U32 r = (bits & 0xffu) << 24;
+diff -rupN jxrlib/image/sys/strcodec.h jxrlib-new/image/sys/strcodec.h
+--- jxrlib/image/sys/strcodec.h 2013-03-21 19:22:34.000000000 +0100
++++ jxrlib-new/image/sys/strcodec.h 2015-09-03 10:30:31.019971779 +0200
+@@ -64,7 +64,7 @@
+
+ #ifndef UNREFERENCED_PARAMETER
+ #define UNREFERENCED_PARAMETER(P) { (P) = (P); }
+-#endif UNREFERENCED_PARAMETER
++#endif // UNREFERENCED_PARAMETER
+
+ #ifdef UNDER_CE
+ #define PLATFORM_WCE
+@@ -673,6 +673,16 @@ void flushToByte(BitIOInfo* pIO);
+ pIO->cBitsUsed &= 16 - 1;\
+ pIO->uiAccumulator = LOAD16(pIO->pbCurrent) << pIO->cBitsUsed;\
+ return 0;
+-// pIO->uiAccumulator = LOAD16(pIO->pbCurrent) & ((U32)(-1) >> pIO->cBitsUsed);\
+
+ void OutputPerfTimerReport(CWMImageStrCodec *pState);
++
++#if (defined(WIN32) && !defined(UNDER_CE)) || (defined(UNDER_CE) && defined(_ARM_))
++// WinCE ARM and Desktop x86
++#else
++// other platform
++#ifdef _BIG__ENDIAN_
++#define _byteswap_ulong(x) (x)
++#else // _BIG__ENDIAN_
++U32 _byteswap_ulong(U32 bits);
++#endif // _BIG__ENDIAN_
++#endif
+\ No newline at end of file
+--- jxrlib-2019.10.9/jxrencoderdecoder/JxrDecApp.c.orig 2025-03-08 22:23:35.002363078 +0100
++++ jxrlib-2019.10.9/jxrencoderdecoder/JxrDecApp.c 2025-03-08 22:25:42.431672734 +0100
+@@ -427,7 +427,7 @@ ERR WmpDecAppCreateEncoderFromExt(
+ Call(GetTestEncodeIID(szExt, &pIID));
+
+ // Create encoder
+- Call(PKTestFactory_CreateCodec(pIID, ppIE));
++ Call(PKTestFactory_CreateCodec(pIID, (void**)ppIE));
+
+ Cleanup:
+ return err;
+--- jxrlib-2019.10.9/jxrencoderdecoder/JxrEncApp.c.orig 2025-03-08 22:23:35.002363078 +0100
++++ jxrlib-2019.10.9/jxrencoderdecoder/JxrEncApp.c 2025-03-08 22:26:32.011404138 +0100
+@@ -615,7 +615,7 @@ main(int argc, char* argv[])
+
+ //================================
+ Call(PKCreateCodecFactory(&pCodecFactory, WMP_SDK_VERSION));
+- Call(pCodecFactory->CreateCodec(&IID_PKImageWmpEncode, &pEncoder));
++ Call(pCodecFactory->CreateCodec(&IID_PKImageWmpEncode, (void**)&pEncoder));
+
+ //----------------------------------------------------------------
+ Call(PKCreateTestFactory(&pTestFactory, WMP_SDK_VERSION));
+--- jxrlib-2019.10.9/jxrgluelib/JXRGlueJxr.c.orig 2025-03-08 22:23:35.079029329 +0100
++++ jxrlib-2019.10.9/jxrgluelib/JXRGlueJxr.c 2025-03-08 22:27:17.294492151 +0100
+@@ -28,6 +28,7 @@
+ //*@@@---@@@@******************************************************************
+ #include <limits.h>
+ #include <JXRGlue.h>
++#include <wchar.h>
+
+
+ static const char szHDPhotoFormat[] = "<dc:format>image/vnd.ms-photo</dc:format>";
+diff -rupN jxrlib/jxrtestlib/JXRTest.c jxrlib-new/jxrtestlib/JXRTest.c
+--- jxrlib/jxrtestlib/JXRTest.c 2013-03-19 20:06:18.000000000 +0100
++++ jxrlib-new/jxrtestlib/JXRTest.c 2015-09-03 10:30:31.022971837 +0200
+@@ -198,7 +198,7 @@ ERR PKTestFactory_CreateDecoderFromFile(
+ ERR err = WMP_errSuccess;
+
+ char *pExt = NULL;
+- PKIID* pIID = NULL;
++ const PKIID* pIID = NULL;
+
+ struct WMPStream* pStream = NULL;
+ PKImageDecode* pDecoder = NULL;
+@@ -214,7 +214,7 @@ ERR PKTestFactory_CreateDecoderFromFile(
+ Call(CreateWS_File(&pStream, szFilename, "rb"));
+
+ // Create decoder
+- Call(PKTestFactory_CreateCodec(pIID, ppDecoder));
++ Call(PKTestFactory_CreateCodec(pIID, (void**)ppDecoder));
+ pDecoder = *ppDecoder;
+
+ // attach stream to decoder
+@@ -232,7 +232,7 @@ ERR PKCreateTestFactory(PKCodecFactory**
+
+ UNREFERENCED_PARAMETER( uVersion );
+
+- Call(PKAlloc(ppCFactory, sizeof(**ppCFactory)));
++ Call(PKAlloc((void**)ppCFactory, sizeof(**ppCFactory)));
+ pCFactory = *ppCFactory;
+
+ pCFactory->CreateCodec = PKTestFactory_CreateCodec;
+@@ -287,7 +287,7 @@ ERR PKTestDecode_Release(
+
+ pID->fStreamOwner && pID->pStream->Close(&pID->pStream);
+
+- return PKFree(ppID);
++ return PKFree((void**)ppID);
+ }
+
+ ERR PKTestDecode_Create(
+@@ -296,7 +296,7 @@ ERR PKTestDecode_Create(
+ ERR err = WMP_errSuccess;
+ PKTestDecode* pID = NULL;
+
+- Call(PKAlloc(ppID, sizeof(**ppID)));
++ Call(PKAlloc((void**)ppID, sizeof(**ppID)));
+
+ pID = *ppID;
+ pID->Initialize = PKTestDecode_Initialize;
+diff -rupN jxrlib/jxrtestlib/JXRTestHdr.c jxrlib-new/jxrtestlib/JXRTestHdr.c
+--- jxrlib/jxrtestlib/JXRTestHdr.c 2013-03-20 17:40:08.000000000 +0100
++++ jxrlib-new/jxrtestlib/JXRTestHdr.c 2015-09-03 10:30:31.022971837 +0200
+@@ -27,7 +27,7 @@
+ //*@@@---@@@@******************************************************************
+ #ifndef ANSI
+ #define _CRT_SECURE_NO_WARNINGS
+-#endif ANSI
++#endif // ANSI
+
+ #include <stdlib.h>
+ #include <string.h>
+diff -rupN jxrlib/jxrtestlib/JXRTestPnm.c jxrlib-new/jxrtestlib/JXRTestPnm.c
+--- jxrlib/jxrtestlib/JXRTestPnm.c 2013-03-19 22:43:44.000000000 +0100
++++ jxrlib-new/jxrtestlib/JXRTestPnm.c 2015-09-03 10:30:31.023971856 +0200
+@@ -27,7 +27,7 @@
+ //*@@@---@@@@******************************************************************
+ #ifndef ANSI
+ #define _CRT_SECURE_NO_WARNINGS
+-#endif ANSI
++#endif // ANSI
+
+ #include <stdlib.h>
+
+diff -rupN jxrlib/jxrtestlib/JXRTestTif.c jxrlib-new/jxrtestlib/JXRTestTif.c
+--- jxrlib/jxrtestlib/JXRTestTif.c 2013-03-19 20:17:12.000000000 +0100
++++ jxrlib-new/jxrtestlib/JXRTestTif.c 2015-09-03 10:30:31.023971856 +0200
+@@ -909,8 +909,8 @@ ERR PKImageDecode_Release_TIF(PKTestDeco
+
+ PKTestDecode *pID = *ppID;
+
+- Call(WMPFree(&pID->EXT.TIF.uStripOffsets));
+- Call(WMPFree(&pID->EXT.TIF.uStripByteCounts));
++ Call(WMPFree((void**)&pID->EXT.TIF.uStripOffsets));
++ Call(WMPFree((void**)&pID->EXT.TIF.uStripByteCounts));
+
+ Call(PKTestDecode_Release(ppID));
+
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/jxrlib.git/commitdiff/329e7fa46ce2d36b13f7b00daa0d071d46cd096b
More information about the pld-cvs-commit
mailing list