Exemplo n.º 1
0
    def build(self):
        for src in self.exports_sources:
            shutil.copy(os.path.join(self.source_folder, src), os.path.join(self.build_folder, src))

        self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows, run_environment=True)
        with self._build_context():
            autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
            autotools.libs = []
            autotools.configure()
Exemplo n.º 2
0
 def _configure_autotools(self):
     autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
     autotools.libs = []
     yes_no = lambda v: "yes" if v else "no"
     args = [
         "--enable-shared={}".format(yes_no(self.options.shared)),
         "--enable-static={}".format(yes_no(not self.options.shared)),
     ]
     autotools.configure(args=args, configure_dir=self._source_subfolder)
     return autotools
Exemplo n.º 3
0
    def _run_makefile(self, target=None):
        target = target or ""
        autotools = AutoToolsBuildEnvironment(self)
        autotools.libs = []
        if self.settings.os == "Windows" and self.settings.compiler != "Visual Studio":
            autotools.link_flags.append("-lcrypt32")
        if self.settings.os == "Macos" and self.settings.arch == "armv8":
            # FIXME: should be handled by helper
            autotools.link_flags.append("-arch arm64")
        args = autotools.vars
        args.update({
            "PREFIX": self.package_folder,
        })
        if self.settings.compiler != "Visual Studio":
            if tools.get_env("CC"):
                args["CC"] = tools.get_env("CC")
            if tools.get_env("LD"):
                args["LD"] = tools.get_env("LD")
            if tools.get_env("AR"):
                args["AR"] = tools.get_env("AR")

            args["LIBTOOL"] = "libtool"
        arg_str = " ".join("{}=\"{}\"".format(k, v) for k, v in args.items())

        with tools.environment_append(args):
            with tools.chdir(self._source_subfolder):
                if self.settings.compiler == "Visual Studio":
                    if self.options.shared:
                        target = "tommath.dll"
                    else:
                        target = "tommath.lib"
                    with tools.vcvars(self):
                        self.run("nmake -f makefile.msvc {} {}".format(
                            target,
                            arg_str,
                        ), run_environment=True)
                else:
                    if self.settings.os == "Windows":
                        makefile = "makefile.mingw"
                        if self.options.shared:
                            target = "libtommath.dll"
                        else:
                            target = "libtommath.a"
                    else:
                        if self.options.shared:
                            makefile = "makefile.shared"
                        else:
                            makefile = "makefile.unix"
                    self.run("{} -f {} {} {} -j{}".format(
                        tools.get_env("CONAN_MAKE_PROGRAM", "make"),
                        makefile,
                        target,
                        arg_str,
                        tools.cpu_count(),
                    ), run_environment=True)
Exemplo n.º 4
0
 def build(self):
     for src in self.exports_sources:
         shutil.copy(os.path.join(self.source_folder, src),
                     self.build_folder)
     self.run("{} -fiv".format(tools.get_env("AUTORECONF")),
              run_environment=True,
              win_bash=self._settings_build.os == "Windows")
     with self._build_context():
         autotools = AutoToolsBuildEnvironment(
             self, win_bash=self._settings_build.os == "Windows")
         autotools.libs = []
         autotools.configure()
         autotools.make()
Exemplo n.º 5
0
    def _configure_autotools(self):
        autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
        autotools.libs = []
        yes_no = lambda v: "yes" if v else "no"
        args = [
            "--enable-shared={}".format(yes_no(self.options.shared)),
            "--enable-static={}".format(yes_no(not self.options.shared)),
        ]
        for option_name in self._option_names:
            option_value = getattr(self.options, option_name)
            args.append("--with-{}={}".format(option_name, yes_no(option_value)))

        autotools.configure(args=args, configure_dir=self._source_subfolder)
        return autotools
Exemplo n.º 6
0
 def _configure_autotools(self):
     autotools = AutoToolsBuildEnvironment(
         self, win_bash=tools.os_info.is_windows)
     autotools.libs = []
     if (self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) >= "12") or \
        str(self.settings.compiler) == "msvc":
         autotools.flags.append("-FS")
     yes_no = lambda v: "yes" if v else "no"
     args = [
         "--enable-shared={}".format(yes_no(self.options.shared)),
         "--enable-static={}".format(yes_no(not self.options.shared)),
     ]
     autotools.configure(args=args, configure_dir=self._source_subfolder)
     return autotools
