Esempio n. 1
0
    def visual_build(self):
        self.output.warn("----------CONFIGURING OPENSSL FOR WINDOWS. %s-------------" % self.version)
        target = self._get_target()
        no_asm = "no-asm" if self.options.no_asm else ""
        # Will output binaries to ./binaries
        with tools.vcvars(self.settings, filter_known_paths=False):

            config_command = "perl Configure %s %s --prefix=%s/binaries %s" % (target,
                                                                               no_asm,
                                                                               self.source_folder,
                                                                               self._get_flags())
            self.output.warn(config_command)
            self.run_in_src(config_command)
            self._patch_runtime()
            self.output.warn("----------MAKE OPENSSL %s-------------" % self.version)
            self.run_in_src("nmake build_libs")
Esempio n. 2
0
 def build(self):
     with tools.vcvars(self.settings) if self._use_nmake else tools.no_op():
         env_vars = {"PERL": self._perl}
         if self._full_version < "1.1.0":
             cflags = " ".join(self._get_env_build().flags)
             env_vars["CC"] = "%s %s" % (self._cc, cflags)
         if self.settings.compiler == "apple-clang":
             xcrun = tools.XCRun(self.settings)
             env_vars["CROSS_SDK"] = os.path.basename(xcrun.sdk_path)
             env_vars["CROSS_TOP"] = os.path.dirname(os.path.dirname(xcrun.sdk_path))
         with tools.environment_append(env_vars):
             if self._full_version >= "1.1.0":
                 self._create_targets()
             else:
                 self._patch_makefile_org()
             self._make()
    def run(self):
        context = tools.no_op()
        compiler = self.settings.get("compiler", None)
        if not self._exclude_vcvars_precommand:
            if compiler == "Visual Studio" and "compiler.version" in self.settings:
                compiler_set = namedtuple("compiler", "version")(
                    self.settings["compiler.version"])
                mock_sets = namedtuple(
                    "mock_settings", "arch compiler get_safe")(
                        self.settings["arch"], compiler_set,
                        lambda x: self.settings.get(x, None))
                context = tools.vcvars(mock_sets)
        with context:
            self.printer.print_rule()
            self.printer.print_profile(tools.load(self._profile_abs_path))

            with self.printer.foldable_output("conan_create"):
                name, version, user, channel = self._reference
                if self._build_policy:
                    self._build_policy = [self._build_policy]
                # https://github.com/conan-io/conan-package-tools/issues/184
                with tools.environment_append({"_CONAN_CREATE_COMMAND_": "1"}):
                    params = {
                        "name": name,
                        "version": version,
                        "user": user,
                        "channel": channel,
                        "build_modes": self._build_policy,
                        "profile_name": self._profile_abs_path
                    }
                    self.printer.print_message("Calling 'conan create'")
                    self.printer.print_dict(params)

                    r = self._conan_api.create(
                        ".",
                        name=name,
                        version=version,
                        user=user,
                        channel=channel,
                        build_modes=self._build_policy,
                        profile_name=self._profile_abs_path,
                        test_folder=self._test_folder)
                    for installed in r['installed']:
                        if installed["recipe"]["id"] == str(self._reference):
                            package_id = installed['packages'][0]['id']
                            self._uploader.upload_packages(
                                self._reference, self._upload, package_id)
