Build By Source

 

目錄

 


Openssl

 

# Success on C4

wget https://github.com/openssl/openssl/archive/OpenSSL_1_0_1-stable.zip

# Success onC6

wget https://github.com/openssl/openssl/archive/OpenSSL_1_0_2-stable.zip

unzip OpenSSL_1_0_2-stable.zip

cd openssl-OpenSSL_1_0_2-stable

Config

./config --prefix=/opt/openssl --openssldir=/opt/openssl no-ssl2 no-ssl3 no-shared no-hw no-engine no-dso

* if you specify a non-existent option, then the configure scripts will proceed without warning.

--prefix & --openssldir

no-hw, no-engine

Disables hardware support

no-dso

Disables the OpenSSL DSO API (the library offers a shared object abstraction layer).

no-srp

Disables Secure Remote Password (SRP).

SRP provides mutual authentication independent of trusted authorities, but its rarely offered or used

zlib, zlib-dynamic

zlib: Build with support for zlib compression/decompression. (CLI: openssl zlib)

zlib-dynamic: Like "zlib", but has OpenSSL load the zlib library dynamically when needed. 

Remark: zlib

data compression on TLS communication may lead to attacks like CRIME,

thus, building openssl with zlib is better to be done when you need it for an specific data compression task

This is only supported on systems where loading of shared libraries is supported.

# For OpenSSL 1.0.2 and below, its required to update the standard distribution once configuration options change.

# OpenSSL 1.1.0 and above performs the dependency step for you, so you should not see the message.

make depend

make -j2

make install_sw   # Only install the OpenSSL software components.

                         # ls -l /opt/openssl/lib <= 沒有 so 檔

 


zlib-devel

 

wget https://www.zlib.net/zlib-1.2.11.tar.gz

tar -zxf zlib-1.2.11.tar.gz; cd zlib-1.2.11

./configure --prefix=/opt/zlib --static

make; make install

ls -r /opt/zlib

-rw-r--r-- 1 root root 151466 Mar  9 04:42 libz.a

 


curl

 

wget https://curl.haxx.se/download/curl-7.71.1.tar.gz

tar -zxf curl-7.71.1.tar.gz; cd curl-7.71.1

Config

./configure --enable-static --disable-shared \
 --prefix=/opt/curl \
 --with-ssl=/opt/openssl \
 --with-zlib=/opt/zlib \
 --with-ca-fallback \
 --enable-optimize \
 --enable-symbol-hiding \
 --disable-ipv6 \
 --disable-proxy \
 --disable-pop3 \
 --disable-imap \
 --disable-smb \
 --disable-smtp \
 --disable-dict \
 --disable-tftp \
 --disable-rtsp \
 --disable-telnet \
 --disable-gopher \
 --disable-ntlm-wb \
 --disable-tls-srp \
 --disable-manual

Feature

  • DICT
  • FILE
  • FTP FTPS
  • GOPHER
  • HTTP HTTPS
  • IMAP IMAPS
  • POP3 POP3S
  • RTSP
  • SMB SMBS
  • SMTP SMTPS
  • TELNET
  • TFTP

Opts

--with-ca-fallback      Use the built in CA store of the SSL library

make & make install

Checking

/opt/curl/bin/curl -V

ldd /home/opt/curl/bin/curl

        linux-gate.so.1 =>  (0x00d0c000)
        librt.so.1 => /lib/librt.so.1 (0x00f01000) # The functions are for Real Time
        libpthread.so.0 => /lib/libpthread.so.0 (0x00634000)
        libc.so.6 => /lib/libc.so.6 (0x0019f000)
        /lib/ld-linux.so.2 (0x00e0e000)

Feature: FILE

Read or write local files. curl does not support accessing file:// URL remotely,

but when running on Microsft Windows using the native UNC approach will work.

Feature: DICT

Get the definition of curl from a dictionary:

curl dict://dict.org/m:curl

Feature: Gopher

https://en.wikipedia.org/wiki/Gopher_(protocol)

 


librsync

 

Version: 0.9.7

tar -zxf librsync-0.9.7.tar.gz

cd librsync-0.9.7

./configure \
--prefix=/opt/librsync \
--enable-static

make -j 4

make install

ls -l /opt/librsync/lib

total 432
-rw-r--r-- 1 root root 436460 Mar  9 03:32 librsync.a
-rwxr-xr-x 1 root root    758 Mar  9 03:32 librsync.la

Version: 2.2.1

 * Centos 7 自帶的 2.0.2 沒有 "BUILD_SHARED_LIBS=OFF"

mkdir /usr/src/librsync

cd /usr/src/librsync

wget https://github.com/librsync/librsync/archive/v2.2.1.zip -O librsync-v2.2.1.zip

unzip librsync-v2.2.1.zip

cd librsync-2.2.1

# yum install cmake

cmake \
-DCMAKE_INSTALL_PREFIX=/opt/librsync\
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_RDIFF=OFF .

make -j 4

ls -l /opt/librsync/lib

librsync.a