Download :
 - openssh7.9p1.tar.gz from http://ftp.uio.no/pub/OpenBSD/OpenSSH/portable/openssh-7.9p1.tar.gz 
 - openssl1.1.1c.tar.gz from https://www.openssl.org/source/old/1.1.1/openssl-1.1.1c.tar.gz
Note: Very important to compile in /tmp and not in a home directory or it may cause NFS lookups when executing ssh

Compilation machines: 
 - for solaris/sparc, works on esekits1088.seki.rnd.ericsson.se with module add gcc/3.4.6 && module add zlib/1.2.3  && module add make/3.82 (or gmake), 
 - for linux 32, works on esekilxxen1231.rnd.ericsson.se (32-bit machine with old linux version 2.6.16 and old libc 2.4) with module add gcc/3.4.6 -> use old glibc to avoid problems when running on a old linux machine 
 - for linux 64, works on esekilxxen1250.rnd.ericsson.se (64-bit machine with old linux version 2.6.16 and old libc 2.4) 
 - for solaris/x86, works on eswki51komp.rnd.ki.sw.ericsson.se

cd /tmp
rm -rf openssh-7.9p1 
rm -rf openssl-1.1.1c
gzip -df openssh-7.9p1.tar.gz 
gzip -df openssl-1.1.1c.tar.gz 
tar xf openssl-1.1.1c.tar 
tar xf openssh-7.9p1.tar

setenv CC gcc
export CC=gcc
module add perl/5.10.1

Solaris/sparc: module add gcc/3.4.6 && module add zlib/1.2.3  && module add gmake
cd /tmp/openssl-1.1.1c
cp ~/moshell/commonjars/src/openssh/patches/0001-Moshell-SSL-mods-1.1.1c.patch .
Solaris: gpatch -p1 -i 0001-Moshell-SSL-mods-1.1.1c.patch
Linux/Cygwin: patch -p1 -i 0001-Moshell-SSL-mods-1.1.1c.patch
Solaris:       x86:    ./Configure solaris-x86-gcc no-shared   
               sparc:  ./Configure solaris-sparcv9-gcc no-shared
               Then edit the Makefile and replace the following lines :
               in the line starting with CNF_CFLAGS= , replace -pthread with -pthreads
               in the line starting with CNF_EX_LIBS=, replace -pthread with -pthreads -lrt
               Then run : make
Cygwin:        ./config no-shared no-threads && make depend && make
Linux:         ./config -fPIC no-shared no-threads && make depend && make

cd /tmp/openssh-7.9p1
cp ~/moshell/commonjars/src/openssh/patches/0001-Moshell-SSH-mods-7.9p1*.patch .
Solaris: gpatch -p1 -i 0001-Moshell-SSH-mods-7.9p1.patch
Linux:  patch -p1 -i 0001-Moshell-SSH-mods-7.9p1.patch
Cygwin: patch -p1 -i 0001-Moshell-SSH-mods-7.9p1-CYGWIN.patch
Solaris/sparc: ./configure --with-ssl-dir=../openssl-1.1.1c --without-zlib-version-check && make
Solaris/x86:   ./configure --with-ssl-dir=../openssl-1.1.1c && make 
Linux/Cygwin:  ./configure --with-ssl-dir=../openssl-1.1.1c && make

Keep the following files and store them in the following locations, with the correct extension (.solaris, .sol86, .linux, .lin64, .exe)
os= lin64 linux solaris sol86 exe
strip /tmp/openssh-7.9p1/ssh            && cp /tmp/openssh-7.9p1/ssh           ~/moshell/commonjars/ssh.$os
strip /tmp/openssh-7.9p1/sftp           && cp /tmp/openssh-7.9p1/sftp          ~/moshell/commonjars/sftp.$os
strip /tmp/openssh-7.9p1/sshd           && cp /tmp/openssh-7.9p1/sshd          ~/moshell/commonjars/sshd.$os
strip /tmp/openssh-7.9p1/sftp-server    && cp /tmp/openssh-7.9p1/sftp-server   ~/moshell/commonjars/sftp-server.$os
strip /tmp/openssh-7.9p1/scp            && cp /tmp/openssh-7.9p1/scp           ~/moshell/commonjars/scp.$os
strip /tmp/openssl-1.1.1c/apps/openssl  && cp /tmp/openssl-1.1.1c/apps/openssl ~/moshell/commonjars/openssl.$os

update mos2emInfo["ssh_version"] in moshell/prog.awk


#############################
How to make the patch files:
#############################
mkdir dummy
cd dummy
module add git
git init
-------------------
tar -xf openssl-1.0.2k.tar.gz
cd openssl-1.0.2k
cp -R ../dummy/.git .
git add -A :/
git commit -m 'Base'
cp ~/moshell/commonjars/src/openssh/sshmods/ssl/* .
cp ~/moshell/commonjars/src/openssh/sshmods/apps/* apps
git status
git add -A :/
git commit -m 'Moshell SSL mods 1.0.2k'
git format-patch HEAD^
---------------------
tar -xf openssh-7.4p1.tar.gz
cd openssh-7.4p1
cp -R ../dummy/.git .
git add -A :/
git commit -m 'Base'
cp ~/moshell/commonjars/src/openssh/sshmods/ssh/* .
git status
git add -A :/
git commit -m 'Moshell SSH mods 7.4p1'
git format-patch HEAD^

#############################

#Not needed anymore on solaris/x86 (or because already done on iov86?)
#First, patch the gcc compiler by downloading the file www.openssl.org/~appro/values.c and store under /tmp/openssl-1.0.0a
#Then run: ksh -f values.c gcc