Exemplo n.º 7
0
    def _configure_autotools(self):
        autotools = AutoToolsBuildEnvironment(
            self, win_bash=tools.os_info.is_windows)
        deps_libpaths = autotools.library_paths
        deps_libs = autotools.libs
        deps_defines = autotools.defines
        if self.settings.os == "Windows" and self.settings.compiler != "Visual Studio":
            autotools.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(self.settings.arch),
            "--with-swiglibdir={}".format(self._swiglibdir),
        ]
        if self.settings.compiler == 'gcc':
            args.append("LIBS=-ldl")

        host, build = None, None

        if self.settings.compiler == "Visual Studio":
            self.output.warn(
                "Visual Studio compiler cannot create ccache-swig. Disabling ccache-swig."
            )
            args.append("--disable-ccache")
            autotools.flags.append("-FS")
            # MSVC canonical names aren't understood
            host, build = False, False

        if self.settings.os == "Macos" and self.settings.arch == "armv8":
            # FIXME: Apple ARM should be handled by build helpers
            autotools.flags.append("-arch arm64")
            autotools.link_flags.append("-arch arm64")

        autotools.libs = []
        autotools.library_paths = []

        if self.settings.os == "Windows" and self.settings.compiler != "Visual Studio":
            autotools.libs.extend(["mingwex", "ssp"])

        autotools.configure(args=args,
                            configure_dir=self._source_subfolder,
                            host=host,
                            build=build)
        return autotools
Exemplo n.º 8
0
 def _configure_autotools(self):
     autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
     autotools.libs = []
     yes_no = lambda v: "yes" if v else "no"
     args = [
         "--enable-shared={}".format(yes_no(self.options.shared)),
         "--enable-static={}".format(yes_no(not self.options.shared)),
         "--disable-frontend",
     ]
     if self.settings.build_type == "Debug":
         args.append("--enable-debug")
     if self.settings.compiler == "clang" and self.settings.arch in ["x86", "x86_64"]:
         autotools.flags.extend(["-mmmx", "-msse"])
     autotools.configure(args=args, configure_dir=self._source_subfolder)
     return autotools
Exemplo n.º 9
0
 def _configure_autotools(self):
     autotools = AutoToolsBuildEnvironment(
         self, win_bash=tools.os_info.is_windows)
     autotools.libs = []
     yes_no = lambda v: "yes" if v else "no"
     args = [
         "--enable-static={}".format(yes_no(not self.options.shared)),
         "--enable-shared={}".format(yes_no(self.options.shared)),
         "--with-libexpat={}".format(
             yes_no(self.options.xml_backend == "expat")),
         "--with-libxml2={}".format(
             yes_no(self.options.xml_backend == "libxml2")),
         "ac_cv_func_malloc_0_nonnull=yes",
     ]
     autotools.configure(configure_dir=self._source_subfolder, args=args)
     return autotools
Exemplo n.º 10
0
 def _configure_autotools(self):
     autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
     autotools.libs = []
     yes_no = lambda v: "yes" if v else "no"
     args = [
         "--enable-static={}".format(yes_no(not self.options.shared)),
         "--enable-shared={}".format(yes_no(self.options.shared)),
         "--enable-thread={}".format(yes_no(self.options.threadsafe)),
         "--disable-fortran",
         "--disable-python",
         "--disable-python-package-system",
         "--disable-python-package-user",
         "--disable-mex-octave",
     ]
     autotools.configure(args=args, configure_dir=self._source_subfolder)
     return autotools
Exemplo n.º 11
0
 def _configure_autotools(self):
     autotools = AutoToolsBuildEnvironment(
         self, win_bash=tools.os_info.is_windows)
     autotools.libs = []
     yes_no = lambda v: "yes" if v else "no"
     args = [
         "--enable-static={}".format(yes_no(not self.options.shared)),
         "--enable-shared={}".format(yes_no(self.options.shared)),
     ]
     if self._is_msvc:
         autotools.cxx_flags.append("-EHsc")
         if not (self.settings.compiler == "Visual Studio" and \
                 tools.Version(self.settings.compiler.version) < "12"):
             autotools.flags.append("-FS")
     autotools.configure(configure_dir=self._source_subfolder, args=args)
     return autotools
Exemplo n.º 12
0
 def _configure_autotools(self):
     autotools = AutoToolsBuildEnvironment(self)
     autotools.libs = []
     yes_no = lambda v: "yes" if v else "no"
     args = [
         "--enable-shared={}".format(yes_no(self.options.shared)),
         "--enable-static={}".format(yes_no(not self.options.shared)),
         "--enable-ltdl-install",
         "--enable-iconv={}".format(yes_no(self.options.with_libiconv)),
         "--sysconfdir=/etc",
     ]
     if self.options.with_libiconv:
         libiconv_prefix = self.deps_cpp_info["libiconv"].rootpath
         args.append("--with-libiconv-prefix={}".format(libiconv_prefix))
     autotools.configure(configure_dir=self._source_subfolder, args=args)
     return autotools
