From f62beb56ff1531a61dfa0db6ee2f836450cea049 Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 31 Jan 2020 19:12:51 +0100 Subject: [PATCH] New package: telegram-cli-20200106 --- .../telegram-cli/patches/cross_comp_lua.patch | 450 ++++++++++++++++++ srcpkgs/telegram-cli/template | 27 ++ 2 files changed, 477 insertions(+) create mode 100644 srcpkgs/telegram-cli/patches/cross_comp_lua.patch create mode 100644 srcpkgs/telegram-cli/template diff --git a/srcpkgs/telegram-cli/patches/cross_comp_lua.patch b/srcpkgs/telegram-cli/patches/cross_comp_lua.patch new file mode 100644 index 00000000000..eb1f4e5befc --- /dev/null +++ b/srcpkgs/telegram-cli/patches/cross_comp_lua.patch @@ -0,0 +1,450 @@ +From c6e70b6a8c2a110d4172762d279f523764030d41 Mon Sep 17 00:00:00 2001 +From: Valentin +Date: Thu, 17 Aug 2017 15:33:19 +0200 +Subject: [PATCH] Update ax_lua.m4 + +--- + ax_lua.m4 | 266 ++++++++++++++++++++++++++++++++---------------------- + 1 file changed, 158 insertions(+), 108 deletions(-) + +diff --git a/ax_lua.m4 b/ax_lua.m4 +index d9f47734..59201671 100644 +--- ax_lua.m4 ++++ b/ax_lua.m4 +@@ -1,5 +1,5 @@ + # =========================================================================== +-# http://www.gnu.org/software/autoconf-archive/ax_lua.html ++# https://www.gnu.org/software/autoconf-archive/ax_lua.html + # =========================================================================== + # + # SYNOPSIS +@@ -18,8 +18,8 @@ + # Also detect Lua headers and libraries. The Lua version contained in the + # header is checked to match the Lua interpreter version exactly. When + # searching for Lua libraries, the version number is used as a suffix. +-# This is done with the goal of supporting multiple Lua installs (5.1 and +-# 5.2 side-by-side). ++# This is done with the goal of supporting multiple Lua installs (5.1, ++# 5.2, and 5.3 side-by-side). + # + # A note on compatibility with previous versions: This file has been + # mostly rewritten for serial 18. Most developers should be able to use +@@ -51,13 +51,10 @@ + # + # If MINIMUM-VERSION is supplied, then only Lua interpreters with a + # version number greater or equal to MINIMUM-VERSION will be accepted. If +-# TOO-BIG- VERSION is also supplied, then only Lua interpreters with a ++# TOO-BIG-VERSION is also supplied, then only Lua interpreters with a + # version number greater or equal to MINIMUM-VERSION and less than + # TOO-BIG-VERSION will be accepted. + # +-# Version comparisons require the AX_COMPARE_VERSION macro, which is +-# provided by ax_compare_version.m4 from the Autoconf Archive. +-# + # The Lua version number, LUA_VERSION, is found from the interpreter, and + # substituted. LUA_PLATFORM is also found, but not currently supported (no + # standard representation). +@@ -69,12 +66,13 @@ + # luaexecdir Directory to install Lua modules. + # pkgluaexecdir $luaexecdir/$PACKAGE + # +-# These paths a found based on $prefix, $exec_prefix, Lua's package.path, +-# and package.cpath. The first path of package.path beginning with $prefix +-# is selected as luadir. The first path of package.cpath beginning with +-# $exec_prefix is used as luaexecdir. This should work on all reasonable +-# Lua installations. If a path cannot be determined, a default path is +-# used. Of course, the user can override these later when invoking make. ++# These paths are found based on $prefix, $exec_prefix, Lua's ++# package.path, and package.cpath. The first path of package.path ++# beginning with $prefix is selected as luadir. The first path of ++# package.cpath beginning with $exec_prefix is used as luaexecdir. This ++# should work on all reasonable Lua installations. If a path cannot be ++# determined, a default path is used. Of course, the user can override ++# these later when invoking make. + # + # luadir Default: $prefix/share/lua/$LUA_VERSION + # luaexecdir Default: $exec_prefix/lib/lua/$LUA_VERSION +@@ -154,8 +152,8 @@ + # + # LICENSE + # +-# Copyright (c) 2013 Tim Perkins +-# Copyright (c) 2013 Reuben Thomas ++# Copyright (c) 2015 Reuben Thomas ++# Copyright (c) 2014 Tim Perkins + # + # This program is free software: you can redistribute it and/or modify it + # under the terms of the GNU General Public License as published by the +@@ -168,7 +166,7 @@ + # Public License for more details. + # + # You should have received a copy of the GNU General Public License along +-# with this program. If not, see . ++# with this program. If not, see . + # + # As a special exception, the respective Autoconf Macro's copyright owner + # gives unlimited permission to copy, distribute and modify the configure +@@ -183,7 +181,7 @@ + # modified version of the Autoconf Macro, you may extend this special + # exception to the GPL to apply to your modified version as well. + +-#serial 21 ++#serial 40 + + dnl ========================================================================= + dnl AX_PROG_LUA([MINIMUM-VERSION], [TOO-BIG-VERSION], +@@ -191,12 +189,16 @@ dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) + dnl ========================================================================= + AC_DEFUN([AX_PROG_LUA], + [ ++ dnl Check for required tools. ++ AC_REQUIRE([AC_PROG_GREP]) ++ AC_REQUIRE([AC_PROG_SED]) ++ + dnl Make LUA a precious variable. + AC_ARG_VAR([LUA], [The Lua interpreter, e.g. /usr/bin/lua5.1]) + + dnl Find a Lua interpreter. + m4_define_default([_AX_LUA_INTERPRETER_LIST], +- [lua lua5.2 lua52 lua5.1 lua51 lua50]) ++ [lua lua5.3 lua53 lua5.2 lua52 lua5.1 lua51 lua50]) + + m4_if([$1], [], + [ dnl No version check is needed. Find any Lua interpreter. +@@ -204,12 +206,14 @@ AC_DEFUN([AX_PROG_LUA], + [AC_PATH_PROGS([LUA], [_AX_LUA_INTERPRETER_LIST], [:])]) + ax_display_LUA='lua' + +- dnl At least check if this is a Lua interpreter. +- AC_MSG_CHECKING([if $LUA is a Lua interpreter]) +- _AX_LUA_CHK_IS_INTRP([$LUA], +- [AC_MSG_RESULT([yes])], +- [ AC_MSG_RESULT([no]) +- AC_MSG_ERROR([not a Lua interpreter]) ++ AS_IF([test "x$LUA" != 'x:'], ++ [ dnl At least check if this is a Lua interpreter. ++ AC_MSG_CHECKING([if $LUA is a Lua interpreter]) ++ _AX_LUA_CHK_IS_INTRP([$LUA], ++ [AC_MSG_RESULT([yes])], ++ [ AC_MSG_RESULT([no]) ++ AC_MSG_ERROR([not a Lua interpreter]) ++ ]) + ]) + ], + [ dnl A version check is needed. +@@ -257,21 +261,26 @@ AC_DEFUN([AX_PROG_LUA], + m4_default([$4], [AC_MSG_ERROR([cannot find suitable Lua interpreter])]) + ], + [ dnl Query Lua for its version number. +- AC_CACHE_CHECK([for $ax_display_LUA version], [ax_cv_lua_version], +- [ ax_cv_lua_version=`$LUA -e "print(_VERSION)" | \ +- sed "s|^Lua \(.*\)|\1|" | \ +- grep -E -o "^@<:@0-9@:>@+\.@<:@0-9@:>@+"` ++ AC_CACHE_CHECK([for $ax_display_LUA version], ++ [ax_cv_lua_version], ++ [ dnl Get the interpreter version in X.Y format. This should work for ++ dnl interpreters version 5.0 and beyond. ++ ax_cv_lua_version=[`$LUA -e ' ++ -- return a version number in X.Y format ++ local _, _, ver = string.find(_VERSION, "^Lua (%d+%.%d+)") ++ print(ver)'`] + ]) + AS_IF([test "x$ax_cv_lua_version" = 'x'], + [AC_MSG_ERROR([invalid Lua version number])]) + AC_SUBST([LUA_VERSION], [$ax_cv_lua_version]) +- AC_SUBST([LUA_SHORT_VERSION], [`echo "$LUA_VERSION" | sed 's|\.||'`]) ++ AC_SUBST([LUA_SHORT_VERSION], [`echo "$LUA_VERSION" | $SED 's|\.||'`]) + + dnl The following check is not supported: + dnl At times (like when building shared libraries) you may want to know + dnl which OS platform Lua thinks this is. +- AC_CACHE_CHECK([for $ax_display_LUA platform], [ax_cv_lua_platform], +- [ax_cv_lua_platform=`$LUA -e "print('unknown')"`]) ++ AC_CACHE_CHECK([for $ax_display_LUA platform], ++ [ax_cv_lua_platform], ++ [ax_cv_lua_platform=[`$LUA -e 'print("unknown")'`]]) + AC_SUBST([LUA_PLATFORM], [$ax_cv_lua_platform]) + + dnl Use the values of $prefix and $exec_prefix for the corresponding +@@ -296,12 +305,12 @@ AC_DEFUN([AX_PROG_LUA], + ax_cv_lua_luadir="$LUA_PREFIX/share/lua/$LUA_VERSION" + + dnl Try to find a path with the prefix. +- _AX_LUA_FND_PRFX_PTH([$LUA], [$ax_lua_prefix], [package.path]) ++ _AX_LUA_FND_PRFX_PTH([$LUA], [$ax_lua_prefix], [script]) + AS_IF([test "x$ax_lua_prefixed_path" != 'x'], + [ dnl Fix the prefix. +- _ax_strip_prefix=`echo "$ax_lua_prefix" | sed 's|.|.|g'` ++ _ax_strip_prefix=`echo "$ax_lua_prefix" | $SED 's|.|.|g'` + ax_cv_lua_luadir=`echo "$ax_lua_prefixed_path" | \ +- sed "s,^$_ax_strip_prefix,$LUA_PREFIX,"` ++ $SED "s|^$_ax_strip_prefix|$LUA_PREFIX|"` + ]) + ]) + AC_SUBST([luadir], [$ax_cv_lua_luadir]) +@@ -323,12 +332,12 @@ AC_DEFUN([AX_PROG_LUA], + + dnl Try to find a path with the prefix. + _AX_LUA_FND_PRFX_PTH([$LUA], +- [$ax_lua_exec_prefix], [package.cpathd]) ++ [$ax_lua_exec_prefix], [module]) + AS_IF([test "x$ax_lua_prefixed_path" != 'x'], + [ dnl Fix the prefix. +- _ax_strip_prefix=`echo "$ax_lua_exec_prefix" | sed 's|.|.|g'` ++ _ax_strip_prefix=`echo "$ax_lua_exec_prefix" | $SED 's|.|.|g'` + ax_cv_lua_luaexecdir=`echo "$ax_lua_prefixed_path" | \ +- sed "s,^$_ax_strip_prefix,$LUA_EXEC_PREFIX,"` ++ $SED "s|^$_ax_strip_prefix|$LUA_EXEC_PREFIX|"` + ]) + ]) + AC_SUBST([luaexecdir], [$ax_cv_lua_luaexecdir]) +@@ -342,7 +351,7 @@ AC_DEFUN([AX_PROG_LUA], + dnl AX_WITH_LUA is now the same thing as AX_PROG_LUA. + AC_DEFUN([AX_WITH_LUA], + [ +- AC_MSG_WARN([[$0 is deprecated, please use AX_PROG_LUA]]) ++ AC_MSG_WARN([[$0 is deprecated, please use AX_PROG_LUA instead]]) + AX_PROG_LUA + ]) + +@@ -352,8 +361,19 @@ dnl _AX_LUA_CHK_IS_INTRP(PROG, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) + dnl ========================================================================= + AC_DEFUN([_AX_LUA_CHK_IS_INTRP], + [ +- dnl Just print _VERSION because all Lua interpreters have this global. +- AS_IF([$1 -e "print('Hello ' .. _VERSION .. '!')" &>/dev/null], ++ dnl A minimal Lua factorial to prove this is an interpreter. This should work ++ dnl for Lua interpreters version 5.0 and beyond. ++ _ax_lua_factorial=[`$1 2>/dev/null -e ' ++ -- a simple factorial ++ function fact (n) ++ if n == 0 then ++ return 1 ++ else ++ return n * fact(n-1) ++ end ++ end ++ print("fact(5) is " .. fact(5))'`] ++ AS_IF([test "$_ax_lua_factorial" = 'fact(5) is 120'], + [$2], [$3]) + ]) + +@@ -364,48 +384,70 @@ dnl [ACTION-IF-TRUE], [ACTION-IF-FALSE]) + dnl ========================================================================= + AC_DEFUN([_AX_LUA_CHK_VER], + [ +- _ax_test_ver=`$1 -e "print(_VERSION)" 2>/dev/null | \ +- sed "s|^Lua \(.*\)|\1|" | grep -E -o "^@<:@0-9@:>@+\.@<:@0-9@:>@+"` +- AS_IF([test "x$_ax_test_ver" = 'x'], +- [_ax_test_ver='0']) +- AX_COMPARE_VERSION([$_ax_test_ver], [ge], [$2]) +- m4_if([$3], [], [], +- [ AS_IF([$ax_compare_version], +- [AX_COMPARE_VERSION([$_ax_test_ver], [lt], [$3])]) +- ]) +- AS_IF([$ax_compare_version], [$4], [$5]) ++ dnl Check that the Lua version is within the bounds. Only the major and minor ++ dnl version numbers are considered. This should work for Lua interpreters ++ dnl version 5.0 and beyond. ++ _ax_lua_good_version=[`$1 -e ' ++ -- a script to compare versions ++ function verstr2num(verstr) ++ local _, _, majorver, minorver = string.find(verstr, "^(%d+)%.(%d+)") ++ if majorver and minorver then ++ return tonumber(majorver) * 100 + tonumber(minorver) ++ end ++ end ++ local minver = verstr2num("$2") ++ local _, _, trimver = string.find(_VERSION, "^Lua (.*)") ++ local ver = verstr2num(trimver) ++ local maxver = verstr2num("$3") or 1e9 ++ if minver <= ver and ver < maxver then ++ print("yes") ++ else ++ print("no") ++ end'`] ++ AS_IF([test "x$_ax_lua_good_version" = "xyes"], ++ [$4], [$5]) + ]) + + + dnl ========================================================================= +-dnl _AX_LUA_FND_PRFX_PTH(PROG, PREFIX, LUA-PATH-VARIABLE) ++dnl _AX_LUA_FND_PRFX_PTH(PROG, PREFIX, SCRIPT-OR-MODULE-DIR) + dnl ========================================================================= + AC_DEFUN([_AX_LUA_FND_PRFX_PTH], + [ +- dnl Invokes the Lua interpreter PROG to print the path variable +- dnl LUA-PATH-VARIABLE, usually package.path or package.cpath. Paths are +- dnl then matched against PREFIX. The first path to begin with PREFIX is set +- dnl to ax_lua_prefixed_path. +- +- ax_lua_prefixed_path='' +- _ax_package_paths=`$1 -e 'print($3)' 2>/dev/null | sed 's|;|\n|g'` +- dnl Try the paths in order, looking for the prefix. +- for _ax_package_path in $_ax_package_paths; do +- dnl Copy the path, up to the use of a Lua wildcard. +- _ax_path_parts=`echo "$_ax_package_path" | sed 's|/|\n|g'` +- _ax_reassembled='' +- for _ax_path_part in $_ax_path_parts; do +- echo "$_ax_path_part" | grep '\?' >/dev/null && break +- _ax_reassembled="$_ax_reassembled/$_ax_path_part" +- done +- dnl Check the path against the prefix. +- _ax_package_path=$_ax_reassembled +- if echo "$_ax_package_path" | grep "^$2" >/dev/null; then +- dnl Found it. +- ax_lua_prefixed_path=$_ax_package_path +- break +- fi +- done ++ dnl Get the script or module directory by querying the Lua interpreter, ++ dnl filtering on the given prefix, and selecting the shallowest path. If no ++ dnl path is found matching the prefix, the result will be an empty string. ++ dnl The third argument determines the type of search, it can be 'script' or ++ dnl 'module'. Supplying 'script' will perform the search with package.path ++ dnl and LUA_PATH, and supplying 'module' will search with package.cpath and ++ dnl LUA_CPATH. This is done for compatibility with Lua 5.0. ++ ++ ax_lua_prefixed_path=[`$1 -e ' ++ -- get the path based on search type ++ local searchtype = "$3" ++ local paths = "" ++ if searchtype == "script" then ++ paths = (package and package.path) or LUA_PATH ++ elseif searchtype == "module" then ++ paths = (package and package.cpath) or LUA_CPATH ++ end ++ -- search for the prefix ++ local prefix = "'$2'" ++ local minpath = "" ++ local mindepth = 1e9 ++ string.gsub(paths, "(@<:@^;@:>@+)", ++ function (path) ++ path = string.gsub(path, "%?.*$", "") ++ path = string.gsub(path, "/@<:@^/@:>@*$", "") ++ if string.find(path, prefix) then ++ local depth = string.len(string.gsub(path, "@<:@^/@:>@", "")) ++ if depth < mindepth then ++ minpath = path ++ mindepth = depth ++ end ++ end ++ end) ++ print(minpath)'`] + ]) + + +@@ -426,9 +468,10 @@ AC_DEFUN([AX_LUA_HEADERS], + AC_ARG_VAR([LUA_INCLUDE], [The Lua includes, e.g. -I/usr/include/lua5.1]) + + dnl Some default directories to search. +- LUA_SHORT_VERSION=`echo "$LUA_VERSION" | sed 's|\.||'` ++ LUA_SHORT_VERSION=`echo "$LUA_VERSION" | $SED 's|\.||'` + m4_define_default([_AX_LUA_INCLUDE_LIST], + [ /usr/include/lua$LUA_VERSION \ ++ /usr/include/lua-$LUA_VERSION \ + /usr/include/lua/$LUA_VERSION \ + /usr/include/lua$LUA_SHORT_VERSION \ + /usr/local/include/lua$LUA_VERSION \ +@@ -472,14 +515,17 @@ AC_DEFUN([AX_LUA_HEADERS], + + AS_IF([test "x$ac_cv_header_lua_h" = 'xyes'], + [ dnl Make a program to print LUA_VERSION defined in the header. +- dnl TODO This probably shouldn't be a runtime test. +- +- AC_CACHE_CHECK([for Lua header version], +- [ax_cv_lua_header_version], +- [ _ax_lua_saved_cppflags=$CPPFLAGS +- CPPFLAGS="$CPPFLAGS $LUA_INCLUDE" +- AC_RUN_IFELSE( +- [ AC_LANG_SOURCE([[ ++ dnl TODO It would be really nice if we could do this without compiling a ++ dnl program, then it would work when cross compiling. But I'm not sure how ++ dnl to do this reliably. For now, assume versions match when cross compiling. ++ ++ AS_IF([test "x$cross_compiling" != 'xyes'], ++ [ AC_CACHE_CHECK([for Lua header version], ++ [ax_cv_lua_header_version], ++ [ _ax_lua_saved_cppflags=$CPPFLAGS ++ CPPFLAGS="$CPPFLAGS $LUA_INCLUDE" ++ AC_RUN_IFELSE( ++ [ AC_LANG_SOURCE([[ + #include + #include + #include +@@ -489,23 +535,26 @@ int main(int argc, char ** argv) + exit(EXIT_SUCCESS); + } + ]]) ++ ], ++ [ ax_cv_lua_header_version=`./conftest$EXEEXT p | \ ++ $SED -n "s|^Lua \(@<:@0-9@:>@\{1,\}\.@<:@0-9@:>@\{1,\}\).\{0,\}|\1|p"` ++ ], ++ [ax_cv_lua_header_version='unknown']) ++ CPPFLAGS=$_ax_lua_saved_cppflags ++ ]) ++ ++ dnl Compare this to the previously found LUA_VERSION. ++ AC_MSG_CHECKING([if Lua header version matches $LUA_VERSION]) ++ AS_IF([test "x$ax_cv_lua_header_version" = "x$LUA_VERSION"], ++ [ AC_MSG_RESULT([yes]) ++ ax_header_version_match='yes' + ], +- [ ax_cv_lua_header_version=`./conftest$EXEEXT p | \ +- sed "s|^Lua \(.*\)|\1|" | \ +- grep -E -o "^@<:@0-9@:>@+\.@<:@0-9@:>@+"` +- ], +- [ax_cv_lua_header_version='unknown']) +- CPPFLAGS=$_ax_lua_saved_cppflags +- ]) +- +- dnl Compare this to the previously found LUA_VERSION. +- AC_MSG_CHECKING([if Lua header version matches $LUA_VERSION]) +- AS_IF([test "x$ax_cv_lua_header_version" = "x$LUA_VERSION"], +- [ AC_MSG_RESULT([yes]) +- ax_header_version_match='yes' ++ [ AC_MSG_RESULT([no]) ++ ax_header_version_match='no' ++ ]) + ], +- [ AC_MSG_RESULT([no]) +- ax_header_version_match='no' ++ [ AC_MSG_WARN([cross compiling so assuming header version number matches]) ++ ax_header_version_match='yes' + ]) + ]) + +@@ -522,7 +571,7 @@ int main(int argc, char ** argv) + dnl AX_LUA_HEADERS_VERSION no longer exists, use AX_LUA_HEADERS. + AC_DEFUN([AX_LUA_HEADERS_VERSION], + [ +- AC_MSG_WARN([[$0 is deprecated, please use AX_LUA_HEADERS]]) ++ AC_MSG_WARN([[$0 is deprecated, please use AX_LUA_HEADERS instead]]) + ]) + + +@@ -578,14 +627,15 @@ AC_DEFUN([AX_LUA_LIBS], + _ax_lua_saved_libs=$LIBS + LIBS="$LIBS $LUA_LIB" + AC_SEARCH_LIBS([lua_load], +- [ lua$LUA_VERSION \ +- lua$LUA_SHORT_VERSION \ +- lua-$LUA_VERSION \ +- lua-$LUA_SHORT_VERSION \ +- lua], +- [_ax_found_lua_libs='yes'], +- [_ax_found_lua_libs='no'], +- [$_ax_lua_extra_libs]) ++ [ lua$LUA_VERSION \ ++ lua$LUA_SHORT_VERSION \ ++ lua-$LUA_VERSION \ ++ lua-$LUA_SHORT_VERSION \ ++ lua \ ++ ], ++ [_ax_found_lua_libs='yes'], ++ [_ax_found_lua_libs='no'], ++ [$_ax_lua_extra_libs]) + LIBS=$_ax_lua_saved_libs + + AS_IF([test "x$ac_cv_search_lua_load" != 'xno' && diff --git a/srcpkgs/telegram-cli/template b/srcpkgs/telegram-cli/template new file mode 100644 index 00000000000..904a3cf1579 --- /dev/null +++ b/srcpkgs/telegram-cli/template @@ -0,0 +1,27 @@ +# Template file for 'telegram-cli' +pkgname=telegram-cli +version=20200106 +revision=1 +build_style=gnu-configure +hostmakedepends="lua-devel libressl-devel libcrypto45" +makedepends="libevent-devel libconfig-devel jansson-devel zlib-devel readline-devel" +short_desc="Command-line interface for Telegram. Uses readline interface" +maintainer="Marco Bertoni " +license="GPL-2.0-only" +homepage="https://github.com/kenorb-contrib/tg" +_tglversion=20190203 +distfiles="https://github.com/kenorb-contrib/tg/archive/${version}.tar.gz>tg-${version}.tar.gz https://github.com/kenorb-contrib/tgl/archive/${_tglversion}.tar.gz>tgl-${_tglversion}.tar.gz" +checksum="824504804e8c0bb20943d765ba54feaacda7b2ec34735da0cfe5d5e61348d519 178e443938a89c9aa771fe7a25b36315840915bff8f6744ab298f36f88540a32" + +do_extract() { + srcdir="$XBPS_SRCDISTDIR/$pkgname-$version" + tar -x --no-same-permissions --no-same-owner -f $srcdir/tg-${version}.tar.gz -C $wrksrc --strip-components 1 + tar -x --no-same-permissions --no-same-owner -f $srcdir/tgl-${_tglversion}.tar.gz -C $wrksrc/tgl --strip-components 1 +} + +do_install() { + cd ${wrksrc} + vbin bin/telegram-cli + vman debian/telegram-cli.8 + vconf tg-server.pub server.pub +}