diff options
author | Jack Lloyd <[email protected]> | 2017-11-29 18:57:23 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-11-29 18:57:23 -0500 |
commit | db4ab47874e46e2a3011b43509db98fb1b0893cc (patch) | |
tree | f8c1e596d1aa8f3b8b065e7da281ba712b91824a | |
parent | 80c7a8bb6c93665dcdc9e2100b8b123c3af772b4 (diff) | |
parent | 33e468711d09430520d2404fbc7edaa6350cdfdc (diff) |
Merge GH #1319 Allow overriding ar command
-rwxr-xr-x | configure.py | 32 | ||||
-rw-r--r-- | src/build-data/cc/clang.txt | 8 | ||||
-rw-r--r-- | src/build-data/cc/ekopath.txt | 10 | ||||
-rw-r--r-- | src/build-data/cc/gcc.txt | 7 | ||||
-rw-r--r-- | src/build-data/cc/hpcc.txt | 8 | ||||
-rw-r--r-- | src/build-data/cc/icc.txt | 7 | ||||
-rw-r--r-- | src/build-data/cc/msvc.txt | 1 | ||||
-rw-r--r-- | src/build-data/cc/pgi.txt | 7 | ||||
-rw-r--r-- | src/build-data/cc/sunstudio.txt | 10 | ||||
-rw-r--r-- | src/build-data/cc/xlc.txt | 7 | ||||
-rw-r--r-- | src/build-data/makefile/gmake.in | 3 | ||||
-rw-r--r-- | src/build-data/makefile/gmake_commands.in | 9 | ||||
-rw-r--r-- | src/build-data/makefile/header.in | 7 | ||||
-rw-r--r-- | src/build-data/makefile/nmake.in | 10 | ||||
-rw-r--r-- | src/build-data/os/darwin.txt | 4 | ||||
-rw-r--r-- | src/build-data/os/ios.txt | 4 | ||||
-rw-r--r-- | src/build-data/os/llvm.txt | 3 | ||||
-rw-r--r-- | src/build-data/os/mingw.txt | 3 | ||||
-rwxr-xr-x | src/scripts/ci_build.py | 2 |
19 files changed, 38 insertions, 104 deletions
diff --git a/configure.py b/configure.py index 2d831b447..23cc1f14b 100755 --- a/configure.py +++ b/configure.py @@ -331,6 +331,9 @@ def process_command_line(args): # pylint: disable=too-many-locals help='set compiler ABI flags', default='') + target_group.add_option('--ar-command', dest='ar_command', metavar='AR', default=None, + help='set path to static archive creator') + target_group.add_option('--with-endian', metavar='ORDER', default=None, help='override byte order guess') @@ -615,6 +618,13 @@ def process_command_line(args): # pylint: disable=too-many-locals options.disable_intrinsics = parse_multiple_enable(options.disable_intrinsics) + # Take some values from environment, if not set on command line + + if options.ar_command is None: + options.ar_command = os.getenv('AR') + if options.compiler_binary is None: + options.compiler_binary = os.getenv('CXX') + return options @@ -1088,8 +1098,8 @@ class CompilerInfo(InfoObject): # pylint: disable=too-many-instance-attributes 'add_lib_dir_option': '-L', 'add_lib_option': '-l', 'add_framework_option': '-framework ', - 'compile_flags': '', - 'debug_info_flags': '', + 'compile_flags': '-c', + 'debug_info_flags': '-g', 'optimization_flags': '', 'size_optimization_flags': '', 'coverage_flags': '', @@ -1102,6 +1112,7 @@ class CompilerInfo(InfoObject): # pylint: disable=too-many-instance-attributes 'visibility_build_flags': '', 'visibility_attribute': '', 'ar_command': None, + 'ar_options': None, 'makefile_style': '' }) @@ -1110,6 +1121,7 @@ class CompilerInfo(InfoObject): # pylint: disable=too-many-instance-attributes self.add_lib_option = lex.add_lib_option self.add_lib_dir_option = lex.add_lib_dir_option self.ar_command = lex.ar_command + self.ar_options = lex.ar_options self.binary_link_commands = force_to_dict(lex.binary_link_commands) self.binary_name = lex.binary_name self.compile_flags = lex.compile_flags @@ -1306,8 +1318,8 @@ class OsInfo(InfoObject): # pylint: disable=too-many-instance-attributes 'soname_pattern_abi': '', 'soname_pattern_base': '', 'static_suffix': 'a', - 'ar_command': 'ar crs', - 'ar_needs_ranlib': False, + 'ar_command': 'ar', + 'ar_options': '', 'install_root': '/usr/local', 'header_dir': 'include', 'bin_dir': 'bin', @@ -1318,6 +1330,9 @@ class OsInfo(InfoObject): # pylint: disable=too-many-instance-attributes 'install_cmd_exec': 'install -m 755' }) + if lex.ar_command == 'ar' and lex.ar_options == '': + lex.ar_options = 'crs' + if lex.soname_pattern_base: self.soname_pattern_base = lex.soname_pattern_base if lex.soname_pattern_patch == '' and lex.soname_pattern_abi == '': @@ -1343,7 +1358,7 @@ class OsInfo(InfoObject): # pylint: disable=too-many-instance-attributes self.aliases = lex.aliases self.ar_command = lex.ar_command - self.ar_needs_ranlib = bool(lex.ar_needs_ranlib) + self.ar_options = lex.ar_options self.bin_dir = lex.bin_dir self.building_shared_supported = (True if lex.building_shared_supported == 'yes' else False) self.doc_dir = lex.doc_dir @@ -1358,9 +1373,6 @@ class OsInfo(InfoObject): # pylint: disable=too-many-instance-attributes self.static_suffix = lex.static_suffix self.target_features = lex.target_features - def ranlib_command(self): - return 'ranlib' if self.ar_needs_ranlib else 'true' - def defines(self, options): r = [] r += ['TARGET_OS_IS_%s' % (self.basename.upper())] @@ -2067,8 +2079,8 @@ def create_template_vars(source_paths, build_config, options, modules, cc, arch, 'fuzzer_libs': '' if options.fuzzer_lib is None else '%s%s' % (cc.add_lib_option, options.fuzzer_lib), 'python_exe': sys.executable, - 'ar_command': cc.ar_command or osinfo.ar_command, - 'ranlib_command': osinfo.ranlib_command(), + 'ar_command': options.ar_command or cc.ar_command or osinfo.ar_command, + 'ar_options': cc.ar_options or osinfo.ar_options, 'install_cmd_exec': osinfo.install_cmd_exec, 'install_cmd_data': osinfo.install_cmd_data, diff --git a/src/build-data/cc/clang.txt b/src/build-data/cc/clang.txt index 992748de7..cfff2e2eb 100644 --- a/src/build-data/cc/clang.txt +++ b/src/build-data/cc/clang.txt @@ -2,19 +2,11 @@ macro_name CLANG binary_name clang++ -output_to_option "-o " -add_include_dir_option -I -add_lib_dir_option -L -add_lib_option -l -add_framework_option "-framework " - lang_flags "-std=c++11 -D_REENTRANT" warning_flags "-Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual" maintainer_warning_flags "-Wunreachable-code -Wdocumentation -Qunused-arguments -Werror -Wno-error=unused-parameter -Wno-error=unreachable-code -Wno-error=deprecated-declarations" -compile_flags "-c" -debug_info_flags "-g" optimization_flags "-O3" size_optimization_flags "-Os" #sanitizer_flags "-fsanitize=address,undefined -fsanitize-coverage=edge,indirect-calls,8bit-counters -fno-sanitize-recover=undefined" diff --git a/src/build-data/cc/ekopath.txt b/src/build-data/cc/ekopath.txt index 549c21a23..c127b78f8 100644 --- a/src/build-data/cc/ekopath.txt +++ b/src/build-data/cc/ekopath.txt @@ -2,19 +2,13 @@ macro_name PATHSCALE binary_name pathCC -output_to_option "-o " -add_include_dir_option -I -add_lib_dir_option -L -add_lib_option -l - -compile_flags "-c" -debug_info_flags "-g" optimization_flags "-O3" lang_flags "-D_REENTRANT -ansi -Wno-long-long" warning_flags "-W -Wall" -ar_command "pathCC -ar -o" +ar_command pathCC +ar_options "-ar -o" shared_flags "-fPIC" diff --git a/src/build-data/cc/gcc.txt b/src/build-data/cc/gcc.txt index 7249fae8e..88e7089ce 100644 --- a/src/build-data/cc/gcc.txt +++ b/src/build-data/cc/gcc.txt @@ -2,11 +2,6 @@ macro_name GCC binary_name g++ -output_to_option "-o " -add_include_dir_option -I -add_lib_dir_option -L -add_lib_option -l - lang_flags "-std=c++11 -D_REENTRANT" # This should only contain flags which are included in GCC 4.8 @@ -14,8 +9,6 @@ warning_flags "-Wall -Wextra -Wpedantic -Wstrict-aliasing -Wstrict-overflow=5 -W maintainer_warning_flags "-Wold-style-cast -Wsuggest-override -Wshadow -Werror -Wno-error=strict-overflow -Wno-error=deprecated-declarations" -compile_flags "-c" -debug_info_flags "-g" optimization_flags "-O3" size_optimization_flags "-Os" diff --git a/src/build-data/cc/hpcc.txt b/src/build-data/cc/hpcc.txt index 2f2686d10..aa305bf82 100644 --- a/src/build-data/cc/hpcc.txt +++ b/src/build-data/cc/hpcc.txt @@ -2,15 +2,7 @@ macro_name HP_ACC binary_name aCC -output_to_option "-o " -add_include_dir_option -I -add_lib_dir_option -L -add_lib_option -l - lang_flags "-AA -ext +eh -z" - -compile_flags "-c" -debug_info_flags "-g" optimization_flags "+O2" warning_flags "+w" shared_flags "+Z" diff --git a/src/build-data/cc/icc.txt b/src/build-data/cc/icc.txt index f1b7e5a15..cdc250187 100644 --- a/src/build-data/cc/icc.txt +++ b/src/build-data/cc/icc.txt @@ -2,13 +2,6 @@ macro_name INTEL binary_name icpc -output_to_option "-o " -add_include_dir_option -I -add_lib_dir_option -L -add_lib_option -l - -compile_flags "-c" -debug_info_flags "-g" optimization_flags "-O2" size_optimization_flags "-Os" diff --git a/src/build-data/cc/msvc.txt b/src/build-data/cc/msvc.txt index 4d97f9d57..51608dcfa 100644 --- a/src/build-data/cc/msvc.txt +++ b/src/build-data/cc/msvc.txt @@ -26,6 +26,7 @@ visibility_build_flags "/DBOTAN_DLL=__declspec(dllexport)" visibility_attribute "__declspec(dllimport)" ar_command lib +ar_options "/nologo" makefile_style nmake diff --git a/src/build-data/cc/pgi.txt b/src/build-data/cc/pgi.txt index 06b2f8400..e8c65ea3a 100644 --- a/src/build-data/cc/pgi.txt +++ b/src/build-data/cc/pgi.txt @@ -2,13 +2,6 @@ macro_name PORTLAND_GROUP binary_name pgCC -output_to_option "-o " -add_include_dir_option -I -add_lib_dir_option -L -add_lib_option -l - -compile_flags "-c" -debug_info_flags "-g" optimization_flags "-fast -Minline" shared_flags "-fPIC" diff --git a/src/build-data/cc/sunstudio.txt b/src/build-data/cc/sunstudio.txt index c2fc97a01..fd87533a5 100644 --- a/src/build-data/cc/sunstudio.txt +++ b/src/build-data/cc/sunstudio.txt @@ -2,20 +2,14 @@ macro_name SUN_STUDIO binary_name CC -output_to_option "-o " -add_include_dir_option -I -add_lib_dir_option -L -add_lib_option -l - -compile_flags "-c" -debug_info_flags "-g" optimization_flags "-xO2" shared_flags "-KPIC" warning_flags "+w -erroff=truncwarn,wnoretvalue" lang_flags "-std=c++11 +p -features=extensions -D__FUNCTION__=__func__" -ar_command "CC -xar -o" +ar_command CC +ar_options "-xar -o" makefile_style gmake diff --git a/src/build-data/cc/xlc.txt b/src/build-data/cc/xlc.txt index 36eaf29d2..28620b7e1 100644 --- a/src/build-data/cc/xlc.txt +++ b/src/build-data/cc/xlc.txt @@ -2,13 +2,6 @@ macro_name XLC binary_name xlC -output_to_option "-o " -add_include_dir_option -I -add_lib_dir_option -L -add_lib_option -l - -compile_flags "-c" -debug_info_flags "-g" optimization_flags "-O2" lang_flags "-std=c++11" diff --git a/src/build-data/makefile/gmake.in b/src/build-data/makefile/gmake.in index a943392ba..c8e7017e5 100644 --- a/src/build-data/makefile/gmake.in +++ b/src/build-data/makefile/gmake.in @@ -47,8 +47,7 @@ $(TEST): $(LIBRARIES) $(TESTOBJS) $(STATIC_LIB): $(LIBOBJS) $(RM) $(STATIC_LIB) - $(AR) $(STATIC_LIB) $(LIBOBJS) - $(RANLIB) $(STATIC_LIB) + $(AR) %{ar_options} $(STATIC_LIB) $(LIBOBJS) # Fake targets .PHONY: clean distclean docs install valgrind lcov diff --git a/src/build-data/makefile/gmake_commands.in b/src/build-data/makefile/gmake_commands.in index 33c6634c3..3d492ae51 100644 --- a/src/build-data/makefile/gmake_commands.in +++ b/src/build-data/makefile/gmake_commands.in @@ -1,14 +1,5 @@ # Program aliases -AR = %{ar_command} COPY = cp -COPY_R = cp -r -CD = @cd -ECHO = @echo -INSTALL_CMD_EXEC = %{install_cmd_exec} -INSTALL_CMD_DATA = %{install_cmd_data} LN = ln -fs -MKDIR = @mkdir -MKDIR_INSTALL = @umask 022; mkdir -p -m 755 -RANLIB = %{ranlib_command} RM = @rm -f RM_R = @rm -rf diff --git a/src/build-data/makefile/header.in b/src/build-data/makefile/header.in index 9929bc4ba..de31c8a0b 100644 --- a/src/build-data/makefile/header.in +++ b/src/build-data/makefile/header.in @@ -1,9 +1,12 @@ -# Compiler Options +# Paths to relevant programs + CXX = %{cxx} %{cxx_abi_flags} LINKER = %{linker} - +AR = %{ar_command} PYTHON_EXE = %{python_exe} +# Compiler Flags + LANG_FLAGS = %{cc_lang_flags} CXXFLAGS = %{cc_compile_flags} WARN_FLAGS = %{cc_warning_flags} diff --git a/src/build-data/makefile/nmake.in b/src/build-data/makefile/nmake.in index b721ffd67..eba3a774d 100644 --- a/src/build-data/makefile/nmake.in +++ b/src/build-data/makefile/nmake.in @@ -1,14 +1,8 @@ %{header_in} ### Aliases for Common Programs -AR = %{ar_command} + COPY = copy -CD = @cd -ECHO = @echo -INSTALL = %{install_cmd_exec} -INSTALL_CMD = %{install_cmd_exec} -MKDIR = @md -MKDIR_INSTALL = @md RM = @del /Q RM_R = $(RM) /S RMDIR = @rmdir @@ -67,7 +61,7 @@ tests: $(TEST) !If "$(SO_OBJ_FLAGS)" == "" # static lib $(LIB_FILENAME): $(LIBOBJS) - $(AR) /OUT:$@ $(LIBOBJS) + $(AR) %{ar_options} /OUT:$@ $(LIBOBJS) !Else # shared lib # Creates the DLL $(SO_FILENAME) and the .lib $(LIB_FILENAME) diff --git a/src/build-data/os/darwin.txt b/src/build-data/os/darwin.txt index 6b02bd8dd..78ad4a948 100644 --- a/src/build-data/os/darwin.txt +++ b/src/build-data/os/darwin.txt @@ -4,10 +4,6 @@ soname_pattern_base "libbotan-{version_major}.dylib" soname_pattern_abi "libbotan-{version_major}.{abi_rev}.dylib" soname_pattern_patch "libbotan-{version_major}.{abi_rev}.{version_minor}.{version_patch}.dylib" -# It doesn't have the 's' option; you need to use needs ranlib -ar_command "ar cr" -ar_needs_ranlib yes - doc_dir doc <target_features> diff --git a/src/build-data/os/ios.txt b/src/build-data/os/ios.txt index 5ac6824a4..ddd283cd9 100644 --- a/src/build-data/os/ios.txt +++ b/src/build-data/os/ios.txt @@ -4,10 +4,6 @@ soname_pattern_base "libbotan-{version_major}.{version_minor}.dylib" soname_pattern_abi "libbotan-{version_major}.{version_minor}.{abi_rev}.dylib" soname_pattern_patch "libbotan-{version_major}.{version_minor}.{abi_rev}.{version_patch}.dylib" -# It doesn't have the 's' option; you need to use needs ranlib -ar_command "ar cr" -ar_needs_ranlib yes - doc_dir doc <target_features> diff --git a/src/build-data/os/llvm.txt b/src/build-data/os/llvm.txt index 119d641e4..9eeff5cba 100644 --- a/src/build-data/os/llvm.txt +++ b/src/build-data/os/llvm.txt @@ -2,7 +2,8 @@ obj_suffix bc building_shared_supported no -ar_command "llvm-link -o" +ar_command llvm-link +ar_options -o <target_features> filesystem diff --git a/src/build-data/os/mingw.txt b/src/build-data/os/mingw.txt index 45fad382d..bf4333ec0 100644 --- a/src/build-data/os/mingw.txt +++ b/src/build-data/os/mingw.txt @@ -6,9 +6,6 @@ static_suffix a building_shared_supported no -ar_command "ar crs" -ar_needs_ranlib yes - install_root /mingw header_dir include lib_dir lib diff --git a/src/scripts/ci_build.py b/src/scripts/ci_build.py index 1294921db..e7fd1e80c 100755 --- a/src/scripts/ci_build.py +++ b/src/scripts/ci_build.py @@ -129,8 +129,8 @@ def determine_flags(target, target_os, target_cpu, target_cc, cc_bin, ccache, ro else: raise Exception("Unknown cross target '%s' for iOS" % (target)) elif target == 'cross-win32': - flags += ['--cpu=x86_32', '--cc-abi-flags=-static'] cc_bin = 'i686-w64-mingw32-g++' + flags += ['--cpu=x86_32', '--cc-abi-flags=-static', '--ar-command=i686-w64-mingw32-ar'] test_cmd = [os.path.join(root_dir, 'botan-test.exe')] # No runtime prefix required for Wine else: |