Esempio n. 4
0
    def build(self):
        for patch in self.conan_data.get("patches", {}).get(self.version, []):
            tools.patch(**patch)

        if self.options.dat_package_file:
            dat_package_file = glob.glob(os.path.join(self.source_folder, self._source_subfolder, "source", "data", "in", "*.dat"))
            if dat_package_file:
                shutil.copy(str(self.options.dat_package_file), dat_package_file[0])

        if self._is_msvc:
            run_configure_icu_file = os.path.join(self._source_subfolder, "source", "runConfigureICU")

            if self.settings.compiler == "Visual Studio":
                flags = "-{}".format(self.settings.compiler.runtime)
                if tools.Version(self.settings.compiler.version) >= "12":
                    flags += " -FS"
            else:
                flags = "-{}{}".format(
                    "MT" if self.settings.runtime == "static" else "MD",
                    "d" if self.settings.runtime_type == "Debug" else "",
                )
                flags += " -FS"
            tools.replace_in_file(run_configure_icu_file, "-MDd", flags)
            tools.replace_in_file(run_configure_icu_file, "-MD", flags)

        self._workaround_icu_20545()

        env_build = self._configure_autotools()
        build_dir = os.path.join(self.build_folder, self._source_subfolder, "build")
        os.mkdir(build_dir)
        with tools.vcvars(self.settings) if self._is_msvc else tools.no_op():
            with tools.environment_append(env_build.vars):
                with tools.chdir(build_dir):
                    # workaround for https://unicode-org.atlassian.net/browse/ICU-20531
                    os.makedirs(os.path.join("data", "out", "tmp"))
                    # workaround for "No rule to make target 'out/tmp/dirs.timestamp'"
                    tools.save(os.path.join("data", "out", "tmp", "dirs.timestamp"), "")

                    self.run(self._build_config_cmd, win_bash=tools.os_info.is_windows)
                    command = "{make} {silent} -j {cpu_count}".format(make=self._make_tool,
                                                                      silent=self._silent,
                                                                      cpu_count=tools.cpu_count())
                    self.run(command, win_bash=tools.os_info.is_windows)
                    if self.options.with_unit_tests:
                        command = "{make} {silent} check".format(make=self._make_tool,
                                                                 silent=self._silent)
                        self.run(command, win_bash=tools.os_info.is_windows)
Esempio n. 5
0
 def build(self):
     if self.settings.compiler == "Visual Studio":
         os.makedirs(os.path.join(self._source_subfolder, "sys"))
         tools.download(
             "https://raw.githubusercontent.com/win32ports/unistd_h/master/unistd.h",
             os.path.join(self._source_subfolder, "unistd.h"))
         tools.download(
             "https://raw.githubusercontent.com/win32ports/sys_time_h/master/sys/time.h",
             os.path.join(self._source_subfolder, "sys", "time.h"))
     with tools.vcvars(
             self.settings
     ) if self.settings.compiler == "Visual Studio" else tools.no_op():
         with tools.chdir(self._source_subfolder):
             host = None
             build = None
             if self.settings.compiler == "Visual Studio":
                 build = False
                 if self.settings.arch == "x86":
                     host = "i686-w64-mingw32"
                 elif self.settings.arch == "x86_64":
                     host = "x86_64-w64-mingw32"
             env_build = AutoToolsBuildEnvironment(
                 self, win_bash=tools.os_info.is_windows)
             args = ["--disable-dependency-tracking", "--disable-doc"]
             if self.settings.os != "Windows" and self.options.fPIC:
                 args.append("--with-pic")
             if self.options.shared:
                 args.extend(["--disable-static", "--enable-shared"])
             else:
                 args.extend(["--disable-shared", "--enable-static"])
             if self.settings.compiler == "Visual Studio":
                 runtime = str(self.settings.compiler.runtime)
                 prefix = tools.unix_path(self.package_folder)
                 args.extend([
                     'CC=$PWD/build-aux/compile cl -nologo',
                     'CFLAGS=-%s' % runtime,
                     'CXX=$PWD/build-aux/compile cl -nologo',
                     'CXXFLAGS=-%s' % runtime,
                     'CPPFLAGS=-D_WIN32_WINNT=0x0600 -I%s/include' % prefix,
                     'LDFLAGS=-L%s/lib' % prefix, 'LD=link',
                     'NM=dumpbin -symbols', 'STRIP=:',
                     'AR=$PWD/build-aux/ar-lib lib', 'RANLIB=:'
                 ])
             env_build.configure(args=args, build=build, host=host)
             with tools.chdir("lib"):
                 env_build.make()
                 env_build.install()
