diff mbox series

[bug#61018,v7,1/2] gnu: Add perl-pcsc.

Message ID MN2PR20MB26051C7816FD8FB469354D27ACB69@MN2PR20MB2605.namprd20.prod.outlook.com
State New
Headers show
Series [bug#61018,v7,1/2] gnu: Add perl-pcsc. | expand

Commit Message

Jake Leporte March 6, 2023, 1:30 a.m. UTC
* gnu/packages/perl.scm (perl-pcsc): New variable.
---
 gnu/packages/perl.scm | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)


base-commit: bbf88ad4e0cf98c2899542897c7a78ee4005c913
prerequisite-patch-id: 55ebfdbee35b36ac06da23b716337ecfef350452
prerequisite-patch-id: cc81d1d3eb9c0687793c8baf949901cd49c42650
prerequisite-patch-id: 52c97b6e4d8d4b78217423a3f1323d95a609de8c
prerequisite-patch-id: 76ab662c68c7b45a8c84eab1ec3dadc60a886ac3

Comments

Maxim Cournoyer March 22, 2023, 1:40 a.m. UTC | #1
Hi,

Jake Leporte <jakeleporte@outlook.com> writes:

> * gnu/packages/perl.scm (perl-pcsc): New variable.
> ---
>  gnu/packages/perl.scm | 36 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 36 insertions(+)
>
> diff --git a/gnu/packages/perl.scm b/gnu/packages/perl.scm
> index b6fb81e..a1a9983 100644
> --- a/gnu/packages/perl.scm
> +++ b/gnu/packages/perl.scm
> @@ -86,6 +86,7 @@ (define-module (gnu packages perl)
>    #:use-module (gnu packages python)
>    #:use-module (gnu packages readline)
>    #:use-module (gnu packages sdl)
> +  #:use-module (gnu packages security-token)
>    #:use-module (gnu packages textutils)
>    #:use-module (gnu packages video)
>    #:use-module (gnu packages web)
> @@ -12269,6 +12270,41 @@ (define-public perl-path-iterator-rule
>  arduous to type for one-liners.")
>      (license license:asl2.0)))
>  
> +(define-public perl-pcsc
> +  (package
> +    (name "perl-pcsc")
> +    (version "1.4.14")
> +    (source (origin
> +              (method url-fetch)
> +              (uri (string-append
> +                    "mirror://cpan/authors/id/W/WH/WHOM/pcsc-perl-" version
> +                    ".tar.bz2"))
> +              (sha256
> +               (base32
> +                "17f6i16jv6ci6459vh6y3sz94vgcvykjjszcl4xsykryakjvf8i7"))))
> +    (build-system perl-build-system)
> +    (arguments
> +     (list
> +           ;; The tests for this package require access to a
> +           ;; card reader with a card inserted, so they won't be
> +           ;; possible to run in the build environment
> +           #:tests? #f
> +           #:phases #~(modify-phases %standard-phases
> +                        (add-after 'unpack 'patch-dlopen
> +                          (lambda* (#:key inputs #:allow-other-keys)
> +                            (substitute* "PCSCperl.h"
> +                              (("libpcsclite.so.1")
> +                               (search-input-file inputs
> +                                                  "/lib/libpcsclite.so.1"))))))))
> +    (native-inputs (list pkg-config))
> +    (inputs (list pcsc-lite))
> +    (synopsis "Perl library for PC/SC")
> +    (description
> +     "This library allows communication with a smart card using PC/SC from a Perl
> +script.")
> +    (home-page "https://pcsc-perl.apdu.fr/")
> +    (license license:gpl2+)))
> +
>  (define-public perl-pod-constants
>    (package
>      (name "perl-pod-constants")

I've installed this change with the following small modification
(reword the comment and end it with a period):

--8<---------------cut here---------------start------------->8---
modified   gnu/packages/perl.scm
@@ -12339,17 +12339,16 @@ (define-public perl-pcsc
     (build-system perl-build-system)
     (arguments
      (list
-           ;; The tests for this package require access to a
-           ;; card reader with a card inserted, so they won't be
-           ;; possible to run in the build environment
-           #:tests? #f
-           #:phases #~(modify-phases %standard-phases
-                        (add-after 'unpack 'patch-dlopen
-                          (lambda* (#:key inputs #:allow-other-keys)
-                            (substitute* "PCSCperl.h"
-                              (("libpcsclite.so.1")
-                               (search-input-file inputs
-                                                  "/lib/libpcsclite.so.1"))))))))
+      ;; The test suite is disabled because it requires access to a card
+      ;; reader with a card inserted.
+      #:tests? #f
+      #:phases #~(modify-phases %standard-phases
+                   (add-after 'unpack 'patch-dlopen
+                     (lambda* (#:key inputs #:allow-other-keys)
+                       (substitute* "PCSCperl.h"
+                         (("libpcsclite.so.1")
+                          (search-input-file inputs
+                                             "/lib/libpcsclite.so.1"))))))))
     (native-inputs (list pkg-config))
     (inputs (list pcsc-lite))
     (synopsis "Perl library for PC/SC")
--8<---------------cut here---------------end--------------->8---
Maxim Cournoyer March 22, 2023, 1:50 a.m. UTC | #2
Hello,

Jake Leporte <jakeleporte@outlook.com> writes:

> * gnu/packages/perl.scm (perl-pcsc): New variable.
> ---
>  gnu/packages/perl.scm | 36 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 36 insertions(+)
>
> diff --git a/gnu/packages/perl.scm b/gnu/packages/perl.scm
> index b6fb81e..a1a9983 100644
> --- a/gnu/packages/perl.scm
> +++ b/gnu/packages/perl.scm
> @@ -86,6 +86,7 @@ (define-module (gnu packages perl)
>    #:use-module (gnu packages python)
>    #:use-module (gnu packages readline)
>    #:use-module (gnu packages sdl)
> +  #:use-module (gnu packages security-token)
>    #:use-module (gnu packages textutils)
>    #:use-module (gnu packages video)
>    #:use-module (gnu packages web)
> @@ -12269,6 +12270,41 @@ (define-public perl-path-iterator-rule
>  arduous to type for one-liners.")
>      (license license:asl2.0)))
>  
> +(define-public perl-pcsc
> +  (package
> +    (name "perl-pcsc")
> +    (version "1.4.14")
> +    (source (origin
> +              (method url-fetch)
> +              (uri (string-append
> +                    "mirror://cpan/authors/id/W/WH/WHOM/pcsc-perl-" version
> +                    ".tar.bz2"))
> +              (sha256
> +               (base32
> +                "17f6i16jv6ci6459vh6y3sz94vgcvykjjszcl4xsykryakjvf8i7"))))
> +    (build-system perl-build-system)
> +    (arguments
> +     (list
> +           ;; The tests for this package require access to a
> +           ;; card reader with a card inserted, so they won't be
> +           ;; possible to run in the build environment
> +           #:tests? #f
> +           #:phases #~(modify-phases %standard-phases
> +                        (add-after 'unpack 'patch-dlopen
> +                          (lambda* (#:key inputs #:allow-other-keys)
> +                            (substitute* "PCSCperl.h"
> +                              (("libpcsclite.so.1")
> +                               (search-input-file inputs
> +                                                  "/lib/libpcsclite.so.1"))))))))
> +    (native-inputs (list pkg-config))
> +    (inputs (list pcsc-lite))
> +    (synopsis "Perl library for PC/SC")
> +    (description
> +     "This library allows communication with a smart card using PC/SC from a Perl
> +script.")
> +    (home-page "https://pcsc-perl.apdu.fr/")
> +    (license license:gpl2+)))
> +

I've also installed this one with the following changes:

modified   gnu/packages/security-token.scm
@@ -17,6 +17,7 @@
 ;;; Copyright © 2022 John Kehayias <john.kehayias@protonmail.com>
 ;;; Copyright © 2022 Petr Hodina <phodina@protonmail.com>
 ;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
+;;; Copyright © 2023 Jake Leporte <jakeleporte@outlook.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -278,13 +279,12 @@ (define-public pcsc-tools
                         "\"/usr/local/pcsc/smartcard_list.txt\", "
                         "\"/usr/share/pcsc/smartcard_list.txt\", "
                         "\"/usr/local/share/pcsc/smartcard_list.txt\""))
-                      (string-append "\""
-                                     #$output
+                      (string-append "\"" #$output
                                      "/share/pcsc/smartcard_list.txt\"")))
                    (substitute* "ATR_analysis.1p"
-                     (("^([.]IR [.]/) ,\n$" _ cwd)
+                     (("^(\\.IR \\./) ,\n$" _ cwd)
                       (string-append cwd "\n"))
-                     (("^[.]I /usr/local/pcsc/\n$")
+                     (("^\\.I /usr/local/pcsc/\n$")
                       "")

Because \\. is more widespread (conventional) than [.] in the guix code
base.

                      (("/usr/share/pcsc/\n$")
                       (string-append #$output "/share/pcsc/\n")))))
@@ -292,26 +292,22 @@ (define-public pcsc-tools
                  (lambda _
                    (for-each
                     (lambda (prog)
-                      (wrap-program (string-append #$output
-                                                   "/bin/"
-                                                   prog)
-                        `("PERL5LIB" =
-                          (,(getenv "PERL5LIB")))))
+                      (wrap-program (string-append #$output "/bin/" prog)
+                        `("PERL5LIB" = (,(getenv "PERL5LIB")))))
                     '("ATR_analysis" "gscriptor" "scriptor"))
-                   (wrap-program (string-append #$output
-                                                "/bin/gscriptor")
-                     `("GI_TYPELIB_PATH" =
-                       (,(getenv "GI_TYPELIB_PATH")))))))))
+                   (wrap-program (string-append #$output "/bin/gscriptor")
+                     `("GI_TYPELIB_PATH" = (,(getenv "GI_TYPELIB_PATH")))))))))

Tightened the indentation a bit (I guess this was 'guix style', which
doesn't always produce perfect results).

     (native-inputs (list autoconf automake libtool gnu-gettext pkg-config))
-    (inputs (list bash-minimal ;for wrap-program
+    (inputs (list bash-minimal          ;for wrap-program
                   perl
-                  perl-pcsc
                   perl-gtk3
-                  pcsc-lite))
-    (synopsis "Tools for use with smart cards and PC/SC")
-    (description
-     "This package provides @code{pcsc_scan}, @code{ATR_analysis}, @code{scriptor},
-and @code{gscriptor}.")
+                  pcsc-lite
+                  perl-pcsc))
+    (synopsis "Smart cards and PC/SC tools")

I streamlined the synopsis a bit,

+    (description "This package provides the @command{pcsc_scan},
+@command{ATR_analysis}, @command{scriptor}, and @command{gscriptor} commands,
+which are useful tools to test a PC/SC driver, card or reader or send commands
+in a friendly environment (text or graphical user interface).")
     (home-page "https://pcsc-tools.apdu.fr/")

and expounded the description, changing @code to @command.

Thank you!
diff mbox series

Patch

diff --git a/gnu/packages/perl.scm b/gnu/packages/perl.scm
index b6fb81e..a1a9983 100644
--- a/gnu/packages/perl.scm
+++ b/gnu/packages/perl.scm
@@ -86,6 +86,7 @@  (define-module (gnu packages perl)
   #:use-module (gnu packages python)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages sdl)
+  #:use-module (gnu packages security-token)
   #:use-module (gnu packages textutils)
   #:use-module (gnu packages video)
   #:use-module (gnu packages web)
@@ -12269,6 +12270,41 @@  (define-public perl-path-iterator-rule
 arduous to type for one-liners.")
     (license license:asl2.0)))
 
+(define-public perl-pcsc
+  (package
+    (name "perl-pcsc")
+    (version "1.4.14")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "mirror://cpan/authors/id/W/WH/WHOM/pcsc-perl-" version
+                    ".tar.bz2"))
+              (sha256
+               (base32
+                "17f6i16jv6ci6459vh6y3sz94vgcvykjjszcl4xsykryakjvf8i7"))))
+    (build-system perl-build-system)
+    (arguments
+     (list
+           ;; The tests for this package require access to a
+           ;; card reader with a card inserted, so they won't be
+           ;; possible to run in the build environment
+           #:tests? #f
+           #:phases #~(modify-phases %standard-phases
+                        (add-after 'unpack 'patch-dlopen
+                          (lambda* (#:key inputs #:allow-other-keys)
+                            (substitute* "PCSCperl.h"
+                              (("libpcsclite.so.1")
+                               (search-input-file inputs
+                                                  "/lib/libpcsclite.so.1"))))))))
+    (native-inputs (list pkg-config))
+    (inputs (list pcsc-lite))
+    (synopsis "Perl library for PC/SC")
+    (description
+     "This library allows communication with a smart card using PC/SC from a Perl
+script.")
+    (home-page "https://pcsc-perl.apdu.fr/")
+    (license license:gpl2+)))
+
 (define-public perl-pod-constants
   (package
     (name "perl-pod-constants")