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 _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 configure(self): if self.options.debian_packaging and ( self.settings.get_safe("os.platform") != "GGP" or tools.detected_os() != "Linux"): raise ConanInvalidConfiguration( "Debian packaging is only supported for GGP builds!") if self.settings.os != "Windows" and not self.options.fPIC: raise ConanInvalidConfiguration( "We only support compiling with fPIC enabled!") if self.options.with_gui and self.settings.arch == "x86": raise ConanInvalidConfiguration( "We don't actively support building the UI for 32bit platforms. Please remove this check in conanfile.py if you still want to do so!" ) self.options["abseil"].cxx_standard = 17 self.options["gtest"].no_main = True if self.options.with_gui: self.options["glew"].system_mesa = self.options.system_mesa if not self.options.system_qt: self.options["qt"].shared = True self.options["qt"].with_sqlite3 = False self.options["qt"].with_mysql = False self.options["qt"].with_pq = False self.options["qt"].with_odbc = False self.options["qt"].with_sdl2 = False self.options["qt"].with_openal = False if self.settings.os == "Windows": self.options["qt"].qttools = True self.options["qt"].with_glib = False self.options["qt"].with_harfbuzz = False self.options["qt"].opengl = "dynamic"
def lib_path(self): lut = { "Macos": f"lib/lib{self.name}.{self.version}.dylib", "Windows": f"bin/lib{self.name}.{self.version}.dll", "Linux": f"lib/lib{self.name}.so.{self.version}", } return lut.get(tools.detected_os(), lut["Linux"])
def configure(self): if self.options.debian_packaging and ( self.settings.get_safe("os.platform") != "GGP" or tools.detected_os() != "Linux"): raise ConanInvalidConfiguration( "Debian packaging is only supported for GGP builds!") self.options["abseil"].cxx_standard = 17 if self.options.with_gui: self.options["glew"].system_mesa = self.options.system_mesa self.options["freeglut"].system_mesa = self.options.system_mesa if not self.options.system_qt: self.options["qt"].shared = True self.options["qt"].with_sqlite3 = False self.options["qt"].with_mysql = False self.options["qt"].with_pq = False self.options["qt"].with_odbc = False self.options["qt"].with_sdl2 = False self.options["qt"].with_openal = False if self.settings.os == "Windows": self.options["qt"].qttools = True self.options["qt"].with_glib = False self.options["qt"].with_harfbuzz = False
def make_lib_path(self, version): version_ext = f".{version}" if version else "" lut = { "Macos": f"lib/lib{self.name}{version_ext}.dylib", "Windows": f"bin/lib{self.name}{version_ext}.dll", "Linux": f"lib/lib{self.name}.so{version_ext}", } return lut.get(tools.detected_os(), lut["Linux"])
def package(self): if tools.detected_os() == "Windows": os.rename('djinni', 'djinni.bat') self.copy("djinni.bat", dst="bin", keep_path=False) else: self.copy("djinni", dst="bin", keep_path=False) executable = os.path.join(self.package_folder, "bin", "djinni") os.chmod(executable, os.stat(executable).st_mode | 0o111) self.copy("LICENSE", dst="licenses", keep_path=False)
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 _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_export_tools(self): with mock.patch("platform.system", mock.MagicMock(return_value='FreeBSD')): self.assertEqual(tools.detected_os(), "FreeBSD")