Ejemplo n.º 1
0
 def get_toolset_version_and_exe(self):
     compiler_version = str(self.settings.compiler.version)
     compiler = str(self.settings.compiler)
     if self.settings.compiler == "Visual Studio":
         cversion = self.settings.compiler.version
         _msvc_version = "14.1" if cversion == "15" else "%s.0" % cversion
         return "msvc", _msvc_version, ""
     elif compiler == "gcc" and compiler_version[0] >= "5":
         # For GCC >= v5 we only need the major otherwise Boost doesn't find the compiler
         # The NOT windows check is necessary to exclude MinGW:
         if not tools.which("g++-%s" % compiler_version[0]):
             # In fedora 24, 25 the gcc is 6, but there is no g++-6 and the detection is 6.3.1
             # so b2 fails because 6 != 6.3.1. Specify the exe to avoid the smart detection
             executable = tools.which("g++")
         else:
             executable = ""
         return compiler, compiler_version[0], executable
     elif str(self.settings.compiler) in ["clang", "gcc"]:
         # For GCC < v5 and Clang we need to provide the entire version string
         return compiler, compiler_version, ""
     elif self.settings.compiler == "apple-clang":
         if self.settings.os == "iOS":
             cc = tools.XCRun(self.settings, tools.apple_sdk_name(self.settings)).cc
             return "darwin", self.bjam_darwin_toolchain_version(), cc
         else:
             return "clang", compiler_version, ""
     elif self.settings.compiler == "sun-cc":
         return "sunpro", compiler_version, ""
     else:
         return compiler, compiler_version, ""
Ejemplo n.º 2
0
    def ios_build(self, config_options_string):
        def find_sysroot(sdk_name):
            return tools.XCRun(self.settings, sdk_name).sdk_path

        def find_cc(settings, sdk_name=None):
            return tools.XCRun(settings, sdk_name).cc

        command = "./Configure iphoneos-cross %s" % config_options_string

        sdk = tools.apple_sdk_name(self.settings)
        sysroot = find_sysroot(sdk)
        cc = find_cc(self.settings, sdk)

        cc += " -arch %s" % tools.to_apple_arch(self.settings.arch)
        if not str(self.settings.arch).startswith("arm"):
            cc += " -DOPENSSL_NO_ASM"

        os.environ["CROSS_SDK"] = os.path.basename(sysroot)
        os.environ["CROSS_TOP"] = os.path.dirname(os.path.dirname(sysroot))

        command = 'CC="%s" %s' % (cc, command)

        self.run_in_src(command)
        # REPLACE -install_name FOR FOLLOW THE CONAN RULES,
        # DYNLIBS IDS AND OTHER DYNLIB DEPS WITHOUT PATH, JUST THE LIBRARY NAME
        old_str = 'SHAREDFLAGS="$$SHAREDFLAGS -install_name $(INSTALLTOP)/$(LIBDIR)/$$SHLIB$'
        new_str = 'SHAREDFLAGS="$$SHAREDFLAGS -install_name $$SHLIB$'
        tools.replace_in_file("./%s/Makefile.shared" % self.subfolder, old_str,
                              new_str)
        self.output.warn("----------MAKE OPENSSL %s-------------" %
                         self.version)
        self.run_in_src("make")
Ejemplo n.º 3
0
    def bjam_darwin_toolchain_version(self):
        sdk_name = tools.apple_sdk_name(self.settings)
        if sdk_name == None:
            raise ValueError("Bad apple SDK name! "
                + "bjam_darwin_toolchain_version could be called only to build for Macos/iOS")

        sdk_version = self._xcrun_sdk_version(sdk_name)

        return {"macosx": sdk_version}.get(sdk_name, "%s~%s" % (sdk_version, sdk_name))
Ejemplo n.º 4
0
    def create_user_config_jam(self, folder):
        """To help locating the zlib and bzip2 deps"""
        self.output.warn("Patching user-config.jam")

        compiler_command = os.environ.get('CXX', None)

        contents = ""
        if self.zip_bzip2_requires_needed:
            contents = "\nusing zlib : 1.2.11 : <include>%s <search>%s <name>%s ;" % (
                self.deps_cpp_info["zlib"].include_paths[0].replace('\\', '/'),
                self.deps_cpp_info["zlib"].lib_paths[0].replace(
                    '\\', '/'), self.deps_cpp_info["zlib"].libs[0])

            contents += "\nusing bzip2 : 1.0.6 : <include>%s <search>%s <name>%s ;" % (
                self.deps_cpp_info["bzip2"].include_paths[0].replace(
                    '\\',
                    '/'), self.deps_cpp_info["bzip2"].lib_paths[0].replace(
                        '\\', '/'), self.deps_cpp_info["bzip2"].libs[0])

        contents += "\nusing python : {} : \"{}\" ;".format(
            sys.version[:3], sys.executable.replace('\\', '/'))

        toolset, version, exe = self.get_toolset_version_and_exe()
        exe = compiler_command or exe  # Prioritize CXX
        # Specify here the toolset with the binary if present if don't empty parameter : :
        contents += '\nusing "%s" : "%s" : ' % (toolset, version)
        contents += ' "%s"' % exe.replace("\\", "/")

        contents += " : \n"
        if "AR" in os.environ:
            contents += '<archiver>"%s" ' % tools.which(
                os.environ["AR"]).replace("\\", "/")
        if "RANLIB" in os.environ:
            contents += '<ranlib>"%s" ' % tools.which(
                os.environ["RANLIB"]).replace("\\", "/")
        if "CXXFLAGS" in os.environ:
            contents += '<cxxflags>"%s" ' % os.environ["CXXFLAGS"]
        if "CFLAGS" in os.environ:
            contents += '<cflags>"%s" ' % os.environ["CFLAGS"]
        if "LDFLAGS" in os.environ:
            contents += '<linkflags>"%s" ' % os.environ["LDFLAGS"]
        if "ASFLAGS" in os.environ:
            contents += '<asmflags>"%s" ' % os.environ["ASFLAGS"]

        if self.settings.os == "iOS":
            sdk_name = tools.apple_sdk_name(self.settings)
            contents += '<striper> <root>%s <architecture>%s <target-os>iphone' % (
                self.bjam_darwin_root(sdk_name),
                self.bjam_darwin_architecture(sdk_name))

        contents += " ;"

        self.output.warn(contents)
        filename = "%s/user-config.jam" % folder
        tools.save(filename, contents)
