gnu: Add emacs-telega-server.

* gnu/packages/emacs-xyz.scm (emacs-telega-server): New variable.
* gnu/packages/patches/emacs-telega-path-placeholder.patch: New file.
* gnu/package/patches/emacs-telega-patch-server-functions.patch: Remove stale patch.
* gnu/local.mk (dist_patch_DATA): Update accordingly.

Signed-off-by: Leo Prikler <leo.prikler@student.tugraz.at>
This commit is contained in:
Zhu Zihao 2021-06-25 13:25:05 +08:00 committed by Leo Prikler
parent 37861f6c29
commit d0ccdd707d
No known key found for this signature in database
GPG key ID: 442A84B8C70E2F87
4 changed files with 99 additions and 33 deletions

View file

@ -988,7 +988,7 @@ dist_patch_DATA = \
%D%/packages/patches/emacs-hyperbole-toggle-messaging.patch \
%D%/packages/patches/emacs-libgit-use-system-libgit2.patch \
%D%/packages/patches/emacs-source-date-epoch.patch \
%D%/packages/patches/emacs-telega-patch-server-functions.patch \
%D%/packages/patches/emacs-telega-path-placeholder.patch \
%D%/packages/patches/emacs-telega-test-env.patch \
%D%/packages/patches/emacs-wordnut-require-adaptive-wrap.patch \
%D%/packages/patches/enjarify-setup-py.patch \

View file

@ -81,7 +81,7 @@
;;; Copyright © 2020, 2021 Niklas Eklund <niklas.eklund@posteo.net>
;;; Copyright © 2020 Marco Grassi <marco.au.grassi98@protonmail.com>
;;; Copyright © 2020 Tomás Ortín Fernández <tomasortin@mailbox.org>
;;; Copyright © 2020 Zhu Zihao <all_but_last@163.com>
;;; Copyright © 2020, 2021 Zhu Zihao <all_but_last@163.com>
;;; Copyright © 2020 Adam Kandur <rndd@tuta.io>
;;; Copyright © 2020 Tim Howes <timhowes@lavabit.com>
;;; Copyright © 2020 Noah Landis <noahlandis@posteo.net>
@ -146,6 +146,7 @@ (define-module (gnu packages emacs-xyz)
#:use-module (gnu packages djvu)
#:use-module (gnu packages ebook)
#:use-module (gnu packages emacs)
#:use-module (gnu packages freedesktop)
#:use-module (gnu packages golang)
#:use-module (gnu packages guile)
#:use-module (gnu packages gtk)
@ -26219,6 +26220,58 @@ (define-public emacs-helm-switch-to-repl
other @code{helm-type-file} sources such as @code{helm-locate}.")
(license license:gpl3+)))
(define-public emacs-telega-server
(package
(name "emacs-telega-server")
(version "0.7.024")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/zevlg/telega.el")
(commit (string-append "v" version))))
(sha256
(base32 "1ra04cp49zzx8vy8aswd00l46ixyc44sxh1s3nw880b4ywzxmc6j"))
(file-name (git-file-name "emacs-telega" version))
(patches
(search-patches "emacs-telega-path-placeholder.patch"
"emacs-telega-test-env.patch"))))
(build-system gnu-build-system)
(arguments
`(#:phases
(modify-phases %standard-phases
(add-before 'configure 'enter-subdirectory
(lambda _ (chdir "server") #t))
(replace 'configure
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(substitute* "Makefile"
(("CC=cc") ,(string-append "CC=" (cc-for-target)))
(("^(INSTALL_PREFIX=).*$" _all prefix)
(string-append prefix out "/bin\n")))
(substitute* "run_tests.py"
(("^(TELEGA_SERVER = ).*$" _all prefix)
(string-append prefix
"\"" out "/bin/telega-server\"\n"))))))
(delete 'check)
(add-after 'install 'check
(assoc-ref %standard-phases 'check))
(add-before 'install-license-files 'leave-subdirectory
(lambda _ (chdir "..") #t)))
#:test-target "test"))
(inputs
`(("tdlib" ,tdlib)
("libappindicator" ,libappindicator)))
(native-inputs
`(("python" ,python)
("pkg-config" ,pkg-config)))
(home-page "https://zevlg.github.io/telega.el/")
(synopsis "Server process of Telega")
(description "Telega-server is helper program to interact with Telegram
service, and connect it with Emacs via inter-process communication.")
(license license:gpl3+)))
(define-public emacs-telega
;; This package has versions newer than indicated on MELPA.
;; Get the current version from `telega-version` in telega.el.

View file

@ -1,31 +0,0 @@
Remove interactive build for telega-server, as it fails on Guix.
Modify the `telega-server--find-bin' function to only use the version
of telega-server installed by Guix.
Created by Brett Gilio <brettg@gnu.org>
--- a/telega-server.el
+++ b/telega-server.el
@@ -113,7 +113,6 @@ If already deferring, then just executes the BODY."
If BUILD-FLAGS is specified, then rebuild server without any
queries using this flags for building, could be empty string.
Otherwise query user about building flags."
- (interactive)
(telega-test-env 'quiet)
(when (or build-flags
(y-or-n-p "Build `telega-server'? "))
@@ -137,11 +136,8 @@ Otherwise query user about building flags."
(defun telega-server--find-bin ()
"Find telega-server executable.
Raise error if not found."
- (let ((exec-path (cons telega-directory exec-path)))
- (or (executable-find "telega-server")
- (progn (telega-server-build)
- (executable-find "telega-server"))
- (error "`telega-server' not found in exec-path"))))
+ (or (executable-find "telega-server")
+ (error "`telega-server' not found in exec-path")))
(defun telega-server-version ()
"Return telega-server version."

View file

@ -0,0 +1,44 @@
From 865b8c553722a971c68742c2e849e41eb0e2360c Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Thu, 24 Jun 2021 23:43:50 +0800
Subject: [PATCH] Replace code that search path with placeholder for
configuration.
---
telega-server.el | 6 +-----
telega-util.el | 2 +-
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/telega-server.el b/telega-server.el
index 999125d..0fa0817 100644
--- a/telega-server.el
+++ b/telega-server.el
@@ -142,11 +142,7 @@ Otherwise query user about building flags."
(defun telega-server--find-bin ()
"Find telega-server executable.
Raise error if not found."
- (let ((exec-path (cons telega-directory exec-path)))
- (or (executable-find "telega-server")
- (progn (telega-server-build)
- (executable-find "telega-server"))
- (error "`telega-server' not found in exec-path"))))
+ "@TELEGA_SERVER_BIN@")
(defun telega-server-version ()
"Return telega-server version."
diff --git a/telega-util.el b/telega-util.el
index 73a46b1..f53e20a 100644
--- a/telega-util.el
+++ b/telega-util.el
@@ -464,7 +464,7 @@ N can't be 0."
(defun telega-etc-file (filename)
"Return absolute path to FILENAME from etc/ directory in telega."
- (expand-file-name (concat "etc/" filename) telega--lib-directory))
+ (concat "@TELEGA_SHARE@" "/" filename))
(defun telega-link-props (link-type link-to &optional face)
"Generate props for link button openable with `telega-link--button-action'."
--
2.32.0