Bug 773423: use absolute paths for windows, different for make vs pymake r=ted

This commit is contained in:
Randell Jesup 2012-07-13 15:48:07 -04:00
parent 36a43871f4
commit eed137b113
2 changed files with 30 additions and 17 deletions

View File

@ -981,6 +981,17 @@ if test -n "$MAKE"; then
fi
fi
MOZ_TOPSRCDIR=$_topsrcdir
if test -z "$NOT_PYMAKE"; then
case "$host" in
*mingw*)
MOZ_TOPSRCDIR=`cd $_topsrcdir && pwd -W`
;;
esac
fi
# MOZ_TOPSRCDIR is an absolute path, in the correct form
# for "topsrcdir=" and "srcdir=" in Makefiles
case "$host_os" in
mingw*)
MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
@ -8681,8 +8692,14 @@ fi
if test -n "$MOZ_WEBRTC"; then
AC_MSG_RESULT("generating WebRTC Makefiles...")
# msys (on windows) does EVIL things to parameters to python it thinks are msys paths.
# Since we already have the path in the format we want (c:/foo for pymake,
# /c/foo for make), we just want to stop msys from mucking with the string.
# The underscores will be removed in mozmake.py. We need the correct form of
# absolute path for building topsrcdir= in Makefiles.
MOZ_TOPSRCDIR="_${MOZ_TOPSRCDIR:0:2}_${MOZ_TOPSRCDIR:2}"
GYP_WEBRTC_OPTIONS="--format=mozmake -D build_with_mozilla=1 -D enable_protobuf=0 -D include_internal_video_render=0 ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir}"
GYP_WEBRTC_OPTIONS="--format=mozmake -D build_with_mozilla=1 -D enable_protobuf=0 -D include_internal_video_render=0 ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir} -G TOPSRCDIR=${MOZ_TOPSRCDIR}"
$PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
$GYP_WEBRTC_OPTIONS \

View File

@ -198,7 +198,7 @@ def Compilable(filename):
return os.path.splitext(filename)[1] in COMPILABLE_EXTENSIONS
class MakefileGenerator(object):
def __init__(self, target_dicts, data, options, depth, topsrcdir, relative_topsrcdir, relative_srcdir, output_dir, flavor):
def __init__(self, target_dicts, data, options, depth, topsrcdir, relative_topsrcdir, relative_srcdir, output_dir, topsrcdir_header):
self.target_dicts = target_dicts
self.data = data
self.options = options
@ -208,7 +208,7 @@ class MakefileGenerator(object):
self.relative_topsrcdir = swapslashes(relative_topsrcdir)
self.srcdir = swapslashes(os.path.join(topsrcdir, relative_srcdir))
self.output_dir = output_dir
self.flavor = flavor
self.topsrcdir_header = topsrcdir_header
# Directories to be built in order.
self.dirs = []
# Directories that can be built in any order, but before |dirs|.
@ -369,10 +369,7 @@ class MakefileGenerator(object):
else:
# Maybe nothing?
return False
if self.flavor == 'win':
top = self.relative_topsrcdir
else:
top = self.topsrcdir
top = self.topsrcdir_header
WriteMakefile(output_file, data, build_file, depth, top,
# we set srcdir up one directory, since the subdir
# doesn't actually exist in the source directory
@ -390,6 +387,11 @@ def GenerateOutput(target_list, target_dicts, data, params):
topsrcdir = os.path.abspath(options.toplevel_dir)
# The object directory (root of the build).
objdir = os.path.abspath(generator_flags['OBJDIR'] if 'OBJDIR' in generator_flags else '.')
# The topsrcdir in correct format for the header (which changes from make to pymake on windows!)
# This is already in absolute format (not relative), with '/'s, with a leading '_' and a
# second after two characters to avoid msys modifying it on Windows(!)
topsrcdir_header = generator_flags['TOPSRCDIR'] if 'TOPSRCDIR' in generator_flags else topsrcdir
topsrcdir_header = topsrcdir_header[1:3] + topsrcdir_header[4:]
# A relative path from the objdir to the topsrcdir
relative_topsrcdir = gyp.common.RelativePath(topsrcdir, objdir)
# The directory containing the gyp file on which gyp was invoked.
@ -399,7 +401,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
# The relative path from objdir to gyp_file_dir
srcdir = gyp.common.RelativePath(gyp_file_dir, objdir)
# The absolute path to the source dir
abs_srcdir = topsrcdir + "/" + relative_srcdir
abs_srcdir = topsrcdir_header + "/" + relative_srcdir
# The path to get up to the root of the objdir from the output dir.
depth = getdepth(relative_srcdir)
# The output directory.
@ -422,23 +424,17 @@ def GenerateOutput(target_list, target_dicts, data, params):
build_file_, _, _ = gyp.common.ParseQualifiedTarget(target)
build_files.add(topsrcdir_path(build_file_))
generator = MakefileGenerator(target_dicts, data, options, depth, topsrcdir, relative_topsrcdir, relative_srcdir, output_dir, flavor)
generator = MakefileGenerator(target_dicts, data, options, depth, topsrcdir, relative_topsrcdir, relative_srcdir, output_dir, topsrcdir_header)
generator.ProcessTargets(needed_targets)
# Write the top-level makefile, which simply calls the other makefiles
topdata = {'DIRS': generator.dirs}
if generator.parallel_dirs:
topdata['PARALLEL_DIRS'] = generator.parallel_dirs
if flavor == 'win':
top = relative_topsrcdir
src = srcdir
else:
top = topsrcdir
src = abs_srcdir
WriteMakefile(makefile_path, topdata, params['build_files'][0],
depth,
swapslashes(top),
swapslashes(src),
swapslashes(topsrcdir_header),
swapslashes(abs_srcdir),
swapslashes(relative_srcdir))
scriptname = topsrcdir_path(__file__)
# Reassemble a commandline from parts so that all the paths are correct