Silas Vedder
6 months ago
1 changed files with 131 additions and 0 deletions
@ -0,0 +1,131 @@
|
||||
;;; SPDX-License-Identifier: GPL-3.0-or-later |
||||
;;; Copyright © 2023 Nicolas Graves <ngraves@ngraves.fr> |
||||
|
||||
(define-module (cnijfilter) |
||||
#:use-module (gnu packages) |
||||
#:use-module (gnu packages autotools) |
||||
#:use-module (gnu packages base) |
||||
#:use-module (gnu packages bash) |
||||
#:use-module (gnu packages cups) |
||||
#:use-module (gnu packages elf) |
||||
#:use-module (gnu packages ghostscript) |
||||
#:use-module (gnu packages glib) |
||||
#:use-module (gnu packages gtk) |
||||
#:use-module (gnu packages pkg-config) |
||||
#:use-module (gnu packages popt) |
||||
#:use-module (guix build-system glib-or-gtk) |
||||
#:use-module (guix download) |
||||
#:use-module (guix gexp) |
||||
#:use-module ((guix licenses) #:prefix license:) |
||||
#:use-module (guix packages) |
||||
#:use-module (guix utils) |
||||
#:use-module (srfi srfi-1) |
||||
#:use-module (ice-9 match)) |
||||
|
||||
;; There seems to exist at least version 3.80 of this package. |
||||
;; But it doesn't seem to include equivalent drivers for old printers. |
||||
;; MAYBE TODO Put drivers in different per-driver outputs. |
||||
(define-public cnijfilter-3.40 |
||||
(package |
||||
(name "cnijfilter") |
||||
(version "3.40") |
||||
(source |
||||
(origin |
||||
(method url-fetch) |
||||
(uri "https://files.canon-europe.com/files/soft40245/Software/\ |
||||
cnijfilter-source-3.40-1.tar.gz") |
||||
(sha256 |
||||
(base32 "0ylapgzwrc51vlilmw4zv210ws049745rqsf7v68m7hs975d8pd9")))) |
||||
(build-system glib-or-gtk-build-system) |
||||
(home-page "https://canon.com") |
||||
(arguments |
||||
(list |
||||
#:tests? #f ; No tests. |
||||
#:configure-flags |
||||
#~(let ((bash (search-input-file %build-inputs "/bin/bash"))) |
||||
(list (string-append "CONFIG_SHELL=" bash) |
||||
(string-append "SHELL=" bash))) |
||||
#:make-flags |
||||
#~(list (string-append "prefix=" #$output) |
||||
(string-append "exec_prefix=" #$output) |
||||
(string-append "backend_bindir=" #$output "/lib/cups/backend") |
||||
(string-append "backendnet_bindir=" #$output "/lib/cups/backend") |
||||
(string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib")) |
||||
#:phases |
||||
#~(modify-phases %standard-phases |
||||
(add-after 'unpack 'fix-compilation |
||||
(lambda _ |
||||
(substitute* "cngpij/cngpij/bjcups.c" |
||||
(("#include <cups/cups\\.h>" all) |
||||
(string-append all "\n#include <cups/ipp.h>")) |
||||
(("pRequest->request\\.op\\.operation_id = CUPS_GET_PRINTERS;") |
||||
"ippSetOperation(pRequest, CUPS_GET_PRINTERS);") |
||||
(("pRequest->request\\.op\\.request_id = 1;") |
||||
"ippSetRequestId(pRequest, 1);") |
||||
(("pResponse->request\\.status\\.status_code") |
||||
"ippGetStatusCode(pResponse)") |
||||
(("pResponse->attrs") |
||||
"ippFirstAttribute(pResponse)") |
||||
(("pAttribute->group_tag") |
||||
"ippGetGroupTag(pAttribute)") |
||||
(("pAttribute->value_tag") |
||||
"ippGetValueTag(pAttribute)") |
||||
(("pAttribute->next") |
||||
"ippNextAttribute(pResponse)") |
||||
(("pAttribute->name") |
||||
"ippGetName(pAttribute)") |
||||
(("pAttribute->values\\[0\\]\\.string\\.text") |
||||
"ippGetString(pAttribute, 0, NULL)")) |
||||
(substitute* "backend/src/cnij_backend_common.c" |
||||
(("#include <cups/cups\\.h>" all) |
||||
(string-append all "\n#include <cups/ppd.h>"))) |
||||
(substitute* "cngpijmon/cnijnpr/cnijnpr/cnijnpr.c" |
||||
(("#include <sys/sysctl\\.h>") |
||||
"")) |
||||
(substitute* "Makefile" |
||||
(("cngpijmon/cnijnpr" all) |
||||
(string-append "lgmon " all))))) |
||||
(replace 'configure |
||||
(lambda* (#:key configure-flags #:allow-other-keys) |
||||
(let ((bash (search-input-file %build-inputs "/bin/bash"))) |
||||
|
||||
(define (configure-dir dir) |
||||
(with-directory-excursion dir |
||||
(setenv "NOCONFIGURE" "1") |
||||
(invoke "./autogen.sh") |
||||
(apply invoke bash "configure" configure-flags))) |
||||
|
||||
(for-each |
||||
configure-dir |
||||
'("cnijfilter" "libs" "printui" "cngpijmon/cnijnpr" "cngpijmon" |
||||
"backend" "pstocanonij" "ppd" "cngpij" "lgmon" |
||||
"backendnet"))))) |
||||
(add-after 'install 'install-libraries |
||||
(lambda _ |
||||
(for-each |
||||
(lambda (lib) |
||||
(invoke "patchelf" |
||||
"--set-rpath" (string-append #$output "/lib") lib) |
||||
(install-file lib (string-append #$output "/lib"))) |
||||
(filter (lambda (s) (not (string-contains s "libs_bin32"))) |
||||
(find-files "." "\\.so")))))))) |
||||
(native-inputs (list autoconf automake libtool |
||||
bash-minimal pkg-config popt |
||||
patchelf)) |
||||
(inputs (list gtk+-2 cups-minimal)) |
||||
(synopsis "Canon Printer Drivers") |
||||
(description "This package provides the drivers for the following Canon |
||||
Printer Series: |
||||
|
||||
@enumerate |
||||
@item mp250 |
||||
@item mp280 |
||||
@item mp495 |
||||
@item mg5100 |
||||
@item ip4800 |
||||
@item mg5200 |
||||
@item mg6100 |
||||
@item mg8100 |
||||
@end enumerate") |
||||
;; This is the license for the source available code, not the binary blobs. |
||||
(license license:gpl2+))) |
Loading…
Reference in new issue