Exemplo n.º 1
0
    def _build_autotools(self):
        # fix MinGW
        tools.replace_in_file(
            os.path.join(self._source_subfolder,
                         "configure.ac"), "AC_CHECK_LIB(z,",
            "AC_CHECK_LIB({},".format(self.deps_cpp_info["zlib"].libs[0]))
        # Disable tests
        tools.replace_in_file(
            os.path.join(self._source_subfolder, "Makefile.am"),
            "SUBDIRS = src test $(EXAMPLES)", "SUBDIRS = src $(EXAMPLES)")

        with tools.chdir(self._source_subfolder):
            self.run("{} -fiv".format(tools.get_env("AUTORECONF")),
                     win_bash=tools.os_info.is_windows)
            # relocatable shared libs on macOS
            tools.replace_in_file("configure", "-install_name \\$rpath/",
                                  "-install_name @rpath/")
            # avoid SIP issues on macOS when dependencies are shared
            if tools.is_apple_os(self.settings.os):
                libpaths = ":".join(self.deps_cpp_info.lib_paths)
                tools.replace_in_file(
                    "configure",
                    "#! /bin/sh\n",
                    "#! /bin/sh\nexport DYLD_LIBRARY_PATH={}:$DYLD_LIBRARY_PATH\n"
                    .format(libpaths),
                )
            with tools.run_environment(self):
                autotools = self._configure_autotools()
                autotools.make()
Exemplo n.º 2
0
 def test(self):
     if not tools.cross_building(self.settings, skip_x64_x86=True):
         with tools.run_environment(self):
             self.run("perl {} --version".format(os.path.join(self.deps_cpp_info["verilator"].rootpath, "bin", "verilator")), run_environment=True)
         self.run(os.path.join("bin", "blinky"), run_environment=True)
         if self._run_systemc_example:
             self.run(os.path.join("bin", "blinky_sc"), run_environment=True)
Exemplo n.º 3
0
    def run(self,
            command,
            output=True,
            cwd=None,
            win_bash=False,
            subsystem=None,
            msys_mingw=True,
            ignore_errors=False,
            run_environment=False):
        def _run():
            if not win_bash:
                return self._conan_runner(command, output,
                                          os.path.abspath(RUN_LOG_NAME), cwd)
            # FIXME: run in windows bash is not using output
            return tools.run_in_windows_bash(self,
                                             bashcmd=command,
                                             cwd=cwd,
                                             subsystem=subsystem,
                                             msys_mingw=msys_mingw)

        if run_environment:
            with tools.run_environment(self):
                if os_info.is_macos:
                    command = 'DYLD_LIBRARY_PATH="%s" %s' % (os.environ.get(
                        'DYLD_LIBRARY_PATH', ''), command)
                retcode = _run()
        else:
            retcode = _run()

        if not ignore_errors and retcode != 0:
            raise ConanException("Error %d while executing %s" %
                                 (retcode, command))

        return retcode
Exemplo n.º 4
0
 def _build_autotools(self):
     with tools.chdir(self._source_subfolder):
         self.run("{} -fiv".format(tools.get_env("AUTORECONF")),
                  win_bash=tools.os_info.is_windows)
         with tools.run_environment(self):
             autotools = self._configure_autotools()
             autotools.make()
Exemplo n.º 5
0
    def build(self):
        cmake = CMake(self)
        cmake.definitions["WITH_PY"] = self.options.python
        cmake.definitions["WITH_JS"] = self.options.js
        cmake.definitions["WITH_DEBUG"] = self.options.debug_logging
        cmake.definitions["WITH_TESTS"] = self.options.tests
        cmake.definitions["WITH_MAGIC"] = self.options.magic
        cmake.definitions["WITH_CURL"] = self.options.curl
        cmake.definitions["WITH_TAGLIB"] = self.options.taglib
        cmake.definitions["WITH_EXIF"] = self.options.exif
        cmake.definitions["WITH_MATROSKA"] = self.options.matroska
        cmake.definitions["WITH_MYSQL"] = self.options.mysql
        cmake.definitions["WITH_AVCODEC"] = self.options.ffmpeg
        cmake.definitions[
            "WITH_FFMPEGTHUMBNAILER"] = self.options.ffmpegthumbnailer

        if self.settings.os != "Linux" or tools.cross_building(self):
            cmake.definitions["WITH_SYSTEMD"] = False

        cmake.configure()
        cmake.build()

        if tools.get_env("CONAN_RUN_TESTS", True):
            with tools.run_environment(self):
                cmake.test(output_on_failure=True)