Exemplo n.º 13
0
 def _configure_autotools(self):
     autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
     autotools.libs = []
     yes_no = lambda v: "yes" if v else "no"
     args = [
         "--enable-shared={}".format(yes_no(self.options.shared)),
         "--enable-static={}".format(yes_no(not self.options.shared)),
         "--disable-docs",
         "--disable-nls",
         "--sysconfdir={}".format(tools.unix_path(os.path.join(self.package_folder, "bin", "etc"))),
         "--datadir={}".format(tools.unix_path(os.path.join(self.package_folder, "bin", "share"))),
         "--datarootdir={}".format(tools.unix_path(os.path.join(self.package_folder, "bin", "share"))),
         "--localstatedir={}".format(tools.unix_path(os.path.join(self.package_folder, "bin", "var"))),
     ]
     autotools.configure(configure_dir=self._source_subfolder, args=args)
     tools.replace_in_file("Makefile", "po-conf test", "po-conf")
     return autotools
Exemplo n.º 14
0
    def build_configure(self):
        without_ext = (tuple(
            extension for extension in self.extensions
            if not getattr(self.options, "with_" + extension)))

        with tools.chdir(self.folder):
            if self.settings.compiler == "Visual Studio":
                with tools.environment_append({
                        "INCLUDE":
                        self.deps_cpp_info.include_paths,
                        "LIB":
                        self.deps_cpp_info.lib_paths
                }):
                    if self.settings.arch == "x86":
                        target = "i686-mswin32"
                    elif self.settings.arch == "x86_64":
                        target = "x64-mswin64"
                    else:
                        raise Exception("Invalid arch")
                    self.run(
                        "{} --prefix={} --target={} --without-ext=\"{},\" --disable-install-doc --disable-install-static-library"
                        .format(os.path.join("win32", "configure.bat"),
                                self.package_folder, target,
                                ",".join(without_ext)))
                    self.run("nmake")
                    self.run("nmake install")
            else:
                win_bash = tools.os_info.is_windows
                autotools = AutoToolsBuildEnvironment(self, win_bash=win_bash)
                # Remove our libs; Ruby doesn't like Conan's help
                autotools.libs = []

                args = [
                    "--with-out-ext=" + ",".join(without_ext),
                    "--disable-install-doc",
                    "--without-gmp",
                    "--enable-shared",
                    "--disable-static",
                ]

                autotools.configure(args=args)
                autotools.make()
                autotools.install()
Exemplo n.º 15
0
    def _build_static_lib_in_shared(self):
        """ Build shared library using libtool (while linking to a static library) """

        # Copy static-in-shared directory to build folder
        autotools_folder = os.path.join(self.build_folder, "static-in-shared")
        shutil.copytree(os.path.join(self.source_folder, "static-in-shared"),
                        autotools_folder)

        install_prefix = os.path.join(autotools_folder, "prefix")

        # Build static library using CMake
        cmake = CMake(self)
        cmake.definitions["CMAKE_INSTALL_PREFIX"] = install_prefix
        cmake.configure(source_folder=autotools_folder,
                        build_folder=os.path.join(autotools_folder,
                                                  "cmake_build"))
        cmake.build()
        cmake.install()

        # Copy autotools directory to build folder
        with tools.chdir(autotools_folder):
            self.run("{} -ifv -Wall".format(os.environ["AUTORECONF"]),
                     win_bash=tools.os_info.is_windows)

        with tools.chdir(autotools_folder):
            conf_args = [
                "--enable-shared",
                "--disable-static",
                "--prefix={}".format(
                    tools.unix_path(os.path.join(install_prefix))),
            ]
            with self._build_context():
                autotools = AutoToolsBuildEnvironment(
                    self, win_bash=tools.os_info.is_windows)
                autotools.libs = []
                autotools.link_flags.append("-L{}".format(
                    tools.unix_path(os.path.join(install_prefix, "lib"))))
                autotools.configure(args=conf_args,
                                    configure_dir=autotools_folder)
                autotools.make(args=["V=1"])
                autotools.install()
Exemplo n.º 16
0
    def _build_autotools(self):
        """ Test autotools integration """
        # Copy autotools directory to build folder
        shutil.copytree(os.path.join(self.source_folder, "autotools"), os.path.join(self.build_folder, "autotools"))
        with tools.chdir("autotools"):
            self.run("{} --install --verbose -Wall".format(os.environ["AUTORECONF"]), win_bash=tools.os_info.is_windows)

        tools.mkdir(self._package_folder)
        conf_args = [
            "--prefix={}".format(tools.unix_path(self._package_folder)),
            "--enable-shared", "--enable-static",
        ]

        os.mkdir("bin_autotools")
        with tools.chdir("bin_autotools"):
            with self._build_context():
                autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
                autotools.libs = []
                autotools.configure(args=conf_args, configure_dir=os.path.join(self.build_folder, "autotools"))
                autotools.make(args=["V=1"])
                autotools.install()