Ejemplo n.º 5
0
    def b2_macosx_version(self):
        sdk_name = tools.apple_sdk_name(self.settings)
        if sdk_name == None:
            raise ValueError("Bad apple SDK name! "
                + "b2_macosx_version could be called only to build for Macos/iOS")

        sdk_version = self._xcrun_sdk_version(sdk_name)

        return {"macosx": sdk_version,
                 "iphoneos": "iphone-%s" % sdk_version,
                 "iphonesimulator": "iphonesim-%s" % sdk_version
               }.get(sdk_name, "%s-%s" % (sdk_name, sdk_version))
Ejemplo n.º 6
0
    def _configure_autotools_vars(self):
        autotools_vars = self._autotools.vars
        # tweaks for mingw
        if self._is_mingw:
            autotools_vars["RCFLAGS"] = "-O COFF"
            if self.settings.arch == "x86":
                autotools_vars["RCFLAGS"] += " --target=pe-i386"
            else:
                autotools_vars["RCFLAGS"] += " --target=pe-x86-64"

            del autotools_vars["LIBS"]
            self.output.info("Autotools env vars: " + repr(autotools_vars))

        if tools.cross_building(self.settings):
            if self.settings.os == "iOS":
                iphoneos = tools.apple_sdk_name(self.settings)
                ios_dev_target = str(self.settings.os.version).split(".")[0]

                env_cppflags = tools.get_env("CPPFLAGS", "")
                socket_flags = " -DHAVE_SOCKET -DHAVE_FCNTL_O_NONBLOCK"
                if self.settings.arch in ["x86", "x86_64"]:
                    autotools_vars[
                        "CPPFLAGS"] = "-D__IPHONE_OS_VERSION_MIN_REQUIRED={}0000 {} {}".format(
                            ios_dev_target, socket_flags, env_cppflags)
                elif self.settings.arch in ["armv7", "armv7s", "armv8"]:
                    autotools_vars["CPPFLAGS"] = "{} {}".format(
                        socket_flags, env_cppflags)
                else:
                    raise ConanInvalidConfiguration(
                        "Unsuported iOS arch {}".format(self.settings.arch))

                cc = tools.XCRun(self.settings, iphoneos).cc
                sysroot = "-isysroot {}".format(
                    tools.XCRun(self.settings, iphoneos).sdk_path)

                if self.settings.arch == "armv8":
                    configure_arch = "arm64"
                    configure_host = "arm"  #unused, autodetected
                else:
                    configure_arch = self.settings.arch
                    configure_host = self.settings.arch  #unused, autodetected

                arch_flag = "-arch {}".format(configure_arch)
                ios_min_version = tools.apple_deployment_target_flag(
                    self.settings.os, self.settings.os.version)
                extra_flag = "-Werror=partial-availability"

                # if we debug, maybe add a -gdwarf-2 , but why would we want that?

                autotools_vars["CC"] = cc
                autotools_vars["IPHONEOS_DEPLOYMENT_TARGET"] = ios_dev_target
                env_cflags = tools.get_env("CFLAGS", "")
                autotools_vars["CFLAGS"] = "{} {} {} {}".format(
                    sysroot, arch_flag, ios_min_version, env_cflags)

                if self.options.with_openssl:
                    openssl_path = self.deps_cpp_info["openssl"].rootpath
                    openssl_libdir = self.deps_cpp_info["openssl"].libdirs[0]
                    autotools_vars["LDFLAGS"] = "{} {} -L{}/{}".format(
                        arch_flag, sysroot, openssl_path, openssl_libdir)
                elif self.options.with_wolfssl:
                    wolfssl_path = self.deps_cpp_info["wolfssl"].rootpath
                    wolfssl_libdir = self.deps_cpp_info["wolfssl"].libdirs[0]
                    autotools_vars["LDFLAGS"] = "{} {} -L{}/{}".format(
                        arch_flag, sysroot, wolfssl_path, wolfssl_libdir)
                else:
                    autotools_vars["LDFLAGS"] = "{} {}".format(
                        arch_flag, sysroot)

            elif self.settings.os == "Android":
                # nothing do to at the moment, this seems to just work
                pass

        return autotools_vars