mirror of
https://github.com/termux-pacman/termux-packages.git
synced 2026-01-06 10:53:21 +00:00
Update package telegram-cli
This commit is contained in:
13
packages/telegram-cli/Makefile.in.patch
Normal file
13
packages/telegram-cli/Makefile.in.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index 8342462..ae845f6 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -6,7 +6,7 @@ CPPFLAGS=@CPPFLAGS@ @OPENSSL_INCLUDES@
|
||||
DEFS=@DEFS@
|
||||
COMPILE_FLAGS=${CFLAGS} ${CPFLAGS} ${CPPFLAGS} ${DEFS} -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-deprecated-declarations -fno-strict-aliasing -fno-omit-frame-pointer -ggdb -Wno-unused-parameter -fPIC
|
||||
EXTRA_LIBS=@LIBS@ @EXTRA_LIBS@ @OPENSSL_LIBS@
|
||||
-LOCAL_LDFLAGS=-rdynamic -ggdb -levent ${EXTRA_LIBS} -ldl -lpthread -lutil
|
||||
+LOCAL_LDFLAGS=-rdynamic -ggdb -levent ${EXTRA_LIBS} -ldl
|
||||
LINK_FLAGS=${LDFLAGS} ${LOCAL_LDFLAGS}
|
||||
|
||||
DEP=dep
|
||||
45
packages/telegram-cli/build.sh
Normal file
45
packages/telegram-cli/build.sh
Normal file
@@ -0,0 +1,45 @@
|
||||
TERMUX_PKG_HOMEPAGE=https://github.com/vysheng/tg
|
||||
TERMUX_PKG_DESCRIPTION="Telegram messenger CLI"
|
||||
TERMUX_PKG_LICENSE="GPL-2.0"
|
||||
TERMUX_PKG_MAINTAINER="Leonid Pliushch <leonid.pliushch@gmail.com>"
|
||||
TERMUX_PKG_VERSION=1:1.4.1
|
||||
TERMUX_PKG_REVISION=3
|
||||
TERMUX_PKG_DEPENDS="libconfig, libevent, libjansson, openssl, readline, zlib"
|
||||
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--disable-liblua"
|
||||
TERMUX_PKG_BUILD_IN_SRC=true
|
||||
TERMUX_PKG_SKIP_SRC_EXTRACT=true
|
||||
TERMUX_PKG_HOSTBUILD=true
|
||||
|
||||
termux_step_get_source() {
|
||||
mkdir -p "$TERMUX_PKG_SRCDIR"
|
||||
cd "$TERMUX_PKG_SRCDIR"
|
||||
git clone https://github.com/vysheng/tg
|
||||
cd tg
|
||||
git checkout 6547c0b21b977b327b3c5e8142963f4bc246187a
|
||||
git submodule update --init --recursive
|
||||
mv * ../
|
||||
}
|
||||
|
||||
termux_step_host_build() {
|
||||
cp -rf $TERMUX_PKG_SRCDIR/* ./
|
||||
./configure --disable-liblua
|
||||
make bin/generate
|
||||
make bin/tl-parser
|
||||
}
|
||||
|
||||
termux_step_pre_configure() {
|
||||
# avoid duplicated symbol errors
|
||||
CFLAGS+=" -fcommon"
|
||||
}
|
||||
|
||||
termux_step_post_configure() {
|
||||
cp -a $TERMUX_PKG_HOSTBUILD_DIR/bin ./
|
||||
touch -d "next hour" bin/generate bin/tl-parser
|
||||
sed -i -e 's@-I/usr/local/include@@g' -e 's@-I/usr/include@@g' Makefile
|
||||
}
|
||||
|
||||
termux_step_make_install() {
|
||||
install -Dm700 -t "$TERMUX_PREFIX"/bin/ bin/telegram-cli
|
||||
install -Dm600 tg-server.pub "$TERMUX_PREFIX"/etc/telegram-cli/server.pub
|
||||
install -Dm600 -t "$TERMUX_PREFIX"/share/man/man8/ debian/telegram-cli.8
|
||||
}
|
||||
60
packages/telegram-cli/main.c.patch
Normal file
60
packages/telegram-cli/main.c.patch
Normal file
@@ -0,0 +1,60 @@
|
||||
diff --git a/main.c b/main.c
|
||||
index 4776f07..f159ee5 100644
|
||||
--- a/main.c
|
||||
+++ b/main.c
|
||||
@@ -45,7 +45,7 @@
|
||||
#include <time.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
-#ifdef HAVE_EXECINFO_H
|
||||
+#if defined(HAVE_EXECINFO_H) && !defined(__ANDROID__)
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
#include <signal.h>
|
||||
@@ -173,6 +173,8 @@ char *get_home_directory (void) {
|
||||
if (!str_empty (home_directory)) { return home_directory = tstrdup (home_directory); }
|
||||
home_directory = getenv("HOME");
|
||||
if (!str_empty (home_directory)) { return home_directory = tstrdup (home_directory); }
|
||||
+
|
||||
+#ifndef __ANDROID__
|
||||
struct passwd *current_passwd;
|
||||
uid_t user_id;
|
||||
setpwent ();
|
||||
@@ -185,6 +187,9 @@ char *get_home_directory (void) {
|
||||
}
|
||||
endpwent ();
|
||||
if (str_empty (home_directory)) { home_directory = tstrdup ("."); }
|
||||
+#else
|
||||
+ home_directory = tstrdup ("@TERMUX_HOME@");
|
||||
+#endif
|
||||
return home_directory;
|
||||
}
|
||||
|
||||
@@ -552,6 +557,9 @@ int accept_any_tcp;
|
||||
char *bot_hash;
|
||||
|
||||
int change_user_group () {
|
||||
+#ifdef __ANDROID__
|
||||
+ return 0;
|
||||
+#endif
|
||||
char *username = set_user_name;
|
||||
char *groupname = set_group_name;
|
||||
struct passwd *pw;
|
||||
@@ -798,7 +806,7 @@ void args_parse (int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
-#ifdef HAVE_EXECINFO_H
|
||||
+#if defined(HAVE_EXECINFO_H) && !defined(__ANDROID__)
|
||||
void print_backtrace (void) {
|
||||
void *buffer[255];
|
||||
const int calls = backtrace (buffer, sizeof (buffer) / sizeof (void *));
|
||||
@@ -993,7 +1001,7 @@ int main (int argc, char **argv) {
|
||||
#ifdef __FreeBSD__
|
||||
tgl_set_rsa_key (TLS, "/usr/local/etc/" PROG_NAME "/server.pub");
|
||||
#else
|
||||
- tgl_set_rsa_key (TLS, "/etc/" PROG_NAME "/server.pub");
|
||||
+ tgl_set_rsa_key (TLS, "@TERMUX_PREFIX@/etc/" PROG_NAME "/server.pub");
|
||||
#endif
|
||||
tgl_set_rsa_key (TLS, "tg-server.pub");
|
||||
|
||||
34
packages/telegram-cli/openssl-1.1.x.patch
Normal file
34
packages/telegram-cli/openssl-1.1.x.patch
Normal file
@@ -0,0 +1,34 @@
|
||||
diff --git a/crypto/rsa_pem_openssl.c b/crypto/rsa_pem_openssl.c
|
||||
index db653f2..0d9d04c 100644
|
||||
--- a/tgl/crypto/rsa_pem_openssl.c
|
||||
+++ b/tgl/crypto/rsa_pem_openssl.c
|
||||
@@ -38,16 +38,22 @@ TGLC_WRAPPER_ASSOC(bn,BIGNUM)
|
||||
|
||||
TGLC_rsa *TGLC_rsa_new (unsigned long e, int n_bytes, const unsigned char *n) {
|
||||
RSA *ret = RSA_new ();
|
||||
- ret->e = unwrap_bn (TGLC_bn_new ());
|
||||
- TGLC_bn_set_word (wrap_bn (ret->e), e);
|
||||
- ret->n = unwrap_bn (TGLC_bn_bin2bn (n, n_bytes, NULL));
|
||||
+ BIGNUM *ret_e = unwrap_bn (TGLC_bn_new ());
|
||||
+ BIGNUM *ret_n = unwrap_bn (TGLC_bn_bin2bn (n, n_bytes, NULL));
|
||||
+ RSA_set0_key (ret, ret_n, ret_e, NULL);
|
||||
+ TGLC_bn_set_word (wrap_bn (ret_e), e);
|
||||
return wrap_rsa (ret);
|
||||
}
|
||||
|
||||
-#define RSA_GETTER(M) \
|
||||
- TGLC_bn *TGLC_rsa_ ## M (TGLC_rsa *key) { \
|
||||
- return wrap_bn (unwrap_rsa (key)->M); \
|
||||
- } \
|
||||
+#define RSA_GETTER(M) \
|
||||
+TGLC_bn *TGLC_rsa_ ## M (TGLC_rsa *key) { \
|
||||
+ BIGNUM *rsa_n, *rsa_e, *rsa_d; \
|
||||
+ RSA_get0_key(unwrap_rsa (key), \
|
||||
+ (const BIGNUM **) &rsa_n, \
|
||||
+ (const BIGNUM **) &rsa_e, \
|
||||
+ (const BIGNUM **) &rsa_d); \
|
||||
+ return wrap_bn (rsa_ ## M); \
|
||||
+}
|
||||
|
||||
RSA_GETTER(n);
|
||||
RSA_GETTER(e);
|
||||
22
packages/telegram-cli/tgl-generate.c.patch
Normal file
22
packages/telegram-cli/tgl-generate.c.patch
Normal file
@@ -0,0 +1,22 @@
|
||||
diff --git a/generate.c b/generate.c
|
||||
index 83d1664..cc96875 100644
|
||||
--- a/tgl/generate.c
|
||||
+++ b/tgl/generate.c
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
-#ifdef HAVE_EXECINFO_H
|
||||
+#if defined(HAVE_EXECINFO_H) && !defined(__ANDROID__)
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
@@ -2954,7 +2954,7 @@ void hexdump (int *in_ptr, int *in_end) {
|
||||
printf ("\n");
|
||||
}*/
|
||||
|
||||
-#ifdef HAVE_EXECINFO_H
|
||||
+#if defined(HAVE_EXECINFO_H) && !defined(__ANDROID__)
|
||||
void print_backtrace (void) {
|
||||
void *buffer[255];
|
||||
const int calls = backtrace (buffer, sizeof (buffer) / sizeof (void *));
|
||||
22
packages/telegram-cli/tgl-tl-parser-tlc.c.patch
Normal file
22
packages/telegram-cli/tgl-tl-parser-tlc.c.patch
Normal file
@@ -0,0 +1,22 @@
|
||||
diff --git a/tlc.c b/tlc.c
|
||||
index cd0300f..5683793 100644
|
||||
--- a/tgl/tl-parser/tlc.c
|
||||
+++ b/tgl/tl-parser/tlc.c
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <signal.h>
|
||||
#include "config.h"
|
||||
|
||||
-#ifdef HAVE_EXECINFO_H
|
||||
+#if defined(HAVE_EXECINFO_H) && !defined(__ANDROID__)
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
#include <stdarg.h>
|
||||
@@ -77,7 +77,7 @@ void hexdump (int *in_ptr, int *in_end) {
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
-#ifdef HAVE_EXECINFO_H
|
||||
+#if defined(HAVE_EXECINFO_H) && !defined(__ANDROID__)
|
||||
void print_backtrace (void) {
|
||||
void *buffer[255];
|
||||
const int calls = backtrace (buffer, sizeof (buffer) / sizeof (void *));
|
||||
Reference in New Issue
Block a user