Exemplo n.º 17
0
 def _configure_autotools(self):
     autotools = AutoToolsBuildEnvironment(
         self, win_bash=tools.os_info.is_windows)
     autotools.libs = []
     if not self.options.shared:
         autotools.defines.append("LIBIDN_STATIC")
     if self.settings.compiler == "Visual Studio":
         if tools.Version(self.settings.compiler.version) >= "12":
             autotools.flags.append("-FS")
         autotools.link_flags.extend("-L{}".format(p.replace("\\", "/"))
                                     for p in self.deps_cpp_info.lib_paths)
     yes_no = lambda v: "yes" if v else "no"
     conf_args = [
         "--enable-shared={}".format(yes_no(self.options.shared)),
         "--enable-static={}".format(yes_no(not self.options.shared)),
         "--enable-threads={}".format(yes_no(self.options.threads)),
         "--with-libiconv-prefix={}".format(
             tools.unix_path(self.deps_cpp_info["libiconv"].rootpath)),
         "--disable-nls",
         "--disable-rpath",
     ]
     autotools.configure(args=conf_args,
                         configure_dir=self._source_subfolder)
     return autotools
Exemplo n.º 18
0
 def _configure_autotools(self):
     disabled_link_type = "static" if self.options.shared else "shared"
     debug_flag = "enable" if self._is_debug else "disable"
     ipv6_flag = "enable" if self.options.with_ipv6 else "disable"
     ssl_path = self.deps_cpp_info["openssl"].rootpath
     args = [
         "--with-defaults",
         "--without-rpm",
         "--without-pcre",
         "--disable-agent",
         "--disable-applications",
         "--disable-manuals",
         "--disable-scripts",
         "--disable-mibs",
         "--disable-embedded-perl",
         f"--disable-{disabled_link_type}",
         f"--{debug_flag}-debugging",
         f"--{ipv6_flag}-ipv6",
         f"--with-openssl={ssl_path}",
     ]
     autotools = AutoToolsBuildEnvironment(self)
     autotools.libs = []
     autotools.configure(args=args)
     return autotools
