gnu: libjxr: Build and install shared library.

* gnu/packages/image.scm (libjxr)[arguments]: Add -fPIC to CFLAGS for shared
library support.  Add 'build-shared-library' phase and modify 'install' phase
to install the shared libraries.

Signed-off-by: Marius Bakke <mbakke@fastmail.com>
master
Kei Kebreau 2019-01-07 19:32:02 -05:00 committed by Marius Bakke
parent 193cbb3d61
commit 8b9570adc1
No known key found for this signature in database
GPG Key ID: A2A06DF2A33A54FA
1 changed files with 60 additions and 30 deletions

View File

@ -437,36 +437,66 @@ lossless JPEG manipulations such as rotation, scaling or cropping:
(patches (search-patches "libjxr-fix-function-signature.patch" (patches (search-patches "libjxr-fix-function-signature.patch"
"libjxr-fix-typos.patch")))) "libjxr-fix-typos.patch"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments '(#:make-flags '("CC=gcc") (arguments
#:tests? #f ; no check target '(#:make-flags
#:phases (list "CC=gcc"
(modify-phases %standard-phases ;; A substitute* procedure call would be enough to add the -fPIC
(delete 'configure) ; no configure script ;; flag if there was no file decoding error.
;; The upstream makefile does not include an install phase. ;; The makefile is a "Non-ISO extended-ASCII text, with CRLF line
(replace 'install ;; terminators" according to the file(1) utility.
(lambda* (#:key outputs #:allow-other-keys) (string-append "CFLAGS=-I. -Icommon/include -Iimage/sys -fPIC "
(let* ((out (assoc-ref outputs "out")) "-D__ANSI__ -DDISABLE_PERF_MEASUREMENT -w -O "))
(bin (string-append out "/bin")) #:tests? #f ; no check target
(lib (string-append out "/lib")) #:phases
(include (string-append out "/include/jxrlib"))) (modify-phases %standard-phases
(for-each (lambda (file) (delete 'configure) ; no configure script
(install-file file include) (add-after 'build 'build-shared-library
(delete-file file)) (lambda _
(append ;; The Makefile uses optimization level 1, so the same
'("jxrgluelib/JXRGlue.h" ;; level is used here for consistency.
"jxrgluelib/JXRMeta.h" (invoke "gcc" "-shared" "-fPIC" "-O"
"jxrtestlib/JXRTest.h" ;; Common files.
"image/sys/windowsmediaphoto.h") "adapthuff.o" "image.o" "strcodec.o" "strPredQuant.o"
(find-files "common/include" "\\.h$"))) "strTransform.o" "perfTimerANSI.o"
(for-each (lambda (file) ;; Decoding files.
(install-file file lib) "decode.o" "postprocess.o" "segdec.o" "strdec.o"
(delete-file file)) "strInvTransform.o" "strPredQuantDec.o" "JXRTranscode.o"
(find-files "." "\\.a$")) ;; Encoding files.
(for-each (lambda (file) "encode.o" "segenc.o" "strenc.o" "strFwdTransform.o"
(install-file file bin) "strPredQuantEnc.o"
(delete-file file)) "-o" "libjpegxr.so")
'("JxrDecApp" "JxrEncApp"))) (invoke "gcc" "-shared" "-fPIC" "-O"
#t))))) ;; Glue files.
"JXRGlue.o" "JXRMeta.o" "JXRGluePFC.o" "JXRGlueJxr.o"
;; Test files.
"JXRTest.o" "JXRTestBmp.o" "JXRTestHdr.o" "JXRTestPnm.o"
"JXRTestTif.o" "JXRTestYUV.o"
"-o" "libjxrglue.so")))
;; The upstream makefile does not include an install phase.
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/bin"))
(lib (string-append out "/lib"))
(include (string-append out "/include/jxrlib")))
(for-each (lambda (file)
(install-file file include)
(delete-file file))
(append
'("jxrgluelib/JXRGlue.h"
"jxrgluelib/JXRMeta.h"
"jxrtestlib/JXRTest.h"
"image/sys/windowsmediaphoto.h")
(find-files "common/include" "\\.h$")))
(for-each (lambda (file)
(install-file file lib)
(delete-file file))
(find-files "." "\\.(a|so)$"))
(for-each (lambda (file)
(install-file file bin)
(delete-file file))
'("JxrDecApp" "JxrEncApp")))
#t)))))
(synopsis "Implementation of the JPEG XR standard") (synopsis "Implementation of the JPEG XR standard")
(description "JPEG XR is an approved ISO/IEC International standard (its (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.") official designation is ISO/IEC 29199-2). This library is an implementation of that standard.")