unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH]  gnu: Add libjxr.
@ 2016-10-21 20:47 Kei Kebreau
  2016-10-21 23:58 ` Leo Famulari
  0 siblings, 1 reply; 9+ messages in thread
From: Kei Kebreau @ 2016-10-21 20:47 UTC (permalink / raw)
  To: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 69 bytes --]

This is a patch I think we need before fixing up freeimage. Thoughts?

[-- Attachment #1.2: 0001-gnu-Add-libjxr.patch --]
[-- Type: text/plain, Size: 12857 bytes --]

From ac9a3c00c9b9a8232fa7cde26b2ecc46b94f809c Mon Sep 17 00:00:00 2001
From: Kei Kebreau <kei@openmailbox.org>
Date: Fri, 21 Oct 2016 16:39:50 -0400
Subject: [PATCH] gnu: Add libjxr.

* gnu/packages/images.scm (libjxr): New variable.
* gnu/packages/patches/libjxr-fix-function-signature.patch: New file.
* gnu/packages/patches/libjxr-fix-typos.patch: New file.
* gnu/packages/patches/libjxr-use-cmake.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register patches.
---
 gnu/local.mk                                       |   3 +
 gnu/packages/image.scm                             |  26 ++++
 .../patches/libjxr-fix-function-signature.patch    |  16 +++
 gnu/packages/patches/libjxr-fix-typos.patch        |  60 +++++++++
 gnu/packages/patches/libjxr-use-cmake.patch        | 143 +++++++++++++++++++++
 5 files changed, 248 insertions(+)
 create mode 100644 gnu/packages/patches/libjxr-fix-function-signature.patch
 create mode 100644 gnu/packages/patches/libjxr-fix-typos.patch
 create mode 100644 gnu/packages/patches/libjxr-use-cmake.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index c6cd586..911af78 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -633,6 +633,9 @@ dist_patch_DATA =						\
   %D%/packages/patches/libdrm-symbol-check.patch		\
   %D%/packages/patches/libevent-dns-tests.patch			\
   %D%/packages/patches/libextractor-ffmpeg-3.patch		\
+  %D%/packages/patches/libjxr-fix-function-signature.patch	\
+  %D%/packages/patches/libjxr-fix-typos.patch			\
+  %D%/packages/patches/libjxr-use-cmake.patch			\
   %D%/packages/patches/liboop-mips64-deplibs-fix.patch		\
   %D%/packages/patches/libotr-test-auth-fix.patch		\
   %D%/packages/patches/liblxqt-include.patch			\
diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index 4b064bb..b1b40b3 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -11,6 +11,7 @@
 ;;; Copyright © 2016 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2016 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2016 Kei Kebreau <kei@openmailbox.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -129,6 +130,31 @@ image files in PBMPLUS PPM/PGM, GIF, BMP, and Targa file formats.")
             (sha256 (base32
                      "1cz0dy05mgxqdgjf52p54yxpyy95rgl30cnazdrfmw7hfca9n0h0"))))))
 
+(define-public libjxr
+  (package
+    (name "libjxr")
+    (version "1.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://debian/pool/main/j/jxrlib/jxrlib_"
+                                  version ".orig.tar.gz"))
+              (sha256
+               (base32
+                "00w3f3cmjsm3fiaxq5mxskmp5rl3mki8psrf9y8s1vqbg237na67"))
+              (patches (search-patches "libjxr-fix-function-signature.patch"
+                                       "libjxr-use-cmake.patch"
+                                       "libjxr-fix-typos.patch"))))
+    (build-system cmake-build-system)
+    (arguments '(#:tests? #f)) ; no check target
+    (synopsis "Implementation of the JPEG XR standard")
+    (description "JPEG XR is an approved ISO/IEC International standard (its
+official designation is ISO/IEC 29199-2). This library is an implementation of that standard.")
+    (license
+     (license:non-copyleft
+      "file://Makefile"
+      "See the header of the Makefile in the distribution."))
+    (home-page "https://jxrlib.codeplex.com/")))
+
 (define-public jpegoptim
   (package
    (name "jpegoptim")
diff --git a/gnu/packages/patches/libjxr-fix-function-signature.patch b/gnu/packages/patches/libjxr-fix-function-signature.patch
new file mode 100644
index 0000000..9efc339
--- /dev/null
+++ b/gnu/packages/patches/libjxr-fix-function-signature.patch
@@ -0,0 +1,16 @@
+Description: Fix function signature
+Author: Mathieu Malaterre <malat@debian.org>
+Origin: upstream, https://jxrlib.codeplex.com/SourceControl/changeset/04cf339385b8196f98025b43a366a0790deac994
+Bug-Debian: http://bugs.debian.org/748590
+
+--- jxrlib-1.1.orig/image/decode/JXRTranscode.c
++++ jxrlib-1.1/image/decode/JXRTranscode.c
+@@ -47,7 +47,7 @@ EXTERN_C Void FreeCodingContextDec(CWMIm
+ EXTERN_C Int StrEncInit(CWMImageStrCodec *);
+ EXTERN_C Void StrIOEncTerm(CWMImageStrCodec *);
+ EXTERN_C Void FreeCodingContextEnc(CWMImageStrCodec *);
+-EXTERN_C Void encodeMB(CWMImageStrCodec *, Int, Int);
++EXTERN_C Int encodeMB(CWMImageStrCodec *, Int, Int);
+ EXTERN_C Int  writeIndexTableNull(CWMImageStrCodec *);
+ EXTERN_C Void writePacketHeader(BitIOInfo *, U8, U8);
+ 
diff --git a/gnu/packages/patches/libjxr-fix-typos.patch b/gnu/packages/patches/libjxr-fix-typos.patch
new file mode 100644
index 0000000..3c051dd
--- /dev/null
+++ b/gnu/packages/patches/libjxr-fix-typos.patch
@@ -0,0 +1,60 @@
+Description: Fix typos and remove some warnings
+Author: Mathieu Malaterre <malat@debian.org>
+
+Index: jxrlib-1.1/CMakeLists.txt
+===================================================================
+--- jxrlib-1.1.orig/CMakeLists.txt
++++ jxrlib-1.1/CMakeLists.txt
+@@ -91,7 +91,7 @@ add_library(jxrglue ${OBJ_GLUE} ${OBJ_TE
+ set_property(TARGET jxrglue
+   PROPERTY COMPILE_DEFINITIONS __ANSI__ DISABLE_PERF_MEASUREMENT ${DEF_ENDIAN}
+ )
+-set_property(TARGET jxrglue PROPERTY LINK_INTERFACE_LIBRARIES "")
++#set_property(TARGET jxrglue PROPERTY LINK_INTERFACE_LIBRARIES "")
+ set_property(TARGET jxrglue PROPERTY COMPILE_FLAGS -w)
+ # VERSION/SOVERSION
+ set_property(TARGET jxrglue PROPERTY VERSION 1.1)
+@@ -104,14 +104,15 @@ install(TARGETS jxrglue
+ #if(HAVE_STRLCPY_BSD)
+ #	target_link_libraries(jxrglue ${BSD_LIBRARY})
+ #endif()
+-target_link_libraries(jxrglue jpegxr m)
++#target_link_libraries(jxrglue m)
++target_link_libraries(jxrglue PRIVATE jpegxr m)
+ # Enc app files
+ set(ENCAPP JxrEncApp)
+ add_executable(${ENCAPP} ${DIR_EXEC}/${ENCAPP}.c)
+ set_property(TARGET ${ENCAPP}
+   PROPERTY COMPILE_DEFINITIONS __ANSI__ DISABLE_PERF_MEASUREMENT ${DEF_ENDIAN}
+ )
+-set_property(TARGET ${ENCAPP} PROPERTY COMPILE_FLAGS -w)
++#set_property(TARGET ${ENCAPP} PROPERTY COMPILE_FLAGS -w)
+ target_link_libraries(${ENCAPP} jxrglue) # jpegxr)
+ install(TARGETS ${ENCAPP} RUNTIME DESTINATION ${JXRLIB_INSTALL_BIN_DIR})
+ # Dec app files
+Index: jxrlib-1.1/jxrencoderdecoder/JxrEncApp.c
+===================================================================
+--- jxrlib-1.1.orig/jxrencoderdecoder/JxrEncApp.c
++++ jxrlib-1.1/jxrencoderdecoder/JxrEncApp.c
+@@ -578,7 +578,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));
+Index: jxrlib-1.1/jxrgluelib/JXRMeta.h
+===================================================================
+--- jxrlib-1.1.orig/jxrgluelib/JXRMeta.h
++++ jxrlib-1.1/jxrgluelib/JXRMeta.h
+@@ -34,7 +34,7 @@
+ 
+ #ifndef UNREFERENCED_PARAMETER
+ #define UNREFERENCED_PARAMETER(P) { (P) = (P); }
+-#endif UNREFERENCED_PARAMETER
++#endif /*UNREFERENCED_PARAMETER*/
+ 
+ //================================================================
+ // Container
diff --git a/gnu/packages/patches/libjxr-use-cmake.patch b/gnu/packages/patches/libjxr-use-cmake.patch
new file mode 100644
index 0000000..cb5919e
--- /dev/null
+++ b/gnu/packages/patches/libjxr-use-cmake.patch
@@ -0,0 +1,143 @@
+Description: Prefer a cmake based build system
+Author: Mathieu Malaterre <malat@debian.org>
+Forwarded: https://jxrlib.codeplex.com/discussions/440294
+
+Index: jxrlib-1.1/CMakeLists.txt
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ jxrlib-1.1/CMakeLists.txt	2014-03-26 17:05:04.429637801 +0100
+@@ -0,0 +1,134 @@
++# Copyright Mathieu Malaterre <malat@debian.org>
++# BSD (Same as jxrlib)
++cmake_minimum_required(VERSION 2.8)
++project(jxrlib C)
++
++# Need shared libs for ABI
++set(BUILD_SHARED_LIBS ON)
++
++# helper macro to preserve original Makefile convention
++macro(JXR_MAKE_OBJ SET_NAME)
++  foreach(src ${SRC_${SET_NAME}})
++    list(APPEND OBJ_${SET_NAME} ${DIR_${SET_NAME}}/${src})
++  endforeach()
++endmacro()
++
++include(TestBigEndian)
++test_big_endian(ISBIGENDIAN)
++if(ISBIGENDIAN)
++  set(DEF_ENDIAN _BIG__ENDIAN_)
++endif()
++
++set(DIR_SYS image/sys)
++set(DIR_DEC image/decode)
++set(DIR_ENC image/encode)
++
++set(DIR_GLUE jxrgluelib)
++set(DIR_TEST jxrtestlib)
++set(DIR_EXEC jxrencoderdecoder)
++
++if(NOT JXRLIB_INSTALL_BIN_DIR)
++  set(JXRLIB_INSTALL_BIN_DIR "bin")
++endif()
++
++if(NOT JXRLIB_INSTALL_LIB_DIR)
++  set(JXRLIB_INSTALL_LIB_DIR "lib")
++endif()
++
++if(NOT JXRLIB_INSTALL_INCLUDE_DIR)
++  set(JXRLIB_INSTALL_INCLUDE_DIR "include/jxrlib")
++endif()
++
++include_directories(
++  common/include
++  ${DIR_SYS}
++  ${DIR_GLUE}
++  ${DIR_TEST}
++)
++
++# where is strlcpy ?
++include(CheckSymbolExists)
++check_symbol_exists(strlcpy "string.h" HAVE_STRLCPY)
++#set(CMAKE_REQUIRED_LIBRARIES bsd)
++#CHECK_SYMBOL_EXISTS(strlcpy "string.h" HAVE_STRLCPY4)
++# on linux, strlcpy is in -lbsd:
++#if(NOT HAVE_STRLCPY)
++#  include(CheckLibraryExists)
++#  find_library(BSD_LIBRARY bsd)
++#  check_library_exists(bsd "strlcpy" ${BSD_LIBRARY} HAVE_STRLCPY_BSD)
++#endif()
++
++# JPEG-XR
++set(SRC_SYS adapthuff.c image.c strcodec.c strPredQuant.c strTransform.c perfTimerANSI.c)
++JXR_MAKE_OBJ(SYS)
++set(SRC_DEC decode.c postprocess.c segdec.c strdec.c strInvTransform.c strPredQuantDec.c JXRTranscode.c)
++JXR_MAKE_OBJ(DEC)
++set(SRC_ENC encode.c segenc.c strenc.c strFwdTransform.c strPredQuantEnc.c)
++JXR_MAKE_OBJ(ENC)
++
++add_library(jpegxr ${OBJ_ENC} ${OBJ_DEC} ${OBJ_SYS})
++set_property(TARGET jpegxr
++  PROPERTY COMPILE_DEFINITIONS __ANSI__ DISABLE_PERF_MEASUREMENT ${DEF_ENDIAN}
++)
++set_property(TARGET jpegxr PROPERTY LINK_INTERFACE_LIBRARIES "")
++set_property(TARGET jpegxr PROPERTY COMPILE_FLAGS -w)
++# VERSION/SOVERSION
++set_property(TARGET jpegxr PROPERTY VERSION 1.1)
++set_property(TARGET jpegxr PROPERTY SOVERSION 0)
++install(TARGETS jpegxr
++  EXPORT JXRLibTargets
++  RUNTIME DESTINATION ${JXRLIB_INSTALL_BIN_DIR} COMPONENT Applications
++  LIBRARY DESTINATION ${JXRLIB_INSTALL_LIB_DIR} COMPONENT Libraries
++)
++
++# JXR-GLUE
++set(SRC_GLUE JXRGlue.c JXRMeta.c JXRGluePFC.c JXRGlueJxr.c)
++JXR_MAKE_OBJ(GLUE)
++set(SRC_TEST JXRTest.c JXRTestBmp.c JXRTestHdr.c JXRTestPnm.c JXRTestTif.c JXRTestYUV.c)
++JXR_MAKE_OBJ(TEST)
++
++add_library(jxrglue ${OBJ_GLUE} ${OBJ_TEST})
++set_property(TARGET jxrglue
++  PROPERTY COMPILE_DEFINITIONS __ANSI__ DISABLE_PERF_MEASUREMENT ${DEF_ENDIAN}
++)
++set_property(TARGET jxrglue PROPERTY LINK_INTERFACE_LIBRARIES "")
++set_property(TARGET jxrglue PROPERTY COMPILE_FLAGS -w)
++# VERSION/SOVERSION
++set_property(TARGET jxrglue PROPERTY VERSION 1.1)
++set_property(TARGET jxrglue PROPERTY SOVERSION 0)
++install(TARGETS jxrglue
++  EXPORT JXRLibTargets
++  RUNTIME DESTINATION ${JXRLIB_INSTALL_BIN_DIR} COMPONENT Applications
++  LIBRARY DESTINATION ${JXRLIB_INSTALL_LIB_DIR} COMPONENT Libraries
++)
++#if(HAVE_STRLCPY_BSD)
++#	target_link_libraries(jxrglue ${BSD_LIBRARY})
++#endif()
++target_link_libraries(jxrglue jpegxr m)
++# Enc app files
++set(ENCAPP JxrEncApp)
++add_executable(${ENCAPP} ${DIR_EXEC}/${ENCAPP}.c)
++set_property(TARGET ${ENCAPP}
++  PROPERTY COMPILE_DEFINITIONS __ANSI__ DISABLE_PERF_MEASUREMENT ${DEF_ENDIAN}
++)
++set_property(TARGET ${ENCAPP} PROPERTY COMPILE_FLAGS -w)
++target_link_libraries(${ENCAPP} jxrglue) # jpegxr)
++install(TARGETS ${ENCAPP} RUNTIME DESTINATION ${JXRLIB_INSTALL_BIN_DIR})
++# Dec app files
++set(DECAPP JxrDecApp)
++add_executable(${DECAPP} ${DIR_EXEC}/${DECAPP}.c)
++set_property(TARGET ${DECAPP}
++  PROPERTY COMPILE_DEFINITIONS __ANSI__ DISABLE_PERF_MEASUREMENT ${DEF_ENDIAN}
++)
++set_property(TARGET ${DECAPP} PROPERTY COMPILE_FLAGS -w)
++target_link_libraries(${DECAPP} jxrglue) # jpegxr)
++install(TARGETS ${DECAPP} RUNTIME DESTINATION ${JXRLIB_INSTALL_BIN_DIR})
++
++# install rules
++install(FILES jxrgluelib/JXRGlue.h jxrgluelib/JXRMeta.h jxrtestlib/JXRTest.h
++  image/sys/windowsmediaphoto.h
++  DESTINATION ${JXRLIB_INSTALL_INCLUDE_DIR} COMPONENT Headers
++)
++install(DIRECTORY common/include/ DESTINATION ${JXRLIB_INSTALL_INCLUDE_DIR}
++  FILES_MATCHING PATTERN "*.h"
++)
-- 
2.10.1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-11-03 13:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-21 20:47 [PATCH] gnu: Add libjxr Kei Kebreau
2016-10-21 23:58 ` Leo Famulari
2016-10-22  8:33   ` Kei Kebreau
2016-10-23 21:29     ` Leo Famulari
2016-10-28 13:40       ` Ludovic Courtès
2016-10-29  4:46         ` Kei Kebreau
2016-10-29 21:02           ` Ludovic Courtès
2016-10-30 15:31             ` Kei Kebreau
2016-11-03 13:36               ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).