Bug 950290 - Move python scripts from build/autoconf into a mozbuild submodule. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 17 Dec 2013 11:13:08 +0900
changeset 160759 512ed7cfb2cf6e01093455c43b539580160a78b1
parent 160758 f6fffc162c1a009a436d7e40c729e24391abe4ad
child 160760 9dfdd4d1088c2da156f0162f758876b6f6b52568
push id25848
push usercbook@mozilla.com
push dateTue, 17 Dec 2013 11:46:20 +0000
treeherdermozilla-central@03ff4ad4bc05 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs950290
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 950290 - Move python scripts from build/autoconf into a mozbuild submodule. r=gps
build/autoconf/check_debug_ranges.py
build/autoconf/compiler-opts.m4
build/autoconf/libstdcxx.py
configure.in
js/src/build/autoconf/check_debug_ranges.py
js/src/build/autoconf/compiler-opts.m4
python/mozbuild/mozbuild/configure/__init__.py
python/mozbuild/mozbuild/configure/check_debug_ranges.py
python/mozbuild/mozbuild/configure/libstdcxx.py
--- a/build/autoconf/compiler-opts.m4
+++ b/build/autoconf/compiler-opts.m4
@@ -303,18 +303,18 @@ if test "$GNU_CC" -a "$GCC_USE_GNU_LD" -
         AC_CACHE_CHECK([whether removing dead symbols breaks debugging],
             GC_SECTIONS_BREAKS_DEBUG_RANGES,
             [echo 'int foo() {return 42;}' \
                   'int bar() {return 1;}' \
                   'int main() {return foo();}' > conftest.${ac_ext}
             if AC_TRY_COMMAND([${CC-cc} -o conftest.${ac_objext} $CFLAGS $MOZ_DEBUG_FLAGS -c conftest.${ac_ext} 1>&2]) &&
                 AC_TRY_COMMAND([${CC-cc} -o conftest${ac_exeext} $LDFLAGS $MOZ_DEBUG_FLAGS -Wl,--gc-sections conftest.${ac_objext} $LIBS 1>&2]) &&
                 test -s conftest${ac_exeext} -a -s conftest.${ac_objext}; then
-                 if test "`$PYTHON "$_topsrcdir"/build/autoconf/check_debug_ranges.py conftest.${ac_objext} conftest.${ac_ext}`" = \
-                         "`$PYTHON "$_topsrcdir"/build/autoconf/check_debug_ranges.py conftest${ac_exeext} conftest.${ac_ext}`"; then
+                 if test "`$PYTHON -m mozbuild.configure.check_debug_ranges conftest.${ac_objext} conftest.${ac_ext}`" = \
+                         "`$PYTHON -m mozbuild.configure.check_debug_ranges conftest${ac_exeext} conftest.${ac_ext}`"; then
                      GC_SECTIONS_BREAKS_DEBUG_RANGES=no
                  else
                      GC_SECTIONS_BREAKS_DEBUG_RANGES=yes
                  fi
              else
                   dnl We really don't expect to get here, but just in case
                   GC_SECTIONS_BREAKS_DEBUG_RANGES="no, but it's broken in some other way"
              fi
--- a/configure.in
+++ b/configure.in
@@ -7207,17 +7207,17 @@ dnl = libstdc++ compatibility hacks
 dnl ========================================================
 
 STDCXX_COMPAT=
 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
 [  --enable-stdcxx-compat  Enable compatibility with older libstdc++],
     STDCXX_COMPAT=1)
 
 if test -n "$STDCXX_COMPAT"; then
-   eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
+   eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON -m mozbuild.configure.libstdcxx)
    AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
    AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
 fi
 
 dnl ========================================================
 dnl =
 dnl = Profiling and Instrumenting
 dnl =