Esempio n. 6
0
    def _build_windows(self):
        with tools.chdir(os.path.join(self._full_source_subfolder, 'win32')):
            debug = "yes" if self.settings.build_type == "Debug" else "no"
            static = "no" if self.options.shared else "yes"

            with tools.vcvars(self.settings):
                args = ["cscript",
                        "configure.js",
                        "compiler=msvc",
                        "prefix=%s" % self.package_folder,
                        "cruntime=/%s" % self.settings.compiler.runtime,
                        "debug=%s" % debug,
                        "static=%s" % static,
                        'include="%s"' % ";".join(self.deps_cpp_info.include_paths),
                        'lib="%s"' % ";".join(self.deps_cpp_info.lib_paths),
                        'iconv=no',
                        'xslt_debug=no',
                        'debugger=no',
                        'crypto=no']
                configure_command = ' '.join(args)
                self.output.info(configure_command)
                self.run(configure_command)

                # Fix library names because they can be not just zlib.lib
                def format_libs(package):
                    libs = []
                    for lib in self.deps_cpp_info[package].libs:
                        libname = lib
                        if not libname.endswith('.lib'):
                            libname += '.lib'
                        libs.append(libname)
                    return ' '.join(libs)

                def fix_library(option, package, old_libname):
                    if option:
                        tools.replace_in_file("Makefile.msvc",
                                              "LIBS = %s" % old_libname,
                                              "LIBS = %s" % format_libs(package))

                if "icu" in self.deps_cpp_info.deps:
                    fix_library(True, 'icu', 'wsock32.lib')

                tools.replace_in_file("Makefile.msvc", "libxml2.lib", format_libs("libxml2"))
                tools.replace_in_file("Makefile.msvc", "libxml2_a.lib", format_libs("libxml2"))

                with tools.environment_append(VisualStudioBuildEnvironment(self).vars):
                    self.run("nmake /f Makefile.msvc install")
Esempio n. 7
0
    def build(self):
        with tools.chdir(self.source_subfolder):
            build_config = "build_config.rb"
            os.rename(build_config, build_config + ".0")
            with open(build_config, "w") as f:
                f.write("MRuby::Build.new do |conf|\n")
                if self.settings.compiler == "Visual Studio":
                    f.write("  toolchain :visualcpp\n")
                else:
                    f.write("  toolchain :gcc\n")

                if self.settings.build_type == "Debug":
                    f.write("  enable_debug\n")
                if self.options.enable_cxx_abi:
                    f.write("  enable_cxx_abi\n")
                
                if self.settings.compiler != "Visual Studio":
                    env = AutoToolsBuildEnvironment(self)
                    vars = env.vars
                    c_flags = vars["CFLAGS"] + " " + vars["CPPFLAGS"]
                    f.write("  conf.cc do |cc|\n")
                    f.write("    cc.flags << %%w(%s)\n" % c_flags)
                    f.write("  end\n")
                    f.write("  conf.linker do |linker|\n")
                    f.write("    linker.flags << %%w(%s)\n" % vars["LDFLAGS"])
                    f.write("  end\n")
                else:
                    env = VisualStudioBuildEnvironment(self)
                    vars = env.vars
                    print(vars)
                    f.write("  conf.cc do |cc|\n")
                    f.write("    cc.flags << %%w(%s)\n" % vars["CL"])
                    f.write("    print(cc.flags)\n")
                    f.write("  end\n")

                
                # default gembox
                f.write("  conf.gembox 'default'\n")

                f.write("end\n")
            
            print("== generated build_config.rb ==")
            print(open(build_config, "r").read())
            print("===============================")
                
            with tools.vcvars(self.settings):
                self.run("ruby minirake")
    def _build_nmake(self, target="release"):
        # https://core.tcl.tk/tips/doc/trunk/tip/477.md
        opts = []
        if not self.options.shared:
            opts.append("static")
        if self.settings.build_type == "Debug":
            opts.append("symbols")
        if "MD" in str(self.settings.compiler.runtime):
            opts.append("msvcrt")
        else:
            opts.append("nomsvcrt")
        if "d" not in str(self.settings.compiler.runtime):
            opts.append("unchecked")
        # https://core.tcl.tk/tk/tktview?name=3d34589aa0
        # https://wiki.tcl-lang.org/page/Building+with+Visual+Studio+2017
        tcl_lib_path = os.path.join(self.deps_cpp_info["tcl"].rootpath, "lib")
        tclimplib, tclstublib = None, None
        for lib in os.listdir(tcl_lib_path):
            if not lib.endswith(".lib"):
                continue
            if lib.startswith("tcl{}".format("".join(
                    self.version.split(".")[:2]))):
                tclimplib = os.path.join(tcl_lib_path, lib)
            elif lib.startswith("tclstub{}".format("".join(
                    self.version.split(".")[:2]))):
                tclstublib = os.path.join(tcl_lib_path, lib)

        if tclimplib is None or tclstublib is None:
            raise ConanException(
                "tcl dependency misses tcl and/or tclstub library")
        with tools.vcvars(self.settings):
            tcldir = self.deps_cpp_info["tcl"].rootpath.replace("/", "\\\\")
            self.run(
                """nmake -nologo -f "{cfgdir}/makefile.vc" INSTALLDIR="{pkgdir}" OPTS={opts} TCLDIR="{tcldir}" TCL_LIBRARY="{tcl_library}" TCLIMPLIB="{tclimplib}" TCLSTUBLIB="{tclstublib}" {target}"""
                .format(
                    cfgdir=self._get_configure_folder("win"),
                    pkgdir=self.package_folder,
                    opts=",".join(opts),
                    tcldir=tcldir,
                    tclstublib=tclstublib,
                    tclimplib=tclimplib,
                    tcl_library=self.deps_env_info['tcl'].TCL_LIBRARY.replace(
                        "\\", "/"),
                    target=target,
                ),
                cwd=self._get_configure_folder("win"),
            )
