Build
This chapter consists of three parts:
- how to set up CHMPX for local development
- how to build CHMPX from the source code
- how to install CHMPX
1. Install prerequisites
CHMPX primarily depends on FULLOCK, K2HASH. Each dependent library and the header files are required to build CHMPX. We provide two ways to install them. You can select your favorite one.
- Use GitHub
Install the source code of dependent libraries and the header files. You will build them and install them. - Use packagecloud.io
Install packages of dependent libraries and the header files. You just install them. Libraries are already built.
1.1. Install each dependent library and the header files from GitHub
Read the following documents for details:
- FULLOCK
- K2HASH
An application, which implements the SSL/TLS protocols, will use one SSL/TLS library. You will select the same SSL/TLS library when you build K2HASH. See K2HASH Build what SSL/TLS libraries K2HASH supports.
Note: You need consider CHMPX, I describe how to build it below, also requires one SSL/TLS library. This means the K2HASH build option affects the CHMPX build option. Table1 shows possible configure options.
Table1. possible configure option:
SSL/TLS library | K2HASH configure options | CHMPX configure options |
---|---|---|
OpenSSL | ./configure –prefix=/usr –with-openssl | ./configure –prefix=/usr –with-openssl |
GnuTLS (gcrypt) | ./configure --prefix=/usr --with-gcrypt | ./configure --prefix=/usr --with-gnutls |
GnuTLS (nettle) | ./configure --prefix=/usr --with-nettle | ./configure --prefix=/usr --with-gnutls |
Mozilla NSS | ./configure --prefix=/usr --with-nss | ./configure --prefix=/usr --with-nss |
1.2. Install each dependent library and the header files from packagecloud.io
This section instructs how to install each dependent library and the header files from packagecloud.io - AntPickax stable repository.
Note: Skip reading this section if you have installed each dependent library and the header files from GitHub in the previous section.
Note: As I described in the previous section, K2HASH Build build option affects the CHMPX build option. See the Table1 in the previous section.
For recent Debian-based Linux distributions users, follow the steps below:
$ sudo apt-get update -y
$ sudo apt-get install curl -y
$ curl -s https://packagecloud.io/install/repositories/antpickax/stable/script.deb.sh \
| sudo bash
$ sudo apt-get install autoconf autotools-dev gcc g++ make gdb libtool pkg-config \
libyaml-dev libfullock-dev k2hash-dev gnutls-dev -y
$ sudo apt-get install git -y
For users who use supported Fedora other than latest version, follow the steps below:
$ sudo dnf makecache
$ sudo dnf install curl -y
$ curl -s https://packagecloud.io/install/repositories/antpickax/stable/script.rpm.sh \
| sudo bash
$ sudo dnf install autoconf automake gcc gcc-c++ gdb make libtool pkgconfig \
libyaml-devel libfullock-devel k2hash-devel nss-devel -y
$ sudo dnf install git -y
For other recent RPM-based Linux distributions users, follow the steps below:
$ sudo yum makecache
$ sudo yum install curl -y
$ curl -s https://packagecloud.io/install/repositories/antpickax/stable/script.rpm.sh \
| sudo bash
$ sudo yum install autoconf automake gcc gcc-c++ gdb make libtool pkgconfig \
libyaml-devel libfullock-devel k2hash-devel nss-devel -y
$ sudo yum install git -y
2. Clone the source code from GitHub
Download the CHMPX’s source code from GitHub.
$ git clone https://github.com/yahoojapan/chmpx.git
3. Build and install
Just follow the steps below to build CHMPX and install it. We use GNU Automake to build CHMPX.
For recent Debian-based Linux distributions users, follow the steps below:
$ cd chmpx
$ sh autogen.sh
$ ./configure --prefix=/usr --with-gnutls
$ make
$ sudo make install
For recent RPM-based Linux distributions users, follow the steps below:
$ cd chmpx
$ sh autogen.sh
$ ./configure --prefix=/usr --with-nss
$ make
$ sudo make install
After successfully installing CHMPX, you will see the CHMPX help text:
$ chmpx -h
[Usage]
chmpx [-conf <file> | -json <json>] [-ctlport <port>] [-d [silent|err|wan|msg|dump]] [-dfile <debug file path>]
chmpx [ -h | -v ]
[option]
-conf <path> specify the configuration file(.ini .yaml .json) path
-json <json string> specify the configuration json string
-ctlport <port> specify the self control port(*)
-d <param> specify the debugging output mode:
silent - no output
err - output error level
wan - output warning level
msg - output debug(message) level
dump - output communication debug level
-dfile <path> specify the file path which is put debug output
-h(help) display this usage.
-v(version) display version.
[environments]
CHMDBGMODE debugging mode like "-d" option.
CHMDBGFILE the file path for debugging output like "-dfile" option.
CHMCONFFILE configuration file path like "-conf" option
CHMJSONCONF configuration json string like "-json" option
(*) if ctlport option is specified, chmpx searches same ctlport in configuration
file and ignores "CTLPORT" directive in "GLOBAL" section. and chmpx will
start in the mode indicated by the server entry that has been detected.