deleted file mode 100644
--- a/js/src/build/autoconf/check_debug_ranges.py
+++ /dev/null
@@ -1,60 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-# This script returns the number of items for the DW_AT_ranges corresponding
-# to a given compilation unit. This is used as a helper to find a bug in some
-# versions of GNU ld.
-
-import subprocess
-import sys
-import re
-
-def get_range_for(compilation_unit, debug_info):
-    '''Returns the range offset for a given compilation unit
-       in a given debug_info.'''
-    name = ranges = ''
-    search_cu = False
-    for nfo in debug_info.splitlines():
-        if 'DW_TAG_compile_unit' in nfo:
-            search_cu = True
-        elif 'DW_TAG_' in nfo or not nfo.strip():
-            if name == compilation_unit and ranges != '':
-                return int(ranges, 16)
-            name = ranges = ''
-            search_cu = False
-        if search_cu:
-            if 'DW_AT_name' in nfo:
-                name = nfo.rsplit(None, 1)[1]
-            elif 'DW_AT_ranges' in nfo:
-                ranges = nfo.rsplit(None, 1)[1]
-    return None
-
-def get_range_length(range, debug_ranges):
-    '''Returns the number of items in the range starting at the
-       given offset.'''
-    length = 0
-    for line in debug_ranges.splitlines():
-        m = re.match('\s*([0-9a-fA-F]+)\s+([0-9a-fA-F]+)\s+([0-9a-fA-F]+)', line)
-        if m and int(m.group(1), 16) == range:
-            length += 1
-    return length
-
-def main(bin, compilation_unit):
-    p = subprocess.Popen(['objdump', '-W', bin], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
-    (out, err) = p.communicate()
-    sections = re.split('\n(Contents of the|The section) ', out)
-    debug_info = [s for s in sections if s.startswith('.debug_info')]
-    debug_ranges = [s for s in sections if s.startswith('.debug_ranges')]
-    if not debug_ranges or not debug_info:
-        return 0
-
-    range = get_range_for(compilation_unit, debug_info[0])
-    if range is not None:
-        return get_range_length(range, debug_ranges[0])
-
-    return -1
-
-
-if __name__ == '__main__':
-    print main(*sys.argv[1:])
--- a/js/src/build/autoconf/compiler-opts.m4
+++ b/js/src/build/autoconf/compiler-opts.m4
@@ -303,18 +303,18 @@ if test "$GNU_CC" -a "$GCC_USE_GNU_LD" -
         AC_CACHE_CHECK([whether removing dead symbols breaks debugging],
             GC_SECTIONS_BREAKS_DEBUG_RANGES,
             [echo 'int foo() {return 42;}' \
                   'int bar() {return 1;}' \
                   'int main() {return foo();}' > conftest.${ac_ext}
             if AC_TRY_COMMAND([${CC-cc} -o conftest.${ac_objext} $CFLAGS $MOZ_DEBUG_FLAGS -c conftest.${ac_ext} 1>&2]) &&
                 AC_TRY_COMMAND([${CC-cc} -o conftest${ac_exeext} $LDFLAGS $MOZ_DEBUG_FLAGS -Wl,--gc-sections conftest.${ac_objext} $LIBS 1>&2]) &&
                 test -s conftest${ac_exeext} -a -s conftest.${ac_objext}; then
-                 if test "`$PYTHON "$_topsrcdir"/build/autoconf/check_debug_ranges.py conftest.${ac_objext} conftest.${ac_ext}`" = \
-                         "`$PYTHON "$_topsrcdir"/build/autoconf/check_debug_ranges.py conftest${ac_exeext} conftest.${ac_ext}`"; then
+                 if test "`$PYTHON -m mozbuild.configure.check_debug_ranges conftest.${ac_objext} conftest.${ac_ext}`" = \
+                         "`$PYTHON -m mozbuild.configure.check_debug_ranges conftest${ac_exeext} conftest.${ac_ext}`"; then
                      GC_SECTIONS_BREAKS_DEBUG_RANGES=no
                  else
                      GC_SECTIONS_BREAKS_DEBUG_RANGES=yes
                  fi
              else
                   dnl We really don't expect to get here, but just in case
                   GC_SECTIONS_BREAKS_DEBUG_RANGES="no, but it's broken in some other way"
              fi
new file mode 100644
rename from build/autoconf/check_debug_ranges.py
rename to python/mozbuild/mozbuild/configure/check_debug_ranges.py
old mode 100755
new mode 100644
rename from build/autoconf/libstdcxx.py
rename to python/mozbuild/mozbuild/configure/libstdcxx.py