mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 04:03:39 +00:00
Add option --githash to mk_win_dist
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
b33e144699
commit
27b1f8d1b3
|
@ -74,6 +74,16 @@ VS_PAR=False
|
||||||
VS_PAR_NUM=8
|
VS_PAR_NUM=8
|
||||||
GPROF=False
|
GPROF=False
|
||||||
|
|
||||||
|
def git_hash():
|
||||||
|
try:
|
||||||
|
r = subprocess.check_output(['git', 'show-ref', '--abbrev=12', 'HEAD'], shell=True).rstrip('\r\n')
|
||||||
|
except:
|
||||||
|
raise MKException("Failed to retrieve git hash")
|
||||||
|
ls = r.split(' ')
|
||||||
|
if len(ls) != 2:
|
||||||
|
raise MKException("Unexpected git output")
|
||||||
|
return ls[0]
|
||||||
|
|
||||||
def is_windows():
|
def is_windows():
|
||||||
return IS_WINDOWS
|
return IS_WINDOWS
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ VERBOSE=True
|
||||||
DIST_DIR='dist'
|
DIST_DIR='dist'
|
||||||
FORCE_MK=False
|
FORCE_MK=False
|
||||||
JAVA_ENABLED=True
|
JAVA_ENABLED=True
|
||||||
|
GIT_HASH=False
|
||||||
|
|
||||||
def set_verbose(flag):
|
def set_verbose(flag):
|
||||||
global VERBOSE
|
global VERBOSE
|
||||||
|
@ -55,17 +56,19 @@ def display_help():
|
||||||
print " -b <sudir>, --build=<subdir> subdirectory where x86 and x64 Z3 versions will be built (default: build-dist)."
|
print " -b <sudir>, --build=<subdir> subdirectory where x86 and x64 Z3 versions will be built (default: build-dist)."
|
||||||
print " -f, --force force script to regenerate Makefiles."
|
print " -f, --force force script to regenerate Makefiles."
|
||||||
print " --nojava do not include Java bindings in the binary distribution files."
|
print " --nojava do not include Java bindings in the binary distribution files."
|
||||||
|
print " --githash include git hash in the Zip file."
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
# Parse configuration option for mk_make script
|
# Parse configuration option for mk_make script
|
||||||
def parse_options():
|
def parse_options():
|
||||||
global FORCE_MK, JAVA_ENABLED
|
global FORCE_MK, JAVA_ENABLED, GIT_HASH
|
||||||
path = BUILD_DIR
|
path = BUILD_DIR
|
||||||
options, remainder = getopt.gnu_getopt(sys.argv[1:], 'b:hsf', ['build=',
|
options, remainder = getopt.gnu_getopt(sys.argv[1:], 'b:hsf', ['build=',
|
||||||
'help',
|
'help',
|
||||||
'silent',
|
'silent',
|
||||||
'force',
|
'force',
|
||||||
'nojava'
|
'nojava',
|
||||||
|
'githash'
|
||||||
])
|
])
|
||||||
for opt, arg in options:
|
for opt, arg in options:
|
||||||
if opt in ('-b', '--build'):
|
if opt in ('-b', '--build'):
|
||||||
|
@ -80,6 +83,8 @@ def parse_options():
|
||||||
FORCE_MK = True
|
FORCE_MK = True
|
||||||
elif opt == '--nojava':
|
elif opt == '--nojava':
|
||||||
JAVA_ENABLED = False
|
JAVA_ENABLED = False
|
||||||
|
elif opt == '--githash':
|
||||||
|
GIT_HASH = True
|
||||||
else:
|
else:
|
||||||
raise MKException("Invalid command line option '%s'" % opt)
|
raise MKException("Invalid command line option '%s'" % opt)
|
||||||
set_build_dir(path)
|
set_build_dir(path)
|
||||||
|
@ -147,15 +152,25 @@ def mk_z3():
|
||||||
mk_z3_core(False)
|
mk_z3_core(False)
|
||||||
mk_z3_core(True)
|
mk_z3_core(True)
|
||||||
|
|
||||||
def mk_dist_dir_core(x64):
|
def get_z3_name(x64):
|
||||||
major, minor, build, revision = get_version()
|
major, minor, build, revision = get_version()
|
||||||
|
if x64:
|
||||||
|
platform = "x64"
|
||||||
|
else:
|
||||||
|
platform = "x86"
|
||||||
|
if GIT_HASH:
|
||||||
|
return 'z3-%s.%s.%s.%s-%s' % (major, minor, build, mk_util.git_hash(), platform)
|
||||||
|
else:
|
||||||
|
return 'z3-%s.%s.%s-%s' % (major, minor, build, platform)
|
||||||
|
|
||||||
|
def mk_dist_dir_core(x64):
|
||||||
if x64:
|
if x64:
|
||||||
platform = "x64"
|
platform = "x64"
|
||||||
build_path = BUILD_X64_DIR
|
build_path = BUILD_X64_DIR
|
||||||
else:
|
else:
|
||||||
platform = "x86"
|
platform = "x86"
|
||||||
build_path = BUILD_X86_DIR
|
build_path = BUILD_X86_DIR
|
||||||
dist_path = os.path.join(DIST_DIR, 'z3-%s.%s.%s-%s' % (major, minor, build, platform))
|
dist_path = os.path.join(DIST_DIR, get_z3_name(x64))
|
||||||
mk_dir(dist_path)
|
mk_dir(dist_path)
|
||||||
if JAVA_ENABLED:
|
if JAVA_ENABLED:
|
||||||
# HACK: Propagate JAVA_ENABLED flag to mk_util
|
# HACK: Propagate JAVA_ENABLED flag to mk_util
|
||||||
|
@ -179,12 +194,7 @@ def mk_zip_visitor(pattern, dir, files):
|
||||||
ZIPOUT.write(fname)
|
ZIPOUT.write(fname)
|
||||||
|
|
||||||
def get_dist_path(x64):
|
def get_dist_path(x64):
|
||||||
major, minor, build, revision = get_version()
|
return get_z3_name(x64)
|
||||||
if x64:
|
|
||||||
platform = "x64"
|
|
||||||
else:
|
|
||||||
platform = "x86"
|
|
||||||
return 'z3-%s.%s.%s-%s' % (major, minor, build, platform)
|
|
||||||
|
|
||||||
def mk_zip_core(x64):
|
def mk_zip_core(x64):
|
||||||
global ZIPOUT
|
global ZIPOUT
|
||||||
|
|
Loading…
Reference in a new issue