def _build_install_binutils(self, target): autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) conf_args = [ "--prefix={}".format(os.path.join(self.package_folder, target).replace("\\", "/")), "--disable-build-warnings", "--target={}".format(target), ] autotools.flags.extend(["-DSTDC_HEADERS", "-D_FORTIFY_SOURCE=0"]) host = tools.get_gnu_triplet(str(self.settings.os), str(self.settings.arch), str(self.settings.compiler)) build = tools.get_gnu_triplet(tools.detected_os(), tools.detected_architecture(), "gcc") if tools.os_info.is_windows: build = "{}-w64-mingw32".format({ "x86": "i686", }.get(str(tools.detected_architecture()), str(tools.detected_architecture()))) if self.settings.os == "Windows": host = "{}-w64-mingw32".format({ "x86": "i686", }.get(str(self.settings.arch), str(self.settings.arch))) build_folder = os.path.join("build_binutils_{}".format(target)) tools.mkdir(build_folder) with tools.chdir(build_folder): self.output.info("Building binutils for target={}".format(target)) autotools.configure(args=conf_args, configure_dir=os.path.join(self.source_folder, "binutils"), build=build, host=host) autotools.make() autotools.install()
def system_requirements(self): if tools.os_info.is_linux: if tools.os_info.with_apt: installer = tools.SystemPackageTool() if self.settings.arch == "x86" and tools.detected_architecture() == "x86_64": arch_suffix = ':i386' installer.install("g++-multilib") else: arch_suffix = '' installer.install("{}{}".format("libgtk2.0-dev", arch_suffix)) elif tools.os_info.with_yum: installer = tools.SystemPackageTool() if self.settings.arch == "x86" and tools.detected_architecture() == "x86_64": arch_suffix = '.i686' else: arch_suffix = '' installer.install("{}{}".format("gtk2-devel", arch_suffix)) elif tools.os_info.with_pacman: if self.settings.arch == "x86" and tools.detected_architecture() == "x86_64": # Note: The packages with the "lib32-" prefix will only be # available if the user has activate Arch's multilib # repository, See # https://wiki.archlinux.org/index.php/official_repositories#multilib arch_suffix = 'lib32-' else: arch_suffix = '' installer = tools.SystemPackageTool() installer.install("{}{}".format(arch_suffix, "gtk2")) else: self.output.warn("Could not determine package manager, skipping Linux system requirements installation.")
def system_requirements(self): if os_info.is_linux: if os_info.with_apt: installer = SystemPackageTool() installer.install("build-essential") installer.install("libxmu-dev") installer.install("libxi-dev") installer.install("libgl-dev") installer.install("libosmesa-dev") if self.settings.arch == "x86" and tools.detected_architecture( ) == "x86_64": installer.install("libglu1-mesa-dev:i386") else: installer.install("libglu1-mesa-dev") elif os_info.with_yum: installer = SystemPackageTool() installer.install("libXmu-devel") installer.install("libXi-devel") installer.install("libGL-devel") if self.settings.arch == "x86" and tools.detected_architecture( ) == "x86_64": installer.install("mesa-libGLU-devel.i686") else: installer.install("mesa-libGLU-devel") else: self.output.warn( "Could not determine Linux package manager, skipping system requirements installation." )
def configure(self, configure_dir=None, args=None, build=None, host=None, target=None, pkg_config_paths=None): """ :param pkg_config_paths: Optional paths to locate the *.pc files :param configure_dir: Absolute or relative path to the configure script :param args: Optional arguments to pass to configure. :param build: In which system the program will be built. "False" skips the --build flag :param host: In which system the generated program will run. "False" skips the --host flag :param target: This option is only used to build a cross-compiling toolchain. "False" skips the --target flag When the tool chain generates executable program, in which target system the program will run. :return: None http://jingfenghanmax.blogspot.com.es/2010/09/configure-with-host-target-and-build.html https://gcc.gnu.org/onlinedocs/gccint/Configure-Terms.html """ if configure_dir: configure_dir = configure_dir.rstrip("/") else: configure_dir = "." auto_build, auto_host, auto_target = None, None, None if build is None or host is None or target is None: auto_build, auto_host, auto_target = self._get_host_build_target_flags( detected_architecture(), platform.system()) triplet_args = [] if build is not False: # Skipped by user if build or auto_build: # User specified value or automatic triplet_args.append("--build=%s" % (build or auto_build)) if host is not False: # Skipped by user if host or auto_host: # User specified value or automatic triplet_args.append("--host=%s" % (host or auto_host)) if target is not False: # Skipped by user if target or auto_target: # User specified value or automatic triplet_args.append("--target=%s" % (target or auto_target)) if pkg_config_paths: pkg_env = {"PKG_CONFIG_PATH": os.pathsep.join(pkg_config_paths)} else: # If we are using pkg_config generator automate the pcs location, otherwise it could # read wrong files pkg_env = {"PKG_CONFIG_PATH": self._conanfile.build_folder} \ if "pkg_config" in self._conanfile.generators else {} with environment_append(pkg_env): with environment_append(self.vars): configure_dir = self._adjust_path(configure_dir) self._conanfile.run('%s/configure %s %s' % (configure_dir, args_to_string(args), " ".join(triplet_args)), win_bash=self._win_bash, subsystem=self.subsystem)
def _get_host_build_target_flags(self): """Based on google search for build/host triplets, it could need a lot and complex verification""" arch_detected = detected_architecture() or platform.machine() os_detected = platform.system() arch_settings = self._conanfile.settings.get_safe("arch") os_settings = self._conanfile.settings.get_safe("os") compiler = self._conanfile.settings.get_safe("compiler") if (os_detected is None or arch_detected is None or arch_settings is None or os_settings is None): return False, False, False if not cross_building(self._conanfile.settings, os_detected, arch_detected): return False, False, False try: build = get_gnu_triplet(os_detected, arch_detected, compiler) except ConanException: build = None try: host = get_gnu_triplet(os_settings, arch_settings, compiler) except ConanException: host = None return build, host, None
def system_requirements(self): if self.settings.os == "Linux": if tools.os_info.linux_distro == "ubuntu" or tools.os_info.linux_distro == "debian": arch = '' if self.settings.arch == "x86" and tools.detected_architecture() == "x86_64": arch = ':i386' packages = ['libx11-dev', 'libglib2.0-dev', 'libgdk-pixbuf2.0-dev', 'libpango1.0-dev', 'libatk1.0-dev', 'libcairo2-dev', 'libgtk2.0-dev libglib2.0-dev', 'libgtk2.0-dev', 'libtiff-dev'] if self.options.secretstore: packages.append('libsecret-1-dev') if self.options.gl: packages.append('libgl1-mesa-dev') if self.options.webview: packages.extend(['libsoup2.4-dev', 'libwebkitgtk-3.0-dev', 'libwebkitgtk-dev']) if self.options.media: packages.extend(['libgstreamer0.10-dev', 'libgstreamer-plugins-base0.10-dev']) installer = tools.SystemPackageTool() for package in packages: installer.install(' '.join(('%s%s' % (i, arch) for i in package.split())))
def build(self): # The BoxFort CMake files use CMAKE_SYSTEM_PROCESSOR to decide which # trampoline-x.S file should be added to the sources. This is a problem # on systems that cross-compile for a different architecture. E.g. the # Docker images used by the automatic builds are still 64-bit, but # build for 32-bit. build_arch = self.settings.get_safe('arch_build') or tools.detected_architecture() target_arch = self.settings.get_safe('target_arch') or self.settings.get_safe('arch') if (build_arch != target_arch and not (os.getenv('CONAN_CMAKE_SYSTEM_PROCESSOR', False)) or os.getenv('CMAKE_SYSTEM_PROCESSOR', False)): path = '{0}/CMakeLists.txt'.format(self.source_subfolder) search = 'set (_ARCH "${CMAKE_SYSTEM_PROCESSOR}")' replace = 'set (_ARCH "{0}")'.format(target_arch) tools.replace_in_file(path, search, replace) cmake = self.configure_cmake() cmake.build() # Whether or not the package consumer should link against rt (only # applicable to static builds), depends on whether or not # CMakeLists.txt sets HAVE_LIBRT. if not self.options.shared and self.settings.os == 'Linux': build_folder = "{0}/{1}".format(self.build_folder, self.build_subfolder) have_librt_re = re.compile('^HAVE_(SHM|[A-Z_]+_RT):INTERNAL=1$') have_librt = False with open("{0}/CMakeCache.txt".format(build_folder)) as f: for line in f: if have_librt_re.match(line): have_librt = True break if have_librt: with open("{0}/static.dependencies".format(build_folder), "w") as f: f.write("pthread\n") f.write("rt\n")
def system_requirements(self): if not self.options.without_python: if os_info.is_linux: if os_info.with_apt: # @Todo This should not be done here !!! conan should not install system packages .. installer = SystemPackageTool() if self.settings.arch == "x86" and tools.detected_architecture( ) == "x86_64": arch_suffix = ':i386' installer.install("g++-multilib") else: arch_suffix = '' installer.install( "%s%s" % ("%s-dev" % self.options.python, arch_suffix)) # elif os_info.with_yum: # installer = SystemPackageTool() # if self.settings.arch == "x86" and tools.detected_architecture() == "x86_64": # arch_suffix = '.i686' # installer.install("glibc-devel.i686") # else: # arch_suffix = '' # installer.install("%s%s" % ("lttng-tools", arch_suffix)) # installer.install("%s%s" % ("lttng-ust", arch_suffix)) else: self.output.warn( "Could not determine package manager, skipping Linux system requirements installation." )
def _cross_building(self): if tools.cross_building(self): if self.settings.os == tools.detected_os(): if self.settings.arch == "x86" and tools.detected_architecture() == "x86_64": return False return True return False
def system_requirements(self): if os_info.is_linux: if os_info.with_apt: installer = SystemPackageTool() if self.settings.arch == "x86" and tools.detected_architecture( ) == "x86_64": arch_suffix = ':i386' installer.install("g++-multilib") else: arch_suffix = '' installer.install("%s%s" % ("libglu1-mesa-dev", arch_suffix)) installer.install("xorg-dev") installer.install("%s%s" % ("libx11-dev", arch_suffix)) installer.install("%s%s" % ("libxrandr-dev", arch_suffix)) installer.install("%s%s" % ("libxinerama-dev", arch_suffix)) installer.install("%s%s" % ("libxcursor-dev", arch_suffix)) installer.install("%s%s" % ("libxi-dev", arch_suffix)) elif os_info.with_yum: installer = SystemPackageTool() if self.settings.arch == "x86" and tools.detected_architecture( ) == "x86_64": arch_suffix = '.i686' installer.install("glibmm24.i686") installer.install("glibc-devel.i686") installer.install("libXrender-devel.i686") installer.install("libdrm-devel.i686") installer.install("libXdamage-devel.i686") installer.install("libxcb-devel.i686") installer.install("libX11-devel.i686") installer.install("libXxf86vm-devel.i686") installer.install("libXfixes-devel.i686") installer.install("libXext-devel.i686") installer.install("mesa-libGL-devel.i686") installer.install("libXau-devel.i686") else: arch_suffix = '' installer.install("%s%s" % ("mesa-libGLU-devel", arch_suffix)) installer.install("%s%s" % ("xorg-x11-server-devel", arch_suffix)) installer.install("%s%s" % ("libXrandr-devel", arch_suffix)) installer.install("%s%s" % ("libXinerama-devel", arch_suffix)) installer.install("%s%s" % ("libXcursor-devel", arch_suffix)) installer.install("%s%s" % ("libXi-devel", arch_suffix)) else: self.output.warn( "Could not determine package manager, skipping Linux system requirements installation." )
def system_requirements(self): if self.settings.os == "Linux": if tools.os_info.linux_distro == "ubuntu" or tools.os_info.linux_distro == "debian": arch = '' if self.settings.arch == "x86" and tools.detected_architecture( ) == "x86_64": arch = ':i386' installer = tools.SystemPackageTool() installer.install('pkg-config%s' % arch)
def config_options(self): # Checking against self.settings.* would prevent cross-building profiles from working if tools.detected_architecture() not in ["x86", "x86_64"]: raise ConanInvalidConfiguration( "Unsupported Architecture. This package currently only supports x86 and x86_64." ) if platform.system() not in ["Windows", "Darwin", "Linux"]: raise ConanInvalidConfiguration( "Unsupported System. This package currently only support Linux/Darwin/Windows" )
def system_requirements(self): if tools.os_info.is_linux: if tools.os_info.with_apt: installer = tools.SystemPackageTool() if self.settings.arch == "x86" and tools.detected_architecture() == "x86_64": installer.install("gcc-multilib") installer.install("libglu1-mesa-dev:i386") else: installer.install("libglu1-mesa-dev") elif tools.os_info.with_yum: installer = tools.SystemPackageTool() if self.settings.arch == "x86" and tools.detected_architecture() == "x86_64": installer.install("glibmm24.i686") installer.install("glibc-devel.i686") installer.install("libGLU-devel.i686") else: installer.install("libGLU-devel") else: self.output.warn("Could not determine Linux package manager, skipping system requirements installation.")
def system_requirements(self): if self.settings.os == 'Linux': if tools.os_info.with_apt: installer = tools.SystemPackageTool() if self.options.with_jack: installer.install("libjack-dev") elif tools.os_info.with_yum: installer = tools.SystemPackageTool() if self.settings.arch == "x86" and tools.detected_architecture( ) == "x86_64": installer.install("glibmm24.i686") installer.install("glibc-devel.i686") if self.options.with_jack: installer.install("jack-audio-connection-kit-devel")
def system_requirements(self): if self.settings.os == "Linux": if self.options.enable_udev: package_tool = tools.SystemPackageTool() libudev_name = "" os_info = tools.OSInfo() if os_info.with_apt: libudev_name = "libudev-dev" if tools.detected_architecture() == "x86_64" and str( self.settings.arch) == "x86": libudev_name += ":i386" elif "x86" in tools.detected_architecture( ) and "arm" in str(self.settings.arch): libudev_name += ":armhf" elif os_info.with_yum: libudev_name = "libudev-devel" if tools.detected_architecture() == "x86_64" and str( self.settings.arch) == "x86": libudev_name += ".i686" else: raise Exception( "Could not install libudev: Undefined package name for platform." ) package_tool.install(packages=libudev_name, update=True)
def system_requirements(self): if os_info.is_linux: if os_info.with_apt: installer = SystemPackageTool() if self.settings.arch == "x86" and tools.detected_architecture( ) == "x86_64": arch_suffix = ':i386' installer.install("g++-multilib") else: arch_suffix = '' installer.install("%s%s" % ("libasound2-dev", arch_suffix)) installer.install("%s%s" % ("libjack-dev", arch_suffix)) elif os_info.with_yum: installer = SystemPackageTool() if self.settings.arch == "x86" and tools.detected_architecture( ) == "x86_64": arch_suffix = '.i686' installer.install("glibmm24.i686") installer.install("glibc-devel.i686") else: arch_suffix = '' installer.install("%s%s" % ("alsa-lib-devel", arch_suffix)) installer.install( "%s%s" % ("jack-audio-connection-kit-devel", arch_suffix))
def configure(self, configure_dir=None, args=None, build=None, host=None, target=None): """ :param configure_dir: Absolute or relative path to the configure script :param args: Optional arguments to pass to configure. :param build: In which system the program will be built. "False" skips the --build flag :param host: In which system the generated program will run. "False" skips the --host flag :param target: This option is only used to build a cross-compiling toolchain. "False" skips the --target flag When the tool chain generates executable program, in which target system the program will run. :return: None http://jingfenghanmax.blogspot.com.es/2010/09/configure-with-host-target-and-build.html https://gcc.gnu.org/onlinedocs/gccint/Configure-Terms.html """ configure_dir = configure_dir or "./" auto_build, auto_host, auto_target = None, None, None if build is None or host is None or target is None: auto_build, auto_host, auto_target = self._get_host_build_target_flags( detected_architecture(), platform.system()) triplet_args = [] if build is not False: # Skipped by user if build or auto_build: # User specified value or automatic triplet_args.append("--build %s" % (build or auto_build)) if host is not False: # Skipped by user if host or auto_host: # User specified value or automatic triplet_args.append("--host %s" % (host or auto_host)) if target is not False: # Skipped by user if target or auto_target: # User specified value or automatic triplet_args.append("--target %s" % (target or auto_target)) with environment_append(self.vars): self._conanfile.run( "%sconfigure %s %s" % (configure_dir, args_to_string(args), " ".join(triplet_args)))
def configure(self, configure_dir=None, args=None, build=None, host=None, target=None): """ :param configure_dir: Absolute or relative path to the configure script :param args: Optional arguments to pass to configure. :param build: In which system the program will be built. "False" skips the --build flag :param host: In which system the generated program will run. "False" skips the --host flag :param target: This option is only used to build a cross-compiling toolchain. "False" skips the --target flag When the tool chain generates executable program, in which target system the program will run. :return: None http://jingfenghanmax.blogspot.com.es/2010/09/configure-with-host-target-and-build.html https://gcc.gnu.org/onlinedocs/gccint/Configure-Terms.html """ if configure_dir: configure_dir = configure_dir.rstrip("/") else: configure_dir = "." auto_build, auto_host, auto_target = None, None, None if build is None or host is None or target is None: auto_build, auto_host, auto_target = self._get_host_build_target_flags(detected_architecture(), platform.system()) triplet_args = [] if build is not False: # Skipped by user if build or auto_build: # User specified value or automatic triplet_args.append("--build %s" % (build or auto_build)) if host is not False: # Skipped by user if host or auto_host: # User specified value or automatic triplet_args.append("--host %s" % (host or auto_host)) if target is not False: # Skipped by user if target or auto_target: # User specified value or automatic triplet_args.append("--target %s" % (target or auto_target)) with environment_append(self.vars): self._conanfile.run("%s/configure %s %s" % (configure_dir, args_to_string(args), " ".join(triplet_args)))
def _build_install_newlib(self, target): ff = lambda a: not a.startswith("-m") autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) conf_args = [ "--prefix={}".format(os.path.join(self.package_folder, target).replace("\\", "/")), "--target={}".format(target), ] autotools.flags = list(filter(ff, autotools.flags)) autotools.cxx_flags = list(filter(ff, autotools.cxx_flags)) autotools.link_flags = list(filter(ff, autotools.link_flags)) host = tools.get_gnu_triplet(str(self.settings.os), str(self.settings.arch), str(self.settings.compiler)) build = tools.get_gnu_triplet(tools.detected_os(), tools.detected_architecture()) if tools.os_info.is_windows: build = "{}-w64-mingw32".format({ "x86": "i686" }.get(str(self.settings.arch), str(self.settings.arch))) if self.settings.os == "Windows": host = "{}-w64-mingw32".format({ "x86": "i686" }.get(str(self.settings.arch), str(self.settings.arch))) env = { "PATH": [os.path.join(self.package_folder, target, "bin")], "CPPFLAGS_FOR_TARGET": "-G0", } self.output.info("env={}".format(env)) build_folder = os.path.join("build_newlib_{}".format(target)) tools.mkdir(build_folder) with tools.chdir(build_folder): with tools.environment_append(env): self.output.info("Building newlib for target={}".format(target)) autotools.configure(args=conf_args, configure_dir=os.path.join(self.source_folder, "newlib"), build=build, host=host) autotools.make(args=["-j1"]) autotools.install()
def _get_host_build_target_flags(self): """Based on google search for build/host triplets, it could need a lot and complex verification""" arch_detected = detected_architecture() or platform.machine() os_detected = platform.system() if os_detected is None or arch_detected is None or self._arch is None or self._os is None: return False, False, False if not cross_building(self._conanfile.settings, os_detected, arch_detected): return False, False, False try: build = get_gnu_triplet(os_detected, arch_detected, self._compiler) except ConanException as exc: self._conanfile.output.warn(str(exc)) build = None try: host = get_gnu_triplet(self._os, self._arch, self._compiler) except ConanException as exc: self._conanfile.output.warn(str(exc)) host = None return build, host, None
def build(self): with tools.chdir(os.path.join(self.build_folder, self._source_subfolder)): self.run('./autogen.sh', win_bash=tools.os_info.is_windows) env_build = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) deps_libpaths = env_build.library_paths deps_libs = env_build.libs deps_defines = env_build.defines if self.settings.os_build == "Windows" and self.settings.compiler != "Visual Studio": env_build.link_flags.append("-static") libargs = list("-L\"{}\"".format(p) for p in deps_libpaths) + list("-l\"{}\"".format(l) for l in deps_libs) args = [ "PCRE_LIBS={}".format(" ".join(libargs)), "PCRE_CPPFLAGS={}".format(" ".join("-D{}".format(define) for define in deps_defines)), "--host={}".format(tools.detected_architecture()), ] if self.settings.compiler == "Visual Studio": self.output.warn("Visual Studio compiler cannot create ccache-swig. Disabling ccache-swig.") args.append("--disable-ccache") with self._build_environment(): env_build.configure(configure_dir=os.path.join(self.build_folder, self._source_subfolder), args=args) with tools.environment_append({"CONAN_CPU_COUNT": "1" if self.settings.compiler == "Visual Studio" else str(tools.cpu_count())}): env_build.make()
def system_requirements(self): if tools.os_info.is_linux: if tools.os_info.with_apt: installer = tools.SystemPackageTool() if self.settings.arch == "x86" and tools.detected_architecture( ) == "x86_64": arch_suffix = ':i386' installer.install("g++-multilib") else: arch_suffix = '' installer.install("%s%s" % ("libglu1-mesa-dev", arch_suffix)) installer.install("xorg-dev") installer.install("%s%s" % ("libx11-dev", arch_suffix)) installer.install("%s%s" % ("libxrandr-dev", arch_suffix)) installer.install("%s%s" % ("libxinerama-dev", arch_suffix)) installer.install("%s%s" % ("libxcursor-dev", arch_suffix)) installer.install("%s%s" % ("libxi-dev", arch_suffix)) elif tools.os_info.with_yum: installer = tools.SystemPackageTool() if self.settings.arch == "x86" and tools.detected_architecture( ) == "x86_64": arch_suffix = '.i686' installer.install("glibmm24.i686") installer.install("glibc-devel.i686") installer.install("libXrender-devel.i686") installer.install("libdrm-devel.i686") installer.install("libXdamage-devel.i686") installer.install("libxcb-devel.i686") installer.install("libX11-devel.i686") installer.install("libXxf86vm-devel.i686") installer.install("libXfixes-devel.i686") installer.install("libXext-devel.i686") installer.install("mesa-libGL-devel.i686") installer.install("libXau-devel.i686") else: arch_suffix = '' installer.install("%s%s" % ("mesa-libGLU-devel", arch_suffix)) installer.install("%s%s" % ("xorg-x11-server-devel", arch_suffix)) installer.install("%s%s" % ("libXrandr-devel", arch_suffix)) installer.install("%s%s" % ("libXinerama-devel", arch_suffix)) installer.install("%s%s" % ("libXcursor-devel", arch_suffix)) installer.install("%s%s" % ("libXi-devel", arch_suffix)) elif tools.os_info.with_pacman: if self.settings.arch == "x86" and tools.detected_architecture( ) == "x86_64": # Note: The packages with the "lib32-" prefix will only be # available if the user has activate Arch's multilib # repository, See # https://wiki.archlinux.org/index.php/official_repositories#multilib arch_suffix = 'lib32-' else: arch_suffix = '' installer = tools.SystemPackageTool() installer.install("%s%s" % (arch_suffix, "libx11")) installer.install("%s%s" % (arch_suffix, "libxrandr")) installer.install("%s%s" % (arch_suffix, "libxinerama")) installer.install("%s%s" % (arch_suffix, "libxcursor")) installer.install("%s%s" % (arch_suffix, "libxi")) installer.install("%s%s" % (arch_suffix, "libglvnd")) else: self.output.warn( "Could not determine package manager, skipping Linux system requirements installation." )
def cross_compiling(self): return self.os != detected_os() or self.arch != detected_architecture()
def _build_install_gcc(self, target, stage): autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) conf_args = [ "--prefix={}".format(os.path.join(self.package_folder, target).replace("\\", "/")), "--disable-build-warnings", "--target={}".format(target), "--with-newlib", ] env = {} if stage == 1: conf_args.extend([ "--enable-languages=c", "--without-headers", ]) else: conf_args.extend([ "--enable-languages=c,c++", "--with-headers={}".format(tools.unix_path(os.path.join(self.package_folder, target, target, "include"))), ]) ff = lambda a: not a.startswith("-m") env.update({ "CFLAGS_FOR_BUILD": " ".join(autotools.flags), "CXXFLAGS_FOR_BUILD": " ".join(autotools.cxx_flags), "LDFLAGS_FOR_BUILD": " ".join(autotools.link_flags), "CFLAGS_FOR_TARGET": " ".join(filter(ff, autotools.flags)), "CXXFLAGS_FOR_TARGET": " ".join(filter(ff, autotools.cxx_flags)), "LDFLAGS_FOR_TARGET": " ".join(filter(ff, autotools.link_flags)), }) autotools.flags = [] autotools.cxx_flags = [] autotools.link_flags = [] autotools.flags.append("-DSTDC_HEADERS") host = tools.get_gnu_triplet(str(self.settings.os), str(self.settings.arch), str(self.settings.compiler)) build = tools.get_gnu_triplet(tools.detected_os(), tools.detected_architecture()) if tools.os_info.is_windows: build = "{}-w64-mingw32".format({ "x86": "i686" }.get(str(tools.detected_architecture()), str(tools.detected_architecture()))) if self.settings.os == "Windows": host = "{}-w64-mingw32".format({ "x86": "i686" }.get(str(self.settings.arch), str(self.settings.arch))) # Apple needs to pretend to be linux if tools.os_info.is_macos: build = "{}-linux-gnu".format({ "x86": "i686" }.get(str(tools.detected_architecture()), str(tools.detected_architecture()))) if tools.is_apple_os(self.settings.os): host = "{}-linux-gnu".format({ "x86": "i686" }.get(str(self.settings.arch), str(self.settings.arch))) build_folder = os.path.join("build_gcc_stage{}_{}".format(stage, target)) tools.mkdir(build_folder) with tools.chdir(build_folder): with tools.environment_append(env): with tools.environment_append({"PATH": [os.path.join(self.package_folder, target, "bin")]}): self.output.info("Building gcc stage1 for target={}".format(target)) autotools.configure(args=conf_args, configure_dir=os.path.join(self.source_folder, "gcc"), build=build, host=host) autotools.make() autotools.install()
def test_various(self): # x86 with mock.patch("platform.machine", mock.MagicMock(return_value='i386')): self.assertEqual('x86', detected_architecture()) with mock.patch("platform.machine", mock.MagicMock(return_value='i686')): self.assertEqual('x86', detected_architecture()) with mock.patch("platform.machine", mock.MagicMock(return_value='x86_64')): self.assertEqual('x86_64', detected_architecture()) with mock.patch("platform.machine", mock.MagicMock(return_value='amd64')): self.assertEqual('x86_64', detected_architecture()) # ARM with mock.patch("platform.machine", mock.MagicMock(return_value='aarch64_be')): self.assertEqual('armv8', detected_architecture()) with mock.patch("platform.machine", mock.MagicMock(return_value='armv8b')): self.assertEqual('armv8', detected_architecture()) with mock.patch("platform.machine", mock.MagicMock(return_value='armv7l')): self.assertEqual('armv7', detected_architecture()) with mock.patch("platform.machine", mock.MagicMock(return_value='armv6l')): self.assertEqual('armv6', detected_architecture()) with mock.patch("platform.machine", mock.MagicMock(return_value='arm')): self.assertEqual('armv6', detected_architecture()) # PowerPC with mock.patch("platform.machine", mock.MagicMock(return_value='ppc64le')): self.assertEqual('ppc64le', detected_architecture()) with mock.patch("platform.machine", mock.MagicMock(return_value='ppc64')): self.assertEqual('ppc64', detected_architecture()) # MIPS with mock.patch("platform.machine", mock.MagicMock(return_value='mips')): self.assertEqual('mips', detected_architecture()) with mock.patch("platform.machine", mock.MagicMock(return_value='mips64')): self.assertEqual('mips64', detected_architecture()) # SPARC with mock.patch("platform.machine", mock.MagicMock(return_value='sparc')): self.assertEqual('sparc', detected_architecture()) with mock.patch("platform.machine", mock.MagicMock(return_value='sparc64')): self.assertEqual('sparcv9', detected_architecture())
def _is_amd64_to_i386(self): return self.settings.arch == "x86" and tools.detected_architecture( ) == "x86_64"