diff --git a/README-Cygwin.md b/README-Cygwin.md old mode 100755 new mode 100644 index 42ed0118..fcf09174 --- a/README-Cygwin.md +++ b/README-Cygwin.md @@ -5,53 +5,52 @@ Install [Cygwin](https://www.cygwin.com/) and cygwin's package manager, [apt-cyg In Cygwin Terminal, install compiler and tools : - apt-cyg install cygwin32-gcc-core cygwin32-gcc-g++ gcc-core gcc-g++ make wget patch diffutils grep tar gzip + apt-cyg install cygwin32-gcc-core cygwin32-gcc-g++ gcc-core gcc-g++ make patch diffutils grep tar gzip Now you have a compiler, but no libraries. You need readline, openssl, libconfig, liblua, python and libjansson to use telegram-cli's full functionality. -Then Clone GitHub Repository in Cygwin Terminal +Clone tg Repository in Cygwin Terminal : git clone --recursive https://github.com/vysheng/tg.git -In Cygwin Terminal, type: +In Cygwin Terminal, type : apt-cyg install libevent-devel openssl-devel libreadline-devel lua-devel python3 -(Install package 'python' to use Python 2.7, or install package 'python3' to use Python 3) + # (Choose 'python' instead of 'python3' to use Python 2.7 instead of Python 3) libconfig and libjansson is not in cygwin's package, so you should compile yourself. -Compile libconfig +Compile libconfig : wget http://www.hyperrealm.com/libconfig/libconfig-1.5.tar.gz tar xvf libconfig-1.5.tar.gz && cd libconfig-1.5 ./configure make && make install && cd .. -Compile libjansson +Compile libjansson : wget http://www.digip.org/jansson/releases/jansson-2.7.tar.gz tar xvf jansson-2.7.tar.gz && cd jansson-2.7 ./configure make && make install && cd .. -Then, go to tg directory then generate Makefile. +Patch Makefile.in and compile : cd tg + patch -p1 < build-cygwin.patch ./configure - -We need to patch Makefile and loop.c to compile in cygwin. Download this [patch](https://gist.github.com/ied206/d774a445f36004d263ab) then untar. Then, patch in tg directory. - - patch -p1 < telegram-cli-cygwin.patch - -Then make +If the patch doesn't work, modify Makefile.in manually : + remove -fPIC from COMPILE_FLAGS + remove -rdynamic from LOCAL_LDFLAGS + After compile is done, **telegram-cli.exe** will be generated in **bin** directory. To run telegram-cli, type bin/telegram-cli -k tg-server.pub -**Caution**: A binary compiled with Cygwin should be run in Cygwin Terminal. +**Caution**: A binary compiled with Cygwin is recommended to run in Cygwin Terminal. diff --git a/README.md b/README.md index 1ecbfa08..b45c3464 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,11 @@ Then build: env CC=clang CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib LUA=/usr/local/bin/lua52 LUA_INCLUDE=-I/usr/local/include/lua52 LUA_LIB=-llua-5.2 ./configure make +#### Windows + +In Windows, you should compile with Cygwin, which has POSIX API functionality. +Follow instructions at [READMD-Cygwin.md](https://github.com/vysheng/tg/blob/master/README-Cygwin.md). + #### Other UNIX If you manage to launch it on other UNIX, please let me know. diff --git a/telegram-cli-cygwin.patch b/build-cygwin.patch similarity index 56% rename from telegram-cli-cygwin.patch rename to build-cygwin.patch index a8ca3ae0..21ee96a4 100644 --- a/telegram-cli-cygwin.patch +++ b/build-cygwin.patch @@ -1,14 +1,13 @@ -Binary files tg/.git/index and tg-cygwin/.git/index differ -diff -urN tg/Makefile tg-cygwin/Makefile ---- tg/Makefile 2015-06-16 12:39:34.931053900 +0900 -+++ tg-cygwin/Makefile 2015-06-16 12:44:12.584342300 +0900 +diff -urN tg/Makefile.in tg-cygwin/Makefile.in +--- tg/Makefile.in 2015-06-19 23:25:30.972865200 +0900 ++++ tg-cygwin/Makefile.in 2015-06-19 23:26:07.870665200 +0900 @@ -4,9 +4,9 @@ - LDFLAGS= -L/usr/local/lib -L/usr/lib -L/usr/lib -L/usr/lib - CPPFLAGS= -I/usr/local/include -I/usr/include -I/usr/include -I/usr/include/python3.4m -I/usr/include - DEFS=-DHAVE_CONFIG_H + LDFLAGS=@LDFLAGS@ @OPENSSL_LDFLAGS@ + 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 +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 - EXTRA_LIBS=-ljansson -lconfig -lz -levent -lm -lreadline -llua-5.2 -lpython3.4m -lssl -lcrypto + EXTRA_LIBS=@LIBS@ @EXTRA_LIBS@ @OPENSSL_LIBS@ -LOCAL_LDFLAGS=-rdynamic -ggdb -levent ${EXTRA_LIBS} -ldl -lpthread -lutil +LOCAL_LDFLAGS=-ggdb -levent ${EXTRA_LIBS} -ldl -lpthread -lutil LINK_FLAGS=${LDFLAGS} ${LOCAL_LDFLAGS}