Exemplo n.º 6
0
 def package(self):
     self.copy("COPYING", src=self._source_subfolder, dst="licenses")
     if self._is_msvc:
         with self._build_context():
             meson = self._configure_meson()
             meson.install()
             if os.path.isfile(
                     os.path.join(self.package_folder, "lib",
                                  "libfontconfig.a")):
                 tools.rename(
                     os.path.join(self.package_folder, "lib",
                                  "libfontconfig.a"),
                     os.path.join(self.package_folder, "lib",
                                  "fontconfig.lib"))
     else:
         with tools.run_environment(self):
             autotools = self._configure_autotools()
             autotools.install()
     tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"),
                                "*.pdb")
     tools.remove_files_by_mask(
         os.path.join(self.package_folder, "bin", "etc", "fonts", "conf.d"),
         "*.conf")
     tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"),
                                "*.def")
     tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"),
                                "*.la")
     tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
     tools.rmdir(os.path.join(self.package_folder, "etc"))
     tools.rmdir(os.path.join(self.package_folder, "share"))
Exemplo n.º 7
0
 def _buildenv(self):
     # TODO: conan v2: replace by VirtualBuildEnv and always add grpc to build requirements
     if tools.cross_building(self):
         yield
     else:
         with tools.run_environment(self):
             yield
Exemplo n.º 8
0
 def build(self):
     cmake = CMake(self)
     cmake.configure()
     cmake.build()
     if self.options.run_tests:
         with tools.run_environment(self):
             cmake.test(output_on_failure=True)
Exemplo n.º 9
0
    def build(self):
        for src in self.exports_sources:
            shutil.copy(os.path.join(self.source_folder, src),
                        dst=os.path.join(self.build_folder, src))
        with tools.chdir(self.build_folder):
            for fn in ("COPYING", "NEWS", "INSTALL", "README", "AUTHORS",
                       "ChangeLog"):
                tools.save(fn, "\n")
            with tools.run_environment(self):
                self.run("gnulib-tool --list",
                         win_bash=tools.os_info.is_windows,
                         run_environment=True)
                self.run("gnulib-tool --import getopt-posix",
                         win_bash=tools.os_info.is_windows,
                         run_environment=True)
            # m4 built with Visual Studio does not support executing *nix utils (e.g. `test`)
            with tools.environment_append({
                    "M4": None
            }) if self.settings.os == "Windows" else tools.no_op():
                self.run("{} -fiv".format(os.environ["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.configure()
                autotools.make()
Exemplo n.º 10
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":
                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()
Exemplo n.º 11
0
 def build(self):
     shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB,
                 os.path.join(self._source_subfolder, "config.sub"))
     shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS,
                 os.path.join(self._source_subfolder, "config.guess"))
     with tools.run_environment(self):
         autotools = self._configure_autotools()
         autotools.make()
Exemplo n.º 12
0
 def package(self):
     self.copy("COPYING", dst="licenses", src=self._source_subfolder)
     with tools.chdir(self._source_subfolder):
         with tools.run_environment(self):
             autotools = self._configure_autotools()
             autotools.install()
     tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la")
     tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
Exemplo n.º 13
0
 def package(self):
     self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder)
     with tools.run_environment(self):
         cmake = self._configure_cmake()
         cmake.install()
     tools.rmdir(os.path.join(self.package_folder, "share"))
     self._create_cmake_module_alias_targets(
         os.path.join(self.package_folder, self._module_file_rel_path),
         {"tensorpipe": "Tensorpipe::Tensorpipe"})
Exemplo n.º 14
0
 def package(self):
     self.copy(pattern="COPYING",
               dst="licenses",
               src=self._source_subfolder)
     with tools.run_environment(self):
         meson = self._configure_meson()
         meson.install()
     tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
     tools.rmdir(os.path.join(self.package_folder, "share"))
Exemplo n.º 15
0
 def _build_context(self):
     with tools.run_environment(self):
         with tools.environment_append(self._libtool_relocatable_env):
             if self.settings.compiler == "Visual Studio":
                 with tools.vcvars(self.settings):
                     with tools.environment_append({"CC": "cl -nologo", "CXX": "cl -nologo",}):
                         yield
             else:
                 yield