Exemplo n.º 19
0
    def build(self):
        # Source should be downloaded in the build step since it depends on specific options
        self._download_source()

        target_tag = self._target_tag
        host_tag = "x86_64-linux-gnu"

        # We currently cannot build with multilib and threads=posix. Otherwise we get the gcc compile error:
        # checking for ld that supports -Wl,--gc-sections... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
        # Makefile:11275: recipe for target 'configure-target-libstdc++-v3' failed
        build_multilib = False

        # Instructions see:
        # https://sourceforge.net/p/mingw-w64/code/HEAD/tree/trunk/mingw-w64-doc/howto-build/mingw-w64-howto-build.txt
        # and
        # https://sourceforge.net/p/mingw-w64/code/HEAD/tree/trunk/mingw-w64-doc/howto-build/mingw-w64-howto-build-adv.txt
        # also good to see specific commands:
        # https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/+/lollipop-dev/build-mingw64-toolchain.sh

        # add binutils to path. Required for gcc build
        env = {"PATH": os.environ["PATH"] + ":" + os.path.join(self.package_folder, "bin")}

        with tools.environment_append(env):
            with_gmp_mpfc_mpc = [
                "--with-gmp={}".format(self.deps_cpp_info["gmp"].rootpath.replace("\\", "/")),
                "--with-mpfr={}".format(self.deps_cpp_info["mpfr"].rootpath.replace("\\", "/")),
                "--with-mpc={}".format(self.deps_cpp_info["mpc"].rootpath.replace("\\", "/"))
            ]

            self.output.info("Building binutils ...")
            os.mkdir(os.path.join(self.build_folder, "binutils"))
            with tools.chdir(os.path.join(self.build_folder, "binutils")):
                autotools = AutoToolsBuildEnvironment(self)
                conf_args = [
                    "--enable-silent-rules",
                    "--with-sysroot={}".format(self.package_folder),
                    "--disable-nls",
                    "--disable-shared"
                ]
                if build_multilib:
                    conf_args.append("--enable-targets=x86_64-w64-mingw32,i686-w64-mingw32")
                conf_args.extend(with_gmp_mpfc_mpc)
                autotools.configure(configure_dir=os.path.join(self.build_folder, "sources", "binutils"),
                                    args=conf_args, target=target_tag, host=False, build=False)
                autotools.make()
                autotools.install()

            self.output.info("Building mingw-w64-tools ...")
            os.mkdir(os.path.join(self.build_folder, "mingw-w64-tools"))
            with tools.chdir(os.path.join(self.build_folder, "mingw-w64-tools")):
                autotools = AutoToolsBuildEnvironment(self)
                conf_args = []
                autotools.configure(configure_dir=os.path.join(self.build_folder, "sources", "mingw-w64", "mingw-w64-tools", "widl"),
                                    args=conf_args, target=target_tag, host=False, build=False)
                autotools.make()
                autotools.install()

            self.output.info("Building mingw-w64-headers ...")
            os.mkdir(os.path.join(self.build_folder, "mingw-w64-headers"))
            with tools.chdir(os.path.join(self.build_folder, "mingw-w64-headers")):
                autotools = AutoToolsBuildEnvironment(self)
                conf_args = [
                    "--enable-silent-rules",
                    "--with-widl={}".format(os.path.join(self.package_folder, "bin")),
                    "--enable-sdk=all",
                    "--prefix={}".format(os.path.join(self.package_folder, target_tag))
                ]
                autotools.configure(configure_dir=os.path.join(self.build_folder, "sources", "mingw-w64", "mingw-w64-headers"),
                                    args=conf_args, target=False, host=target_tag, build=host_tag)
                autotools.make()
                autotools.install()
                # Step 3) GCC requires the x86_64-w64-mingw32 directory be mirrored as a
                # directory 'mingw' in the same root.  So, if using configure default
                # /usr/local, type:
                #     ln -s /usr/local/x86_64-w64-mingw32 /usr/local/mingw
                #     or, for sysroot, type:
                #     ln -s /mypath/x86_64-w64-mingw32 /mypath/mingw
                self.run("ln -s {} {}".format(os.path.join(self.package_folder, target_tag),
                                              os.path.join(self.package_folder, 'mingw')))
                # Step 5) Symlink x86_64-w64-mingw32/lib directory as x86_64-w64-mingw32/lib64:
                # ln -s /usr/local/x86_64-w64-mingw32/lib /usr/local/x86_64-w64-mingw32/lib64
                # or, for sysroot:
                #     ln -s /mypath/x86_64-w64-mingw32/lib /mypath/x86_64-w64-mingw32/lib64
                self.run("ln -s {} {}".format(os.path.join(self.package_folder, target_tag, 'lib'),
                                              os.path.join(self.package_folder, target_tag, 'lib64')))

            self.output.info("Building core gcc ...")
            os.mkdir(os.path.join(self.build_folder, "gcc"))
            with tools.chdir(os.path.join(self.build_folder, "gcc")):
                autotools_gcc = AutoToolsBuildEnvironment(self)
                conf_args = [
                    "--enable-silent-rules",
                    "--enable-languages=c,c++",
                    "--with-sysroot={}".format(self.package_folder),
                    "--disable-shared"
                ]
                if build_multilib:
                    conf_args.append("--enable-targets=all")
                    conf_args.append("--enable-multilib")
                else:
                    conf_args.append("--disable-multilib")
                conf_args.extend(with_gmp_mpfc_mpc)
                if self.options.exception == "sjlj":
                    conf_args.append("--enable-sjlj-exceptions")
                if self.options.threads == "posix":
                    # Some specific options which need to be set for posix thread. Otherwise it fails compiling.
                    conf_args.extend([
                        "--enable-silent-rules",
                        "--enable-threads=posix",
                        # Not 100% sure why, but the following options are required, otherwise
                        # gcc fails to build with posix threads
                    ])
                autotools_gcc.libs = []
                autotools_gcc.configure(configure_dir=os.path.join(self.build_folder, "sources", "gcc"),
                                        args=conf_args, target=target_tag, host=False, build=False)
                autotools_gcc.make(target="all-gcc")
                autotools_gcc.make(target="install-gcc")

            env_compiler = dict(env)
            # The CC and CXX compiler must be set to the mingw compiler. Conan already sets CC and CXX, therefore we need to overwrite it.
            # If the wrong compiler is used for mingw-w64-crt, then you will get the error
            # configure: Please check if the mingw-w64 header set and the build/host option are set properly.
            env_compiler["CC"] = target_tag + "-gcc"
            env_compiler["CXX"] = target_tag + "-g++"
            with tools.environment_append(env_compiler):
                self.output.info("Building mingw-w64-crt ...")
                os.mkdir(os.path.join(self.build_folder, "mingw-w64-crt"))
                with tools.chdir(os.path.join(self.build_folder, "mingw-w64-crt")):
                    autotools = AutoToolsBuildEnvironment(self)
                    conf_args = [
                        "--enable-silent-rules",
                        "--prefix={}".format(os.path.join(self.package_folder, target_tag)),
                        "--with-sysroot={}".format(self.package_folder)
                    ]
                    if build_multilib:
                        conf_args.append("--enable-lib32")
                    autotools.configure(configure_dir=os.path.join(self.build_folder, "sources", "mingw-w64", "mingw-w64-crt"),
                                        args=conf_args, target=False, host=target_tag, build=False,
                                        use_default_install_dirs=False)
                    autotools.make()
                    autotools.install()

                if self.options.threads == "posix":
                    self.output.info("Building mingw-w64-libraries-winpthreads ...")
                    os.mkdir(os.path.join(self.build_folder, "mingw-w64-libraries-winpthreads"))
                    with tools.chdir(os.path.join(self.build_folder, "mingw-w64-libraries-winpthreads")):
                        autotools = AutoToolsBuildEnvironment(self)
                        conf_args = [
                            "--enable-silent-rules",
                            "--disable-shared",
                            "--prefix={}".format(os.path.join(self.package_folder, target_tag))
                        ]
                        autotools.configure(configure_dir=os.path.join(self.build_folder, "sources", "mingw-w64", "mingw-w64-libraries", "winpthreads"),
                                            args=conf_args, target=False, host=target_tag, build=False)
                        autotools.make()
                        autotools.install()

            self.output.info("Building libgcc ...")
            with tools.chdir(os.path.join(self.build_folder, "gcc")):
                autotools_gcc.make()
                autotools_gcc.install()

        self.output.info("Building done!")
