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>
This commit is contained in:
		
							parent
							
								
									193cbb3d61
								
							
						
					
					
						commit
						8b9570adc1
					
				
					 1 changed files with 60 additions and 30 deletions
				
			
		| 
						 | 
					@ -437,11 +437,41 @@ 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
 | 
				
			||||||
 | 
					     '(#:make-flags
 | 
				
			||||||
 | 
					       (list "CC=gcc"
 | 
				
			||||||
 | 
					             ;; A substitute* procedure call would be enough to add the -fPIC
 | 
				
			||||||
 | 
					             ;; flag if there was no file decoding error.
 | 
				
			||||||
 | 
					             ;; The makefile is a "Non-ISO extended-ASCII text, with CRLF line
 | 
				
			||||||
 | 
					             ;; terminators" according to the file(1) utility.
 | 
				
			||||||
 | 
					             (string-append "CFLAGS=-I. -Icommon/include -Iimage/sys -fPIC "
 | 
				
			||||||
 | 
					                            "-D__ANSI__ -DDISABLE_PERF_MEASUREMENT -w -O "))
 | 
				
			||||||
       #:tests? #f ; no check target
 | 
					       #:tests? #f ; no check target
 | 
				
			||||||
       #:phases
 | 
					       #:phases
 | 
				
			||||||
       (modify-phases %standard-phases
 | 
					       (modify-phases %standard-phases
 | 
				
			||||||
         (delete 'configure) ; no configure script
 | 
					         (delete 'configure) ; no configure script
 | 
				
			||||||
 | 
					         (add-after 'build 'build-shared-library
 | 
				
			||||||
 | 
					           (lambda _
 | 
				
			||||||
 | 
					             ;; The Makefile uses optimization level 1, so the same
 | 
				
			||||||
 | 
					             ;; level is used here for consistency.
 | 
				
			||||||
 | 
					             (invoke "gcc" "-shared" "-fPIC" "-O"
 | 
				
			||||||
 | 
					                     ;; Common files.
 | 
				
			||||||
 | 
					                     "adapthuff.o" "image.o" "strcodec.o" "strPredQuant.o"
 | 
				
			||||||
 | 
					                     "strTransform.o" "perfTimerANSI.o"
 | 
				
			||||||
 | 
					                     ;; Decoding files.
 | 
				
			||||||
 | 
					                     "decode.o" "postprocess.o" "segdec.o" "strdec.o"
 | 
				
			||||||
 | 
					                     "strInvTransform.o" "strPredQuantDec.o" "JXRTranscode.o"
 | 
				
			||||||
 | 
					                     ;; Encoding files.
 | 
				
			||||||
 | 
					                     "encode.o" "segenc.o" "strenc.o" "strFwdTransform.o"
 | 
				
			||||||
 | 
					                     "strPredQuantEnc.o"
 | 
				
			||||||
 | 
					                     "-o" "libjpegxr.so")
 | 
				
			||||||
 | 
					             (invoke "gcc" "-shared" "-fPIC" "-O"
 | 
				
			||||||
 | 
					                     ;; 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.
 | 
					         ;; The upstream makefile does not include an install phase.
 | 
				
			||||||
         (replace 'install
 | 
					         (replace 'install
 | 
				
			||||||
           (lambda* (#:key outputs #:allow-other-keys)
 | 
					           (lambda* (#:key outputs #:allow-other-keys)
 | 
				
			||||||
| 
						 | 
					@ -461,7 +491,7 @@ lossless JPEG manipulations such as rotation, scaling or cropping:
 | 
				
			||||||
               (for-each (lambda (file)
 | 
					               (for-each (lambda (file)
 | 
				
			||||||
                           (install-file file lib)
 | 
					                           (install-file file lib)
 | 
				
			||||||
                           (delete-file file))
 | 
					                           (delete-file file))
 | 
				
			||||||
                                   (find-files "." "\\.a$"))
 | 
					                         (find-files "." "\\.(a|so)$"))
 | 
				
			||||||
               (for-each (lambda (file)
 | 
					               (for-each (lambda (file)
 | 
				
			||||||
                           (install-file file bin)
 | 
					                           (install-file file bin)
 | 
				
			||||||
                           (delete-file file))
 | 
					                           (delete-file file))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue