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>
This commit is contained in:
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

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