aboutsummaryrefslogblamecommitdiff
path: root/install-win32/prebuild
blob: b4cb00b82db0e669fd17426fb62993dcf4033eac (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13












                                              
         


                                              
                        

                             
                     

                         
               







                                                             
                     

                          






















                                                                 
                         


                   
                                             
































                                                                         
                                                                         
 
                                      









                                                      

                                          
                          

                                                         






                                                   


































                                                                 
# Given a standard OpenVPN tarball tree,
# build a Windows tree which is NSIS-ready.
#
# Requires:
#  MinGW
#  MSYS GNU shell environment
#  See other requirements below

# Top level directory.
H=/c/src

# Output NSIS-ready tree here (will be deleted
# if already exists).
OUT=$H/21

# Source distribution is here.  Can be the top
# level directory of exploded tarball.
IN=/y/openvpn/21/openvpn

# Already built OpenSSL tree.
SSL=$H/openssl-0.9.7l

# Already built LZO tree.
LZO=$H/lzo-2.02

# Already built dmalloc tree.
# Optional, but leave defined even if you are not using
# dmalloc.
DMALLOC=$H/dmalloc-5.4.2

# TAP binaries should be here: tap0801.sys and tapinstall.exe
# These must be built with MS DDK.
TAPBIN=$H/tapbin-0804
TAPBIN64=$H/tapbin64-0801
#TAPBIN64=$H/tapbin64-0804

# u2d.c should exist here.
SCRIPTS=$IN/install-win32

# Put service.[ch] here from MS Platform SDK.
SVC_TEMPLATE=$H/svc-template

# Misc files/directories which should be copied to OUT (optional)
MISC=$H/add

# Temporary directory
TMP=/tmp

# End of user-defined parameters.

U2D=$TMP/u2d

echo BUILD u2d
gcc -O2 $SCRIPTS/u2d.c -o $U2D

echo BUILD output dir from source
rm -rf $OUT
mkdir $OUT
mkdir $OUT/pkcs11-headers

cp $IN/*.[ch] $OUT
rm -f $OUT/config.h
cp $IN/pkcs11-headers/*.h $OUT/pkcs11-headers

if [ $MISC ]; then
  cp $MISC/*.* $OUT
fi

echo BUILD makefile

sed "s#^OPENSSL = .*\$#OPENSSL = $SSL#" <$IN/makefile.w32 | \
sed "s#^LZO = .*\$#LZO = $LZO#" | \
sed "s#^DMALLOC = .*\$#DMALLOC = $DMALLOC#" >$OUT/Makefile

echo BUILD bin

mkdir $OUT/bin
for f in libeay32.dll libssl32.dll openssl.exe ; do
  cp $SSL/$f $OUT/bin
  strip $OUT/bin/$f
done

echo BUILD install-win32

mkdir $OUT/install-win32

cp $IN/install-win32/openvpn.nsi $OUT/install-win32
cp $IN/install-win32/setpath.nsi $OUT/install-win32
cp $IN/images/install-whirl.bmp $OUT/install-win32
cp $IN/images/openvpn.ico $OUT/install-win32
cp $IN/INSTALL-win32.txt $OUT/install-win32
cat $IN/COPYING $IN/COPYRIGHT.GPL | $U2D >$OUT/install-win32/license.txt

$U2D <$IN/sample-config-files/client.conf >$OUT/install-win32/client.ovpn
$U2D <$IN/sample-config-files/server.conf >$OUT/install-win32/server.ovpn
cp $IN/install-win32/sample.ovpn $OUT/install-win32
$U2D <$IN/easy-rsa/1.0/openssl.cnf >$OUT/install-win32/openssl.cnf.sample

echo BUILD tap-win32 for x86 and amd64

mkdir $OUT/tap-win32
cp $IN/tap-win32/*.[ch] $OUT/tap-win32
cp $IN/tap-win32/*.rc $OUT/tap-win32
cp $IN/tap-win32/MAKEFILE $OUT/tap-win32
cp $IN/tap-win32/SOURCES $OUT/tap-win32

mkdir $OUT/tap-win32/i386
cp $IN/tap-win32/i386/OemWin2k.inf $OUT/tap-win32/i386
cp $IN/tap-win32/i386/tap.cat $OUT/tap-win32/i386
cp $TAPBIN/tap0801.sys $OUT/tap-win32/i386

mkdir $OUT/tap-win32/amd64
cp $TAPBIN64/OemWin2k.inf $OUT/tap-win32/amd64
#cp $IN/tap-win32/amd64/OemWin2k.inf $OUT/tap-win32/amd64
cp $IN/tap-win32/amd64/tap.cat $OUT/tap-win32/amd64
cp $TAPBIN64/tap0801.sys $OUT/tap-win32/amd64

mkdir $OUT/bin/ti3790-i386
cp $TAPBIN/tapinstall.exe $OUT/bin/ti3790-i386
mkdir $OUT/bin/ti3790-amd64
cp $TAPBIN64/tapinstall.exe $OUT/bin/ti3790-amd64

echo BUILD service-win32

mkdir $OUT/service-win32
cp $IN/service-win32/Makefile $OUT/service-win32
cp $IN/service-win32/mkpatch $OUT/service-win32
cp $IN/service-win32/openvpnserv.c $OUT/service-win32
cp $IN/service-win32/service.patch $OUT/service-win32

cp $SVC_TEMPLATE/service.[ch] $OUT/service-win32
cp $OUT/service-win32/service.h $OUT/service-win32/service.h.orig
cp $OUT/service-win32/service.c $OUT/service-win32/service.c.orig

pushd $OUT/service-win32
patch <service.patch
popd

echo BUILD easy-rsa
cp -a $IN/easy-rsa $OUT

echo BUILD sample-keys
cp -a $IN/sample-keys $OUT

echo COMPILE OpenVPN
pushd $OUT
make
strip openvpn.exe
popd

echo COMPILE OpenVPN Service
pushd $OUT/service-win32
make clean
make
strip openvpnserv.exe
popd