Exemplo n.º 16
0
 def build(self):
     cmake = CMake(self)
     with tools.run_environment(self):
         cmake.configure()
         cmake.build()
         if self.options.run_tests:
             with tools.environment_append({"CTEST_OUTPUT_ON_FAILURE":
                                            "1"}):
                 cmake.test()
Exemplo n.º 17
0
    def package(self):
        self.copy(pattern="LICENSES.txt", src=self._source_subfolder, dst="licenses")
        with tools.run_environment(self):
            cmake = self._configure_cmake()
            cmake.install()

        tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
        tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
        tools.rmdir(os.path.join(self.package_folder, "share"))
Exemplo n.º 18
0
 def build(self):
     self._patch_files()
     if self.settings.compiler == "Visual Studio":
         with self._build_context():
             meson = self._configure_meson()
             meson.build()
     else:
         with tools.run_environment(self):
             autotools = self._configure_autotools()
             autotools.make()
Exemplo n.º 19
0
 def package(self):
     self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder)
     with tools.run_environment(self):
         autotools = self._configure_autotools()
         autotools.install()
     tools.rmdir(os.path.join(self.package_folder, "etc"))
     tools.rmdir(os.path.join(self.package_folder, "share"))
     tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
     tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
     tools.remove_files_by_mask(self.package_folder, "*.la")
Exemplo n.º 20
0
 def build(self):
     self._patch_files()
     if self._is_msvc:
         with self._build_context():
             meson = self._configure_meson()
             meson.build()
     else:
         with tools.run_environment(self):
             autotools = self._configure_autotools()
             autotools.make()
Exemplo n.º 21
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():
            build_env = {
                "MAKEFLAGS": "j%d" % tools.cpu_count(),
                "PKG_CONFIG_PATH": [os.getcwd()]
            }
            if self.settings.os == "Windows":
                build_env["PATH"] = [
                    os.path.join(self.source_folder, "qt6", "gnuwin32", "bin")
                ]

            if tools.os_info.is_macos:
                open(self.build_folder + "/.qmake.stash", 'w').close()
                open(self.build_folder + "/.qmake.super", 'w').close()

            with tools.environment_append(build_env):
                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()
Exemplo n.º 22
0
 def package(self):
     self.copy("COPYING", dst="licenses", src=self._source_subfolder)
     with tools.run_environment(self):
         autotools = self._configure_autotools()
         autotools.install()
     os.unlink(os.path.join(self.package_folder, "lib", "libfontconfig.la"))
     tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
     for f in glob.glob(os.path.join(self.package_folder, "bin", "etc", "fonts", "conf.d", "*.conf")):
         if os.path.islink(f):
             os.unlink(f)
     for def_file in glob.glob(os.path.join(self.package_folder, "lib", "*.def")):
         os.remove(def_file)
Exemplo n.º 23
0
    def build(self):
        self._patch_sources()
        if self._is_msvc:
            self._build_msvc()
        elif self._is_mingw_windows:
            self._build_mingw()
        else:
            with tools.run_environment(self):   # required for ICU build
                autotools = self._configure_autotools()
                autotools.make(["libxml2.la"])

                if self.options.include_utils:
                    autotools.make(["xmllint", "xmlcatalog", "xml2-config"])
Exemplo n.º 24
0
 def package(self):
     self.copy("COPYING", dst="licenses", src=self._source_subfolder)
     if self._is_msvc:
         self.copy("spatialite.h", dst="include", src=os.path.join(self._source_subfolder, "src", "headers"))
         self.copy("*.h", dst=os.path.join("include", "spatialite"), src=os.path.join(self._source_subfolder, "src", "headers", "spatialite"))
         self.copy("*.lib", dst="lib", src=self._source_subfolder)
         self.copy("*.dll", dst="bin", src=self._source_subfolder)
     else:
         with tools.chdir(self._source_subfolder):
             with tools.run_environment(self):
                 autotools = self._configure_autotools()
                 autotools.install()
         tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la")
         tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
Exemplo n.º 25
0
 def build(self):
     self._patch_files()
     if self._is_msvc:
         with self._build_context():
             meson = self._configure_meson()
             meson.build()
     else:
         # relocatable shared lib on macOS
         tools.replace_in_file(
             os.path.join(self._source_subfolder, "configure"),
             "-install_name \\$rpath/", "-install_name @rpath/")
         with tools.run_environment(self):
             autotools = self._configure_autotools()
             autotools.make()
