2010-05-11 21:32:41 +02:00
|
|
|
import os, sys
|
2011-02-11 15:20:43 +01:00
|
|
|
from wb import system, config, home_fn, cd_home, cd_service_win32
|
2010-04-22 14:53:31 +02:00
|
|
|
|
|
|
|
os.environ['PATH'] += ";%s\\VC" % (os.path.normpath(config['MSVC']),)
|
|
|
|
|
|
|
|
def build_vc(cmd):
|
2011-02-11 15:20:43 +01:00
|
|
|
"""Make sure environment variables are setup before build"""
|
2010-04-22 14:53:31 +02:00
|
|
|
system('cmd /c "vcvarsall.bat x86 && %s"' % (cmd,))
|
|
|
|
|
|
|
|
def main():
|
2011-02-11 15:20:43 +01:00
|
|
|
"""Build openvpn.exe and openvpnserv.exe"""
|
2010-04-22 14:53:31 +02:00
|
|
|
cd_home()
|
|
|
|
build_vc("nmake /f %s" % (home_fn('msvc.mak'),))
|
2011-02-11 15:20:43 +01:00
|
|
|
cd_service_win32()
|
|
|
|
build_vc("nmake /f %s" % ('msvc.mak'))
|
2010-04-22 14:53:31 +02:00
|
|
|
|
2010-05-11 21:32:41 +02:00
|
|
|
def clean():
|
2011-02-11 15:20:43 +01:00
|
|
|
"""Clean up after openvpn.exe and openvpnserv.exe build"""
|
2010-05-11 21:32:41 +02:00
|
|
|
cd_home()
|
|
|
|
build_vc("nmake /f %s clean" % (home_fn('msvc.mak'),))
|
2011-02-11 15:20:43 +01:00
|
|
|
os.chdir("service-win32")
|
|
|
|
build_vc("nmake /f %s clean" % ('msvc.mak'))
|
2010-05-11 21:32:41 +02:00
|
|
|
|
2010-04-22 14:53:31 +02:00
|
|
|
# if we are run directly, and not loaded as a module
|
|
|
|
if __name__ == "__main__":
|
2010-05-11 21:32:41 +02:00
|
|
|
if len(sys.argv) == 2 and sys.argv[1] == 'clean':
|
|
|
|
clean()
|
|
|
|
else:
|
|
|
|
main()
|