Exemplo n.º 20
0
    def build(self):
        libdir = "%s/lib/gcc/%s" % (self.package_folder, self.version)
        tools.replace_in_file(os.path.join(self.source_folder,
                                           self._source_subfolder, "gcc",
                                           "config", "i386", "t-linux64"),
                              "m64=../lib64",
                              "m64=../lib",
                              strict=False)
        tools.replace_in_file(os.path.join(self.source_folder,
                                           self._source_subfolder, "libgcc",
                                           "config", "t-slibgcc-darwin"),
                              "@shlib_slibdir@",
                              libdir,
                              strict=False)

        pkgversion = "Conan GCC %s" % self.version
        tools.rmdir(self._build_subfolder)
        tools.mkdir(self._build_subfolder)
        condigure_dir = os.path.abspath(
            os.path.join(self.source_folder, self._source_subfolder))
        with tools.chdir(self._build_subfolder):
            # http://www.linuxfromscratch.org/lfs/view/development/chapter06/gcc.html
            args = [
                "--enable-languages=%s" % self.options.languages,
                "--disable-nls",
                "--disable-bootstrap",
                "--disable-multilib",  # this means building two architectures at once, too hard for now
                "--with-system-zlib",
                "--program-suffix=-%s" % self.version,
                "--with-bugurl=https://github.com/bincrafters/community/issues",
                "--with-pkgversion=%s" % pkgversion,
                "--libdir=%s" % libdir,
                "--with-gmp=%s" % self.deps_cpp_info["gmp"].rootpath,
                "--with-mpfr=%s" % self.deps_cpp_info["mpfr"].rootpath,
                "--with-mpc=%s" % self.deps_cpp_info["mpc"].rootpath
            ]
            args.extend(self._extra_configure_flags)
            if self.settings.os == "Macos":
                # https://github.com/Homebrew/homebrew-core/blob/master/Formula/gcc.rb
                args.extend([
                    "--with-native-system-header-dir=/usr/include",
                    "--with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
                ])
                # FIXME : unwind-dw2-fde-dip.c:36:10: fatal error: elf.h: No such file or directory
                elf_h = os.path.join(self.source_folder,
                                     self._source_subfolder, "include",
                                     "elf.h")
                if not os.path.isfile(elf_h):
                    tools.download(
                        "https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=elf/elf.h",
                        elf_h)
                    tools.replace_in_file(elf_h, "#include <features.h>", "")
            env_build = AutoToolsBuildEnvironment(self)
            env_build_vars = env_build.vars
            env_build_vars["SHELL"] = self._bash
            env_build.libs = [
            ]  # otherwise causes config.log to fail finding -lmpc
            if self.settings.compiler in [
                    "clang", "apple-clang"
            ]:  # GCC doesn't like Clang-specific flags
                if self.settings.compiler.libcxx == "libc++":
                    env_build.cxx_flags.remove("-stdlib=libc++")
                elif self.settings.compiler.libcxx in [
                        "libstdc++", "libstdc++11"
                ]:
                    env_build.cxx_flags.remove("-stdlib=libstdc++")
            env_build.configure(vars=env_build_vars,
                                args=args,
                                configure_dir=condigure_dir,
                                target=self.options.target)
            make_args = self._make_args
            make_install_args = self._make_install_args
            if self.settings.os == "Macos":
                #  Ensure correct install names when linking against libgcc_s;
                #  see discussion in https://github.com/Homebrew/legacy-homebrew/pull/34303
                make_args.append(
                    "BOOT_LDFLAGS=-Wl,-headerpad_max_install_names")
                make_install_args.append(
                    "BOOT_LDFLAGS=-Wl,-headerpad_max_install_names")
            env_build.make(vars=env_build_vars, args=make_args)
            env_build.make(vars=env_build_vars, args=make_install_args)