Exemplo n.º 26
0
    def _build_with_autotools(self):
        with tools.chdir(self._source_subfolder):
            # autoreconf
            self.run("{} -fiv".format(tools.get_env("AUTORECONF") or "autoreconf"), win_bash=tools.os_info.is_windows, run_environment=True)

            # fix generated autotools files on alle to have relocateable binaries
            if tools.is_apple_os(self.settings.os):
                tools.replace_in_file("configure", "-install_name \\$rpath/", "-install_name ")

            self.run("chmod +x configure")

            # run configure with *LD_LIBRARY_PATH env vars it allows to pick up shared openssl
            with tools.run_environment(self):
                autotools, autotools_vars = self._configure_autotools()
                autotools.make(vars=autotools_vars)
Exemplo n.º 27
0
 def package(self):
     self.copy("COPYING", dst="licenses", src=self._source_subfolder)
     if self.settings.compiler == "Visual Studio":
         self.copy("rasterlite.h",
                   dst="include",
                   src=os.path.join(self._source_subfolder, "headers"))
         self.copy("*.lib", dst="lib", src=self._source_subfolder)
         self.copy("*.dll", dst="bin", src=self._source_subfolder)
     else:
         with tools.chdir(self._source_subfolder):
             with tools.run_environment(self):
                 autotools = self._configure_autotools()
                 autotools.install()
         tools.remove_files_by_mask(
             os.path.join(self.package_folder, "lib"), "*.la")
         tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
Exemplo n.º 28
0
 def build(self):
     self._patch_sources()
     with tools.chdir(self._source_subfolder):
         self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows)
         # relocatable shared libs on macOS
         tools.replace_in_file("configure", "-install_name \\$rpath/", "-install_name @rpath/")
         # avoid SIP issues on macOS when dependencies are shared
         if tools.is_apple_os(self.settings.os):
             libpaths = ":".join(self.deps_cpp_info.lib_paths)
             tools.replace_in_file(
                 "configure",
                 "#! /bin/sh\n",
                 "#! /bin/sh\nexport DYLD_LIBRARY_PATH={}:$DYLD_LIBRARY_PATH\n".format(libpaths),
             )
         with tools.run_environment(self):
             autotools = self._configure_autotools()
             autotools.make()
Exemplo n.º 29
0
    def _build_autotools(self):
        # fix MinGW
        tools.replace_in_file(
            os.path.join(self._source_subfolder,
                         "configure.ac"), "AC_CHECK_LIB(z,",
            "AC_CHECK_LIB({},".format(self.deps_cpp_info["zlib"].libs[0]))
        # Disable tests
        tools.replace_in_file(
            os.path.join(self._source_subfolder, "Makefile.am"),
            "SUBDIRS = src test $(EXAMPLES)", "SUBDIRS = src $(EXAMPLES)")

        with tools.chdir(self._source_subfolder):
            self.run("{} -fiv".format(tools.get_env("AUTORECONF")),
                     win_bash=tools.os_info.is_windows)
            with tools.run_environment(self):
                autotools = self._configure_autotools()
                autotools.make()
Exemplo n.º 30
0
 def package(self):
     cmake = self._configure_cmake()
     with tools.run_environment(self):
         cmake.install()
     os.mkdir(os.path.join(self.package_folder, "licenses"))
     rename(self, os.path.join(self.package_folder, "LICENSE"),
            os.path.join(self.package_folder, "licenses", "LICENSE"))
     os.remove(os.path.join(self.package_folder, "README"))
     tools.remove_files_by_mask(self.package_folder, "*.pdb")
     tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
     tools.rmdir(os.path.join(self.package_folder, "docs"))
     tools.rmdir(os.path.join(self.package_folder, "share"))
     if self.settings.os == "Windows" and self.options.shared:
         self.copy("*.dll", "bin", keep_path=False)
     if self.options.shared:
         tools.remove_files_by_mask(self.package_folder, "*.a")
     else:
         tools.remove_files_by_mask(self.package_folder, "*.dll")
         tools.remove_files_by_mask(self.package_folder, "*.dylib")
         tools.remove_files_by_mask(self.package_folder, "*.so*")