Download :
 - openssh7.4p1.tar.gz from http://ftp.eu.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-7.4p1.tar.gz 
 - openssl1.0.2k.tar.gz from https://www.openssl.org/source/openssl-1.0.2k.tar.gz or ftp://ftp.openssl.org/source/openssl-1.0.2k.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 selix069.lmera.ericsson.se (solaris 10 with old libc) 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.4p1
rm -rf openssl-1.0.2k
gzip -df openssh-7.4p1.tar.gz && tar xf openssh-7.4p1.tar
gzip -df openssl-1.0.2k.tar.gz && tar xf openssl-1.0.2k.tar

setenv CC gcc
export CC=gcc


Solaris/sparc: module add gcc/3.4.6 && module add zlib/1.2.3  && module add gmake
cd /tmp/openssl-1.0.2k
cp ~/moshell/commonjars/src/openssh/patches/0001-Moshell-SSL-mods-1.0.2k.patch .
Solaris: gpatch -p1 -i 0001-Moshell-SSL-mods-1.0.2k.patch
Linux/Cygwin: patch -p1 -i 0001-Moshell-SSL-mods-1.0.2k.patch
#or: cp ~/moshell/commonjars/src/openssh/sshmods/ssl/ssl.h ssl/ssl.h 
#    cp ~/moshell/commonjars/src/openssh/sshmods/apps/* apps
Solaris/x86:   ./Configure solaris-x86-gcc && make
Solaris/sparc: ./config && make
Cygwin:        ./config && make
Linux:         ./config -fPIC shared && make depend && make

cd /tmp/openssh-7.4p1
cp ~/moshell/commonjars/src/openssh/patches/0001-Moshell-SSH-mods-7.4p1.patch .
Solaris: gpatch -p1 -i 0001-Moshell-SSH-mods-7.4p1.patch
Linux/Cygwin: patch -p1 -i 0001-Moshell-SSH-mods-7.4p1.patch
#or: cp ~/moshell/commonjars/src/openssh/sshmods/ssh/* .
Cygwin:        ./configure --with-ssl-dir=../openssl-1.0.2k && make
Solaris/sparc: ./configure --with-ssl-dir=../openssl-1.0.2k --without-zlib-version-check && make
Solaris/x86:   ./configure --with-ssl-dir=../openssl-1.0.2k  && make 
Linux:         env LD_LIBRARY_PATH=../openssl-1.0.2k ./configure --with-ssl-dir=../openssl-1.0.2k && make

Keep the following files and store them in the following locations, with the correct extension (.solaris, .sol86, .linux, .lin64, .exe)
/tmp/openssh-7.4p1/ssh            -> moshell/commonjars
/tmp/openssh-7.4p1/sftp           -> moshell/commonjars
/tmp/openssh-7.4p1/sshd           -> moshell/commonjars
/tmp/openssh-7.4p1/sftp-server    -> moshell/commonjars
/tmp/openssh-7.4p1/scp            -> moshell/commonjars
/tmp/openssl-1.0.2k/apps/openssl  -> moshell/commonjars
On linux, and lin64:
/tmp/openssl-1.0.2k/libssl.so.1.0.0     -> moshell/commonjars/lib/<os>
/tmp/openssl-1.0.2k/libcrypto.so.1.0.0  -> moshell/commonjars/lib/<os>
No shared libraries on cygwin and solaris (statically compiled)


Also strip them to save space

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


#############################
strip /tmp/openssh-7.4p1/ssh                
strip /tmp/openssh-7.4p1/sftp               
strip /tmp/openssh-7.4p1/sshd               
strip /tmp/openssh-7.4p1/sftp-server        
strip /tmp/openssh-7.4p1/scp                
strip /tmp/openssl-1.0.2k/apps/openssl      
strip /tmp/openssl-1.0.2k/libssl.so.1.0.0   
strip /tmp/openssl-1.0.2k/libcrypto.so.1.0.0

setenv os solaris
cp /tmp/openssh-7.4p1/ssh                     /home/eanzmagn/moshell/commonjars/ssh.$os         
cp /tmp/openssh-7.4p1/sshd                    /home/eanzmagn/moshell/commonjars/sshd.$os        
cp /tmp/openssh-7.4p1/sftp                    /home/eanzmagn/moshell/commonjars/sftp.$os        
cp /tmp/openssh-7.4p1/sftp-server             /home/eanzmagn/moshell/commonjars/sftp-server.$os 
cp /tmp/openssh-7.4p1/scp                     /home/eanzmagn/moshell/commonjars/scp.$os         
cp /tmp/openssl-1.0.2k/apps/openssl           /home/eanzmagn/moshell/commonjars/openssl.$os
cp /tmp/openssl-1.0.2k/libssl.so.1.0.0        /home/eanzmagn/moshell/commonjars/lib/$os/libssl.so.1.0.0   
cp /tmp/openssl-1.0.2k/libcrypto.so.1.0.0     /home/eanzmagn/moshell/commonjars/lib/$os/libcrypto.so.1.0.0


diff /home/eanzmagn/moshell/commonjars/ssh.$os                        /app/moshell/latest/moshell/commonjars/ssh.$os                   
diff /home/eanzmagn/moshell/commonjars/sftp.$os                       /app/moshell/latest/moshell/commonjars/sftp.$os                  
diff /home/eanzmagn/moshell/commonjars/sshd.$os                       /app/moshell/latest/moshell/commonjars/sshd.$os                  
diff /home/eanzmagn/moshell/commonjars/sftp-server.$os                /app/moshell/latest/moshell/commonjars/sftp-server.$os           
diff /home/eanzmagn/moshell/commonjars/scp.$os                        /app/moshell/latest/moshell/commonjars/scp.$os                   
diff /home/eanzmagn/moshell/commonjars/openssl.$os                    /app/moshell/latest/moshell/commonjars/openssl.$os               
diff /home/eanzmagn/moshell/commonjars/lib/$os/libssl.so.1.0.0        /app/moshell/latest/moshell/commonjars/lib/$os/libssl.so.1.0.0   
diff /home/eanzmagn/moshell/commonjars/lib/$os/libcrypto.so.1.0.0     /app/moshell/latest/moshell/commonjars/lib/$os/libcrypto.so.1.0.0



#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
