mirror of
https://github.com/OpenVPN/openvpn3.git
synced 2024-09-20 04:02:15 +02:00
Windows build system changes:
1. Use os.path.join(parms['BUILD'], parms['ARCH']) as the build directory, to allow concurrent build directories to exist for multiple architectures. 2. Allow extra build parameters to be specified out-of-tree in c:/src/ovpn3/common/deps/win/extra.py
This commit is contained in:
parent
a94b4815f4
commit
5200ab2c38
15
deps/win/build.py
vendored
15
deps/win/build.py
vendored
@ -25,13 +25,13 @@ paths = {
|
||||
"ovpn3" : PARMS['OVPN3'],
|
||||
"tap" : os.path.join(PARMS['TAP'], 'src'),
|
||||
"tap_component_id" : PARMS['TAP_WIN_COMPONENT_ID'],
|
||||
"asio" : os.path.join(PARMS['BUILD'], "asio"),
|
||||
"polarssl" : os.path.join(PARMS['BUILD'], "polarssl"),
|
||||
"lz4" : os.path.join(PARMS['BUILD'], "lz4"),
|
||||
"jsoncpp" : os.path.join(PARMS['BUILD'], "jsoncpp"), # optional
|
||||
"asio" : os.path.join(build_dir(PARMS), "asio"),
|
||||
"polarssl" : os.path.join(build_dir(PARMS), "polarssl"),
|
||||
"lz4" : os.path.join(build_dir(PARMS), "lz4"),
|
||||
"jsoncpp" : os.path.join(build_dir(PARMS), "jsoncpp"), # optional
|
||||
"srcfile" : srcfile,
|
||||
"dbg_rel_flags" : dbg_rel_flags,
|
||||
"extra_defs" : "",
|
||||
"extra_defs" : PARMS['CPP_EXTRA'],
|
||||
"extra_inc" : "",
|
||||
"extra_lib_path" : "",
|
||||
"extra_lib" : "",
|
||||
@ -50,8 +50,5 @@ if 'jsoncpp' in paths:
|
||||
paths['extra_lib_path'] += " /LIBPATH:%(jsoncpp)s/dist" % paths
|
||||
paths['extra_lib'] += " jsoncpp.lib"
|
||||
|
||||
# ovpn3 client should use command agent for privilege separation
|
||||
paths['extra_inc'] += " /DOPENVPN_COMMAND_AGENT"
|
||||
|
||||
# build it
|
||||
vc_cmd(PARMS, r"cl %(extra_defs)s /DNOMINMAX /D_CRT_SECURE_NO_WARNINGS /DASIO_STANDALONE /DASIO_NO_DEPRECATED /I %(asio)s\asio\include /DUSE_POLARSSL /I %(polarssl)s\include /DHAVE_LZ4 /I %(lz4)s%(extra_inc)s -DPRIVATE_TUNNEL_PROXY /I %(ovpn3)s\common -DTAP_WIN_COMPONENT_ID=%(tap_component_id)s /I %(tap)s /I %(ovpn3)s\core /GL /EHsc /MD /W0 %(dbg_rel_flags)s /nologo %(srcfile)s /link /LIBPATH:%(polarssl)s\library /LIBPATH:%(lz4)s%(extra_lib_path)s polarssl.lib lz4.lib%(extra_lib)s ws2_32.lib crypt32.lib iphlpapi.lib winmm.lib user32.lib gdi32.lib advapi32.lib wininet.lib shell32.lib ole32.lib" % paths, arch=os.environ.get("ARCH"))
|
||||
vc_cmd(PARMS, r"cl %(extra_defs)s /DNOMINMAX /D_CRT_SECURE_NO_WARNINGS /DASIO_STANDALONE /DASIO_NO_DEPRECATED /I %(asio)s\asio\include /DUSE_POLARSSL /I %(polarssl)s\include /DHAVE_LZ4 /I %(lz4)s%(extra_inc)s /I %(ovpn3)s\common -DTAP_WIN_COMPONENT_ID=%(tap_component_id)s /I %(tap)s /I %(ovpn3)s\core /GL /EHsc /MD /W0 %(dbg_rel_flags)s /nologo %(srcfile)s /link /LIBPATH:%(polarssl)s\library /LIBPATH:%(lz4)s%(extra_lib_path)s polarssl.lib lz4.lib%(extra_lib)s ws2_32.lib crypt32.lib iphlpapi.lib winmm.lib user32.lib gdi32.lib advapi32.lib wininet.lib shell32.lib ole32.lib" % paths, arch=os.environ.get("ARCH"))
|
||||
|
47
deps/win/buildep.py
vendored
47
deps/win/buildep.py
vendored
@ -15,27 +15,27 @@ def compile_one_file(srcfile, incdirs):
|
||||
"dbg_rel_flags" : dbg_rel_flags,
|
||||
}
|
||||
|
||||
vc_cmd(PARMS, r"cl /c /D_WIN32_WINNT=0x0600 /DNOMINMAX /D_CRT_SECURE_NO_WARNINGS %(incdirs)s /EHsc /MD /W3 %(dbg_rel_flags)s /nologo %(srcfile)s" % paths, arch=os.environ.get("ARCH"))
|
||||
vc_cmd(PARMS, r"cl /c /DNOMINMAX /D_CRT_SECURE_NO_WARNINGS %(incdirs)s /EHsc /MD /W3 %(dbg_rel_flags)s /nologo %(srcfile)s" % paths, arch=os.environ.get("ARCH"))
|
||||
|
||||
def build_asio(parms):
|
||||
def build_asio():
|
||||
print "**************** ASIO"
|
||||
with Cd(parms['BUILD']) as cd:
|
||||
with ModEnv('PATH', "%s\\bin;%s" % (parms.get('GIT'), os.environ['PATH'])):
|
||||
d = expand('asio', parms['DEP'], parms.get('LIB_VERSIONS'))
|
||||
with Cd(build_dir(PARMS)) as cd:
|
||||
with ModEnv('PATH', "%s\\bin;%s" % (PARMS.get('GIT'), os.environ['PATH'])):
|
||||
d = expand('asio', PARMS['DEP'], PARMS.get('LIB_VERSIONS'))
|
||||
|
||||
def build_polarssl(parms):
|
||||
def build_polarssl():
|
||||
print "**************** PolarSSL"
|
||||
with Cd(parms['BUILD']) as cd:
|
||||
with ModEnv('PATH', "%s\\bin;%s" % (parms.get('GIT'), os.environ['PATH'])):
|
||||
with Cd(build_dir(PARMS)) as cd:
|
||||
with ModEnv('PATH', "%s\\bin;%s" % (PARMS.get('GIT'), os.environ['PATH'])):
|
||||
dist = os.path.realpath('polarssl')
|
||||
rmtree(dist)
|
||||
d = expand('polarssl', parms['DEP'], parms.get('LIB_VERSIONS'))
|
||||
d = expand('polarssl', PARMS['DEP'], PARMS.get('LIB_VERSIONS'))
|
||||
if d.endswith("-gpl"):
|
||||
d = d[:-4]
|
||||
os.rename(d, dist)
|
||||
|
||||
# copy our custom config.h
|
||||
cp(os.path.join(parms['OVPN3'], 'core', 'deps', 'polarssl', 'config.h'),
|
||||
cp(os.path.join(PARMS['OVPN3'], 'core', 'deps', 'polarssl', 'config.h'),
|
||||
os.path.join(dist, 'include', 'polarssl', 'config.h'))
|
||||
with open(os.path.join(dist, 'include', 'polarssl', 'openvpn-polarssl.h'), 'w') as f:
|
||||
f.write("// automatically generated by buildep.py\n#define POLARSSL_SELF_TEST\n")
|
||||
@ -54,26 +54,26 @@ def build_polarssl(parms):
|
||||
# collect object files into polarssl.lib
|
||||
vc_cmd(PARMS, r"lib /OUT:polarssl.lib " + ' '.join(obj))
|
||||
|
||||
def build_lz4(parms):
|
||||
def build_lz4():
|
||||
print "**************** LZ4"
|
||||
with Cd(parms['BUILD']) as cd:
|
||||
with ModEnv('PATH', "%s\\bin;%s" % (parms.get('GIT'), os.environ['PATH'])):
|
||||
with Cd(build_dir(PARMS)) as cd:
|
||||
with ModEnv('PATH', "%s\\bin;%s" % (PARMS.get('GIT'), os.environ['PATH'])):
|
||||
dist = os.path.realpath('lz4')
|
||||
rmtree(dist)
|
||||
d = expand('lz4', parms['DEP'], parms.get('LIB_VERSIONS'))
|
||||
d = expand('lz4', PARMS['DEP'], PARMS.get('LIB_VERSIONS'))
|
||||
os.rename(d, dist)
|
||||
os.chdir(dist)
|
||||
compile_one_file("lz4.c", ())
|
||||
vc_cmd(PARMS, r"lib /OUT:lz4.lib lz4.obj")
|
||||
|
||||
def build_jsoncpp(parms):
|
||||
def build_jsoncpp():
|
||||
if 'jsoncpp' in PARMS['LIB_VERSIONS']:
|
||||
print "**************** JSONCPP"
|
||||
with Cd(parms['BUILD']) as cd:
|
||||
with ModEnv('PATH', "%s\\bin;%s" % (parms.get('GIT'), os.environ['PATH'])):
|
||||
with Cd(build_dir(PARMS)) as cd:
|
||||
with ModEnv('PATH', "%s\\bin;%s" % (PARMS.get('GIT'), os.environ['PATH'])):
|
||||
dist = os.path.realpath('jsoncpp')
|
||||
rmtree(dist)
|
||||
d = expand('jsoncpp', parms['DEP'], parms.get('LIB_VERSIONS'))
|
||||
d = expand('jsoncpp', PARMS['DEP'], PARMS.get('LIB_VERSIONS'))
|
||||
os.rename(d, dist)
|
||||
os.chdir(dist)
|
||||
call(["python", "amalgamate.py"])
|
||||
@ -81,9 +81,8 @@ def build_jsoncpp(parms):
|
||||
compile_one_file("jsoncpp.cpp", (".",))
|
||||
vc_cmd(PARMS, r"lib /OUT:jsoncpp.lib jsoncpp.obj")
|
||||
|
||||
wipetree(PARMS['BUILD'])
|
||||
wipetree(PARMS['DIST'])
|
||||
build_asio(PARMS)
|
||||
build_polarssl(PARMS)
|
||||
build_lz4(PARMS)
|
||||
build_jsoncpp(PARMS)
|
||||
wipetree(build_dir(PARMS))
|
||||
build_asio()
|
||||
build_polarssl()
|
||||
build_lz4()
|
||||
build_jsoncpp()
|
||||
|
13
deps/win/parms.py
vendored
13
deps/win/parms.py
vendored
@ -1,19 +1,26 @@
|
||||
import sys, os
|
||||
|
||||
PARMS = {
|
||||
"DEBUG" : False,
|
||||
"OVPN3" : "c:\\src\\ovpn3",
|
||||
"TAP" : "c:\\src\\tap-windows6",
|
||||
"TAP_WIN_COMPONENT_ID" : "tapoas", # Community: tap0901, Access Server: tapoas
|
||||
"TAP_WIN_COMPONENT_ID" : "tap0901", # Community: tap0901, Access Server: tapoas
|
||||
"DEP" : "z:\\james\\downloads",
|
||||
"BUILD" : "c:\\src\\ovpn3-build",
|
||||
"DIST" : "c:\\src\\ovpn3\\dist",
|
||||
"PATCH" : "c:\\src\\as\\pyovpn\\patch",
|
||||
"GIT" : "c:\\Program Files (x86)\\Git",
|
||||
"CPP_EXTRA" : "",
|
||||
"MSVC_DIR" : "c:\\Program Files (x86)\\Microsoft Visual Studio 14.0",
|
||||
"ARCH" : "amd64", # one of amd64, x86, or x86_xp (note that x86_xp requires vcvarsall.bat patch)
|
||||
"LIB_VERSIONS" : {
|
||||
'asio' : "asio-20150924",
|
||||
'polarssl' : "polarssl-1.3.9a",
|
||||
'lz4' : "lz4-r120",
|
||||
'jsoncpp' : "jsoncpp-1.3.0", # optional
|
||||
}
|
||||
}
|
||||
|
||||
ex = "c:/src/ovpn3/common/deps/win/extra.py"
|
||||
if os.path.exists(ex):
|
||||
sys.path.append(os.path.dirname(ex))
|
||||
import extra
|
||||
extra.update_parms(PARMS)
|
||||
|
5
deps/win/utils.py
vendored
5
deps/win/utils.py
vendored
@ -80,7 +80,7 @@ def wipetree(dir):
|
||||
print "WIPETREE", dir
|
||||
shutil.rmtree(dir, ignore_errors=False, onerror=onerror)
|
||||
if not os.path.isdir(dir):
|
||||
os.mkdir(dir)
|
||||
os.makedirs(dir)
|
||||
|
||||
def extract_dict(d, k, default=None):
|
||||
if k in d:
|
||||
@ -197,3 +197,6 @@ def patch(pkg_prefix, patchdir):
|
||||
patch_fn = patchfile(pkg_prefix, patchdir)
|
||||
print "PATCH", patch_fn
|
||||
call(['patch', '-p1', '-i', patch_fn])
|
||||
|
||||
def build_dir(parms):
|
||||
return os.path.join(parms['BUILD'], parms['ARCH'])
|
||||
|
Loading…
Reference in New Issue
Block a user