2
from wb import home_fn, rm_rf, mkdir, cp_a, cp
4
def main(config, tap=True):
8
bin = os.path.join(dist, 'bin')
9
i386 = os.path.join(dist, 'i386')
10
amd64 = os.path.join(dist, 'amd64')
12
# build dist and subdirectories
20
# copy openvpn.exe and manifest
21
cp(home_fn('openvpn.exe'), bin)
22
cp(home_fn('openvpn.exe.manifest'), bin)
24
# copy DLL dependencies
25
cp(home_fn(config['LZO_DIR']+'/bin/lzo2.dll'), bin)
26
cp(home_fn(config['OPENSSL_DIR']+'/bin/libeay32.dll'), bin)
27
cp(home_fn(config['OPENSSL_DIR']+'/bin/ssleay32.dll'), bin)
30
cp_a(home_fn(config['MSVC_CRT']), bin)
34
for dir_name, dest in (('amd64', amd64), ('i386', i386)):
35
dir = home_fn(os.path.join('tap-win32', dir_name))
36
for dirpath, dirnames, filenames in os.walk(dir):
38
root, ext = os.path.splitext(f)
39
if ext in ('.inf', '.cat', '.sys'):
40
cp(os.path.join(dir, f), dest)
44
dest = {'amd64' : amd64, 'i386' : i386}
45
for dirpath, dirnames, filenames in os.walk(home_fn('tapinstall')):
47
if f == 'tapinstall.exe':
48
dir_name = os.path.basename(dirpath)
49
src = os.path.join(dirpath, f)
51
cp(src, dest[dir_name])
53
# if we are run directly, and not loaded as a module
54
if __name__ == "__main__":
2
from wb import home_fn, rm_rf, mkdir, cp_a, cp, rename, run_in_vs_shell
4
def main(config, tap=True):
8
bin = os.path.join(dist, 'bin')
9
i386 = os.path.join(dist, 'i386')
10
amd64 = os.path.join(dist, 'amd64')
11
samples = os.path.join(dist, 'samples')
13
# build dist and subdirectories
21
# copy openvpn.exe, openvpnserv.exe and their manifests
22
cp(home_fn('openvpn.exe'), bin)
23
cp(home_fn('openvpn.exe.manifest'), bin)
24
cp(home_fn('service-win32/openvpnserv.exe'), bin)
25
cp(home_fn('service-win32/openvpnserv.exe.manifest'), bin)
28
cp(home_fn(config['OPENVPN_GUI_DIR']+"/"+config['OPENVPN_GUI']), bin)
30
# copy DLL dependencies
31
cp(home_fn(config['LZO_DIR']+'/bin/lzo2.dll'), bin)
32
cp(home_fn(config['LZO_DIR']+'/bin/lzo2.dll.manifest'), bin)
33
cp(home_fn(config['OPENSSL_DIR']+'/bin/libeay32.dll'), bin)
34
cp(home_fn(config['OPENSSL_DIR']+'/bin/ssleay32.dll'), bin)
35
cp(home_fn(config['PKCS11_HELPER_DIR']+'/lib/libpkcs11-helper-1.dll'), bin)
36
cp(home_fn(config['PKCS11_HELPER_DIR']+'/lib/libpkcs11-helper-1.dll.manifest'), bin)
38
# copy OpenSSL utilities (=openvpn.exe)
39
cp(home_fn(config['OPENSSL_DIR']+'/bin/openssl.exe'), bin)
41
# copy sample config files; renaming is necessary due to openvpn.nsi script
42
cp(home_fn('install-win32/sample.ovpn'), samples)
43
cp(home_fn('sample-config-files/client.conf'), samples)
44
cp(home_fn('sample-config-files/server.conf'), samples)
45
rename(os.path.join(samples,'client.conf'), os.path.join(samples, 'client.ovpn'))
46
rename(os.path.join(samples,'server.conf'), os.path.join(samples, 'server.ovpn'))
48
# embed manifests to executables and DLLs
49
for f in [ "openvpn.exe", "openvpnserv.exe", "lzo2.dll", "libpkcs11-helper-1.dll" ]:
51
outputresource = os.path.join(bin,f)
52
manifest = outputresource+".manifest"
54
# EXEs and DLLs require slightly different treatment
55
if f.endswith(".exe"):
57
elif f.endswith(".dll"):
60
print "ERROR: Could not embed manifest to "+outputresouce+", bailing out."
64
run_in_vs_shell('mt.exe -manifest %s -outputresource:%s;%s' % (manifest, outputresource, type))
67
cp_a(home_fn(config['MSVC_CRT']), bin)
69
# TAP-driver and tapinstall.exe were built, so copy those over
74
# we're using prebuilt TAP-driver and tapinstall.exe
75
elif 'TAP_PREBUILT' in config:
76
drv_dir = config['TAP_PREBUILT']
77
ti_dir = config['TAP_PREBUILT']
80
print "ERROR: Could not find prebuilt TAP-drivers or tapinstall.exe. Please check win/settings.in"
84
for dir_name, dest in (('amd64', amd64), ('i386', i386)):
85
dir = home_fn(os.path.join(drv_dir, dir_name))
86
for dirpath, dirnames, filenames in os.walk(dir):
88
root, ext = os.path.splitext(f)
89
if ext in ('.inf', '.cat', '.sys'):
90
cp(os.path.join(dir, f), dest)
93
# Copy tapinstall.exe (usually known as devcon.exe)
94
dest = {'amd64' : amd64, 'i386' : i386}
95
for dirpath, dirnames, filenames in os.walk(home_fn(ti_dir)):
97
if f in ( 'devcon.exe', 'tapinstall.exe' ):
98
dir_name = os.path.basename(dirpath)
99
src = os.path.join(dirpath, f)
100
dst = os.path.join(dest[dir_name],'tapinstall.exe')
102
cp(src, dst, dest_is_dir=False)
104
# if we are run directly, and not loaded as a module
105
if __name__ == "__main__":
106
from wb import config