Exemplo n.º 21
0
    def build_configure(self):
        without_ext = (tuple(
            extension for extension in self.extensions
            if not getattr(self.options, "with_" + extension)))

        ruby_folder = os.path.join(self.build_folder, self._source_subfolder)
        if not os.path.exists(ruby_folder):
            self.source()

        with tools.chdir(ruby_folder):
            if self.settings.compiler == "Visual Studio":
                with tools.environment_append({
                        "INCLUDE":
                        self.deps_cpp_info.include_paths,
                        "LIB":
                        self.deps_cpp_info.lib_paths
                }):
                    if self.settings.arch == "x86":
                        target = "i686-mswin32"
                    elif self.settings.arch == "x86_64":
                        target = "x64-mswin64"
                    else:
                        raise Exception("Invalid arch")
                    self.run(
                        "{} --prefix={} --target={} --without-ext=\"{},\" --disable-install-doc"
                        .format(os.path.join("win32", "configure.bat"),
                                self.package_folder, target,
                                ",".join(without_ext)))

                    # Patch in runtime settings
                    def define(line):
                        tools.replace_in_file("Makefile", "CC = cl -nologo",
                                              "CC = cl -nologo\n" + line)

                    define("RUNTIMEFLAG = -{}".format(
                        self.settings.compiler.runtime))
                    if self.settings.build_type == "Debug":
                        define("COMPILERFLAG = -Zi")
                        define("OPTFLAGS = -Od -Ob0")

                    self.run("nmake")
                    self.run("nmake install")
            else:
                win_bash = tools.os_info.is_windows
                if not win_bash:
                    without_ext = (*without_ext, 'win32ole', 'win32')

                autotools = AutoToolsBuildEnvironment(self, win_bash=win_bash)
                # Remove our libs; Ruby doesn't like Conan's help
                autotools.libs = []
                if self.settings.compiler == "clang":
                    autotools.link_flags.append("--rtlib=compiler-rt")

                args = [
                    "--with-out-ext=" + ",".join(without_ext),
                    "--disable-install-doc",
                    "--without-gmp",
                    "--enable-shared",
                ]

                if self.options.with_openssl:
                    openssl_dir = self.deps_cpp_info['openssl'].rootpath
                    args.append('--with-openssl-dir={}'.format(openssl_dir))

                    if tools.os_info.is_macos:
                        # Mitigates an rbinstall linker bug
                        shutil.copy(
                            os.path.join(openssl_dir, 'lib',
                                         'libssl.1.1.dylib'),
                            './libssl.1.1.dylib')
                        shutil.copy(
                            os.path.join(openssl_dir, 'lib',
                                         'libcrypto.1.1.dylib'),
                            './libcrypto.1.1.dylib')

                if self.options.with_zlib:
                    zlib_dir = self.deps_cpp_info['zlib'].rootpath
                    args.append('--with-zlib-dir={}'.format(zlib_dir))

                    if tools.os_info.is_macos:
                        # Mitigates an rbinstall linker bug
                        shutil.copy(
                            os.path.join(zlib_dir, 'lib', 'libz.dylib'),
                            './libz.dylib')

                # Mitigate macOS ARM -> x86 cross-compiling bug
                make_program = None
                if tools.os_info.is_macos and self.settings.arch == "x86_64" and self.settings.arch_build == "armv8":
                    make_program = 'arch -x86_64 make'
                    with tools.environment_append(autotools.vars):
                        # Conan doesn't have a "configure_file" variable, so we have to add the automatically-generated variables ourselves...
                        cmd = "arch -x86_64 ./configure {} --prefix={}".format(
                            ' '.join(args), self.package_folder)
                        self.output.info("Calling:\n > {}".format(cmd))
                        self.run(cmd)
                else:
                    autotools.configure(args=args)

                autotools.make(['miniruby'], make_program)
                autotools.make(make_program=make_program)
                autotools.install(make_program=make_program)
