summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authormichaelbai@google.com <michaelbai@google.com@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-02-10 19:26:26 +0000
committermichaelbai@google.com <michaelbai@google.com@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-02-10 19:26:26 +0000
commit0d03514a1a95cd83126ba35102c4277555603577 (patch)
tree3a9b23cc676b9aa4f20f03044fbcbd46892f0f51 /build
parentd1e7facca966ca4b7632940d71f62deea5094083 (diff)
downloadwebrtc-0d03514a1a95cd83126ba35102c4277555603577.tar.gz
Revert "Use libvpx's obj_int_extract and unpack_lib_posix to generate offset header file."
This reverts commit 7686f0ddda717a9e776be0e219f039f68a10f9ed. BUG= TBR=andrew@webrtc.org, fischman@webrtc.org, Review URL: https://webrtc-codereview.appspot.com/8369004 git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@5520 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'build')
-rw-r--r--build/common.gypi5
-rw-r--r--build/generate_asm_header.gypi79
-rw-r--r--build/generate_asm_header.py74
3 files changed, 154 insertions, 4 deletions
diff --git a/build/common.gypi b/build/common.gypi
index d8b958aa..e4a4b09b 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -25,13 +25,11 @@
'webrtc_root%': '<(DEPTH)/third_party/webrtc',
'apk_tests_path%': '<(DEPTH)/third_party/webrtc/build/apk_tests.gyp',
'modules_java_gyp_path%': '<(DEPTH)/third_party/webrtc/modules/modules_java_chromium.gyp',
- 'gen_core_neon_offsets_gyp%': '<(DEPTH)/third_party/webrtc/modules/audio_processing/gen_core_neon_offsets_chromium.gyp',
}, {
'build_with_libjingle%': 0,
'webrtc_root%': '<(DEPTH)/webrtc',
'apk_tests_path%': '<(DEPTH)/webrtc/build/apk_test_noop.gyp',
'modules_java_gyp_path%': '<(DEPTH)/webrtc/modules/modules_java.gyp',
- 'gen_core_neon_offsets_gyp%':'<(DEPTH)/webrtc/modules/audio_processing/gen_core_neon_offsets.gyp',
}],
],
},
@@ -40,7 +38,7 @@
'webrtc_root%': '<(webrtc_root)',
'apk_tests_path%': '<(apk_tests_path)',
'modules_java_gyp_path%': '<(modules_java_gyp_path)',
- 'gen_core_neon_offsets_gyp%': '<(gen_core_neon_offsets_gyp)',
+
'webrtc_vp8_dir%': '<(webrtc_root)/modules/video_coding/codecs/vp8',
'rbe_components_path%': '<(webrtc_root)/modules/remote_bitrate_estimator',
'include_opus%': 1,
@@ -50,7 +48,6 @@
'webrtc_root%': '<(webrtc_root)',
'apk_tests_path%': '<(apk_tests_path)',
'modules_java_gyp_path%': '<(modules_java_gyp_path)',
- 'gen_core_neon_offsets_gyp%': '<(gen_core_neon_offsets_gyp)',
'webrtc_vp8_dir%': '<(webrtc_vp8_dir)',
'include_opus%': '<(include_opus)',
'rbe_components_path%': '<(rbe_components_path)',
diff --git a/build/generate_asm_header.gypi b/build/generate_asm_header.gypi
new file mode 100644
index 00000000..4600bb19
--- /dev/null
+++ b/build/generate_asm_header.gypi
@@ -0,0 +1,79 @@
+# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+# This file is meant to be included into a target to provide an action
+# to generate C header files. These headers include definitions
+# that can be used in ARM assembly files.
+#
+# To use this, create a gyp target with the following form:
+# {
+# 'target_name': 'my_asm_headers_lib',
+# 'type': 'static_library',
+# 'sources': [
+# 'foo.c',
+# 'bar.c',
+# ],
+# 'includes': ['path/to/this/gypi/file'],
+# }
+#
+# The headers are guaranteed to be generated before any
+# source files, even within this target, are compiled.
+#
+# The 'asm_header_dir' variable specifies the path suffix that output
+# files are generated under.
+
+# TODO(kma): port this block from Android into other build systems.
+{
+ 'variables': {
+ 'out_dir': '<(SHARED_INTERMEDIATE_DIR)/<(asm_header_dir)',
+ 'process_outputs_as_sources': 1,
+ 'conditions': [
+ # We only support Android and iOS.
+ ['OS=="android"', {
+ 'compiler_to_use':
+ '<!(/bin/echo -n ${ANDROID_GOMA_WRAPPER} <(android_toolchain)/*-gcc)',
+ 'compiler_options': '-I<(webrtc_root)/.. -I<@(android_ndk_include) -S',
+ 'pattern_to_detect': 'offset_',
+ }],
+ ['OS=="ios"', {
+ 'compiler_to_use': 'clang',
+ 'compiler_options':
+ '-arch armv7 -I<(webrtc_root)/.. -isysroot $(SDKROOT) -S',
+ 'pattern_to_detect': '_offset_',
+ }],
+ ]
+ },
+ 'rules': [
+ {
+ 'rule_name': 'generate_asm_header',
+ 'extension': 'c',
+ 'inputs': [
+ 'generate_asm_header.py',
+ ],
+ 'outputs': [
+ '<(out_dir)/<(RULE_INPUT_ROOT).h',
+ ],
+ 'action': [
+ 'python',
+ '<(webrtc_root)/build/generate_asm_header.py',
+ '--compiler=<(compiler_to_use)',
+ '--options=<(compiler_options)',
+ '--pattern=<(pattern_to_detect)',
+ '--dir=<(out_dir)',
+ '<(RULE_INPUT_PATH)',
+ ],
+ 'message': 'Generating assembly header files',
+ 'process_outputs_as_sources': 1,
+ },
+ ],
+ 'direct_dependent_settings': {
+ 'include_dirs': ['<(out_dir)',],
+ },
+ # This target exports a hard dependency because it generates header files.
+ 'hard_dependency': 1,
+}
diff --git a/build/generate_asm_header.py b/build/generate_asm_header.py
new file mode 100644
index 00000000..c159d507
--- /dev/null
+++ b/build/generate_asm_header.py
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
+#
+# Use of this source code is governed by a BSD-style license
+# that can be found in the LICENSE file in the root of the source
+# tree. An additional intellectual property rights grant can be found
+# in the file PATENTS. All contributing project authors may
+# be found in the AUTHORS file in the root of the source tree.
+
+"""This script is a tool to generate special header files from input
+C source files.
+
+It first assembles the input source files to generate intermediate assembly
+files (*.s). Then it parses the .s files and finds declarations of variables
+whose names start with the string specified as the third argument in the
+command-line, translates the variable names and values into constant defines
+and writes them into header files.
+"""
+
+import os
+import re
+import subprocess
+import sys
+from optparse import OptionParser
+
+def main(argv):
+ parser = OptionParser()
+ usage = 'Usage: %prog [options] input_filename'
+ parser.set_usage(usage)
+ parser.add_option('--compiler', default = 'gcc', help = 'compiler name')
+ parser.add_option('--options', default = '-S', help = 'compiler options')
+ parser.add_option('--pattern', default = 'offset_', help = 'A match pattern'
+ ' used for searching the relevant constants.')
+ parser.add_option('--dir', default = '.', help = 'output directory')
+ (options, args) = parser.parse_args()
+
+ # Generate complete intermediate and header file names.
+ input_filename = args[0]
+ output_root = (options.dir + '/' +
+ os.path.splitext(os.path.basename(input_filename))[0])
+ interim_filename = output_root + '.s'
+ out_filename = output_root + '.h'
+
+ # Set the shell command with the compiler and options inputs.
+ compiler_command = (options.compiler + " " + options.options + " " +
+ input_filename + " -o " + interim_filename)
+
+ # Run the shell command and generate the intermediate file.
+ subprocess.check_call(compiler_command, shell=True)
+
+ interim_file = open(interim_filename) # The intermediate file.
+ out_file = open(out_filename, 'w') # The output header file.
+
+ # Generate the output header file.
+ while True:
+ line = interim_file.readline()
+ if not line: break
+ if line.startswith(options.pattern):
+ # Find name of the next constant and write to the output file.
+ const_name = re.sub(r'^_', '', line.split(':')[0])
+ out_file.write('#define %s ' % const_name)
+
+ # Find value of the constant we just found and write to the output file.
+ line = interim_file.readline()
+ const_value = filter(str.isdigit, line.split(' ')[0])
+ if const_value != '':
+ out_file.write('%s\n' % const_value)
+
+ interim_file.close()
+ out_file.close()
+
+if __name__ == "__main__":
+ main(sys.argv[1:])