~ruther/guix-local

0c3462568b718bb0ec6df9562adc5ebc8d49e885 — kestrel 5 months ago c854966
gnu: Add 7zip.

* gnu/packages/compression.scm: Import copy-build-system.
(7zip): new variable.

Change-Id: I5c19d3cb301b3f3b633ce9c91760ad77bd20b7dc
Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
1 files changed, 79 insertions(+), 0 deletions(-)

M gnu/packages/compression.scm
M gnu/packages/compression.scm => gnu/packages/compression.scm +79 -0
@@ 67,6 67,7 @@
  #:use-module (guix git-download)
  #:use-module (guix build-system ant)
  #:use-module (guix build-system cmake)
  #:use-module (guix build-system copy)
  #:use-module (guix build-system glib-or-gtk)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system go)


@@ 1460,6 1461,84 @@ for most inputs, but the resulting compressed files are anywhere from 20% to
    (license license:asl2.0)
    (properties '((cpe-vendor . "google")))))

(define-public 7zip
  (package
    (name "7zip")
    (version "25.01")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
              (url "https://github.com/ip7z/7zip")
              (commit version)))
       (sha256
        (base32 "01jg1fkc2zsdngv3ag3pwq4x8i5x01hjxsk30n78ffwiv2ps4rmq"))
       (file-name (git-file-name name version))
       (modules '((guix build utils)
                  (ice-9 regex)))
       (snippet #~(begin
                    (for-each
                     delete-file
                     (append (find-files "CPP/7zip/Compress" "^Rar.*")
                             (find-files "DOC/unRarLicense.txt")))))))
    (build-system copy-build-system)
    (arguments
     (list
      #:install-plan
      #~'(("DOC/" "share/doc/7zip")
          ("CPP/7zip/UI/Console/_o/7z" "bin/")
          ("CPP/7zip/Bundles/Format7zF/_o/7z.so" "lib/")
          ("CPP/7zip/Bundles/SFXCon/_o/7zCon" "lib/7zCon.sfx"))
      #:phases
      #~(modify-phases %standard-phases
          (delete 'configure)
          (delete 'check)
          (add-after 'unpack 'patch-sources
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
                     (lib (string-append out "/lib")))
                (substitute* "CPP/7zip/UI/Client7z/Client7z.cpp"
                  (("if \\(!lib\\.Load\\(dllPrefix + FTEXT\\(kDllName\\)\\)\\)")
                   (string-append "if (!lib.Load(FTEXT(\"" lib
                                  "\") + FTEXT(kDllName)) || "
                                  "!lib.Load(dllPrefix + FTEXT(kDllName)))")))
                (substitute* "CPP/7zip/UI/Common/ArchiveCommandLine.cpp"
                  (("s = FTEXT\\(\"\\.\"\\)")
                   (string-append "s = FTEXT(\"" lib "\")"))
                  (("s = fas2fs\\(g_ModuleDirPrefix\\)")
                   (string-append "s = FTEXT(\"" lib "\") "
                                  "FSTRING_PATH_SEPARATOR"))))))
          (add-before 'install 'build
            (lambda* _
              (define make-flags
                '#$(list "DISABLE_RAR=1"
                         (string-append "CC=" (cc-for-target))
                         (string-append "CXX=" (cxx-for-target))
                         (string-append "PLATFORM="
                                        (cond
                                         ((target-x86-64?) "x64")
                                         ((target-x86-32?) "x86")
                                         ((target-arm32?) "arm")
                                         ((target-aarch64?) "arm64")
                                         (#t "")))))
              (with-directory-excursion "CPP/7zip/"
                (for-each
                 (lambda (dir)
                   (with-directory-excursion dir
                     (apply invoke "make" "-f" "makefile.gcc" make-flags)))
                 '("UI/Console"
                   "Bundles/Format7zF"
                   "Bundles/SFXCon"))))))))
    (home-page "https://7-zip.org")
    (synopsis "7-zip file archiver")
    (description
     "7-zip is a command-line file compressor that supports a number
of archive formats and features self-extracting archives.")
    (license (list license:lgpl2.1+
                   license:bsd-2
                   license:bsd-3
                   license:public-domain))))

(define-public p7zip
  (package
    (name "p7zip")