aboutsummaryrefslogtreecommitdiff
path: root/win/make_dist.py
diff options
context:
space:
mode:
authorSamuli Seppänen <samuli@openvpn.net>2011-03-08 16:07:49 +0200
committerDavid Sommerseth <davids@redhat.com>2011-03-21 15:15:12 +0100
commit0c03c731a80399998cc4b03a35ffad2961c7b369 (patch)
tree9bfd3ff8c63e0d8f63ba8102ea691402b075d6b8 /win/make_dist.py
parentImplement IPv6 in TUN mode for Windows TAP driver. (diff)
downloadopenvpn-0c03c731a80399998cc4b03a35ffad2961c7b369.tar.xz
Added support for prebuilt TAP-drivers. Automated embedding manifests.
Removed win/make_dist.py's dependency on TAP-driver and tapinstall.exe building. Also added manifest embedding commands to win/make_dist.py. To avoid duplicate code moved the "build_vc" method from win/build.py to win/wb.py and renamed it "run_in_vs_shell". Signed-off-by: Samuli Seppänen <samuli@openvpn.net> Acked-by: James Yonan <james@openvpn.net> Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to '')
-rw-r--r--win/make_dist.py109
1 files changed, 69 insertions, 40 deletions
diff --git a/win/make_dist.py b/win/make_dist.py
index 70aaa60..730ccb7 100644
--- a/win/make_dist.py
+++ b/win/make_dist.py
@@ -1,8 +1,8 @@
-import os
-from wb import home_fn, rm_rf, mkdir, cp_a, cp, rename
-
-def main(config, tap=True):
- dist = config['DIST']
+import os
+from wb import home_fn, rm_rf, mkdir, cp_a, cp, rename, run_in_vs_shell
+
+def main(config, tap=True):
+ dist = config['DIST']
assert dist
dist = home_fn(dist)
bin = os.path.join(dist, 'bin')
@@ -11,14 +11,13 @@ def main(config, tap=True):
samples = os.path.join(dist, 'samples')
# build dist and subdirectories
- rm_rf(dist)
- mkdir(dist)
- mkdir(bin)
- if tap:
- mkdir(i386)
- mkdir(amd64)
+ rm_rf(dist)
+ mkdir(dist)
+ mkdir(bin)
+ mkdir(i386)
+ mkdir(amd64)
mkdir(samples)
-
+
# copy openvpn.exe, openvpnserv.exe and their manifests
cp(home_fn('openvpn.exe'), bin)
cp(home_fn('openvpn.exe.manifest'), bin)
@@ -45,34 +44,64 @@ def main(config, tap=True):
cp(home_fn('sample-config-files/server.conf'), samples)
rename(os.path.join(samples,'client.conf'), os.path.join(samples, 'client.ovpn'))
rename(os.path.join(samples,'server.conf'), os.path.join(samples, 'server.ovpn'))
-
- # copy MSVC CRT
- cp_a(home_fn(config['MSVC_CRT']), bin)
-
- if tap:
- # copy TAP drivers
- for dir_name, dest in (('amd64', amd64), ('i386', i386)):
- dir = home_fn(os.path.join('tap-win32', dir_name))
- for dirpath, dirnames, filenames in os.walk(dir):
- for f in filenames:
- root, ext = os.path.splitext(f)
- if ext in ('.inf', '.cat', '.sys'):
- cp(os.path.join(dir, f), dest)
- break
-
- # Copy tapinstall.exe (usually known as devcon.exe)
- dest = {'amd64' : amd64, 'i386' : i386}
- for dirpath, dirnames, filenames in os.walk(home_fn('tapinstall')):
- for f in filenames:
- if f == 'tapinstall.exe':
- # dir_name is either i386 or amd64
- dir_name = os.path.basename(dirpath)
- src = os.path.join(dirpath, f)
- if dir_name in dest:
- cp(src, dest[dir_name])
-
-# if we are run directly, and not loaded as a module
-if __name__ == "__main__":
+ # embed manifests to executables and DLLs
+ for f in [ "openvpn.exe", "openvpnserv.exe", "lzo2.dll", "libpkcs11-helper-1.dll" ]:
+
+ outputresource = os.path.join(bin,f)
+ manifest = outputresource+".manifest"
+
+ # EXEs and DLLs require slightly different treatment
+ if f.endswith(".exe"):
+ type = "1"
+ elif f.endswith(".dll"):
+ type = "2"
+ else:
+ print "ERROR: Could not embed manifest to "+outputresouce+", bailing out."
+ sys.exit(1)
+
+ # Embed the manifest
+ run_in_vs_shell('mt.exe -manifest %s -outputresource:%s;%s' % (manifest, outputresource, type))
+
+ # copy MSVC CRT
+ cp_a(home_fn(config['MSVC_CRT']), bin)
+
+ # TAP-driver and tapinstall.exe were built, so copy those over
+ if tap:
+ drv_dir = 'tap-win32'
+ ti_dir = 'tapinstall'
+
+ # we're using prebuilt TAP-driver and tapinstall.exe
+ elif 'TAP_PREBUILT' in config:
+ drv_dir = config['TAP_PREBUILT']
+ ti_dir = config['TAP_PREBUILT']
+
+ else:
+ print "ERROR: Could not find prebuilt TAP-drivers or tapinstall.exe. Please check win/settings.in"
+ sys.exit(1)
+
+ # copy TAP drivers
+ for dir_name, dest in (('amd64', amd64), ('i386', i386)):
+ dir = home_fn(os.path.join(drv_dir, dir_name))
+ for dirpath, dirnames, filenames in os.walk(dir):
+ for f in filenames:
+ root, ext = os.path.splitext(f)
+ if ext in ('.inf', '.cat', '.sys'):
+ cp(os.path.join(dir, f), dest)
+ break
+
+ # Copy tapinstall.exe (usually known as devcon.exe)
+ dest = {'amd64' : amd64, 'i386' : i386}
+ for dirpath, dirnames, filenames in os.walk(home_fn(ti_dir)):
+ for f in filenames:
+ if f == 'devcon.exe':
+ dir_name = os.path.basename(dirpath)
+ src = os.path.join(dirpath, f)
+ dst = os.path.join(dest[dir_name],'tapinstall.exe')
+ if dir_name in dest:
+ cp(src, dst, dest_is_dir=False)
+
+# if we are run directly, and not loaded as a module
+if __name__ == "__main__":
from wb import config
main(config)