Esempio n. 9
0
    def build_visual(self):
        # fully replace gif_lib.h for VS, with patched version
        ver_components = self.version.split(".")
        tools.replace_in_file('gif_lib.h', '@GIFLIB_MAJOR@', ver_components[0])
        tools.replace_in_file('gif_lib.h', '@GIFLIB_MINOR@', ver_components[1])
        tools.replace_in_file('gif_lib.h', '@GIFLIB_RELEASE@', ver_components[2])
        shutil.copy('gif_lib.h', os.path.join(self._source_subfolder, 'lib'))
        # add unistd.h for VS
        shutil.copy('unistd.h', os.path.join(self._source_subfolder, 'lib'))

        with tools.chdir(self._source_subfolder):
            if self.settings.arch == "x86":
                host = "i686-w64-mingw32"
            elif self.settings.arch == "x86_64":
                host = "x86_64-w64-mingw32"
            else:
                raise ConanInvalidConfiguration("unsupported architecture %s" % self.settings.arch)
            if self.options.shared:
                options = '--disable-static --enable-shared'
            else:
                options = '--enable-static --disable-shared'

            cflags = ''
            if not self.options.shared:
                cflags = '-DUSE_GIF_LIB'

            prefix = tools.unix_path(os.path.abspath(self.package_folder))
            with tools.vcvars(self.settings):
                command = './configure ' \
                          '{options} ' \
                          '--host={host} ' \
                          '--prefix={prefix} ' \
                          'CC="$PWD/compile cl -nologo" ' \
                          'CFLAGS="-{runtime} {cflags}" ' \
                          'CXX="$PWD/compile cl -nologo" ' \
                          'CXXFLAGS="-{runtime} {cflags}" ' \
                          'CPPFLAGS="-I{prefix}/include" ' \
                          'LDFLAGS="-L{prefix}/lib" ' \
                          'LD="link" ' \
                          'NM="dumpbin -symbols" ' \
                          'STRIP=":" ' \
                          'AR="$PWD/ar-lib lib" ' \
                          'RANLIB=":" '.format(host=host, prefix=prefix, options=options,
                                              runtime=self.settings.compiler.runtime, cflags=cflags)
                self.run(command, win_bash=True)
                self.run('make', win_bash=True)
                self.run('make install', win_bash=True)
Esempio n. 10
0
 def _upgrade_single_project_file(self, project_file):
     """
     `devenv /upgrade <project.vcxproj>` will upgrade *ALL* projects referenced by the project.
     By temporarily moving the solution project, only one project is upgraded
     This is needed for static cpython or for disabled optional dependencies (e.g. tkinter=False)
     Restore it afterwards because it is needed to build some targets.
     """
     tools.rename(os.path.join(self._source_subfolder, "PCbuild", "pcbuild.sln"),
                  os.path.join(self._source_subfolder, "PCbuild", "pcbuild.sln.bak"))
     tools.rename(os.path.join(self._source_subfolder, "PCbuild", "pcbuild.proj"),
                  os.path.join(self._source_subfolder, "PCbuild", "pcbuild.proj.bak"))
     with tools.vcvars(self.settings):
         self.run("devenv \"{}\" /upgrade".format(project_file), run_environment=True)
     tools.rename(os.path.join(self._source_subfolder, "PCbuild", "pcbuild.sln.bak"),
                  os.path.join(self._source_subfolder, "PCbuild", "pcbuild.sln"))
     tools.rename(os.path.join(self._source_subfolder, "PCbuild", "pcbuild.proj.bak"),
                  os.path.join(self._source_subfolder, "PCbuild", "pcbuild.proj"))
