Download :
 - openssl-3.1.6.tar.gz from https://www.openssl.org/source/openssl-3.1.6.tar.gz or ftp://ftp.openssl.org/source/openssl-3.1.6.tar.gz
 - libssh2 1.11.0 from https://www.libssh2.org/download/libssh2-1.11.0.tar.gz
 - curl 8.8.0 from https://curl.se/download/curl-8.8.0.tar.gz
 - zlib 1.3.1 from https://zlib.net/zlib-1.3.1.tar.gz
Store all the files in /tmp/curl

Compilation machines: 
 - for linux 64, works (from citrix) on seliiuts02919.seli.gic.ericsson.se or seliiuts03047 or seliiuts02893 to seliiuts02913  , ottlsvr18 (libc 2.11.3.1) or seliiuts02929.seli.gic.ericsson.se or sekilx484.wrbs.rnd.ki.sw.ericsson.se or sekilx1260.wrbs.rnd.ki.sw.ericsson.se

export CC=gcc
module add gcc/10.2.0
module add make/4.3
module add perl/5.10.1

#script: run with bash -v

unzip ~/moshell/commonjars/src/openssh/patches.zip -d ~/moshell/commonjars/src/openssh/

set -e
cd /tmp/curl
cp /home/eanzmagn/openssl-3.1.6.tar.gz  /home/eanzmagn/zlib-1.3.1.tar.gz /home/eanzmagn/libssh2-1.11.0.tar.gz /home/eanzmagn/curl-8.8.0.tar.gz .
rm -rf openssl-3.1.6 zlib-1.3.1 libssh2-1.11.0 curl-8.8.0
tar xf openssl-3.1.6.tar.gz
tar xf zlib-1.3.1.tar.gz
tar xf libssh2-1.11.0.tar.gz
tar xf curl-8.8.0.tar.gz
cd /tmp/curl/zlib-1.3.1
env CFLAGS="-g -O2 -fPIC" LDSHARED="gcc " ./configure && make
cd /tmp/curl/openssl-3.1.6
cp /home/eanzmagn/moshell/commonjars/src/openssh/patches/0001-Moshell-SSL-mods-3.1.1.patch /tmp/curl/openssl-3.1.6
cp /home/eanzmagn/moshell/commonjars/src/openssh/patches/0001-Restore-SHA1-security-strength.patch /tmp/curl/openssl-3.1.6
cp /home/eanzmagn/moshell/commonjars/src/openssh/patches/0001-Allow-client-unsafe-renegotiation.patch /tmp/curl/openssl-3.1.6
patch -p1 -i 0001-Moshell-SSL-mods-3.1.1.patch
patch -p1 -i 0001-Restore-SHA1-security-strength.patch
patch -p1 -i 0001-Allow-client-unsafe-renegotiation.patch
./config -fPIC no-shared no-threads && make
cd /tmp/curl/libssh2-1.11.0
env CFLAGS=" -I/tmp/curl/openssl-3.1.6/include" LIBS="-ldl" LDFLAGS="-L/tmp/curl/openssl-3.1.6 -L/tmp/curl/zlib-1.3.1" ./configure --with-openssl --enable-shared=no --with-libssl-prefix=/tmp/curl/openssl-3.1.6 --with-libgcrypt-prefix=/tmp/curl/openssl-3.1.6 && make
#rm -f /tmp/curl/openssl-3.1.6/libcrypto.so* /tmp/curl/openssl-3.1.6/libssl.so*  #does not seem to be needed anymore
cd /tmp/curl/curl-8.8.0
env CFLAGS="" LIBS="-ldl" LDFLAGS="-L/tmp/curl/openssl-3.1.6 -L/tmp/curl/libssh2-1.11.0/src/.libs -L/tmp/curl/zlib-1.3.1/ -static" ./configure  --without-libpsl --disable-debug --disable-curldebug --disable-ldap --disable-rtsp --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-libcurl-option --enable-ipv6 --disable-sspi --disable-ntlm-wb --with-ssl=/tmp/curl/openssl-3.1.6 --with-libssh2=/tmp/curl/libssh2-1.11.0 && make
strip ./src/curl 

MacOS:
env CFLAGS="" LIBS="-ldl" LDFLAGS="-L/tmp/curl/openssl-3.1.2 -L/tmp/curl/libssh2-1.11.0/src/.libs -L/tmp/curl/zlib-1.2.13/" ./configure --enable-static --disable-debug --disable-curldebug --disable-ldap --disable-rtsp --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-libcurl-option --enable-ipv6 --disable-sspi --disable-ntlm-wb --with-ssl=/tmp/curl/openssl-3.1.2 --with-libssh2=/tmp/curl/libssh2-1.11.0 && make
 
