me
/
guix
Archived
1
0
Fork 0

gnu: emacs-telega: Update to 0.7.024.

* gnu/packages/emacs-xyz.scm (emacs-telega): Update to 0.7.024.
[build-system] Use emacs-build-system.
[arguments] Add #:emacs.
Drop outdated phases.
Update ‘patch-sources’ phase to find new occurences of ffmpeg to patch.
Add new ‘configure’ and ‘install-share-files’ phases.

Signed-off-by: Leo Prikler <leo.prikler@student.tugraz.at>
master
Zhu Zihao 2021-06-25 13:26:51 +08:00 committed by Leo Prikler
parent d0ccdd707d
commit a303be7c3b
No known key found for this signature in database
GPG Key ID: 442A84B8C70E2F87
1 changed files with 65 additions and 119 deletions

View File

@ -26273,125 +26273,71 @@ service, and connect it with Emacs via inter-process communication.")
(license license:gpl3+))) (license license:gpl3+)))
(define-public emacs-telega (define-public emacs-telega
;; This package has versions newer than indicated on MELPA. (package
;; Get the current version from `telega-version` in telega.el. (inherit emacs-telega-server)
;; or by running M-x telega-version. (name "emacs-telega")
(let ((commit "1d28dc209e2acf1a3bf2852cc620b6e412ea73f9") (build-system emacs-build-system)
(revision "1") (arguments
(version "0.7.1")) `(#:emacs ,(if (target-64bit?)
(package emacs-minimal
(name "emacs-telega") ;; Require wide-int support for 32-bit platform.
(version (git-version version revision commit)) emacs-wide-int)
(source #:phases
(origin (modify-phases %standard-phases
(method git-fetch) (add-after 'unpack 'patch-sources
(uri (git-reference (lambda* (#:key inputs #:allow-other-keys)
(url "https://github.com/zevlg/telega.el") ;; Hard-code paths to `ffplay` and `ffmpeg`.
(commit commit))) (let* ((ffmpeg (assoc-ref inputs "ffmpeg"))
(sha256 (ffmpeg-bin (string-append ffmpeg "/bin/ffmpeg"))
(base32 (ffplay-bin (string-append ffmpeg "/bin/ffplay")))
"0h6kj3r36x26v6p4gkzg5s6fv0brlvrf6ycsdwnz27fw5sdb99k7")) (substitute* "telega-ffplay.el"
(patches (search-patches (("(shell-command-to-string\|concat) \"(ffmpeg\|ffprobe)"
"emacs-telega-patch-server-functions.patch" all func cmd)
"emacs-telega-test-env.patch")) (string-append func " \"" (assoc-ref inputs "ffmpeg")
(file-name (git-file-name name version)))) "bin/" cmd))
(build-system gnu-build-system) (("\\(executable-find \"ffplay\"\\)")
(arguments (string-append "(and (file-executable-p \"" ffplay-bin "\")"
`(#:modules ((guix build gnu-build-system) "\"" ffplay-bin "\")"))
((guix build emacs-build-system) #:prefix emacs:) (("\\(executable-find \"ffmpeg\"\\)")
(guix build utils) (string-append "(and (file-executable-p \"" ffmpeg-bin "\")"
(guix build emacs-utils)) "\"" ffmpeg-bin "\")"))))))
#:imported-modules (,@%gnu-build-system-modules (add-after 'unpack 'configure
(guix build emacs-build-system) (lambda* (#:key inputs outputs #:allow-other-keys)
(guix build emacs-utils)) (substitute* "telega-server.el"
#:test-target "test" (("@TELEGA_SERVER_BIN@")
;; TODO: Currently tgVOIP is not functional, thus we have disabled it (string-append (assoc-ref inputs "emacs-telega-server")
;; temporarily. "/bin/telega-server")))
;; #:make-flags (list "WITH_VOIP=t") (substitute* "telega-util.el"
#:phases (("@TELEGA_SHARE@")
(modify-phases %standard-phases (string-append (assoc-ref outputs "out")
(add-after 'unpack 'prefix-patch "/share/emacs-telega")))))
(lambda _ (add-after 'install 'install-share-files
(substitute* "server/Makefile" (lambda* (#:key outputs #:allow-other-keys)
(("CC=cc") (define install-plan
,(string-append "CC=" (cc-for-target))) '("langs" "sounds" "emojis.alist"
(("INSTALL_PREFIX=\\$\\(HOME\\)/.telega") "verified.svg" "telega-logo.svg"))
(string-append "INSTALL_PREFIX=" (assoc-ref %outputs "out")
"/bin")) (define prefix (string-append (assoc-ref outputs "out")
;; Manually invoke `run_tests.py` after install phase. "/share/emacs-telega"))
(("python3 run_tests.py") (with-directory-excursion "etc"
"")) (for-each (lambda (file)
#t)) (if (file-is-directory? file)
(add-after 'unpack 'expand-load-path (let ((dest (string-append prefix "/" file)))
(assoc-ref emacs:%standard-phases 'expand-load-path)) (copy-recursively file dest))
(add-after 'unpack 'patch-sources (install-file file prefix)))
(lambda* (#:key inputs #:allow-other-keys) install-plan))
;; Hard-code paths to `ffplay` and `ffmpeg`. #t)))))
(let ((ffplay-bin (string-append (assoc-ref inputs "ffmpeg") (inputs
"/bin/ffplay")) `(("emacs-telega-server" ,emacs-telega-server)
(ffmpeg-bin (string-append (assoc-ref inputs "ffmpeg") ("ffmpeg" ,ffmpeg)))
"/bin/ffmpeg"))) (native-inputs '())
(substitute* "telega-ffplay.el" (propagated-inputs
(("\\(executable-find \"ffplay\"\\)") `(("emacs-visual-fill-column" ,emacs-visual-fill-column)
(string-append ("emacs-company" ,emacs-company)
"(and (file-executable-p \"" ffplay-bin "\")" ("emacs-rainbow-identifiers" ,emacs-rainbow-identifiers)))
"\"" ffplay-bin "\")")) (synopsis "GNU Emacs client for the Telegram messenger")
(("\\(executable-find \"ffmpeg\"\\)") (description "Telega is a full-featured, unofficial GNU Emacs-based client
(string-append for the Telegram messaging platform.")))
"(and (file-executable-p \"" ffmpeg-bin "\")"
"\"" ffmpeg-bin "\")"))))
;; This would push the "contrib" sources to the load path,
;; but as contrib is not installed alongside telega, it does
;; nothing.
(substitute* "telega.el"
(("\\(push .* load-path\\)") ""))
#t))
;; The server test suite has a hardcoded path.
;; Reset this behavior to use the proper path.
(add-after 'unpack 'patch-test-suite
(lambda _
(substitute* "server/run_tests.py"
(("~/.telega/telega-server")
(string-append (assoc-ref %outputs "out")
"/bin/telega-server")))
#t))
(add-after 'install 'run-server-suite
(lambda _
(invoke "python3" "server/run_tests.py")
#t))
(delete 'configure)
(add-after 'expand-load-path 'emacs-install
(lambda args
(apply (assoc-ref emacs:%standard-phases 'install)
#:include `("etc" ,@emacs:%default-include)
args)))
(add-after 'emacs-install 'emacs-build
(assoc-ref emacs:%standard-phases 'build))
(add-after 'emacs-install 'emacs-make-autoloads
(assoc-ref emacs:%standard-phases 'make-autoloads)))))
(inputs
`(("ffmpeg" ,ffmpeg))) ; mp4/gif support.
(propagated-inputs
`(("emacs-visual-fill-column" ,emacs-visual-fill-column)
("emacs-company" ,emacs-company)
("emacs-rainbow-identifiers"
,emacs-rainbow-identifiers)
("libwebp" ,libwebp))) ; sticker support.
(native-inputs
`(("tdlib" ,tdlib)
;; Use Emacs with wide ints on 32-bit architectures.
("emacs" ,(match (%current-system)
((or "i686-linux" "armhf-linux")
emacs-wide-int)
(_
emacs)))
("python" ,python)))
(synopsis "GNU Emacs client for the Telegram messenger")
(description
"Telega is a full-featured, unofficial GNU Emacs-based client for the
Telegram messaging platform.")
(home-page "https://zevlg.github.io/telega.el/")
(license license:gpl3+))))
(define-public emacs-telega-contrib (define-public emacs-telega-contrib
(package/inherit emacs-telega (package/inherit emacs-telega