Esempio n. 11
0
    def build(self):
        for patch in self.conan_data.get("patches").get(self.version, []):
            tools.patch(**patch)

        with tools.chdir(self._source_subfolder):
            # README.W32
            if tools.os_info.is_windows:
                if self.settings.compiler == "Visual Studio":
                    command = "build_w32.bat --without-guile"
                else:
                    command = "build_w32.bat --without-guile gcc"
            else:
                env_build = AutoToolsBuildEnvironment(self)
                env_build.configure()
                command = "./build.sh"
            with tools.vcvars(self.settings) if self.settings.compiler == "Visual Studio" else tools.no_op():
                self.run(command)
Esempio n. 12
0
 def _build_context(self):
     if self.settings.compiler == "Visual Studio":
         with tools.vcvars(self.settings):
             env = {
                 "CC": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)),
                 "CXX": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)),
                 "LD": "link -nologo",
                 "AR": "{} lib".format(tools.unix_path(self.deps_user_info["automake"].ar_lib)),
                 "DLLTOOL": ":",
                 "OBJDUMP": ":",
                 "RANLIB": ":",
                 "STRIP": ":",
             }
             with tools.environment_append(env):
                 yield
     else:
         yield
Esempio n. 13
0
 def _build_context(self):
     if self.settings.compiler == "Visual Studio":
         with tools.vcvars(self.settings):
             env = {
                 "AR": "{}/build-aux/ar-lib lib".format(tools.unix_path(self._source_subfolder)),
                 "CC": "cl -nologo",
                 "CXX": "cl -nologo",
                 "LD": "link",
                 "NM": "dumpbin -symbols",
                 "OBJDUMP": ":",
                 "RANLIB": ":",
                 "STRIP": ":",
             }
             with tools.environment_append(env):
                 yield
     else:
         yield
Esempio n. 14
0
 def build_msvc(self):
     with tools.chdir(self._source_subfolder):
         # https://cairographics.org/end_to_end_build_for_win32/
         win32_common = os.path.join('build', 'Makefile.win32.common')
         tools.replace_in_file(win32_common, '-MD ', '-%s ' % self.settings.compiler.runtime)
         tools.replace_in_file(win32_common, '-MDd ', '-%s ' % self.settings.compiler.runtime)
         tools.replace_in_file(win32_common, '$(ZLIB_PATH)/zdll.lib', self.deps_cpp_info['zlib'].libs[0] + '.lib')
         tools.replace_in_file(win32_common, '$(LIBPNG_PATH)/libpng.lib',
                               self.deps_cpp_info['libpng'].libs[0] + '.lib')
         tools.replace_in_file(win32_common, '$(PIXMAN_PATH)/pixman/$(CFG)/pixman-1.lib',
                               self.deps_cpp_info['pixman'].libs[0] + '.lib')
         with tools.vcvars(self.settings):
             env_msvc = VisualStudioBuildEnvironment(self)
             env_msvc.flags.append('/FS')  # C1041 if multiple CL.EXE write to the same .PDB file, please use /FS
             with tools.environment_append(env_msvc.vars):
                 env_build = AutoToolsBuildEnvironment(self)
                 env_build.make(args=['-f', 'Makefile.win32', 'CFG=%s' % str(self.settings.build_type).lower()])
Esempio n. 15
0
 def _build_context(self):
     if self.settings.compiler == "Visual Studio":
         with tools.vcvars(self):
             env = {
                 "CC":
                 "{} cl -nologo".format(
                     tools.unix_path(
                         self._user_info_build["automake"].compile)),
                 "LD":
                 "{} link -nologo".format(
                     tools.unix_path(
                         self._user_info_build["automake"].compile)),
             }
             with tools.environment_append(env):
                 yield
     else:
         yield
