mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 07:48:37 -04:00
makepanda: Require flex 2.5.9 for building egg lexer
Otherwise, fall back to prebuilt file instead
This commit is contained in:
parent
6f5362c3fe
commit
748dd61615
@ -1663,6 +1663,19 @@ def CompileFlex(wobj,wsrc,opts):
|
||||
pre = GetValueOption(opts, "BISONPREFIX_")
|
||||
dashi = opts.count("FLEXDASHI")
|
||||
flex = GetFlex()
|
||||
want_version = GetValueOption(opts, "FLEXVERSION:")
|
||||
if want_version:
|
||||
# Is flex at the required version for this file?
|
||||
want_version = tuple(map(int, want_version.split('.')))
|
||||
have_version = GetFlexVersion()
|
||||
if want_version > have_version:
|
||||
Warn("Skipping flex %s for file %s, need at least %s" % (
|
||||
'.'.join(map(str, have_version)),
|
||||
ifile,
|
||||
'.'.join(map(str, want_version)),
|
||||
))
|
||||
flex = None
|
||||
|
||||
if flex is None:
|
||||
# We don't have flex. See if there is a prebuilt file.
|
||||
base, ext = os.path.splitext(wsrc)
|
||||
@ -4932,7 +4945,7 @@ if GetTarget() == 'windows' and PkgSkip("DX9")==0 and not RUNTIME:
|
||||
#
|
||||
|
||||
if not RUNTIME and not PkgSkip("EGG"):
|
||||
OPTS=['DIR:panda/src/egg', 'BUILDING:PANDAEGG', 'ZLIB', 'BISONPREFIX_eggyy', 'FLEXDASHI']
|
||||
OPTS=['DIR:panda/src/egg', 'BUILDING:PANDAEGG', 'ZLIB', 'BISONPREFIX_eggyy', 'FLEXDASHI', 'FLEXVERSION:2.5.9']
|
||||
CreateFile(GetOutputDir()+"/include/parser.h")
|
||||
TargetAdd('p3egg_parser.obj', opts=OPTS, input='parser.yxx')
|
||||
TargetAdd('parser.h', input='p3egg_parser.obj', opts=['DEPENDENCYONLY'])
|
||||
|
@ -553,6 +553,16 @@ def GetFlex():
|
||||
|
||||
return FLEX
|
||||
|
||||
def GetFlexVersion():
|
||||
flex = GetFlex()
|
||||
if not flex:
|
||||
return None
|
||||
|
||||
handle = subprocess.Popen(["flex", "--version"], executable=flex, stdout=subprocess.PIPE)
|
||||
version = handle.communicate()[0].strip().splitlines()[0].split(b' ')[-1]
|
||||
version = tuple(map(int, version.split(b'.')))
|
||||
return version
|
||||
|
||||
########################################################################
|
||||
##
|
||||
## LocateBinary
|
||||
|
Loading…
x
Reference in New Issue
Block a user