def build(self): with tools.chdir("./libjson"): env_build = AutoToolsBuildEnvironment(self) env_build.flags = [] # libjson's makefile chokes if we pass this env_build.cxxflags = [] self.run( "make" ) # Run make manually so AutoToolsBuildEnvironment doesn't pass the -j parameter. That breaks the build
def _configure_autotools(self): win_bash = tools.os_info.is_windows prefix = os.path.abspath(self.package_folder) if win_bash: prefix = tools.unix_path(prefix) args = [ '--prefix=%s' % prefix, '--disable-examples', '--disable-unit-tests', '--disable-tools', '--disable-docs', '--enable-vp9-highbitdepth', '--as=yasm' ] if self.options.shared: args.extend(['--disable-static', '--enable-shared']) else: args.extend(['--disable-shared', '--enable-static']) if self.settings.os != 'Windows' and self.options.get_safe("fPIC"): args.append('--enable-pic') if self.settings.build_type == "Debug": args.append('--enable-debug') if self.settings.compiler == 'Visual Studio': if 'MT' in str(self.settings.compiler.runtime): args.append('--enable-static-msvcrt') arch = { 'x86': 'x86', 'x86_64': 'x86_64', 'armv7': 'armv7', 'armv8': 'arm64', 'mips': 'mips32', 'mips64': 'mips64', 'sparc': 'sparc' }.get(str(self.settings.arch)) build_compiler = str(self.settings.compiler) if build_compiler == 'Visual Studio': compiler = 'vs' + str(self.settings.compiler.version) elif build_compiler in ['gcc', 'clang', 'apple-clang']: compiler = 'gcc' else: raise ConanInvalidConfiguration( "Unsupported compiler '{}'.".format(build_compiler)) build_os = str(self.settings.os) if build_os == 'Windows': os_name = 'win32' if self.settings.arch == 'x86' else 'win64' elif tools.is_apple_os(build_os): if self.settings.arch in ["x86", "x86_64"]: os_name = 'darwin11' elif self.settings.arch == "armv8" and self.settings.os == "Macos": os_name = 'darwin20' else: # Unrecognized toolchain 'arm64-darwin11-gcc', see list of toolchains in ./configure --help os_name = 'darwin' elif build_os == 'Linux': os_name = 'linux' elif build_os == 'Solaris': os_name = 'solaris' elif build_os == 'Android': os_name = 'android' target = "%s-%s-%s" % (arch, os_name, compiler) args.append('--target=%s' % target) if str(self.settings.arch) in ["x86", "x86_64"]: for name in self._arch_options: if not self.options.get_safe(name): args.append('--disable-%s' % name) with tools.vcvars( self.settings ) if self.settings.compiler == 'Visual Studio' else tools.no_op(): env_build = AutoToolsBuildEnvironment(self, win_bash=win_bash) if self.settings.compiler == "Visual Studio": # gen_msvs_vcxproj.sh doesn't like custom flags env_build.cxxflags = [] env_build.flags = [] if tools.is_apple_os(self.settings.os) and self.settings.get_safe( "compiler.libcxx") == "libc++": # special case, as gcc/g++ is hard-coded in makefile, it implicitly assumes -lstdc++ env_build.link_flags.append("-stdlib=libc++") env_build.configure(args=args, configure_dir=self._source_subfolder, host=False, build=False, target=False) return env_build
def _configure_autotools(self): args = [ "--prefix={}".format(tools.unix_path(self.package_folder)), "--disable-examples", "--disable-unit-tests", "--disable-tools", "--disable-docs", "--enable-vp9-highbitdepth", "--as=yasm", ] if self.options.shared: args.extend(['--disable-static', '--enable-shared']) else: args.extend(['--disable-shared', '--enable-static']) if self.settings.os != 'Windows' and self.options.get_safe( "fPIC", True): args.append('--enable-pic') if self.settings.build_type == "Debug": args.append('--enable-debug') if self._is_msvc and "MT" in msvc_runtime_flag(self): args.append('--enable-static-msvcrt') arch = { 'x86': 'x86', 'x86_64': 'x86_64', 'armv7': 'armv7', 'armv8': 'arm64', 'mips': 'mips32', 'mips64': 'mips64', 'sparc': 'sparc' }.get(str(self.settings.arch)) if self._is_msvc: if self.settings.compiler == "Visual Studio": vc_version = self.settings.compiler.version else: vc_version = msvc_version_to_vs_ide_version( self.settings.compiler.version) compiler = "vs{}".format(vc_version) elif self.settings.compiler in ["gcc", "clang", "apple-clang"]: compiler = 'gcc' host_os = str(self.settings.os) if host_os == 'Windows': os_name = 'win32' if self.settings.arch == 'x86' else 'win64' elif tools.is_apple_os(host_os): if self.settings.arch in ["x86", "x86_64"]: os_name = 'darwin11' elif self.settings.arch == "armv8" and self.settings.os == "Macos": os_name = 'darwin20' else: # Unrecognized toolchain 'arm64-darwin11-gcc', see list of toolchains in ./configure --help os_name = 'darwin' elif host_os == 'Linux': os_name = 'linux' elif host_os == 'Solaris': os_name = 'solaris' elif host_os == 'Android': os_name = 'android' target = "%s-%s-%s" % (arch, os_name, compiler) args.append('--target=%s' % target) if str(self.settings.arch) in ["x86", "x86_64"]: for name in self._arch_options: if not self.options.get_safe(name): args.append('--disable-%s' % name) autotools = AutoToolsBuildEnvironment( self, win_bash=tools.os_info.is_windows) if self._is_msvc: # gen_msvs_vcxproj.sh doesn't like custom flags autotools.cxxflags = [] autotools.flags = [] if tools.is_apple_os(self.settings.os) and self.settings.get_safe( "compiler.libcxx") == "libc++": # special case, as gcc/g++ is hard-coded in makefile, it implicitly assumes -lstdc++ autotools.link_flags.append("-stdlib=libc++") autotools.configure(args=args, configure_dir=self._source_subfolder, host=False, build=False, target=False) return autotools