Esempio n. 16
0
    def build(self):
        cmake, env = self._set_up_cmake()

        if len(env.keys()):
            s = '\nAdditional Environment:\n'
            for k,v in env.items():
                s += ' - %s=%s\n'%(k, v)
            self.output.info(s)

        with tools.environment_append(env):
            if tools.os_info.is_windows and 'Visual Studio' == self.settings.compiler:
                with tools.vcvars(self.settings, filter_known_paths=False):
                    cmake.configure(source_folder=self.name)
                    cmake.build()
            else:
                cmake.configure(source_folder=self.name)
                cmake.build()
Esempio n. 17
0
 def _build_msvc(self):
     kwargs = {}
     with tools.chdir(os.path.join(self._source_subfolder, "msvc++")):
         # cl : Command line error D8016: '/ZI' and '/Gy-' command-line options are incompatible
         tools.replace_in_file("libid3tag.dsp", "/ZI ", "")
         if self.settings.compiler == "clang":
             tools.replace_in_file("libid3tag.dsp", "CPP=cl.exe",
                                   "CPP=clang-cl.exe")
             tools.replace_in_file("libid3tag.dsp", "RSC=rc.exe",
                                   "RSC=llvm-rc.exe")
             kwargs["toolset"] = "ClangCl"
         if self.settings.arch == "x86_64":
             tools.replace_in_file("libid3tag.dsp", "Win32", "x64")
         with tools.vcvars(self.settings):
             self.run("devenv /Upgrade libid3tag.dsp")
         msbuild = MSBuild(self)
         msbuild.build(project_file="libid3tag.vcxproj", **kwargs)
Esempio n. 18
0
 def package(self):
     self.copy('LICENSE', dst='licenses', src=self._source_folder)
     with tools.chdir(self._source_folder):
         if self.settings.compiler == "Visual Studio":
             with tools.vcvars(self.settings):
                 self.run('nmake install DESTROOT=%s' % self.package_folder)
         else:
             autotools = self._configure_autotools()
             tools.mkdir(os.path.join(self.package_folder, "include"))
             tools.mkdir(os.path.join(self.package_folder, "lib"))
             autotools.make(target="install-headers")
             if self.options.shared:
                 tools.mkdir(os.path.join(self.package_folder, "bin"))
                 autotools.make(target="install-dlls")
                 autotools.make(target="install-implib-default")
             else:
                 autotools.make(target="install-lib-default")
Esempio n. 19
0
 def _build_context(self):
     if self.settings.compiler == "Visual Studio":
         with tools.vcvars(self):
             env = {
                 "CC": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)),
                 "CXX": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)),
                 "CFLAGS": "-{}".format(self.settings.compiler.runtime),
                 "LD": "link",
                 "NM": "dumpbin -symbols",
                 "STRIP": ":",
                 "AR": "{} lib".format(tools.unix_path(self.deps_user_info["automake"].ar_lib)),
                 "RANLIB": ":",
             }
             with tools.environment_append(env):
                 yield
     else:
         yield
Esempio n. 20
0
    def package(self):
        self.copy("COPYING", src=self._source_subfolder, dst="licenses")
        with tools.vcvars(self) if self._is_clang_cl else tools.no_op():
            meson = self._configure_meson()
            meson.install()

        if self._is_msvc:
            tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.pdb")
            if not self.options.shared:
                os.rename(os.path.join(self.package_folder, "lib", "libpkgconf.a"),
                          os.path.join(self.package_folder, "lib", "pkgconf.lib"),)

        tools.rmdir(os.path.join(self.package_folder, "share", "man"))
        os.rename(os.path.join(self.package_folder, "share", "aclocal"),
                  os.path.join(self.package_folder, "bin", "aclocal"))
        tools.rmdir(os.path.join(self.package_folder, "share"))
        tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
Esempio n. 21
0
    def package(self):
        self.copy(pattern="LICENSE",
                  src=self._source_subfolder,
                  dst="licenses")
        with tools.vcvars(self) if self._is_msvc else tools.no_op():
            autotools = self._configure_autotools()
            autotools.install()
        tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))

        if self._is_msvc:
            # don't trust install target
            tools.rmdir(os.path.join(self.package_folder, "lib"))
            libdir = os.path.join(
                "Win32" if self.settings.arch == "x86" else "x64",
                "Debug" if self.settings.build_type == "Debug" else "Release",
            )
            self.copy("vpx*.lib", src=libdir, dst="lib")
