def main(config, proj, arch): if proj == 'tap': dir = home_fn('tap-win32') elif proj == 'tapinstall': dir = home_fn('tapinstall') else: raise ValueError("unknown project: %s" % (proj,)) for x64 in choose_arch(arch): build_ddk(config, dir, x64)
def main(config, proj, arch): if proj == 'tap': dir = home_fn('tap-win32') elif proj == 'tapinstall': dir = home_fn('tapinstall') else: raise ValueError("unknown project: %s" % (proj, )) for x64 in choose_arch(arch): build_ddk(config, dir, x64)
def main(config): src = os.path.join(home_fn(config['TISRC']), config['DDKVER_MAJOR']) dest = home_fn('tapinstall') shutil.rmtree(dest, ignore_errors=True) shutil.copytree(src, dest) preprocess(config, in_fn=os.path.join(src, 'sources'), out_fn=os.path.join(dest, 'sources'), if_prefix='!', head_comment='# %s\n\n' % autogen)
def main(config): build_autodefs(config, mod_fn('autodefs.h.in'), home_fn('autodefs.h')) ho = make_headers_objs(home_fn('Makefile.am')) preprocess(dict_def(config, [('HEADERS_OBJS', ho)]), in_fn=mod_fn('msvc.mak.in'), out_fn=home_fn('msvc.mak'), quote_begin='@', quote_end='@', head_comment='# %s\n\n' % autogen)
def main(config): build_autodefs(config, mod_fn('autodefs.h.in'), home_fn('autodefs.h')) ho = make_headers_objs(home_fn('Makefile.am')) preprocess(dict_def(config, [('HEADERS_OBJS', ho)]), in_fn=mod_fn('msvc.mak.in'), out_fn=home_fn('msvc.mak'), quote_begin='@', quote_end='@', if_prefix='!', head_comment='# %s\n\n' % autogen)
def main(config): build_autodefs(config, mod_fn("autodefs.h.in"), home_fn("autodefs.h")) ho = make_headers_objs(home_fn("Makefile.am")) preprocess( dict_def(config, [("HEADERS_OBJS", ho)]), in_fn=mod_fn("msvc.mak.in"), out_fn=home_fn("msvc.mak"), quote_begin="@", quote_end="@", if_prefix="!", head_comment="# %s\n\n" % autogen, )
def main(config): build_config_h(config) build_configure_h(config, mod_fn(home_fn('configure.h')), head_comment='/* %s */\n\n' % autogen) build_version_m4_vars(mod_fn(mod_fn('version_m4_vars.tmp')), head_comment='/* %s */\n\n' % autogen) build_autodefs(config, mod_fn('autodefs.h.in'), home_fn('autodefs.h')) ho = make_headers_objs(home_fn('Makefile.am')) preprocess(dict_def(config, [('HEADERS_OBJS', ho)]), in_fn=mod_fn('msvc.mak.in'), out_fn=home_fn('msvc.mak'), quote_begin='@', quote_end='@', if_prefix='!', head_comment='# %s\n\n' % autogen)
def main(config): preprocess(config, in_fn=home_fn('tap-win32/SOURCES.in'), out_fn=home_fn('tap-win32/SOURCES'), quote_begin='@@', quote_end='@@', head_comment='# %s\n\n' % autogen) preprocess(config, in_fn=home_fn('tap-win32/i386/OemWin2k.inf.in'), out_fn=home_fn('tap-win32/i386/OemWin2k.inf'), quote_begin='@@', quote_end='@@', if_prefix='!', head_comment='; %s\n\n' % autogen) try: os.mkdir(home_fn('tap-win32/amd64')) except: pass preprocess(dict_def(config, [('AMD64', '1')]), in_fn=home_fn('tap-win32/i386/OemWin2k.inf.in'), out_fn=home_fn('tap-win32/amd64/OemWin2k.inf'), quote_begin='@@', quote_end='@@', if_prefix='!', head_comment='; %s\n\n' % autogen)
def main(config, tap=True): dist = config['DIST'] assert dist dist = home_fn(dist) bin = os.path.join(dist, 'bin') i386 = os.path.join(dist, 'i386') amd64 = os.path.join(dist, 'amd64') # build dist and subdirectories rm_rf(dist) mkdir(dist) mkdir(bin) if tap: mkdir(i386) mkdir(amd64) # copy openvpn.exe and manifest cp(home_fn('openvpn.exe'), bin) cp(home_fn('openvpn.exe.manifest'), bin) # copy DLL dependencies cp(home_fn(config['LZO_DIR']+'/bin/lzo2.dll'), bin) cp(home_fn(config['OPENSSL_DIR']+'/bin/libeay32.dll'), bin) cp(home_fn(config['OPENSSL_DIR']+'/bin/ssleay32.dll'), bin) # 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 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 = os.path.basename(dirpath) src = os.path.join(dirpath, f) if dir_name in dest: cp(src, dest[dir_name])
def copy_tapinstall(src, dest, x64): base = { False : 'i386', True: 'amd64' }[x64] mkdir_silent(dest) for dirpath, dirnames, filenames in os.walk(home_fn(src)): for f in filenames: if f == 'devcon.exe': dir_name = os.path.basename(dirpath) s = os.path.join(dirpath, f) if dir_name == base: cp(s, dest)
def copy_tapinstall(src, dest, x64): base = { False : 'i386', True: 'amd64' }[x64] mkdir_silent(dest) for dirpath, dirnames, filenames in os.walk(home_fn(src)): for f in filenames: if f == 'tapinstall.exe': dir_name = os.path.basename(dirpath) s = os.path.join(dirpath, f) if dir_name == base: cp(s, dest)
def main(config, tap=True): dist = config['DIST'] assert dist dist = home_fn(dist) bin = os.path.join(dist, 'bin') i386 = os.path.join(dist, 'i386') amd64 = os.path.join(dist, 'amd64') # build dist and subdirectories rm_rf(dist) mkdir(dist) mkdir(bin) if tap: mkdir(i386) mkdir(amd64) # copy openvpn.exe and manifest cp(home_fn('openvpn.exe'), bin) cp(home_fn('openvpn.exe.manifest'), bin) # copy DLL dependencies cp(home_fn(config['LZO_DIR'] + '/bin/lzo2.dll'), bin) cp(home_fn(config['OPENSSL_DIR'] + '/bin/libeay32.dll'), bin) cp(home_fn(config['OPENSSL_DIR'] + '/bin/ssleay32.dll'), bin) # 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 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 = os.path.basename(dirpath) src = os.path.join(dirpath, f) if dir_name in dest: cp(src, dest[dir_name])
def clean(): cd_home() build_vc("nmake /f %s clean" % (home_fn('msvc.mak'), ))
import sys, os, shutil from wb import config, home_fn, mod_fn, preprocess, autogen, dict_def, build_autodefs, rm_rf, mkdir_silent, cp if 'SIGNTOOL' in config: sys.path.append(home_fn(config['SIGNTOOL'])) from signtool import SignTool from build_ddk import build_tap ti_dir = "c:/src/tapinstall" hi = ("c:/winddk/7600.16385.1", 7600, 7600, ("i386", "amd64")) low = ("c:/winddk/6001.18002", 6001, 5600, ("win2k",)) dest_top = home_fn('tap_build') dist = home_fn(config['TAP_DIST']) def copy_tap(src, dest, x64): dir = os.path.join(src, { False : 'i386', True: 'amd64' }[x64]) mkdir_silent(dest) 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 def copy_tapinstall(src, dest, x64): base = { False : 'i386', True: 'amd64' }[x64] mkdir_silent(dest) for dirpath, dirnames, filenames in os.walk(home_fn(src)): for f in filenames: if f == 'tapinstall.exe': dir_name = os.path.basename(dirpath) s = os.path.join(dirpath, f)
def main(config, tap=True): dist = config['DIST'] assert dist dist = home_fn(dist) bin = os.path.join(dist, 'bin') i386 = os.path.join(dist, 'i386') amd64 = os.path.join(dist, 'amd64') samples = os.path.join(dist, 'samples') # build dist and subdirectories 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) cp(home_fn('service-win32/openvpnserv.exe'), bin) cp(home_fn('service-win32/openvpnserv.exe.manifest'), bin) # copy openvpn-gui cp(home_fn(config['OPENVPN_GUI_DIR']+"/"+config['OPENVPN_GUI']), bin) # copy DLL dependencies cp(home_fn(config['LZO_DIR']+'/bin/lzo2.dll'), bin) cp(home_fn(config['LZO_DIR']+'/bin/lzo2.dll.manifest'), bin) cp(home_fn(config['OPENSSL_DIR']+'/bin/libeay32.dll'), bin) cp(home_fn(config['OPENSSL_DIR']+'/bin/ssleay32.dll'), bin) cp(home_fn(config['PKCS11_HELPER_DIR']+'/lib/libpkcs11-helper-1.dll'), bin) cp(home_fn(config['PKCS11_HELPER_DIR']+'/lib/libpkcs11-helper-1.dll.manifest'), bin) # copy OpenSSL utilities (=openvpn.exe) cp(home_fn(config['OPENSSL_DIR']+'/bin/openssl.exe'), bin) # copy sample config files; renaming is necessary due to openvpn.nsi script cp(home_fn('install-win32/sample.ovpn'), samples) cp(home_fn('sample-config-files/client.conf'), samples) 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')) # 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 in ( 'devcon.exe', 'tapinstall.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)
import sys from wb import config, choose_arch, home_fn if 'SIGNTOOL' in config: sys.path.append(home_fn(config['SIGNTOOL'])) def main(conf, arch): from signtool import SignTool st = SignTool(conf) for x64 in choose_arch(arch): st.sign_verify(x64=x64) # if we are run directly, and not loaded as a module if __name__ == "__main__": if len(sys.argv) >= 2: main(config, sys.argv[1]) else: print "usage: sign <x64|x86|all>" sys.exit(2)
def main(): """Build openvpn.exe and openvpnserv.exe""" cd_home() run_in_vs_shell("nmake /f %s" % (home_fn('msvc.mak'),)) cd_service_win32() run_in_vs_shell("nmake /f %s" % ('msvc.mak'))
def clean(): """Clean up after openvpn.exe and openvpnserv.exe build""" cd_home() run_in_vs_shell("nmake /f %s clean" % (home_fn('msvc.mak'),)) os.chdir("service-win32") run_in_vs_shell("nmake /f %s clean" % ('msvc.mak'))
def main(): rm_rf(dest_top) os.mkdir(dest_top) rm_rf(dist) os.mkdir(dist) for ver in hi, low: top = os.path.join(dest_top, str(ver[1])) os.mkdir(top) tap_dest = os.path.join(top, "tap-win32") ti_dest = os.path.join(top, "tapinstall") ti_src = os.path.join(ti_dir, str(ver[2])) shutil.copytree(home_fn("tap-win32"), tap_dest) shutil.copytree(ti_src, ti_dest) i386 = os.path.join(tap_dest, "i386") amd64 = os.path.join(tap_dest, "amd64") build_amd64 = (len(ver[3]) >= 2) build_autodefs(config, mod_fn('autodefs.h.in'), os.path.join(top, 'autodefs.h')) st = SignTool(config, tap_dest) preprocess(config, in_fn=os.path.join(tap_dest, 'SOURCES.in'), out_fn=os.path.join(tap_dest, 'SOURCES'), quote_begin='@@', quote_end='@@', head_comment='# %s\n\n' % autogen) preprocess(config, in_fn=os.path.join(i386, 'OemWin2k.inf.in'), out_fn=os.path.join(i386, 'OemWin2k.inf'), quote_begin='@@', quote_end='@@', if_prefix='!', head_comment='; %s\n\n' % autogen) preprocess(config, in_fn=os.path.join(ti_dest, 'sources.in'), out_fn=os.path.join(ti_dest, 'sources'), if_prefix='!', head_comment='# %s\n\n' % autogen) build_tap(ddk_path=ver[0], ddk_major=ver[1], debug=False, dir=tap_dest, x64=False) st.sign_verify(x64=False) build_tap(ddk_path=ver[0], ddk_major=ver[1], debug=False, dir=ti_dest, x64=False) tap_dist = os.path.join(dist, ver[3][0]) copy_tap(tap_dest, tap_dist, x64=False) copy_tapinstall(ti_dest, tap_dist, x64=False) if build_amd64: os.mkdir(amd64) preprocess(dict_def(config, [('AMD64', '1')]), in_fn=os.path.join(i386, 'OemWin2k.inf.in'), out_fn=os.path.join(amd64, 'OemWin2k.inf'), quote_begin='@@', quote_end='@@', if_prefix='!', head_comment='; %s\n\n' % autogen) build_tap(ddk_path=ver[0], ddk_major=ver[1], debug=False, dir=tap_dest, x64=True) build_tap(ddk_path=ver[0], ddk_major=ver[1], debug=False, dir=ti_dest, x64=True) st.sign_verify(x64=True) tap_dist_x64 = os.path.join(dist, ver[3][1]) copy_tap(tap_dest, tap_dist_x64, x64=True) copy_tapinstall(ti_dest, tap_dist_x64, x64=True)
def main(): """Build openvpn.exe and openvpnserv.exe""" cd_home() run_in_vs_shell("nmake /f %s" % (home_fn('msvc.mak'), )) cd_service_win32() run_in_vs_shell("nmake /f %s" % ('msvc.mak'))
import sys from wb import config, choose_arch, home_fn if 'SIGNTOOL' in config: sys.path.append(home_fn(config['SIGNTOOL'])) def main(conf, arch, tap_dir): from signtool import SignTool st = SignTool(conf, tap_dir) for x64 in choose_arch(arch): st.sign_verify(x64=x64) # if we are run directly, and not loaded as a module if __name__ == "__main__": if len(sys.argv) >= 2: if len(sys.argv) >= 3: tap_dir = home_fn(sys.argv[2]) else: tap_dir = None main(config, sys.argv[1], tap_dir) else: print "usage: sign <x64|x86|all> [tap-dir]" sys.exit(2)
def main(): cd_home() build_vc("nmake /f %s" % (home_fn('msvc.mak'), ))
def clean(): """Clean up after openvpn.exe and openvpnserv.exe build""" cd_home() run_in_vs_shell("nmake /f %s clean" % (home_fn('msvc.mak'), )) os.chdir("service-win32") run_in_vs_shell("nmake /f %s clean" % ('msvc.mak'))
import sys, os, shutil from wb import config, home_fn, mod_fn, preprocess, autogen, dict_def, build_autodefs, rm_rf, mkdir_silent, cp if 'SIGNTOOL' in config: sys.path.append(home_fn(config['SIGNTOOL'])) from signtool import SignTool from build_ddk import build_tap ti_dir = "c:/src/tapinstall" hi = ("c:/winddk/7600.16385.1", 7600, 7600, ("i386", "amd64")) low = ("c:/winddk/6001.18002", 6001, 5600, ("win2k",)) dest_top = home_fn('tap_build') dist = home_fn(config['TAP_DIST']) def copy_tap(src, dest, x64): dir = os.path.join(src, { False : 'i386', True: 'amd64' }[x64]) mkdir_silent(dest) 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 def copy_tapinstall(src, dest, x64): base = { False : 'i386', True: 'amd64' }[x64] mkdir_silent(dest) for dirpath, dirnames, filenames in os.walk(home_fn(src)): for f in filenames: if f == 'devcon.exe': dir_name = os.path.basename(dirpath) s = os.path.join(dirpath, f)