diff --git a/cnijfilter2.scm b/cnijfilter2.scm new file mode 100644 index 0000000..319c00f --- /dev/null +++ b/cnijfilter2.scm @@ -0,0 +1,99 @@ +;;; SPDX-License-Identifier: GPL-3.0-or-later +;;; Copyright © 2023 Nicolas Graves + +(define-module (cnijfilter2) + #: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)) + +(define-public cnijfilter2 + (package + (name "cnijfilter2") + (version "6.60") + (source + (origin + (method url-fetch) + (uri "https://gdlp01.c-wss.com/gds/3/0100011753/01/cnijfilter2-source-6.60-1.tar.gz") + (sha256 + (base32 "1l5nvaqk3220vy37yin6xkq7nwpp9jm6pg2mam0bdllpg3b1jwcr")))) + (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* "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 + '("cmdtocanonij2" "cmdtocanonij3" "cnijbe2" "lgmon3" "rastertocanonij" + "tocanonij" "tocnpwg"))))) + (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+)))