Esempio n. 22
0
 def bootstrap(self):
     folder = os.path.join(self.source_folder, self.folder_name, "tools", "build")
     try:
         bootstrap = "bootstrap.bat" if tools.os_info.is_windows else "./bootstrap.sh"
         with tools.vcvars(self.settings) if self.settings.compiler == "Visual Studio" else tools.no_op():
             self.output.info("Using %s %s" % (self.settings.compiler, self.settings.compiler.version))
             with tools.chdir(folder):
                 option = "" if tools.os_info.is_windows else "-with-toolset="
                 cmd = "%s %s%s" % (bootstrap, option, self._get_boostrap_toolset())
                 self.output.info(cmd)
                 self.run(cmd)
     except Exception as exc:
         self.output.warn(str(exc))
         if os.path.exists(os.path.join(folder, "bootstrap.log")):
             self.output.warn(tools.load(os.path.join(folder, "bootstrap.log")))
         raise
     return os.path.join(folder, "b2.exe") if tools.os_info.is_windows else os.path.join(folder, "b2")
Esempio n. 23
0
 def _build_context(self):
     env = {}
     if self.settings.compiler != "Visual Studio":
         env["YACC"] = self._user_info_build["bison"].YACC
     if self.settings.compiler == "Visual Studio":
         with tools.vcvars(self):
             env.update({
                 "CC": "{} cl -nologo".format(tools.unix_path(self._user_info_build["automake"].compile)),
                 "CXX": "{} cl -nologo".format(tools.unix_path(self._user_info_build["automake"].compile)),
                 "AR": "{} link".format(self._user_info_build["automake"].ar_lib),
                 "LD": "link",
             })
             with tools.environment_append(env):
                 yield
     else:
         with tools.environment_append(env):
             yield
Esempio n. 24
0
 def build(self):
     if self.settings.os == "Windows":
         if tools.os_info.detect_windows_subsystem() not in ("cygwin", "msys2"):
             raise ConanInvalidConfiguration("This recipe needs a Windows Subsystem to be compiled. "
                             "You can specify a build_require to:"
                             " 'msys2_installer/latest@bincrafters/stable' or"
                             " 'cygwin_installer/2.9.0@bincrafters/stable' or"
                             " put in the PATH your own installation")
         if self._is_msvc:
             with tools.vcvars(self.settings):
                 self._build_autotools()
         elif self._is_mingw_windows:
             self._build_autotools()
         else:
             raise ConanInvalidConfiguration("unsupported build")
     else:
         self._build_autotools()
 def _build_context(self):
     if self.settings.compiler == "Visual Studio":
         with tools.vcvars(self.settings):
             msvc_env = {
                 "CC": "cl -nologo",
                 "CXX": "cl -nologo",
                 "LD": "link -nologo",
                 "LDFLAGS": "",
                 "NM": "dumpbin -symbols",
                 "STRIP": ":",
                 "AR": "lib -nologo",
                 "RANLIB": ":",
             }
             with tools.environment_append(msvc_env):
                 yield
     else:
         yield
Esempio n. 26
0
    def build(self):
        with tools.chdir("libmaxminddb"):
            if self.settings.compiler != "Visual Studio":
                self.run("autoreconf -fiv", run_environment=True)

                args = ["--prefix=%s" % self.package_folder]
                if self.options.shared:
                    args.extend(["--disable-static", "--enable-shared"])
                else:
                    args.extend(["--disable-shared", "--enable-static"])
                if self.settings.build_type == "Debug":
                    args.append("--enable-debug")
                if self.options.fPIC:
                    args.append("--with-pic")
                else:
                    args.append("--without-pic")
                if tools.cross_building(self.settings):
                    args.append("--disable-tests")

                autotools = AutoToolsBuildEnvironment(self)
                autotools.configure(args=args)
                autotools.make()
                if not tools.cross_building(self.settings):
                    self.run("make check")
                autotools.install()
            else:
                if self.options["shared"]:
                    self.output.warning(
                        "libmaxminddb does not support building dynamic library yet, building static library instead"
                    )
                    self.options["shared"] = False

                with tools.vcvars(self.settings):
                    sdk = tools.get_env("WindowsSDKVersion")
                    if sdk:
                        sdk = sdk.strip(" \\")

                msbuild = MSBuild(self)
                msbuild.build(
                    "projects/VS12/libmaxminddb.sln",
                    targets=["libmaxminddb"],
                    properties={"WindowsTargetPlatformVersion": sdk}
                    if sdk else {},
                    platforms={"x86": "Win32"},
                )
