Skip to content

Installation

NobodyNada edited this page Feb 23, 2017 · 14 revisions

This bot is dependent on the OS you're running on, and uses Linux specific libraries. So if you're on any other OS than Linux or Mac, it's unlikely the bot will run.

#Building the Swift version on macOS

To build, you need to have Xcode, openssl, and libwebsockets installed. You can install Xcode from the Mac App Store and openssl with Homebrew, but you'll have to compile libwebsockets yourself since the version installed by Homebrew is ancient.

In a terminal, run:

$ brew install openssl
$ git clone -b v2.1-stable https://github.com/warmcat/libwebsockets.git
$ cd libwebsockets
$ mkdir build
$ cd build
$ cmake .. -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DCMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE=/usr/local/opt/openssl -DLWS_WITH_HTTP2=1
$ make
$ make install

To build FireAlarm on OS X, use build.sh. project.sh generates an Xcode project, and clean.sh cleans the project.

#Building the C version on Linux

To run this program, you need to either have gcc or clang installed. If you have them installed you can skip to the next part. If you do not have them installed, here's what you have to do if you're on Ubuntu/Debian:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-<version>

Just run the above commands, and put the version you want to be installed in place of <version>.

For installing gcc on OpenSuse, do:

sudo zypper install gcc

Now to the next step. This program uses libwebsockets, and libCURL, which is normally not installed in a linux computer. To install them, do:

apt-get install libcurl-dev

This will show you some versions of libCURL you can install. Choose one of them, and continue.

To install libwebsockets, do:

apt-get install libwebsockets-dev

After you've installed all this, you can compile the bot. So simply run the makefile or do:

gcc chatbot/*.c -lcurl -lwebsockets -lpthread -lm -o firealarm

Note that you shouldn't have any more C files in the folder you've kept the chatbot, other than the files in the repo. If there are, you should take all the chatbot's files to another folder, or replace *.c with the names of the files.

If it compiles successfully, run the executable (firealarm) using ./firealarm. You will be prompted to enter the email and password of the account you want to run the bot on.

If you do not want to enter the email and password each and every time you run the executable, set two environment variables as the email and password:

export ChatBotEmail=<enter email here>
export ChatBotPass=<enter password here>

The bot will then not ask you to enter the email and password. Do note that if you close and reopen the terminal, you have set the environment variables again.

#Building the C version on OS X

To build, you need to have Xcode and libwebsockets installed. You can install Xcode from the Mac App Store, and you can install libwebsockets with Homebrew:

brew install libwebsockets

If the above command gives an error complaining that the brew command does not exist, try installing Homebrew from brew.sh.

Then, build using the provided Xcode project, or follow the Linux compile instructions to compile with Clang.

Clone this wiki locally