def build(self): env_build = AutoToolsBuildEnvironment(self) if self.options.stdcxx == "14": if self.settings.compiler.libcxx == 'libstdc++11': env_build.cxx_flags = "-std=gnu++14 -D_GLIBCXX_USE_CXX11_ABI=1" else: env_build.cxx_flags = "-std=gnu++14 -D_GLIBCXX_USE_CXX11_ABI=0" elif self.options.stdcxx == "11": if self.settings.compiler.libcxx == 'libstdc++11': env_build.cxx_flags = "-std=gnu++11 -D_GLIBCXX_USE_CXX11_ABI=1" else: env_build.cxx_flags = "-std=gnu++11 -D_GLIBCXX_USE_CXX11_ABI=0" elif self.options.stdcxx == "98": env_build.cxx_flags = "-std=gnu++98" env_build.fpic = True tools.mkdir("build") # make sure timestamps are correct to avoid invocation of autoconf tools tools.touch("%s/aclocal.m4" % os.path.join(self.source_folder, self.source_subfolder)) tools.touch("%s/Makefile.in" % os.path.join(self.source_folder, self.source_subfolder)) tools.touch("%s/configure" % os.path.join(self.source_folder, self.source_subfolder)) env_build.libs.remove('systemc') with tools.chdir("build"): env_build.configure( configure_dir=os.path.join(self.source_folder, self.source_subfolder), args=[ '--prefix=%s' % os.path.join(self.source_folder, 'install'), '--with-systemc=%s' % self.deps_cpp_info["SystemC"].rootpath, '--enable-static=no --enable-shared=yes' if self.options.shared else '--enable-static=yes --enable-shared=no' #'--disable-debug', #'--disable-opt' ]) env_build.make() env_build.make(args=["install"])
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()