Esempio n. 27
0
    def build(self):
        for f in glob.glob("*.cmake"):
            tools.replace_in_file(f,
                "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:>",
                "", strict=False)
            tools.replace_in_file(f,
                "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY>:>",
                "", strict=False)
            tools.replace_in_file(f,
                "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:>",
                "", strict=False)
            tools.replace_in_file(f,
                "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,SHARED_LIBRARY>:-Wl,--export-dynamic>",
                "", strict=False)
            tools.replace_in_file(f,
                "$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY>:-Wl,--export-dynamic>",
                "", strict=False)
        with tools.vcvars(self.settings) if self.settings.compiler == "Visual Studio" else tools.no_op():
            # next lines force cmake package to be in PATH before the one provided by visual studio (vcvars)
            build_env = tools.RunEnvironment(self).vars if self.settings.compiler == "Visual Studio" else {}
            build_env["MAKEFLAGS"] = "j%d" % tools.cpu_count()
            build_env["PKG_CONFIG_PATH"] = [self.build_folder]
            if self.settings.os == "Windows":
                if not "PATH" in build_env:
                    build_env["PATH"] = []
                build_env["PATH"].append(os.path.join(self.source_folder, "qt6", "gnuwin32", "bin"))
            if self.settings.compiler == "Visual Studio":
                # this avoids cmake using gcc from strawberryperl
                build_env["CC"] = "cl"
                build_env["CXX"] = "cl"
            with tools.environment_append(build_env):

                if tools.os_info.is_macos:
                    open(".qmake.stash" , "w").close()
                    open(".qmake.super" , "w").close()

                cmake = self._configure_cmake()
                if tools.os_info.is_macos:
                    with open("bash_env", "w") as f:
                        f.write('export DYLD_LIBRARY_PATH="%s"' % ":".join(RunEnvironment(self).vars["DYLD_LIBRARY_PATH"]))
                with tools.environment_append({
                    "BASH_ENV": os.path.abspath("bash_env")
                }) if tools.os_info.is_macos else tools.no_op():
                    with tools.run_environment(self):
                        cmake.build()
Esempio n. 28
0
 def build(self):
     if tools.os_info.is_windows:
         msys_bin = self.deps_env_info["msys2_installer"].MSYS_BIN
         # Make sure that Ruby is first in the path order
         path = self.deps_env_info["ruby_installer"].path + [msys_bin]
         with tools.environment_append({
                 "PATH":
                 path,
                 "CONAN_BASH_PATH":
                 os.path.join(msys_bin, "bash.exe")
         }):
             if self.settings.compiler == "Visual Studio":
                 with tools.vcvars(self.settings):
                     self.build_configure()
             else:
                 self.build_configure()
     else:
         self.build_configure()
 def _build_context(self):
     env = {}
     if self.settings.compiler == "Visual Studio":
         with tools.vcvars(self.settings):
             env.update({
                 "AR": "{} lib".format(tools.unix_path(self.deps_user_info["automake"].ar_lib)),
                 "CC": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)),
                 "CXX": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)),
                 "NM": "dumpbin -symbols",
                 "OBJDUMP": ":",
                 "RANLIB": ":",
                 "STRIP": ":",
             })
             with tools.environment_append(env):
                 yield
     else:
         with tools.environment_append(env):
             yield
Esempio n. 30
0
 def _build_vs(self):
     with tools.chdir(
             os.path.join(self._source_subfolder, 'Mkfiles', 'vc10')):
         with tools.vcvars(self.settings,
                           arch=str(self.settings.arch_build),
                           force=True):
             msbuild = MSBuild(self)
             if self.settings.arch_build == "x86":
                 msbuild.build_env.link_flags.append('/MACHINE:X86')
             elif self.settings.arch_build == "x86_64":
                 msbuild.build_env.link_flags.append(
                     '/SAFESEH:NO /MACHINE:X64')
             msbuild.build(project_file="yasm.sln",
                           arch=self.settings.arch_build,
                           build_type="Release",
                           targets=["yasm"],
                           platforms={"x86": "Win32"},
                           force_vcvars=True)