Exemplo n.º 22
0
    def build_configure(self):
        without_ext = (tuple(
            extension for extension in self.extensions
            if not getattr(self.options, "with_" + extension)))

        with tools.chdir(self._source_subfolder):
            if self.settings.compiler == "Visual Studio":
                with tools.environment_append({
                        "INCLUDE":
                        self.deps_cpp_info.include_paths,
                        "LIB":
                        self.deps_cpp_info.lib_paths
                }):
                    if self.settings.arch == "x86":
                        target = "i686-mswin32"
                    elif self.settings.arch == "x86_64":
                        target = "x64-mswin64"
                    else:
                        raise Exception("Invalid arch")
                    self.run(
                        "{} --prefix={} --target={} --without-ext=\"{},\" --disable-install-doc"
                        .format(os.path.join("win32", "configure.bat"),
                                self.package_folder, target,
                                ",".join(without_ext)))

                    # Patch in runtime settings
                    def define(line):
                        tools.replace_in_file("Makefile", "CC = cl -nologo",
                                              "CC = cl -nologo\n" + line)

                    define("RUNTIMEFLAG = -{}".format(
                        self.settings.compiler.runtime))
                    if self.settings.build_type == "Debug":
                        define("COMPILERFLAG = -Zi")
                        define("OPTFLAGS = -Od -Ob0")

                    self.run("nmake")
                    self.run("nmake install")
            else:
                win_bash = tools.os_info.is_windows
                if win_bash:
                    self.win_bash = win_bash
                autotools = AutoToolsBuildEnvironment(self, win_bash=win_bash)
                # Remove our libs; Ruby doesn't like Conan's help
                autotools.libs = []
                if self.settings.compiler == "clang":
                    autotools.link_flags.append("--rtlib=compiler-rt")

                if self.options.msys2:
                    without_ext += ("bigdecimal")

                args = [
                    "--with-out-ext=" + ",".join(without_ext),
                    "--disable-install-doc",
                    "--without-gmp",
                    "--enable-shared",
                ]

                autotools.configure(args=args)
                autotools.make()
                autotools.install()
Exemplo n.º 23
0
 def _configure_autotools(self):
     autotools = AutoToolsBuildEnvironment(self)
     autotools.libs = []
     return autotools
Exemplo n.º 24
0
    def build(self):
        autotools = AutoToolsBuildEnvironment(self)

        # The LLVM/Clang libs get automatically added by the `requires` line,
        # but this package doesn't need to link with them.
        autotools.libs = []

        autotools.flags.append('-Oz')
        autotools.flags.append('-Wno-error')

        if platform.system() == 'Darwin':
            autotools.flags.append('-isysroot %s' %
                                   self.deps_cpp_info['macos-sdk'].rootpath)
            autotools.flags.append('-mmacosx-version-min=10.11')
            autotools.link_flags.append('-Wl,-headerpad_max_install_names')
            autotools.link_flags.append(
                '-Wl,-install_name,@rpath/libcsv.dylib')

        common_configure_args = [
            '--quiet',
            '--enable-shared',
            '--disable-static',
        ]

        env_vars = {
            'CC': self.deps_cpp_info['llvm'].rootpath + '/bin/clang',
            'CXX': self.deps_cpp_info['llvm'].rootpath + '/bin/clang++',
        }
        with tools.environment_append(env_vars):
            build_root = os.getcwd()

            self.output.info("=== Build for x86_64 ===")
            tools.mkdir(self.build_x86_dir)
            with tools.chdir(self.build_x86_dir):
                autotools.flags.append('-arch x86_64')
                autotools.link_flags.append('-arch x86_64')
                autotools.configure(configure_dir='../%s' % self.source_dir,
                                    build=False,
                                    host=False,
                                    args=common_configure_args + [
                                        '--prefix=%s/%s' %
                                        (build_root, self.install_x86_dir),
                                    ])
                autotools.make(args=['--quiet'])
                autotools.make(target='install', args=['--quiet'])

            self.output.info("=== Build for arm64 ===")
            tools.mkdir(self.build_arm_dir)
            with tools.chdir(self.build_arm_dir):
                autotools.flags.remove('-arch x86_64')
                autotools.flags.append('-arch arm64')
                autotools.link_flags.remove('-arch x86_64')
                autotools.link_flags.append('-arch arm64')
                autotools.configure(configure_dir='../%s' % self.source_dir,
                                    build=False,
                                    host=False,
                                    args=common_configure_args + [
                                        '--prefix=%s/%s' %
                                        (build_root, self.install_arm_dir),
                                        '--host=x86_64-apple-darwin15.0.0',
                                    ])
                autotools.make(args=['--quiet'])
                autotools.make(target='install', args=['--quiet'])