Commit c5333c03 authored by Vysheng's avatar Vysheng

Merge github.com:vysheng/tg

parents 99ffbf90 2ee8ece0
srcdir=.
CFLAGS=-g -O2 -I/usr/include/lua5.2
CFLAGS=-g -O2
LDFLAGS=
CPPFLAGS=
DEFS=-DHAVE_CONFIG_H
COMPILE_FLAGS=${CFLAGS} ${CPPFLAGS} ${DEFS} -Wall -Wextra -Werror -Wno-deprecated -fno-strict-aliasing -fno-omit-frame-pointer -ggdb
EXTRA_LIBS= -lreadline -lrt -lconfig -llua5.2 -ldl
LOCAL_LDFLAGS=-lm -lcrypto -lz -lssl -rdynamic -ggdb ${EXTRA_LIBS}
EXTRA_LIBS=-lconfig -lcrypto -lz -lrt -lm -lreadline -llua
LOCAL_LDFLAGS=-rdynamic -ggdb ${EXTRA_LIBS}
LINK_FLAGS=${LDFLAGS} ${LOCAL_LDFLAGS}
HEADERS= ${srcdir}/constants.h ${srcdir}/include.h ${srcdir}/interface.h ${srcdir}/LICENSE.h ${srcdir}/loop.h ${srcdir}/mtproto-client.h ${srcdir}/mtproto-common.h ${srcdir}/net.h ${srcdir}/no-preview.h ${srcdir}/queries.h ${srcdir}/structures.h ${srcdir}/telegram.h ${srcdir}/tree.h ${srcdir}/config.h ${srcdir}/binlog.h ${srcdir}/tools.h ${srcdir}/lua-tg.h
......
......@@ -6,7 +6,7 @@ CPPFLAGS=@CPPFLAGS@
DEFS=@DEFS@
COMPILE_FLAGS=${CFLAGS} ${CPPFLAGS} ${DEFS} -Wall -Wextra -Werror -Wno-deprecated -fno-strict-aliasing -fno-omit-frame-pointer -ggdb
EXTRA_LIBS=-lssl @LIBS@ @EXTRA_LIBS@
EXTRA_LIBS=@LIBS@ @EXTRA_LIBS@
LOCAL_LDFLAGS=-rdynamic -ggdb ${EXTRA_LIBS}
LINK_FLAGS=${LDFLAGS} ${LOCAL_LDFLAGS}
......
......@@ -30,6 +30,10 @@ On gentoo:
$ sudo emerge -av sys-libs/readline dev-libs/libconfig dev-libs/openssl dev-lang/lua
On Fedora:
$ sudo yum install lua-devel, openssl-devel, libconfig-devel, readline-devel
Default Makefile uses liblua5.2 from ubuntu. If you use different version of liblua or linux you have to run ./configure script or you will get some strange compilation error.
Then
......@@ -44,6 +48,7 @@ The client depends on [readline library](http://cnswww.cns.cwru.edu/php/chet/rea
$ brew install libconfig
$ brew install readline
$ brew install lua
$ export CFLAGS="-I/usr/local/include -I/usr/local/Cellar/readline/6.2.4/include"
$ export LDFLAGS="-L/usr/local/lib -L/usr/local/Cellar/readline/6.2.4/lib"
$ ./configure && make
......
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* enable libconfig */
#define ENABLE_LIBCONFIG 1
/* Define to 1 if you have the `alarm' function. */
#define HAVE_ALARM 1
......@@ -25,6 +22,9 @@
/* Define to 1 if you have the <lauxlib.h> header file. */
#define HAVE_LAUXLIB_H 1
/* Define to 1 if you have the `config' library (-lconfig). */
#define HAVE_LIBCONFIG 1
/* Define to 1 if you have the `crypto' library (-lcrypto). */
#define HAVE_LIBCRYPTO 1
......@@ -141,6 +141,9 @@
/* Define to the version of this package. */
#define PACKAGE_VERSION "0.1"
/* Use custom prog name */
/* #undef PROG_NAME */
/* Use libedit */
/* #undef READLINE_EDIT */
......
/* config.h.in. Generated from configure.ac by autoheader. */
/* enable libconfig */
#undef ENABLE_LIBCONFIG
/* Define to 1 if you have the `alarm' function. */
#undef HAVE_ALARM
......@@ -24,6 +21,9 @@
/* Define to 1 if you have the <lauxlib.h> header file. */
#undef HAVE_LAUXLIB_H
/* Define to 1 if you have the `config' library (-lconfig). */
#undef HAVE_LIBCONFIG
/* Define to 1 if you have the `crypto' library (-lcrypto). */
#undef HAVE_LIBCRYPTO
......@@ -140,6 +140,9 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Use custom prog name */
#undef PROG_NAME
/* Use libedit */
#undef READLINE_EDIT
......
......@@ -687,6 +687,7 @@ ac_user_opts='
enable_option_checking
enable_libconfig
enable_liblua
with_progname
'
ac_precious_vars='build_alias
host_alias
......@@ -1312,6 +1313,11 @@ Optional Features:
--enable-libconfig/--disable-libconfig
--enable-liblua/--disable-liblua
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-progname=<name>
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
......@@ -3562,14 +3568,16 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_config_config_init" >&5
$as_echo "$ac_cv_lib_config_config_init" >&6; }
if test "x$ac_cv_lib_config_config_init" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBCONFIG 1
_ACEOF
$as_echo "#define ENABLE_LIBCONFIG 1" >>confdefs.h
LIBS="-lconfig $LIBS"
else
as_fn_error $? "No libconfig found. Try --disable-libconfig" "$LINENO" 5
fi
EXTRA_LIBS="${EXTRA_LIBS} -lconfig" ;
fi
else
......@@ -3613,14 +3621,16 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_config_config_init" >&5
$as_echo "$ac_cv_lib_config_config_init" >&6; }
if test "x$ac_cv_lib_config_config_init" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBCONFIG 1
_ACEOF
$as_echo "#define ENABLE_LIBCONFIG 1" >>confdefs.h
LIBS="-lconfig $LIBS"
else
as_fn_error $? "No libconfig found. Try --disable-libconfig" "$LINENO" 5
fi
EXTRA_LIBS="${EXTRA_LIBS} -lconfig" ;
fi
......@@ -5359,6 +5369,35 @@ fi
fi
#check for custom prog name
# Check whether --with-progname was given.
if test "${with_progname+set}" = set; then :
withval=$with_progname;
if test "x$with_progname" = "xno" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: default" >&5
$as_echo "default" >&6; }
elif test "x$with_progname" = "xyes" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: default" >&5
$as_echo "default" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$with_progname\"" >&5
$as_echo "\"$with_progname\"" >&6; }
cat >>confdefs.h <<_ACEOF
#define PROG_NAME "$with_progname"
_ACEOF
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: default" >&5
$as_echo "default" >&6; }
fi
# Checks for header files.
for ac_header in execinfo.h fcntl.h malloc.h netdb.h stdlib.h string.h unistd.h arpa/inet.h mach/mach.h netinet/in.h sys/file.h sys/socket.h termios.h
do :
......
......@@ -35,13 +35,11 @@ AC_ARG_ENABLE(libconfig,[--enable-libconfig/--disable-libconfig],
AC_MSG_RESULT([disabled])
else
AC_MSG_RESULT([enabled])
AC_CHECK_LIB([config],[config_init],AC_DEFINE(ENABLE_LIBCONFIG,1,[enable libconfig]),AC_MSG_ERROR([No libconfig found. Try --disable-libconfig]))
[EXTRA_LIBS="${EXTRA_LIBS} -lconfig" ; ]
AC_CHECK_LIB([config],[config_init],[],AC_MSG_ERROR([No libconfig found. Try --disable-libconfig]))
fi
],[
AC_MSG_RESULT([enabled])
AC_CHECK_LIB([config],[config_init],AC_DEFINE(ENABLE_LIBCONFIG,1,[enable libconfig]),AC_MSG_ERROR([No libconfig found. Try --disable-libconfig]))
[EXTRA_LIBS="${EXTRA_LIBS} -lconfig" ; ]
AC_CHECK_LIB([config],[config_init],[],AC_MSG_ERROR([No libconfig found. Try --disable-libconfig]))
])
AC_MSG_CHECKING([for liblua])
......@@ -78,6 +76,21 @@ AC_ARG_ENABLE(liblua,[--enable-liblua/--disable-liblua],
])
])
#check for custom prog name
AC_ARG_WITH(progname,[--with-progname=<name>],
[
if test "x$with_progname" = "xno" ; then
AC_MSG_RESULT([default])
elif test "x$with_progname" = "xyes" ; then
AC_MSG_RESULT([default])
else
AC_MSG_RESULT(["$with_progname"])
AC_DEFINE_UNQUOTED([PROG_NAME], ["$with_progname"], [Use custom prog name])
fi
],[
AC_MSG_RESULT([default])
])
# Checks for header files.
AC_CHECK_HEADERS([execinfo.h fcntl.h malloc.h netdb.h stdlib.h string.h unistd.h arpa/inet.h mach/mach.h netinet/in.h sys/file.h sys/socket.h termios.h])
......
telegram-cli (0.1-1) unstable; urgency=low
* Initial release (Closes #737563)
-- Cleto Martín <cleto@debian.org> Mon, 03 Feb 2014 20:00:03 +0000
Makefile
\ No newline at end of file
Source: telegram-cli
Section: net
Priority: optional
Maintainer: Cleto Martín <cleto@debian.org>
Build-Depends: debhelper (>= 8.0.0),
autotools-dev,
autoconf-archive,
libreadline-dev,
libconfig-dev,
libssl-dev,
lua5.2,
liblua5.2-dev
Standards-Version: 3.9.4
Homepage: https://github.com/vysheng/tg
Vcs-Git: git://github.com/vysheng/tg.git
Vcs-Browser: https://github.com/vysheng/tg
Package: telegram-cli
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Command-line interface for Telegram messenger
Telegram messenger is a cloud-based instant messaging designed for
smart phones and similar to Whatsapp but more flexible, and
powerful. You can send messages, photos, videos and documents to
people who are in your phone contacts (and have Telegram). Telegram
also supports secret chats whose provide a private (encrypted) way of
communication.
.
This package contains a command-line based client for Telegram with
the following features:
* Colored terminal messages.
* Message management: history, stats, etc.
* Group chat: create and manage groups.
* Secret chat: secured and encrypted conversations.
* Contact management: add/edit/remove contacts.
* Multimedia support: send/load photos and videos.
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: telegram-cli
Source: https://github.com/vysheng/tg
Files: *
Copyright: 2013 Vitaly Valtman
License: GPL-2.0+
Files: debian/*
Copyright: 2014 Cleto Martín <cleto@debian.org>
License: GPL-2.0+
License: GPL-2.0+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
README.md
telegram usr/bin
#!/usr/bin/make -f
# -*- makefile -*-
VERSION=$(shell dpkg-parsechangelog | sed -n 's/^Version: //p' | cut -f1 -d'-')
PACKAGE_NAME=$(shell dpkg-parsechangelog | sed -n 's/^Source: //p')
%:
dh $@ --with autotools-dev
build-orig:
mkdir -p $(PACKAGE_NAME)-$(VERSION)
tar --exclude=ax_lua.m4 --exclude=debian --exclude=\.pc \
--exclude=$(PACKAGE_NAME)-$(VERSION) -cf - . \
| ( cd $(PACKAGE_NAME)-$(VERSION) && tar xf - )
tar -cf ../$(PACKAGE_NAME)_$(VERSION).orig.tar $(PACKAGE_NAME)-$(VERSION)
$(RM) -r $(PACKAGE_NAME)-$(VERSION)
xz ../$(PACKAGE_NAME)_$(VERSION).orig.tar
version=3
opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/tg-$1\.tar\.gz/ \
https://github.com/vysheng/tg/tags .*/v?(\d\S*)\.tar\.gz
EBUILD telegram-cli-9999.ebuild 641 SHA256 4597e2f84c36b1ee02ecc415c399408bb8536b456e94370e996d57477db621be SHA512 287da263c9a4ba2058bf2f5844599432619053abc9249fd5725ed7b5e920c5c02e2493ad7b07f89177933b2c15394d939e7dc7dbf05d5873c32e55c9ec614d4c WHIRLPOOL 73dee37f91f1d4b747afc35c0a0cb2efb141d37702c71a7a9d188d2e1d727375c0ee3e7a1192e6c4c34f17ba1303f3a0be47b24272b5378ff255bce1a4a281be
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=5
EGIT_REPO_URI="https://github.com/vysheng/tg.git"
inherit git-2
IUSE="lua"
DESCRIPTION="Command line interface client for Telegram"
HOMEPAGE="https://github.com/vysheng/tg"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
DEPEND="sys-libs/zlib
sys-libs/readline
dev-libs/libconfig
dev-libs/openssl
lua? ( dev-lang/lua )"
src_configure() {
econf $(use_enable lua liblua ) --with-progname=telegram-cli
}
src_install() {
newbin telegram telegram-cli
insinto /etc/telegram-cli/
newins tg.pub server.pub
}
......@@ -43,7 +43,7 @@
#include <execinfo.h>
#endif
#include <signal.h>
#ifdef ENABLE_LIBCONFIG
#ifdef HAVE_LIBCONFIG
#include <libconfig.h>
#endif
......@@ -247,7 +247,7 @@ void running_for_first_time (void) {
}
}
#ifdef ENABLE_LIBCONFIG
#ifdef HAVE_LIBCONFIG
void parse_config_val (config_t *conf, char **s, char *param_name, const char *default_name, const char *path) {
static char buf[1000];
int l = 0;
......@@ -433,7 +433,9 @@ void print_backtrace (void) {
}
#else
void print_backtrace (void) {
write (1, "No libexec. Backtrace disabled\n", 32);
if (write (1, "No libexec. Backtrace disabled\n", 32) < 0) {
// Sad thing
}
}
#endif
......
Name: telegram-cli
Version: Beta
Release: 2%{?dist}
Summary: Private fast and open platform for instant messaging
Packager: Pablo Iranzo Gómez (Pablo.Iranzo@gmail.com)
Group: Internet/Messaging
License: GPL
URL: https://github.com/vysheng/tg
Source: master.zip
BuildRequires: lua-devel, openssl-devel, libconfig-devel, readline-devel, wget
#Requires: wget
%description
Telegram is an Open Source messaging platform for mobile, desktop focused on privacy.
%prep
[ -d %{name} ] && rm -Rfv %{name}
mkdir %{name}
cd %{name}
wget -O master.zip https://github.com/vysheng/tg/archive/master.zip
unzip master.zip
cd tg-master
./configure
make %{?_smp_mflags}
%install
cd %{name}
cd tg-master
%{__install} -D -m0755 telegram %{buildroot}/usr/bin/telegram
%{__install} -D -m0644 tg.pub %{buildroot}/etc/telegram/server.pub
%files
/usr/bin/telegram
/etc/telegram/server.pub
%changelog
* Tue Feb 4 2014 Pablo Iranzo Gómez (Pablo.Iranzo@gmail.com)
- Add server key to /etc/telegram/
* Sat Feb 1 2014 Pablo Iranzo Gómez (Pablo.Iranzo@gmail.com)
- Initial SPEC file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment