Skip to content

Commit

Permalink
fixes #142 - update build documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
d99kris committed Nov 5, 2023
1 parent 548187f commit 4b71a18
Show file tree
Hide file tree
Showing 8 changed files with 159 additions and 152 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
- name: Checkout
uses: actions/checkout@v1
- name: Build Linux
run: ./make.sh all
run: ./make.sh all -y
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
- name: Checkout
uses: actions/checkout@v1
- name: Build macOS
run: ./make.sh all
run: ./make.sh all -y
17 changes: 17 additions & 0 deletions FLAGS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Feature Flags
=============

Enabling / Disabling Protocol Support
-------------------------------------
The protocols supported by nchat is controlled by the following cmake flags:

HAS_DUMMY=ON
HAS_TELEGRAM=ON
HAS_WHATSAPP=ON

It is possible to enable / disable protocols by passing one or multiple flags
to cmake:

mkdir -p build && cd build
cmake -DHAS_WHATSAPP=OFF .. && make -s

82 changes: 82 additions & 0 deletions LOWMEMORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
Building on Low Memory / RAM Systems
====================================
The Telegram client library subcomponent requires relatively large amount of
RAM to build by default (3.5GB using g++, and 1.5 GB for clang++). It is
possible to adjust the Telegram client library source code so that it requires
less RAM (but takes longer time). Doing so reduces the memory requirement to
around 1GB under g++ and 0.5GB for clang++.

Steps to build nchat on a low memory system:

**Extra Dependencies (Linux)**

sudo apt install php-cli clang

**Source**

git clone https://github.com/d99kris/nchat && cd nchat

**Setup**

mkdir -p build && cd build
CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake ..

**Split source (optional)**

cmake --build . --target prepare_cross_compiling
cd ../lib/tgchat/ext/td ; php SplitSource.php ; cd -

**Build**

make -s

**Install**

sudo make install

**Revert Source Code Split (Optional)**

cd ../lib/tgchat/ext/td ; php SplitSource.php --undo ; cd -

Arch Linux
----------
**Source**

git clone https://aur.archlinux.org/nchat-git.git && cd nchat-git

**Prepare**

Open PKGBUILD in your favourite editor.
Add `php` and `clang` on depends array.
Change the `_install_mode` to `slow`.

**Build**

makepkg -s

**Install**

makepkg -i

Fedora
------
**Extra Dependencies**

sudo dnf install php-cli

**Source**

git clone https://github.com/d99kris/nchat && cd nchat

**Build**

mkdir -p build && cd build
CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake ..
cmake --build . --target prepare_cross_compiling
cd ../lib/tgchat/ext/td ; php SplitSource.php ; cd -
make -s

**Install**

sudo make install

190 changes: 47 additions & 143 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,193 +117,97 @@ Supported Platforms
nchat is developed and tested on Linux and macOS. Current version has been
tested on:

- macOS Big Sur 11.5
- Ubuntu 20.04 LTS
- macOS Sonoma 14.0
- Ubuntu 22.04 LTS


Build / Install
===============
Nchat consists of a large code-base (mainly the Telegram client library), so be
prepared for a relatively long first build time.

Ubuntu
------
**Dependencies**

sudo apt install ccache cmake build-essential gperf help2man libreadline-dev libssl-dev libncurses-dev libncursesw5-dev ncurses-doc zlib1g-dev libsqlite3-dev libmagic-dev golang

**Source**

git clone https://github.com/d99kris/nchat && cd nchat

**Build**

mkdir -p build && cd build && cmake .. && make -s

**Install**

sudo make install
Install using Package Manager
=============================

macOS
-----
**Build / Install Stable Release**

There are two methods to install nchat on macOS: through Homebrew or building from source.

### Using Homebrew

**Add tap**

brew tap d99kris/nchat

**Install**

brew install nchat

### Building from Source

**Dependencies**

brew install gperf cmake openssl ncurses ccache readline help2man sqlite libmagic go

**Source**

git clone https://github.com/d99kris/nchat && cd nchat

**Build**

mkdir -p build && cd build && cmake .. && make -s

**Install**

make install
brew install d99kris/d99kris/nchat

Arch Linux
----------
**Source**
**Build / Install Latest Git**

git clone https://aur.archlinux.org/nchat-git.git && cd nchat-git
makepkg -s && makepkg -i

**Build**
**Build / Install Stable Release**

makepkg -s

**Install**

makepkg -i

Fedora
------
**Dependencies**
git clone https://aur.archlinux.org/nchat.git && cd nchat
makepkg -s && makepkg -i

sudo dnf install git cmake clang golang ccache file-devel file-libs gperf readline-devel openssl-devel ncurses-devel sqlite-devel zlib-devel
Build from Source
=================
nchat consists of a large code-base (mainly the Telegram library tdlib), so be
prepared for a relatively long first build time.

**Source**
**Get Source**

git clone https://github.com/d99kris/nchat && cd nchat

**Build**
Using make.sh script
--------------------
If using macOS, Arch, Fedora, Gentoo, Raspbian, Ubuntu or Void, one can use
the `make.sh` script provided.

mkdir -p build && cd build && cmake .. && make -s
**Dependencies**

**Install**
./make.sh deps

sudo make install
**Build / Install**

Enabling / Disabling Protocol Support
-------------------------------------
The protocols supported by nchat is controlled by the following cmake flags:
./make.sh build && ./make.sh install

HAS_DUMMY=ON
HAS_TELEGRAM=ON
HAS_WHATSAPP=ON
Manually
--------
**Dependencies**

It is possible to enable / disable protocols by passing one or multiple flags
to cmake:
macOS

mkdir -p build && cd build
cmake -DHAS_WHATSAPP=OFF .. && make -s
brew install gperf cmake openssl ncurses ccache readline help2man sqlite libmagic go

Low Memory / RAM Systems
------------------------
The Telegram client library subcomponent requires relatively large amount of
RAM to build by default (3.5GB using g++, and 1.5 GB for clang++). It is
possible to adjust the Telegram client library source code so that it requires
less RAM (but takes longer time). Doing so reduces the memory requirement to
around 1GB under g++ and 0.5GB for clang++.
Arch

Steps to build nchat on a low memory system:
sudo pacman -S ccache cmake file go gperf help2man ncurses openssl readline sqlite zlib base-devel

**Extra Dependencies (Linux)**
Debian-based (Ubuntu, Raspbian, etc)

sudo apt install php-cli clang
sudo apt install ccache cmake build-essential gperf help2man libreadline-dev libssl-dev libncurses-dev libncursesw5-dev ncurses-doc zlib1g-dev libsqlite3-dev libmagic-dev golang

**Source**
Fedora

git clone https://github.com/d99kris/nchat && cd nchat
sudo dnf install git cmake clang golang ccache file-devel file-libs gperf readline-devel openssl-devel ncurses-devel sqlite-devel zlib-devel

**Setup**
Gentoo

mkdir -p build && cd build
CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake ..
sudo emerge -n dev-util/cmake dev-util/gperf sys-apps/help2man sys-libs/readline dev-libs/openssl sys-libs/ncurses sys-libs/zlib dev-db/sqlite sys-apps/file dev-lang/go

**Split source (optional)**
Void

cmake --build . --target prepare_cross_compiling
cd ../lib/tgchat/ext/td ; php SplitSource.php ; cd -
sudo xbps-install base-devel go ccache cmake gperf help2man libmagick-devel readline-devel sqlite-devel file-devel openssl-devel

**Build**

make -s
mkdir -p build && cd build && cmake .. && make -s

**Install**

sudo make install

**Revert Source Code Split (Optional)**

cd ../lib/tgchat/ext/td ; php SplitSource.php --undo ; cd -

Arch Linux
----------
**Source**

git clone https://aur.archlinux.org/nchat-git.git && cd nchat-git

**Prepare**

Open PKGBUILD in your favourite editor.
Add `php` and `clang` on depends array.
Change the `_install_mode` to `slow`.

**Build**

makepkg -s

**Install**
Advanced Build Options
----------------------
By default nchat requires ~3.5GB RAM to build using G++ and ~1.5GB RAM with
clang++, but it is possible to reduce the memory needed,
see [Building on Low Memory Systems](LOWMEMORY.md).

makepkg -i
All nchat features are enabled by default, but it's possible to control
inclusion of some features using cmake flags, see [Feature Flags](FLAGS.md).

Fedora
------
**Extra Dependencies**

sudo dnf install php-cli

**Source**

git clone https://github.com/d99kris/nchat && cd nchat

**Build**

mkdir -p build && cd build
CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake ..
cmake --build . --target prepare_cross_compiling
cd ../lib/tgchat/ext/td ; php SplitSource.php ; cd -
make -s

**Install**

sudo make install

Getting Started
===============
Expand Down
2 changes: 1 addition & 1 deletion lib/common/src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

#pragma once

#define NCHAT_VERSION "3.95"
#define NCHAT_VERSION "3.96"
Loading

0 comments on commit 4b71a18

Please sign in to comment.