Add target and config info to merged lib name.

BUG=None
TEST=build merged_lib on Linux, Mac, Win

Review URL: https://webrtc-codereview.appspot.com/344014

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1487 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
andrew@webrtc.org 2012-01-20 01:32:16 +00:00
parent a191506ce9
commit f33dfa89b9
2 changed files with 17 additions and 17 deletions

View File

@ -27,7 +27,7 @@
{
'variables': {
'output_lib_name': 'webrtc',
'output_lib': '<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)<(output_lib_name)_<(OS)<(STATIC_LIB_SUFFIX)',
'output_lib': '<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)<(output_lib_name)_<(OS)_<(target_arch)_<(CONFIGURATION_NAME)<(STATIC_LIB_SUFFIX)',
},
'action_name': 'merge_libs',
'inputs': ['<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)no_op<(EXECUTABLE_SUFFIX)'],
@ -35,7 +35,7 @@
'action': ['python',
'merge_libs.py',
'<(PRODUCT_DIR)',
'<(output_lib)'],
'<(output_lib)',],
},
],
},

View File

@ -22,33 +22,33 @@ if __name__ == '__main__':
search_path = sys.argv[1]
output_lib = sys.argv[2]
from subprocess import Popen, PIPE
from subprocess import call, PIPE
if sys.platform.startswith('linux'):
Popen(["rm -f " + output_lib], shell=True)
Popen(["rm -rf " + search_path + "/obj.target/*do_not_use*"], shell=True)
Popen(["ar crs " + output_lib + " $(find " + search_path +
call(["rm -f " + output_lib], shell=True)
call(["rm -rf " + search_path + "/obj.target/*do_not_use*"], shell=True)
call(["ar crs " + output_lib + " $(find " + search_path +
"/obj.target -name *\.o)"], shell=True)
Popen(["ar crs " + output_lib + " $(find " + search_path +
call(["ar crs " + output_lib + " $(find " + search_path +
"/obj/gen -name *\.o)"], shell=True)
elif sys.platform == 'darwin':
Popen(["rm -f " + output_lib], shell=True)
Popen(["rm -f " + search_path + "/*do_not_use*"], shell=True)
Popen(["libtool -static -v -o " + output_lib + " " + search_path + "/*.a"],
shell=True)
call(["rm -f " + output_lib], shell=True)
call(["rm -f " + search_path + "/*do_not_use*"], shell=True)
call(["libtool -static -v -o " + output_lib + " " + search_path + "/*.a"],
shell=True)
elif sys.platform == 'win32':
# We need to execute a batch file to set some environment variables for the
# lib command. VS 8 uses vsvars.bat and VS 9 uses vsvars32.bat. It's
# required that at least one of them is in the system PATH. We try both and
# suppress stderr and stdout to fail silently.
Popen(["del " + output_lib], stderr=PIPE, stdout=PIPE, shell=True)
Popen(["del /F /S /Q " + search_path + "/lib/*do_not_use*"],
shell=True)
Popen(["vsvars.bat"], stderr=PIPE, stdout=PIPE, shell=True)
Popen(["vsvars32.bat"], stderr=PIPE, stdout=PIPE, shell=True)
Popen(["lib /OUT:" + output_lib + " " + search_path + "/lib/*.lib"],
call(["vsvars.bat"], stderr=PIPE, stdout=PIPE, shell=True)
call(["vsvars32.bat"], stderr=PIPE, stdout=PIPE, shell=True)
call(["del " + output_lib], shell=True)
call(["del /F /S /Q " + search_path + "/lib/*do_not_use*"],
shell=True)
call(["lib /OUT:" + output_lib + " " + search_path + "/lib/*.lib"],
shell=True)
else:
sys.stderr.write('Platform not supported: %r\n\n' % sys.platform)