Download :
 - openssl3.0.7.tar.gz from https://www.openssl.org/source/openssl-3.0.7.tar.gz or ftp://ftp.openssl.org/source/openssl-3.0.7.tar.gz
 - libssh2 1.10.0 from https://www.libssh2.org/download/libssh2-1.10.0.tar.gz
 - curl 7.86.0 from https://curl.se/download/curl-7.86.0.tar.gz
 - zlib 1.2.13 from https://zlib.net/zlib-1.2.13.tar.gz
Store all the files in /tmp/curl

Compilation machines: 
 - for linux 64, works on seliiuts02930.seli.gic.ericsson.se , ottlsvr18 (libc 2.11.3) or seliiuts02929.seli.gic.ericsson.se or sekilx484.wrbs.rnd.ki.sw.ericsson.se or sekilx1260.wrbs.rnd.ki.sw.ericsson.se

module add gcc/10.2.0
module add make/4.3
module add perl/5.10.1

#script: run with bash -v

set -e
cd /tmp/curl
cp /home/eanzmagn/openssl-3.0.7.tar.gz  /home/eanzmagn/zlib-1.2.13.tar.gz /home/eanzmagn/libssh2-1.10.0.tar.gz /home/eanzmagn/curl-7.86.0.tar.gz .
rm -rf openssl-3.0.7 zlib-1.2.13 libssh2-1.10.0 curl-7.86.0
tar xf openssl-3.0.7.tar.gz
tar xf zlib-1.2.13.tar.gz
tar xf libssh2-1.10.0.tar.gz
tar xf curl-7.86.0.tar.gz
cd /tmp/curl/zlib-1.2.13
env CFLAGS="-g -O2 -fPIC" LDSHARED="gcc " ./configure && make
cd /tmp/curl/openssl-3.0.7
cp /home/eanzmagn/moshell/commonjars/src/openssh/patches/0001-Moshell-SSL-mods-3.0.5.patch /tmp/curl/openssl-3.0.7
cp /home/eanzmagn/moshell/commonjars/src/openssh/patches/0001-Restore-SHA1-security-strength.patch /tmp/curl/openssl-3.0.7
cp /home/eanzmagn/moshell/commonjars/src/openssh/patches/0001-Allow-client-unsafe-renegotiation.patch /tmp/curl/openssl-3.0.7
patch -p1 -i 0001-Moshell-SSL-mods-3.0.5.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.10.0
env CFLAGS=" -I/tmp/curl/openssl-3.0.7/include" LIBS="-ldl" LDFLAGS="-L/tmp/curl/openssl-3.0.7 -L/tmp/curl/zlib-1.2.13" ./configure --with-openssl --enable-shared=no --with-libssl-prefix=/tmp/curl/openssl-3.0.7 --with-libgcrypt-prefix=/tmp/curl/openssl-3.0.7 && make
#rm -f /tmp/curl/openssl-3.0.7/libcrypto.so* /tmp/curl/openssl-3.0.7/libssl.so*  #does not seem to be needed anymore
cd /tmp/curl/curl-7.86.0
env CFLAGS="" LIBS="-ldl" LDFLAGS="-L/tmp/curl/openssl-3.0.7 -L/tmp/curl/libssh2-1.10.0/src/.libs -L/tmp/curl/zlib-1.2.13/ -static" ./configure --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.0.7 --with-libssh2=/tmp/curl/libssh2-1.10.0 && make
strip ./src/curl  
