Exemplo n.º 1
0
    def build_configure(self):
        # FIXME : once component feature is out, should be unnecessary
        if self.options.freetype:
            shutil.move("freetype.pc", "freetype2.pc")
            shutil.move("zlib.pc", "ZLIB.pc")
            shutil.move("bzip2.pc", "BZip2.pc")
        if self.options.openjpeg:
            shutil.move("openjpeg.pc", "libopenjp2.pc")
            shutil.move("tiff.pc", "TIFF.pc")
        if self.options.fdk_aac:
            shutil.move("libfdk_aac.pc", "fdk-aac.pc")
        if self.options.webp:
            self._copy_pkg_config('libwebp')  # components: libwebpmux
        if self.options.vorbis:
            self._copy_pkg_config(
                'vorbis')  # components: vorbisenc, vorbisfile
        if self.options.lzma:
            shutil.move('xz_utils.pc', 'lzma.pc')
        with tools.chdir(self._source_subfolder):
            prefix = tools.unix_path(
                self.package_folder
            ) if self.settings.os == 'Windows' else self.package_folder
            args = [
                '--prefix=%s' % prefix, '--disable-doc', '--disable-programs'
            ]
            if self.options.shared:
                args.extend(['--disable-static', '--enable-shared'])
            else:
                args.extend(['--disable-shared', '--enable-static'])
            args.append('--pkg-config-flags=--static')
            if self.settings.build_type == 'Debug':
                args.extend([
                    '--disable-optimizations', '--disable-mmx',
                    '--disable-stripping', '--enable-debug'
                ])
            if self._is_msvc:
                args.append('--toolchain=msvc')
                args.append('--extra-cflags=-%s' %
                            self.settings.compiler.runtime)
                if int(str(self.settings.compiler.version)) <= 12:
                    # Visual Studio 2013 (and earlier) doesn't support "inline" keyword for C (only for C++)
                    args.append('--extra-cflags=-Dinline=__inline' %
                                self.settings.compiler.runtime)

            if self.settings.arch == 'x86':
                args.append('--arch=x86')

            if self.settings.os != "Windows":
                args.append(
                    '--enable-pic' if self.options.fPIC else '--disable-pic')

            args.append('--enable-postproc' if self.options.
                        postproc else '--disable-postproc')
            args.append(
                '--enable-zlib' if self.options.zlib else '--disable-zlib')
            args.append(
                '--enable-bzlib' if self.options.bzlib else '--disable-bzlib')
            args.append(
                '--enable-lzma' if self.options.lzma else '--disable-lzma')
            args.append(
                '--enable-iconv' if self.options.iconv else '--disable-iconv')
            args.append('--enable-libfreetype' if self.options.
                        freetype else '--disable-libfreetype')
            args.append('--enable-libopenjpeg' if self.options.
                        openjpeg else '--disable-libopenjpeg')
            args.append('--enable-libopenh264' if self.options.
                        openh264 else '--disable-libopenh264')
            args.append('--enable-libvorbis' if self.options.
                        vorbis else '--disable-libvorbis')
            args.append('--enable-libopus' if self.options.
                        opus else '--disable-libopus')
            args.append(
                '--enable-libzmq' if self.options.zmq else '--disable-libzmq')
            args.append(
                '--enable-sdl2' if self.options.sdl2 else '--disable-sdl2')
            args.append('--enable-libx264' if self.options.
                        x264 else '--disable-libx264')
            args.append('--enable-libx265' if self.options.
                        x265 else '--disable-libx265')
            args.append(
                '--enable-libvpx' if self.options.vpx else '--disable-libvpx')
            args.append('--enable-libmp3lame' if self.options.
                        mp3lame else '--disable-libmp3lame')
            args.append('--enable-libfdk-aac' if self.options.
                        fdk_aac else '--disable-libfdk-aac')
            args.append('--enable-libwebp' if self.options.
                        webp else '--disable-libwebp')
            args.append('--enable-openssl' if self.options.
                        openssl else '--disable-openssl')

            if self.options.x264 or self.options.x265 or self.options.postproc:
                args.append('--enable-gpl')

            if self.options.fdk_aac:
                args.append('--enable-nonfree')

            if self.settings.os == "Linux":
                args.append(
                    '--enable-alsa' if self.options.alsa else '--disable-alsa')
                args.append('--enable-libpulse' if self.options.
                            pulse else '--disable-libpulse')
                args.append('--enable-vaapi' if self.options.
                            vaapi else '--disable-vaapi')
                args.append('--enable-vdpau' if self.options.
                            vdpau else '--disable-vdpau')
                if self.options.xcb:
                    args.extend([
                        '--enable-libxcb', '--enable-libxcb-shm',
                        '--enable-libxcb-shape', '--enable-libxcb-xfixes'
                    ])
                else:
                    args.extend([
                        '--disable-libxcb', '--disable-libxcb-shm',
                        '--disable-libxcb-shape', '--disable-libxcb-xfixes'
                    ])

            if self.settings.os == "Macos":
                args.append('--enable-appkit' if self.options.
                            appkit else '--disable-appkit')
                args.append('--enable-avfoundation' if self.options.
                            avfoundation else '--disable-avfoundation')
                args.append('--enable-coreimage' if self.options.
                            avfoundation else '--disable-coreimage')
                args.append('--enable-audiotoolbox' if self.options.
                            audiotoolbox else '--disable-audiotoolbox')
                args.append('--enable-videotoolbox' if self.options.
                            videotoolbox else '--disable-videotoolbox')
                args.append('--enable-securetransport' if self.options.
                            securetransport else '--disable-securetransport')

            if self.settings.os == "Windows":
                args.append('--enable-libmfx' if self.options.
                            qsv else '--disable-libmfx')

            # FIXME disable CUDA and CUVID by default, revisit later
            args.extend(['--disable-cuda', '--disable-cuvid'])

            env_build = AutoToolsBuildEnvironment(
                self, win_bash=self._is_mingw_windows or self._is_msvc)
            # ffmpeg's configure is not actually from autotools, so it doesn't understand standard options like
            # --host, --build, --target
            env_build.configure(args=args,
                                build=False,
                                host=False,
                                target=False)
            env_build.make()
            env_build.make(args=['install'])
Exemplo n.º 2
0
 def test(self):
     if not tools.cross_building(self):
         autotools = AutoToolsBuildEnvironment(self)
         autotools.make()
Exemplo n.º 3
0
 def _get_env_build(self):
     return AutoToolsBuildEnvironment(self)
Exemplo n.º 4
0
 def _build_configure(self):
     with tools.chdir(self._source_subfolder):
         env_build = AutoToolsBuildEnvironment(self)
         env_build.fPIC = self.options.fPIC
         env_build.configure()
         env_build.make()
Exemplo n.º 5
0
 def package(self):
     be = AutoToolsBuildEnvironment(self)
     with tools.chdir(self._source_subfolder):
         with tools.environment_append(be.vars):
             be.install()
Exemplo n.º 6
0
 def _get_env_build(self):
     if not self._env_build:
         self._env_build = AutoToolsBuildEnvironment(self)
     return self._env_build
Exemplo n.º 7
0
 def build(self):
     autotools = AutoToolsBuildEnvironment(self)
     autotools.configure(configure_dir="sources")
     autotools.make()
     autotools.install()
Exemplo n.º 8
0
    def build(self):
        for patch in self.conan_data.get("patches", {}).get(self.version, []):
            tools.patch(**patch)

        if self.settings.compiler == "Visual Studio":
            tools.replace_in_file(
                os.path.join(self._source_subfolder, "third_party", "zlib",
                             "BUILD.gn"), "libs = [ \"z\" ]",
                "libs = [ {} ]".format(", ".join(
                    "\"{}.lib\"".format(l)
                    for l in self.deps_cpp_info["zlib"].libs)))

        if self.settings.compiler == "gcc":
            toolchain_path = os.path.join(self._source_subfolder,
                                          "third_party", "mini_chromium",
                                          "mini_chromium", "build", "config",
                                          "BUILD.gn")
            # Remove gcc-incompatible compiler arguments
            for comp_arg in ("-Wheader-hygiene", "-Wnewline-eof",
                             "-Wstring-conversion", "-Wexit-time-destructors",
                             "-fobjc-call-cxx-cdtors", "-Wextra-semi",
                             "-Wimplicit-fallthrough"):
                tools.replace_in_file(toolchain_path,
                                      "\"{}\"".format(comp_arg), "\"\"")

        autotools = AutoToolsBuildEnvironment(self)
        extra_cflags = autotools.flags + [
            "-D{}".format(d) for d in autotools.defines
        ]
        extra_cflags_c = []
        extra_cflags_cc = autotools.cxx_flags
        extra_ldflags = autotools.link_flags
        if self.options.get_safe("fPIC"):
            extra_cflags.append("-fPIC")
        extra_cflags.extend("-I {}".format(inc)
                            for inc in autotools.include_paths)
        extra_ldflags.extend("-{}{}".format(
            "LIBPATH:" if self.settings.compiler == "Visual Studio" else "L ",
            libdir) for libdir in autotools.library_paths)
        if self.settings.compiler == "clang":
            if self.settings.compiler.get_safe("libcxx"):
                stdlib = {
                    "libstdc++11": "libstdc++",
                }.get(str(self.settings.compiler.libcxx),
                      str(self.settings.compiler.libcxx))
                extra_cflags_cc.append("-stdlib={}".format(stdlib))
                extra_ldflags.append("-stdlib={}".format(stdlib))
        gn_args = [
            "host_os=\\\"{}\\\"".format(self._gn_os),
            "host_cpu=\\\"{}\\\"".format(self._gn_arch),
            "is_debug={}".format(
                str(self.settings.build_type == "Debug").lower()),
            "crashpad_http_transport_impl=\\\"{}\\\"".format(
                self._http_transport_impl),
            "crashpad_use_boringssl_for_http_transport_socket={}".format(
                str(self.options.get_safe("with_tls", False) != False).lower()
            ),
            "extra_cflags=\\\"{}\\\"".format(" ".join(extra_cflags)),
            "extra_cflags_c=\\\"{}\\\"".format(" ".join(extra_cflags_c)),
            "extra_cflags_cc=\\\"{}\\\"".format(" ".join(extra_cflags_cc)),
            "extra_ldflags=\\\"{}\\\"".format(" ".join(extra_ldflags)),
        ]
        with tools.chdir(self._source_subfolder):
            with self._build_context():
                self.run("gn gen out/Default --args=\"{}\"".format(
                    " ".join(gn_args)),
                         run_environment=True)
                targets = [
                    "client", "minidump", "crashpad_handler", "snapshot"
                ]
                if self.settings.os == "Windows":
                    targets.append("crashpad_handler_com")
                self.run("ninja -C out/Default {targets} -j{parallel}".format(
                    targets=" ".join(targets), parallel=tools.cpu_count()),
                         run_environment=True)

        def lib_filename(name):
            prefix, suffix = (
                "", ".lib") if self.settings.compiler == "Visual Studio" else (
                    "lib", ".a")
            return "{}{}{}".format(prefix, name, suffix)

        tools.rename(
            os.path.join(self._source_subfolder, "out", "Default", "obj",
                         "client", lib_filename("common")),
            os.path.join(self._source_subfolder, "out", "Default", "obj",
                         "client", lib_filename("client_common")))
        tools.rename(
            os.path.join(self._source_subfolder, "out", "Default", "obj",
                         "handler", lib_filename("common")),
            os.path.join(self._source_subfolder, "out", "Default", "obj",
                         "handler", lib_filename("handler_common")))
Exemplo n.º 9
0
 def package(self):
     with tools.chdir("{}-{}".format(self.name, self.version)):
         autotools = AutoToolsBuildEnvironment(self)
         autotools.install()
Exemplo n.º 10
0
    def _configure_autotools(self):
        if self._autotools is None:
            self._autotools = AutoToolsBuildEnvironment(
                self, win_bash=tools.os_info.is_windows)
            configure_args = [
                "--disable-sample",
                "--disable-macos-framework",
                "--with-dblib=none",
            ]
            if self.options.shared:
                configure_args.extend(["--enable-shared", "--disable-static"])
            else:
                configure_args.extend(["--disable-shared", "--enable-static"])

            if not self.options.with_openssl:
                configure_args.append("--without-openssl")

            if not self.options.with_digest:
                configure_args.append("--disable-digest")

            if not self.options.with_scram:
                configure_args.append("--disable-scram")

            if not self.options.with_otp:
                configure_args.append("--disable-otp")

            if not self.options.with_krb4:
                configure_args.append("--disable-krb4")

            if self.options.with_gssapi:
                configure_args.append("--with-gss_impl=mit")
            else:
                configure_args.append("--disable-gssapi")

            if not self.options.with_plain:
                configure_args.append("--disable-plain")

            if not self.options.with_anon:
                configure_args.append("--disable-anon")

            if (self.options.with_postgresql or self.options.with_mysql
                    or self.options.with_sqlite3):
                configure_args.append("--enable-sql")
                if self.options.with_postgresql:
                    configure_args.append("--with-pgsql={}".format(
                        self.deps_cpp_info["libpq"].rootpath))
                else:
                    configure_args.append("--with-pgsql=no")
                if self.options.with_mysql:
                    configure_args.append("--with-mysql={}".format(
                        self.deps_cpp_info["libmysqlclient"].rootpath))
                else:
                    configure_args.append("--with-mysql=no")
                configure_args.append("--with-sqlite=no")
                if self.options.with_mysql:
                    configure_args.append("--with-sqlite3={}".format(
                        self.deps_cpp_info["libmysqlclient"].rootpath))
                else:
                    configure_args.append("--with-sqlite3=no")
            else:
                configure_args.append("--disable-sql")

            configure_file_path = os.path.join(self._source_subfolder)
            self._autotools.configure(configure_dir=configure_file_path,
                                      args=configure_args)
        return self._autotools
Exemplo n.º 11
0
    def _configure_autotools(self):
        if self._autotools:
            return self._autotools
        self._autotools = AutoToolsBuildEnvironment(
            self, win_bash=tools.os_info.is_windows)
        self._autotools.libs = []
        args = [
            "--bit-depth=%s" % str(self.options.bit_depth),
            "--disable-cli",
            "--prefix={}".format(tools.unix_path(self.package_folder)),
        ]
        if self.options.shared:
            args.append("--enable-shared")
        else:
            args.append("--enable-static")
        if self.options.get_safe("fPIC", self.settings.os != "Windows"):
            args.append("--enable-pic")
        if self.settings.build_type == "Debug":
            args.append("--enable-debug")
        if self.settings.os == "Macos" and self.settings.arch == "armv8":
            # bitstream-a.S:29:18: error: unknown token in expression
            args.append("--extra-asflags=-arch arm64")
            args.append("--extra-ldflags=-arch arm64")
            args.append("--host=aarch64-apple-darwin")

        if self._with_nasm:
            # FIXME: get using user_build_info
            self._override_env["AS"] = os.path.join(
                self.dependencies.build["nasm"].package_folder, "bin",
                "nasm{}".format(
                    ".exe" if tools.os_info.is_windows else "")).replace(
                        "\\", "/")
        if tools.cross_building(self):
            if self.settings.os == "Android":
                # the as of ndk does not work well for building libx264
                self._override_env["AS"] = os.environ["CC"]
                ndk_root = tools.unix_path(os.environ["NDK_ROOT"])
                arch = {
                    "armv7": "arm",
                    "armv8": "aarch64",
                    "x86": "i686",
                    "x86_64": "x86_64",
                }.get(str(self.settings.arch))
                abi = "androideabi" if self.settings.arch == "armv7" else "android"
                args.append("--cross-prefix={}".format(
                    "{}/bin/{}-linux-{}-".format(ndk_root, arch, abi)))
        if self._is_msvc:
            self._override_env["CC"] = "cl -nologo"
            self._autotools.flags.append("-{}".format(msvc_runtime_flag(self)))
            if not (self.settings.compiler == "Visual Studio"
                    and tools.Version(self.settings.compiler.version) < "12"):
                self._autotools.flags.append("-FS")
        build_canonical_name = None
        host_canonical_name = None
        if self._is_msvc:
            # autotools does not know about the msvc canonical name(s)
            build_canonical_name = False
            host_canonical_name = False
        self._autotools.configure(args=args,
                                  vars=self._override_env,
                                  configure_dir=self._source_subfolder,
                                  build=build_canonical_name,
                                  host=host_canonical_name)
        return self._autotools
Exemplo n.º 12
0
    def _configure_autotools(self):
        if self._autotools:
            return self._autotools
        self._autotools = AutoToolsBuildEnvironment(
            self, win_bash=tools.os_info.is_windows)
        self._autotools.libs = []
        opt_enable_disable = lambda what, v: "--{}-{}".format(
            "enable" if v else "disable", what)
        args = [
            "--pkg-config-flags=--static",
            "--disable-doc",
            opt_enable_disable("cross-compile", tools.cross_building(self)),
            # Libraries
            opt_enable_disable("shared", self.options.shared),
            opt_enable_disable("static", not self.options.shared),
            opt_enable_disable("pic", self.options.get_safe("fPIC", True)),
            opt_enable_disable("avdevice", self.options.avdevice),
            opt_enable_disable("avcodec", self.options.avcodec),
            opt_enable_disable("avformat", self.options.avformat),
            opt_enable_disable("swresample", self.options.swresample),
            opt_enable_disable("swscale", self.options.swscale),
            opt_enable_disable("postproc", self.options.postproc),
            opt_enable_disable("avfilter", self.options.avfilter),
            # Dependencies
            opt_enable_disable("bzlib", self.options.with_bzip2),
            opt_enable_disable("zlib", self.options.with_zlib),
            opt_enable_disable("lzma", self.options.with_lzma),
            opt_enable_disable("iconv", self.options.with_libiconv),
            opt_enable_disable("libopenjpeg", self.options.with_openjpeg),
            opt_enable_disable("libopenh264", self.options.with_openh264),
            opt_enable_disable("libvorbis", self.options.with_vorbis),
            opt_enable_disable("libopus", self.options.with_opus),
            opt_enable_disable("libzmq", self.options.with_zeromq),
            opt_enable_disable("sdl2", self.options.with_sdl),
            opt_enable_disable("libx264", self.options.with_libx264),
            opt_enable_disable("libx265", self.options.with_libx265),
            opt_enable_disable("libvpx", self.options.with_libvpx),
            opt_enable_disable("libmp3lame", self.options.with_libmp3lame),
            opt_enable_disable("libfdk-aac", self.options.with_libfdk_aac),
            opt_enable_disable("libwebp", self.options.with_libwebp),
            opt_enable_disable("openssl", self.options.with_ssl == "openssl"),
            opt_enable_disable("alsa", self.options.get_safe("with_libalsa")),
            opt_enable_disable("libpulse",
                               self.options.get_safe("with_pulse")),
            opt_enable_disable("vaapi", self.options.get_safe("with_vaapi")),
            opt_enable_disable("vdpau", self.options.get_safe("with_vdpau")),
            opt_enable_disable("libxcb", self.options.get_safe("with_xcb")),
            opt_enable_disable("libxcb-shm",
                               self.options.get_safe("with_xcb")),
            opt_enable_disable("libxcb-shape",
                               self.options.get_safe("with_xcb")),
            opt_enable_disable("libxcb-xfixes",
                               self.options.get_safe("with_xcb")),
            opt_enable_disable("appkit", self.options.get_safe("with_appkit")),
            opt_enable_disable("avfoundation",
                               self.options.get_safe("with_avfoundation")),
            opt_enable_disable("coreimage",
                               self.options.get_safe("with_coreimage")),
            opt_enable_disable("audiotoolbox",
                               self.options.get_safe("with_audiotoolbox")),
            opt_enable_disable("videotoolbox",
                               self.options.get_safe("with_videotoolbox")),
            opt_enable_disable("securetransport",
                               self.options.with_ssl == "securetransport"),
            "--disable-cuda",  # FIXME: CUDA support
            "--disable-cuvid",  # FIXME: CUVID support
            # Licenses
            opt_enable_disable("nonfree", self.options.with_libfdk_aac),
            opt_enable_disable(
                "gpl", self.options.with_libx264 or self.options.with_libx265
                or self.options.postproc)
        ]
        args.append("--arch={}".format(self._target_arch))
        if self.settings.build_type == "Debug":
            args.extend([
                "--disable-optimizations",
                "--disable-mmx",
                "--disable-stripping",
                "--enable-debug",
            ])
        if not self.options.with_programs:
            args.append("--disable-programs")
        # since ffmpeg"s build system ignores CC and CXX
        if tools.get_env("AS"):
            args.append("--as={}".format(tools.get_env("AS")))
        if tools.get_env("CC"):
            args.append("--cc={}".format(tools.get_env("CC")))
        if tools.get_env("CXX"):
            args.append("--cxx={}".format(tools.get_env("CXX")))
        extra_cflags = []
        extra_ldflags = []
        if tools.is_apple_os(self.settings.os) and self.settings.os.version:
            extra_cflags.append(
                tools.apple_deployment_target_flag(self.settings.os,
                                                   self.settings.os.version))
            extra_ldflags.append(
                tools.apple_deployment_target_flag(self.settings.os,
                                                   self.settings.os.version))
        if self.settings.compiler == "Visual Studio":
            args.append("--pkg-config={}".format(tools.get_env("PKG_CONFIG")))
            args.append("--toolchain=msvc")
            if tools.Version(str(self.settings.compiler.version)) <= 12:
                # Visual Studio 2013 (and earlier) doesn't support "inline" keyword for C (only for C++)
                self._autotools.defines.append("inline=__inline")
        if tools.cross_building(self):
            args.append("--target-os={}".format(self._target_os))
            if tools.is_apple_os(self.settings.os):
                xcrun = tools.XCRun(self.settings)
                apple_arch = tools.to_apple_arch(str(self.settings.arch))
                extra_cflags.extend([
                    "-arch {}".format(apple_arch),
                    "-isysroot {}".format(xcrun.sdk_path)
                ])
                extra_ldflags.extend([
                    "-arch {}".format(apple_arch),
                    "-isysroot {}".format(xcrun.sdk_path)
                ])

        args.append("--extra-cflags={}".format(" ".join(extra_cflags)))
        args.append("--extra-ldflags={}".format(" ".join(extra_ldflags)))

        self._autotools.configure(args=args,
                                  configure_dir=self._source_subfolder,
                                  build=False,
                                  host=False,
                                  target=False)
        return self._autotools
Exemplo n.º 13
0
    def build_configure(self):
        with tools.chdir('sources'):
            prefix = tools.unix_path(self.package_folder) if self.settings.os == 'Windows' else self.package_folder
            args = ['--prefix=%s' % prefix,
                    '--disable-doc',
                    '--disable-programs']
            if self.options.shared:
                args.extend(['--disable-static', '--enable-shared'])
            else:
                args.extend(['--disable-shared', '--enable-static', '--pkg-config-flags=--static'])
            if self.settings.build_type == 'Debug':
                args.extend(['--disable-optimizations', '--disable-mmx', '--disable-stripping', '--enable-debug'])
            if self.settings.compiler == 'Visual Studio':
                args.append('--toolchain=msvc')
            if self.settings.arch == 'x86':
                args.append('--arch=x86')

            args.append('--enable-postproc' if self.options.postproc else '--disable-postproc')
            args.append('--enable-pic' if self.options.fPIC else '--disable-pic')
            args.append('--enable-zlib' if self.options.zlib else '--disable-zlib')
            args.append('--enable-bzlib' if self.options.bzlib else '--disable-bzlib')
            args.append('--enable-lzma' if self.options.lzma else '--disable-lzma')
            args.append('--enable-iconv' if self.options.iconv else '--disable-iconv')
            args.append('--enable-libfreetype' if self.options.freetype else '--disable-libfreetype')
            args.append('--enable-libopenjpeg' if self.options.openjpeg else '--disable-libopenjpeg')
            args.append('--enable-libopenh264' if self.options.openh264 else '--disable-libopenh264')
            args.append('--enable-libvorbis' if self.options.vorbis else '--disable-libvorbis')
            args.append('--enable-libopus' if self.options.opus else '--disable-libopus')
            args.append('--enable-libzmq' if self.options.zmq else '--disable-libzmq')
            args.append('--enable-sdl2' if self.options.sdl2 else '--disable-sdl2')
            args.append('--enable-libx264' if self.options.x264 else '--disable-libx264')
            args.append('--enable-libx265' if self.options.x265 else '--disable-libx265')
            args.append('--enable-libvpx' if self.options.vpx else '--disable-libvpx')
            args.append('--enable-libmp3lame' if self.options.mp3lame else '--disable-libmp3lame')
            args.append('--enable-libfdk-aac' if self.options.fdk_aac else '--disable-libfdk-aac')

            if self.options.x264 or self.options.x265 or self.options.postproc:
                args.append('--enable-gpl')

            if self.options.fdk_aac:
                args.append('--enable-nonfree')

            if self.settings.os == "Linux":
                args.append('--enable-alsa' if self.options.alsa else '--disable-alsa')
                args.append('--enable-jack' if self.options.jack else '--disable-jack')
                args.append('--enable-libpulse' if self.options.pulse else '--disable-libpulse')
                args.append('--enable-vaapi' if self.options.vaapi else '--disable-vaapi')
                args.append('--enable-vdpau' if self.options.vdpau else '--disable-vdpau')
                if self.options.xcb:
                    args.extend(['--enable-libxcb', '--enable-libxcb-shm',
                                 '--enable-libxcb-shape', '--enable-libxcb-xfixes'])
                else:
                    args.extend(['--disable-libxcb', '--disable-libxcb-shm',
                                 '--disable-libxcb-shape', '--disable-libxcb-xfixes'])

            if self.settings.os == "Macos":
                args.append('--enable-appkit' if self.options.appkit else '--disable-appkit')
                args.append('--enable-avfoundation' if self.options.avfoundation else '--disable-avfoundation')
                args.append('--enable-coreimage' if self.options.avfoundation else '--disable-coreimage')
                args.append('--enable-audiotoolbox' if self.options.audiotoolbox else '--disable-audiotoolbox')
                args.append('--enable-videotoolbox' if self.options.videotoolbox else '--disable-videotoolbox')
                args.append('--enable-vda' if self.options.vda else '--disable-vda')
                args.append('--enable-securetransport' if self.options.securetransport else '--disable-securetransport')

            if self.settings.os == "Windows":
                args.append('--enable-libmfx' if self.options.qsv else '--disable-libmfx')

            # FIXME disable CUDA and CUVID by default, revisit later
            args.extend(['--disable-cuda', '--disable-cuvid'])

            os.makedirs('pkgconfig')
            if self.options.freetype:
                self.copy_pkg_config('freetype')
                self.copy_pkg_config('libpng')
            if self.options.opus:
                self.copy_pkg_config('opus')
            if self.options.vorbis:
                self.copy_pkg_config('ogg')
                self.copy_pkg_config('vorbis')
            if self.options.zmq:
                self.copy_pkg_config('zmq')
            if self.options.sdl2:
                self.copy_pkg_config('sdl2')
            if self.options.x264:
                self.copy_pkg_config('libx264')
            if self.options.x265:
                self.copy_pkg_config('libx265')
            if self.options.vpx:
                self.copy_pkg_config('libvpx')
            if self.options.fdk_aac:
                self.copy_pkg_config('libfdk_aac')
            if self.options.openh264:
                self.copy_pkg_config('openh264')

            env_vars = {'PKG_CONFIG_PATH': os.path.abspath('pkgconfig')}

            if self.settings.compiler == 'Visual Studio':
                args.append('--extra-cflags=-%s' % self.settings.compiler.runtime)
                if int(str(self.settings.compiler.version)) <= 12:
                    args.append('--extra-cflags=-Dsnprintf=_snprintf')

            with tools.environment_append(env_vars):
                env_build = AutoToolsBuildEnvironment(self, win_bash=self.is_mingw or self.is_msvc)
                # ffmpeg's configure is not actually from autotools, so it doesn't understand standard options like
                # --host, --build, --target
                env_build.configure(args=args, build=False, host=False, target=False)
                env_build.make()
Exemplo n.º 14
0
    def _configure_autotools(self):
        if self._autotools:
            return self._autotools
        self._autotools = AutoToolsBuildEnvironment(
            self, win_bash=tools.os_info.is_windows)
        self._autotools.libs = []
        yes_no = lambda v: "yes" if v else "no"
        conf_args = [
            "--enable-shared={}".format(yes_no(self.options.shared)),
            "--with-doc-strings={}".format(yes_no(self.options.docstrings)),
            "--with-pymalloc={}".format(yes_no(self.options.pymalloc)),
            "--with-system-expat",
            "--with-system-ffi",
            "--enable-optimizations={}".format(
                yes_no(self.options.optimizations)),
            "--with-lto={}".format(yes_no(self.options.lto)),
            "--with-pydebug={}".format(
                yes_no(self.settings.build_type == "Debug")),
        ]
        if self._is_py2:
            conf_args.extend([
                "--enable-unicode={}".format(yes_no(self.options.unicode)),
            ])
        if self._is_py3:
            conf_args.extend([
                "--with-system-libmpdec",
                "--with-openssl={}".format(
                    self.deps_cpp_info["openssl"].rootpath),
                "--enable-loadable-sqlite-extensions={}".format(
                    yes_no(not self.options["sqlite3"].omit_load_extension)),
            ])
        if self.settings.compiler == "intel":
            conf_args.extend(["--with-icc"])
        if tools.get_env("CC") or self.settings.compiler != "gcc":
            conf_args.append("--without-gcc")
        if self.options.with_tkinter:
            tcltk_includes = []
            tcltk_libs = []
            # FIXME: collect using some conan util (https://github.com/conan-io/conan/issues/7656)
            for dep in ("tcl", "tk", "zlib"):
                tcltk_includes += [
                    "-I{}".format(d)
                    for d in self.deps_cpp_info[dep].include_paths
                ]
                tcltk_libs += [
                    "-l{}".format(lib) for lib in self.deps_cpp_info[dep].libs
                ]
            if self.settings.os == "Linux" and not self.options["tk"].shared:
                # FIXME: use info from xorg.components (x11, xscrnsaver)
                tcltk_libs.extend(
                    ["-l{}".format(lib) for lib in ("X11", "Xss")])
            conf_args.extend([
                "--with-tcltk-includes={}".format(" ".join(tcltk_includes)),
                "--with-tcltk-libs={}".format(" ".join(tcltk_libs)),
            ])
        if self.settings.os in ("Linux", "FreeBSD"):
            # Building _testembed fails due to missing pthread/rt symbols
            self._autotools.link_flags.append("-lpthread")

        build = None
        if tools.cross_building(self) and not tools.cross_building(
                self, skip_x64_x86=True):
            # Building from x86_64 to x86 is not a "real" cross build, so set build == host
            build = tools.get_gnu_triplet(str(self.settings.os),
                                          str(self.settings.arch),
                                          str(self.settings.compiler))
        self._autotools.configure(args=conf_args,
                                  configure_dir=self._source_subfolder,
                                  build=build)
        return self._autotools
Exemplo n.º 15
0
    def build_configure(self):
        with tools.chdir(self._source_subfolder):
            prefix = tools.unix_path(
                self.package_folder
            ) if self.settings.os == 'Windows' else self.package_folder
            args = [
                '--prefix=%s' % prefix, '--disable-doc', '--disable-programs'
            ]
            if self.options.shared:
                args.extend(['--disable-static', '--enable-shared'])
            else:
                args.extend(['--disable-shared', '--enable-static'])
            args.append('--pkg-config-flags=--static')
            if self.settings.build_type == 'Debug':
                args.extend([
                    '--disable-optimizations', '--disable-mmx',
                    '--disable-stripping', '--enable-debug'
                ])
            # since ffmpeg's build system ignores CC and CXX
            if 'CC' in os.environ:
                args.append('--cc=%s' % os.environ['CC'])
            if 'CXX' in os.environ:
                args.append('--cxx=%s' % os.environ['CXX'])
            if self._is_msvc:
                args.append('--toolchain=msvc')
                args.append('--extra-cflags=-%s' %
                            self.settings.compiler.runtime)
                if int(str(self.settings.compiler.version)) <= 12:
                    # Visual Studio 2013 (and earlier) doesn't support "inline" keyword for C (only for C++)
                    args.append('--extra-cflags=-Dinline=__inline' %
                                self.settings.compiler.runtime)

            if self.settings.arch == 'x86':
                args.append('--arch=x86')

            if self.settings.os != "Windows":
                args.append(
                    '--enable-pic' if self.options.fPIC else '--disable-pic')

            args.append('--enable-postproc' if self.options.
                        postproc else '--disable-postproc')
            args.append(
                '--enable-zlib' if self.options.zlib else '--disable-zlib')
            args.append(
                '--enable-bzlib' if self.options.bzlib else '--disable-bzlib')
            args.append(
                '--enable-lzma' if self.options.lzma else '--disable-lzma')
            args.append(
                '--enable-iconv' if self.options.iconv else '--disable-iconv')
            args.append('--enable-libfreetype' if self.options.
                        freetype else '--disable-libfreetype')
            args.append('--enable-libopenjpeg' if self.options.
                        openjpeg else '--disable-libopenjpeg')
            args.append('--enable-libopenh264' if self.options.
                        openh264 else '--disable-libopenh264')
            args.append('--enable-libvorbis' if self.options.
                        vorbis else '--disable-libvorbis')
            args.append('--enable-libopus' if self.options.
                        opus else '--disable-libopus')
            args.append(
                '--enable-libzmq' if self.options.zmq else '--disable-libzmq')
            args.append(
                '--enable-sdl2' if self.options.sdl2 else '--disable-sdl2')
            args.append('--enable-libx264' if self.options.
                        x264 else '--disable-libx264')
            args.append('--enable-libx265' if self.options.
                        x265 else '--disable-libx265')
            args.append(
                '--enable-libvpx' if self.options.vpx else '--disable-libvpx')
            args.append('--enable-libmp3lame' if self.options.
                        mp3lame else '--disable-libmp3lame')
            args.append('--enable-libfdk-aac' if self.options.
                        fdk_aac else '--disable-libfdk-aac')
            args.append('--enable-libwebp' if self.options.
                        webp else '--disable-libwebp')
            args.append('--enable-openssl' if self.options.
                        openssl else '--disable-openssl')

            if self.options.x264 or self.options.x265 or self.options.postproc:
                args.append('--enable-gpl')

            if self.options.fdk_aac:
                args.append('--enable-nonfree')

            if self.settings.os == "Linux":
                args.append(
                    '--enable-alsa' if self.options.alsa else '--disable-alsa')
                args.append('--enable-libpulse' if self.options.
                            pulse else '--disable-libpulse')
                args.append('--enable-vaapi' if self.options.
                            vaapi else '--disable-vaapi')
                args.append('--enable-vdpau' if self.options.
                            vdpau else '--disable-vdpau')
                if self.options.xcb:
                    args.extend([
                        '--enable-libxcb', '--enable-libxcb-shm',
                        '--enable-libxcb-shape', '--enable-libxcb-xfixes'
                    ])
                else:
                    args.extend([
                        '--disable-libxcb', '--disable-libxcb-shm',
                        '--disable-libxcb-shape', '--disable-libxcb-xfixes'
                    ])

            if self.settings.os == "Macos":
                args.append('--enable-appkit' if self.options.
                            appkit else '--disable-appkit')
                args.append('--enable-avfoundation' if self.options.
                            avfoundation else '--disable-avfoundation')
                args.append('--enable-coreimage' if self.options.
                            avfoundation else '--disable-coreimage')
                args.append('--enable-audiotoolbox' if self.options.
                            audiotoolbox else '--disable-audiotoolbox')
                args.append('--enable-videotoolbox' if self.options.
                            videotoolbox else '--disable-videotoolbox')
                args.append('--enable-securetransport' if self.options.
                            securetransport else '--disable-securetransport')

            if self.settings.os == "Windows":
                args.append('--enable-libmfx' if self.options.
                            qsv else '--disable-libmfx')

            # FIXME disable CUDA and CUVID by default, revisit later
            args.extend(['--disable-cuda', '--disable-cuvid'])

            # Add dxv (resolume codec) support if requested
            if self.options.decoder_dxv:
                args.append('--enable-decoder=dxv')

            env_build = AutoToolsBuildEnvironment(
                self, win_bash=self._is_mingw_windows or self._is_msvc)
            # ffmpeg's configure is not actually from autotools, so it doesn't understand standard options like
            # --host, --build, --target
            env_build.configure(args=args,
                                build=False,
                                host=False,
                                target=False)
            env_build.make()
            env_build.make(args=['install'])
Exemplo n.º 16
0
    def build(self):
        binutils_bindir = os.path.join(self.deps_cpp_info['binutils'].rootpath,
                                       str(self.options.target), 'bin')
        sysroot_path = self._prepare_sysroot()

        with tools.chdir("{}-{}".format(self.name, self.version)):
            autotools = AutoToolsBuildEnvironment(self)
            """
 --with-build-sysroot=/home/jgsogo/dev/musl-cross-make/build/local/x86_64-linux-musl/
	 obj_sysroot 
 AR_FOR_TARGET=/home/jgsogo/dev/musl-cross-make/build/local/x86_64-linux-musl/
 	obj_binutils/binutils/ar 
 AS_FOR_TARGET=/home/jgsogo/dev/musl-cross-make/build/local/x86_64-linux-musl/obj_binutils/gas/as-new 
 LD_FOR_TARGET=/home/jgsogo/dev/musl-cross-make/build/local/x86_64-linux-musl/obj_binutils/ld/ld-new 
 NM_FOR_TARGET=/home/jgsogo/dev/musl-cross-make/build/local/x86_64-linux-musl/obj_binutils/binutils/nm-new 
 OBJCOPY_FOR_TARGET=/home/jgsogo/dev/musl-cross-make/build/local/x86_64-linux-musl/obj_binutils/binutils/objcopy 
 OBJDUMP_FOR_TARGET=/home/jgsogo/dev/musl-cross-make/build/local/x86_64-linux-musl/obj_binutils/binutils/objdump 
 RANLIB_FOR_TARGET=/home/jgsogo/dev/musl-cross-make/build/local/x86_64-linux-musl/obj_binutils/binutils/ranlib 
 READELF_FOR_TARGET=/home/jgsogo/dev/musl-cross-make/build/local/x86_64-linux-musl/obj_binutils/binutils/readelf 
 STRIP_FOR_TARGET=/home/jgsogo/dev/musl-cross-make/build/local/x86_64-linux-musl/obj_binutils/binutils/strip-new
			"""
            args = [
                "--enable-languages=c,c++",
                "--disable-werror",
                "--target={}".format(self.options.target),
                "--prefix=",
                "--libdir=/lib",
                "--disable-multilib",
                "--with-sysroot=/{}".format(self.options.target),
                "--enable-tls",
                "--disable-libmudflap",
                "--disable-libsanitizer",
                "--disable-gnu-indirect-function",
                "--disable-libmpx",
                "--enable-deterministic-archives",
                "--enable-libstdcxx-time",
                "--with-build-sysroot={}".format(sysroot_path),
                "AR_FOR_TARGET={}".format(os.path.join(binutils_bindir, "ar")),
                "AS_FOR_TARGET={}".format(os.path.join(binutils_bindir, "as")),
                "LD_FOR_TARGET={}".format(os.path.join(binutils_bindir, "ld")),
                "NM_FOR_TARGET={}".format(os.path.join(binutils_bindir, "nm")),
                "OBJCOPY_FOR_TARGET={}".format(
                    os.path.join(binutils_bindir, "objcopy")),
                "OBJDUMP_FOR_TARGET={}".format(
                    os.path.join(binutils_bindir, "objdump")),
                "RANLIB_FOR_TARGET={}".format(
                    os.path.join(binutils_bindir, "ranlib")),
                "READELF_FOR_TARGET={}".format(
                    os.path.join(binutils_bindir, "readelf")),
                "STRIP_FOR_TARGET={}".format(
                    os.path.join(binutils_bindir, "strip")),
            ]
            autotools.configure(args=args)
            "make MULTILIB_OSDIRNAMES= INFO_DEPS= infodir= ac_cv_prog_lex_root=lex.yy.c MAKEINFO=false"
            args = [
                "MULTILIB_OSDIRNAMES=", "INFO_DEPS=", "infodir=",
                "ac_cv_prog_lex_root=lex.yy.c", "MAKEINFO=false"
            ]
            make_args = args + [
                "MAKE=make {}".format(" ".join(args)),
            ]
            autotools.make(args=make_args)
Exemplo n.º 17
0
    def _configure_autotools(self):
        if self._autotools:
            return self._autotools

        self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)

        yes_no = lambda v: "yes" if v else "no"
        internal_no = lambda v: "internal" if v else "no"
        rootpath = lambda req: tools.unix_path(self.deps_cpp_info[req].rootpath)
        rootpath_no = lambda v, req: rootpath(req) if v else "no"

        args = []
        args.append("--datarootdir={}".format(tools.unix_path(os.path.join(self.package_folder, "res"))))
        # Shared/Static
        args.extend([
            "--enable-static={}".format(yes_no(not self.options.shared)),
            "--enable-shared={}".format(yes_no(self.options.shared)),
        ])
        # Enable C++14 if requested in conan profile or if with_charls enabled
        if (self.settings.compiler.cppstd and tools.valid_min_cppstd(self, 14)) or self.options.with_charls:
            args.append("--with-cpp14")
        # Debug
        if self.settings.build_type == "Debug":
            args.append("--enable-debug")
        # SIMD Intrinsics
        simd_intrinsics = self.options.get_safe("simd_intrinsics", False)
        if not simd_intrinsics:
            args.extend(["--without-sse", "--without-ssse3", "--without-avx"])
        elif simd_intrinsics == "sse":
            args.extend(["--with-sse", "--without-ssse3", "--without-avx"])
        elif simd_intrinsics == "ssse3":
            args.extend(["--with-sse", "--with-ssse3", "--without-avx"])
        elif simd_intrinsics == "avx":
            args.extend(["--with-sse", "--with-ssse3", "--with-avx"])
        # LTO (disabled)
        args.append("--disable-lto")
        # Symbols
        args.append("--with-hide_internal_symbols")
        # Do not add /usr/local/lib and /usr/local/include
        args.append("--without-local")
        # Threadsafe
        args.append("--with-threads={}".format(yes_no(self.options.threadsafe)))
        # Depencencies:
        args.append("--with-proj=yes") # always required !
        args.append("--with-libz={}".format(yes_no(self.options.with_zlib)))
        if self._has_with_libdeflate_option:
            args.append("--with-libdeflate={}".format(yes_no(self.options.with_libdeflate)))
        args.append("--with-libiconv-prefix={}".format(rootpath_no(self.options.with_libiconv, "libiconv")))
        args.append("--with-liblzma=no") # always disabled: liblzma is an optional transitive dependency of gdal (through libtiff).
        args.append("--with-zstd={}".format(yes_no(self.options.get_safe("with_zstd")))) # Optional direct dependency of gdal only if lerc lib enabled
        # Drivers:
        if not (self.options.with_zlib and self.options.with_png and bool(self.options.with_jpeg)):
            # MRF raster driver always depends on zlib, libpng and libjpeg: https://github.com/OSGeo/gdal/issues/2581
            if tools.Version(self.version) < "3.0.0":
                args.append("--without-mrf")
            else:
                args.append("--disable-driver-mrf")
        args.append("--with-pg={}".format(yes_no(self.options.with_pg)))
        args.extend(["--without-grass", "--without-libgrass"]) # TODO: to implement when libgrass lib available
        args.append("--with-cfitsio={}".format(rootpath_no(self.options.with_cfitsio, "cfitsio")))
        args.append("--with-pcraster={}".format(internal_no(self.options.with_pcraster))) # TODO: use conan recipe when available instead of internal one
        args.append("--with-png={}".format(rootpath_no(self.options.with_png, "libpng")))
        args.append("--with-dds={}".format(rootpath_no(self.options.with_dds, "crunch")))
        args.append("--with-gta={}".format(rootpath_no(self.options.with_gta, "libgta")))
        args.append("--with-pcidsk={}".format(internal_no(self.options.with_pcidsk))) # TODO: use conan recipe when available instead of internal one
        args.append("--with-libtiff={}".format(rootpath("libtiff"))) # always required !
        args.append("--with-geotiff={}".format(rootpath("libgeotiff"))) # always required !
        if self.options.with_jpeg == "libjpeg":
            args.append("--with-jpeg={}".format(rootpath("libjpeg")))
        elif self.options.with_jpeg == "libjpeg-turbo":
            args.append("--with-jpeg={}".format(rootpath("libjpeg-turbo")))
        else:
            args.append("--without-jpeg")
        args.append("--without-jpeg12") # disabled: it requires internal libjpeg and libgeotiff
        args.append("--with-charls={}".format(yes_no(self.options.with_charls)))
        args.append("--with-gif={}".format(rootpath_no(self.options.with_gif, "giflib")))
        args.append("--without-ogdi") # TODO: to implement when ogdi lib available (https://sourceforge.net/projects/ogdi/)
        args.append("--without-fme") # commercial library
        args.append("--without-sosi") # TODO: to implement when fyba lib available
        args.append("--without-mongocxx") # TODO: handle mongo-cxx-driver v2
        args.append("--with-mongocxxv3={}".format(yes_no(self.options.with_mongocxx)))
        args.append("--with-hdf4={}".format(yes_no(self.options.with_hdf4)))
        args.append("--with-hdf5={}".format(yes_no(self.options.with_hdf5)))
        args.append("--with-kea={}".format(yes_no(self.options.with_kea)))
        args.append("--with-netcdf={}".format(rootpath_no(self.options.with_netcdf, "netcdf")))
        args.append("--with-jasper={}".format(rootpath_no(self.options.with_jasper, "jasper")))
        args.append("--with-openjpeg={}".format(yes_no(self.options.with_openjpeg)))
        args.append("--without-fgdb") # TODO: to implement when file-geodatabase-api lib available
        args.append("--without-ecw") # commercial library
        args.append("--without-kakadu") # commercial library
        args.extend(["--without-mrsid", "--without-jp2mrsid", "--without-mrsid_lidar"]) # commercial library
        args.append("--without-jp2lura") # commercial library
        args.append("--without-msg") # commercial library
        args.append("--without-oci") # TODO
        args.append("--with-gnm={}".format(yes_no(self.options.with_gnm)))
        args.append("--with-mysql={}".format(yes_no(self.options.with_mysql)))
        args.append("--without-ingres") # commercial library
        args.append("--with-xerces={}".format(rootpath_no(self.options.with_xerces, "xerces-c")))
        args.append("--with-expat={}".format(yes_no(self.options.with_expat)))
        args.append("--with-libkml={}".format(rootpath_no(self.options.with_libkml, "libkml")))
        if self.options.with_odbc:
            args.append("--with-odbc={}".format("yes" if self.settings.os == "Windows" else rootpath("odbc")))
        else:
            args.append("--without-odbc")
        args.append("--without-dods-root") # TODO: to implement when libdap lib available
        args.append("--with-curl={}".format(yes_no(self.options.with_curl)))
        args.append("--with-xml2={}".format(yes_no(self.options.with_xml2)))
        args.append("--without-spatialite") # TODO: to implement when libspatialite lib available
        args.append("--with-sqlite3={}".format(yes_no(self.options.get_safe("with_sqlite3"))))
        args.append("--without-rasterlite2") # TODO: to implement when rasterlite2 lib available
        args.append("--with-pcre={}".format(yes_no(self.options.get_safe("with_pcre"))))
        args.append("--without-teigha") # commercial library
        args.append("--without-idb") # commercial library
        if tools.Version(self.version) < "3.2.0":
            args.append("--without-sde") # commercial library
        if tools.Version(self.version) < "3.3.0":
            args.append("--without-epsilon")
        args.append("--with-webp={}".format(rootpath_no(self.options.with_webp, "libwebp")))
        args.append("--with-geos={}".format(yes_no(self.options.with_geos)))
        args.append("--without-sfcgal") # TODO: to implement when sfcgal lib available
        args.append("--with-qhull={}".format(yes_no(self.options.with_qhull)))
        if self.options.with_opencl:
            args.extend([
                "--with-opencl",
                "--with-opencl-include={}".format(tools.unix_path(self.deps_cpp_info["opencl-headers"].include_paths[0])),
                "--with-opencl-lib=-L{}".format(tools.unix_path(self.deps_cpp_info["opencl-icd-loader"].lib_paths[0]))
            ])
        else:
            args.append("--without-opencl")
        args.append("--with-freexl={}".format(yes_no(self.options.with_freexl)))
        args.append("--with-libjson-c={}".format(rootpath("json-c"))) # always required !
        if self.options.without_pam:
            args.append("--without-pam")
        args.append("--with-poppler={}".format(yes_no(self.options.with_poppler)))
        args.append("--with-podofo={}".format(rootpath_no(self.options.with_podofo, "podofo")))
        if self.options.with_podofo:
            args.append("--with-podofo-lib=-l{}".format(" -l".join(self._gather_libs("podofo"))))
        args.append("--without-pdfium") # TODO: to implement when pdfium lib available
        args.append("--without-perl")
        args.append("--without-python")
        args.append("--without-java")
        args.append("--without-hdfs")
        if tools.Version(self.version) >= "3.0.0":
            args.append("--without-tiledb") # TODO: to implement when tiledb lib available
        args.append("--without-mdb")
        args.append("--without-rasdaman") # TODO: to implement when rasdaman lib available
        if tools.Version(self.version) >= "3.1.0":
            args.append("--without-rdb") # commercial library
        args.append("--without-armadillo") # TODO: to implement when armadillo lib available
        args.append("--with-cryptopp={}".format(rootpath_no(self.options.with_cryptopp, "cryptopp")))
        args.append("--with-crypto={}".format(yes_no(self.options.with_crypto)))
        if tools.Version(self.version) >= "3.3.0":
            args.append("--with-lerc={}".format(internal_no(not self.options.without_lerc)))
        else:
            args.append("--with-lerc={}".format(yes_no(not self.options.without_lerc)))
        if self.options.with_null:
            args.append("--with-null")
        if self._has_with_exr_option:
            args.append("--with-exr={}".format(yes_no(self.options.with_exr)))
        if self._has_with_heif_option:
            args.append("--with-heif={}".format(yes_no(self.options.with_heif)))

        # Inject -stdlib=libc++ for clang with libc++
        env_build_vars = self._autotools.vars
        if self.settings.compiler == "clang" and \
           self.settings.os == "Linux" and tools.stdcpp_library(self) == "c++":
            env_build_vars["LDFLAGS"] = "-stdlib=libc++ {}".format(env_build_vars["LDFLAGS"])

        self._autotools.configure(args=args, vars=env_build_vars)
        return self._autotools
Exemplo n.º 18
0
 def _configure_autotools(self):
     if not self._autotools:
         self._autotools = AutoToolsBuildEnvironment(self)
         self._autotools.configure(configure_dir=self._source_subfolder)
     return self._autotools
Exemplo n.º 19
0
    def build(self):

        if self.settings.os == "Linux" or self.settings.os == "Macos":

            env_build = AutoToolsBuildEnvironment(self)

            env_vars = env_build.vars.copy()
            # Configure script creates conftest that cannot execute without shared openssl binaries.
            # Ways to solve the problem:
            # 1. set *LD_LIBRARY_PATH (works with Linux with RunEnvironment but does not work on OS X 10.11 with SIP)
            # 2. copying dylib's to the build directory (fortunately works on OS X)
            imported_libs = []
            if self.options.shared and self.settings.os == "Macos":
                for dep in self.deps_cpp_info.deps:
                    for libname in os.listdir(
                            self.deps_cpp_info[dep].lib_paths[0]):
                        if libname.endswith('.dylib'):
                            shutil.copy(
                                self.deps_cpp_info[dep].lib_paths[0] + '/' +
                                libname, self.source_subfolder)
                            imported_libs.append(libname)
                self.output.warn(
                    "Copying OpenSSL libraries to fix conftest: " +
                    repr(imported_libs))

            # required to correctly find static libssl on Linux
            if self.options.with_openssl and self.settings.os == "Linux":
                env_vars['OPENSSL_LIBADD'] = '-ldl'

            # disable rpath build
            tools.replace_in_file(
                os.path.join(self.source_subfolder, "configure"),
                r"-install_name \$rpath/", "-install_name ")

            # compose configure options
            suffix = ''
            if not self.options.shared:
                suffix += " --disable-shared "
            if self.options.with_openssl:
                suffix += "--enable-openssl "
            else:
                suffix += "--disable-openssl "
            if self.options.disable_threads:
                suffix += "--disable-thread-support "

            with tools.environment_append(env_vars):

                with tools.chdir(self.source_subfolder):
                    # set LD_LIBRARY_PATH
                    with tools.environment_append(RunEnvironment(self).vars):
                        cmd = './configure %s' % (suffix)
                        self.output.warn('Running: ' + cmd)
                        self.run(cmd)

                        cmd = 'make'
                        self.output.warn('Running: ' + cmd)
                        self.run(cmd)

                    # now clean imported libs
                    for imported_lib in imported_libs:
                        os.unlink(imported_lib)

        elif self.settings.os == "Windows":
            vcvars = tools.vcvars_command(self.settings)
            suffix = ''
            if self.is_v21 and self.options.with_openssl:
                suffix = "OPENSSL_DIR=" + self.deps_cpp_info['OpenSSL'].rootpath
            make_command = "nmake %s -f Makefile.nmake" % suffix
            with tools.chdir(self.source_subfolder):
                self.run("%s && %s" % (vcvars, make_command))
Exemplo n.º 20
0
 def _configure_autotools(self):
     if self._autotools:
         return self._autotools
     self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
     self._autotools.configure(args=self._autotools_args, configure_dir=self._source_subfolder)
     return self._autotools
Exemplo n.º 21
0
    def _configure_autotools(self):
        if self._autotools:
            return self._autotools
        self._autotools = AutoToolsBuildEnvironment(
            self, win_bash=tools.os_info.is_windows)
        self._autotools.libs = []

        def opt_enable_disable(what, v):
            return "--{}-{}".format("enable" if v else "disable", what)

        def opt_append_disable_if_set(args, what, v):
            if v:
                args.append("--disable-{}".format(what))

        args = [
            "--pkg-config-flags=--static",
            "--disable-doc",
            opt_enable_disable("cross-compile", tools.cross_building(self)),
            # Libraries
            opt_enable_disable("shared", self.options.shared),
            opt_enable_disable("static", not self.options.shared),
            opt_enable_disable("pic", self.options.get_safe("fPIC", True)),
            # Components
            opt_enable_disable("avdevice", self.options.avdevice),
            opt_enable_disable("avcodec", self.options.avcodec),
            opt_enable_disable("avformat", self.options.avformat),
            opt_enable_disable("swresample", self.options.swresample),
            opt_enable_disable("swscale", self.options.swscale),
            opt_enable_disable("postproc", self.options.postproc),
            opt_enable_disable("avfilter", self.options.avfilter),

            # Dependencies
            opt_enable_disable("bzlib", self.options.with_bzip2),
            opt_enable_disable("zlib", self.options.with_zlib),
            opt_enable_disable("lzma", self.options.with_lzma),
            opt_enable_disable("iconv", self.options.with_libiconv),
            opt_enable_disable("libopenjpeg", self.options.with_openjpeg),
            opt_enable_disable("libopenh264", self.options.with_openh264),
            opt_enable_disable("libvorbis", self.options.with_vorbis),
            opt_enable_disable("libopus", self.options.with_opus),
            opt_enable_disable("libzmq", self.options.with_zeromq),
            opt_enable_disable("sdl2", self.options.with_sdl),
            opt_enable_disable("libx264", self.options.with_libx264),
            opt_enable_disable("libx265", self.options.with_libx265),
            opt_enable_disable("libvpx", self.options.with_libvpx),
            opt_enable_disable("libmp3lame", self.options.with_libmp3lame),
            opt_enable_disable("libfdk-aac", self.options.with_libfdk_aac),
            opt_enable_disable("libwebp", self.options.with_libwebp),
            opt_enable_disable("openssl", self.options.with_ssl == "openssl"),
            opt_enable_disable("alsa", self.options.get_safe("with_libalsa")),
            opt_enable_disable("libpulse",
                               self.options.get_safe("with_pulse")),
            opt_enable_disable("vaapi", self.options.get_safe("with_vaapi")),
            opt_enable_disable("vdpau", self.options.get_safe("with_vdpau")),
            opt_enable_disable("libxcb", self.options.get_safe("with_xcb")),
            opt_enable_disable("libxcb-shm",
                               self.options.get_safe("with_xcb")),
            opt_enable_disable("libxcb-shape",
                               self.options.get_safe("with_xcb")),
            opt_enable_disable("libxcb-xfixes",
                               self.options.get_safe("with_xcb")),
            opt_enable_disable("appkit", self.options.get_safe("with_appkit")),
            opt_enable_disable("avfoundation",
                               self.options.get_safe("with_avfoundation")),
            opt_enable_disable("coreimage",
                               self.options.get_safe("with_coreimage")),
            opt_enable_disable("audiotoolbox",
                               self.options.get_safe("with_audiotoolbox")),
            opt_enable_disable("videotoolbox",
                               self.options.get_safe("with_videotoolbox")),
            opt_enable_disable("securetransport",
                               self.options.with_ssl == "securetransport"),
            "--disable-cuda",  # FIXME: CUDA support
            "--disable-cuvid",  # FIXME: CUVID support
            # Licenses
            opt_enable_disable(
                "nonfree", self.options.with_libfdk_aac
                or (self.options.with_ssl and
                    (self.options.with_libx264 or self.options.with_libx265
                     or self.options.postproc))),
            opt_enable_disable(
                "gpl", self.options.with_libx264 or self.options.with_libx265
                or self.options.postproc)
        ]

        # Individual Component Options
        opt_append_disable_if_set(args, "everything",
                                  self.options.disable_everything)
        opt_append_disable_if_set(args, "encoders",
                                  self.options.disable_all_encoders)
        opt_append_disable_if_set(args, "decoders",
                                  self.options.disable_all_decoders)
        opt_append_disable_if_set(
            args, "hwaccels", self.options.disable_all_hardware_accelerators)
        opt_append_disable_if_set(args, "muxers",
                                  self.options.disable_all_muxers)
        opt_append_disable_if_set(args, "demuxers",
                                  self.options.disable_all_demuxers)
        opt_append_disable_if_set(args, "parsers",
                                  self.options.disable_all_parsers)
        opt_append_disable_if_set(args, "bsfs",
                                  self.options.disable_all_bitstream_filters)
        opt_append_disable_if_set(args, "protocols",
                                  self.options.disable_all_protocols)
        opt_append_disable_if_set(args, "devices",
                                  self.options.disable_all_devices)
        opt_append_disable_if_set(args, "indevs",
                                  self.options.disable_all_input_devices)
        opt_append_disable_if_set(args, "outdevs",
                                  self.options.disable_all_output_devices)
        opt_append_disable_if_set(args, "filters",
                                  self.options.disable_all_filters)

        args.extend(
            self._split_and_format_options_string(
                "enable-encoder", self.options.enable_encoders))
        args.extend(
            self._split_and_format_options_string(
                "disable-encoder", self.options.disable_encoders))
        args.extend(
            self._split_and_format_options_string(
                "enable-decoder", self.options.enable_decoders))
        args.extend(
            self._split_and_format_options_string(
                "disable-decoder", self.options.disable_decoders))
        args.extend(
            self._split_and_format_options_string(
                "enable-hwaccel", self.options.enable_hardware_accelerators))
        args.extend(
            self._split_and_format_options_string(
                "disable-hwaccel", self.options.disable_hardware_accelerators))
        args.extend(
            self._split_and_format_options_string("enable-muxer",
                                                  self.options.enable_muxers))
        args.extend(
            self._split_and_format_options_string("disable-muxer",
                                                  self.options.disable_muxers))
        args.extend(
            self._split_and_format_options_string(
                "enable-demuxer", self.options.enable_demuxers))
        args.extend(
            self._split_and_format_options_string(
                "disable-demuxer", self.options.disable_demuxers))
        args.extend(
            self._split_and_format_options_string("enable-parser",
                                                  self.options.enable_parsers))
        args.extend(
            self._split_and_format_options_string(
                "disable-parser", self.options.disable_parsers))
        args.extend(
            self._split_and_format_options_string(
                "enable-bsf", self.options.enable_bitstream_filters))
        args.extend(
            self._split_and_format_options_string(
                "disable-bsf", self.options.disable_bitstream_filters))
        args.extend(
            self._split_and_format_options_string(
                "enable-protocol", self.options.enable_protocols))
        args.extend(
            self._split_and_format_options_string(
                "disable-protocol", self.options.disable_protocols))
        args.extend(
            self._split_and_format_options_string(
                "enable-indev", self.options.enable_input_devices))
        args.extend(
            self._split_and_format_options_string(
                "disable-indev", self.options.disable_input_devices))
        args.extend(
            self._split_and_format_options_string(
                "enable-outdev", self.options.enable_output_devices))
        args.extend(
            self._split_and_format_options_string(
                "disable-outdev", self.options.disable_output_devices))
        args.extend(
            self._split_and_format_options_string("enable-filter",
                                                  self.options.enable_filters))
        args.extend(
            self._split_and_format_options_string(
                "disable-filter", self.options.disable_filters))

        if self._version_supports_vulkan():
            args.append(
                opt_enable_disable("vulkan",
                                   self.options.get_safe("with_vulkan")))
        if tools.is_apple_os(self.settings.os):
            # relocatable shared libs
            args.append("--install-name-dir=@rpath")
        args.append("--arch={}".format(self._target_arch))
        if self.settings.build_type == "Debug":
            args.extend([
                "--disable-optimizations",
                "--disable-mmx",
                "--disable-stripping",
                "--enable-debug",
            ])
        if not self.options.with_programs:
            args.append("--disable-programs")
        # since ffmpeg"s build system ignores CC and CXX
        if tools.get_env("AS"):
            args.append("--as={}".format(tools.get_env("AS")))
        if tools.get_env("CC"):
            args.append("--cc={}".format(tools.get_env("CC")))
        if tools.get_env("CXX"):
            args.append("--cxx={}".format(tools.get_env("CXX")))
        extra_cflags = []
        extra_ldflags = []
        if tools.is_apple_os(self.settings.os) and self.settings.os.version:
            extra_cflags.append(
                tools.apple_deployment_target_flag(self.settings.os,
                                                   self.settings.os.version))
            extra_ldflags.append(
                tools.apple_deployment_target_flag(self.settings.os,
                                                   self.settings.os.version))
        if self._is_msvc:
            args.append("--pkg-config={}".format(tools.get_env("PKG_CONFIG")))
            args.append("--toolchain=msvc")
            if self.settings.compiler == "Visual Studio" and tools.Version(
                    self.settings.compiler.version) <= "12":
                # Visual Studio 2013 (and earlier) doesn't support "inline" keyword for C (only for C++)
                self._autotools.defines.append("inline=__inline")
        if tools.cross_building(self):
            if self._target_os == "emscripten":
                args.append("--target-os=none")
            else:
                args.append("--target-os={}".format(self._target_os))

            if tools.is_apple_os(self.settings.os):
                xcrun = tools.XCRun(self.settings)
                apple_arch = tools.to_apple_arch(str(self.settings.arch))
                extra_cflags.extend([
                    "-arch {}".format(apple_arch),
                    "-isysroot {}".format(xcrun.sdk_path)
                ])
                extra_ldflags.extend([
                    "-arch {}".format(apple_arch),
                    "-isysroot {}".format(xcrun.sdk_path)
                ])

        args.append("--extra-cflags={}".format(" ".join(extra_cflags)))
        args.append("--extra-ldflags={}".format(" ".join(extra_ldflags)))

        self._autotools.configure(args=args,
                                  configure_dir=self._source_subfolder,
                                  build=False,
                                  host=False,
                                  target=False)
        return self._autotools
Exemplo n.º 22
0
    def package(self):
        self.copy(pattern="COPYRIGHT",
                  dst="licenses",
                  src=self._source_subfolder)
        if self._is_msvc:
            self.copy("*postgres_ext.h",
                      src=self._source_subfolder,
                      dst="include",
                      keep_path=False)
            self.copy("*pg_config.h",
                      src=self._source_subfolder,
                      dst="include",
                      keep_path=False)
            self.copy("*pg_config_ext.h",
                      src=self._source_subfolder,
                      dst="include",
                      keep_path=False)
            self.copy("*libpq-fe.h",
                      src=self._source_subfolder,
                      dst="include",
                      keep_path=False)
            self.copy("*libpq-events.h",
                      src=self._source_subfolder,
                      dst="include",
                      keep_path=False)
            self.copy("*.h",
                      src=os.path.join(self._source_subfolder, "src",
                                       "include", "libpq"),
                      dst=os.path.join("include", "libpq"),
                      keep_path=False)
            self.copy("*genbki.h",
                      src=self._source_subfolder,
                      dst=os.path.join("include", "catalog"),
                      keep_path=False)
            self.copy("*pg_type.h",
                      src=self._source_subfolder,
                      dst=os.path.join("include", "catalog"),
                      keep_path=False)
            if self.options.shared:
                self.copy("**/libpq.dll",
                          src=self._source_subfolder,
                          dst="bin",
                          keep_path=False)
                self.copy("**/libpq.lib",
                          src=self._source_subfolder,
                          dst="lib",
                          keep_path=False)
            else:
                self.copy("*.lib",
                          src=self._source_subfolder,
                          dst="lib",
                          keep_path=False)
        else:
            autotools = AutoToolsBuildEnvironment(
                self, win_bash=tools.os_info.is_windows
            )  #self._configure_autotools()
            with tools.chdir(
                    os.path.join(self._source_subfolder, "src", "common")):
                autotools.install(args=self._make_args)
            with tools.chdir(
                    os.path.join(self._source_subfolder, "src", "include")):
                autotools.install(args=self._make_args)
            with tools.chdir(
                    os.path.join(self._source_subfolder, "src", "interfaces",
                                 "libpq")):
                autotools.install(args=self._make_args)
            if tools.Version(self.version) >= "12":
                with tools.chdir(
                        os.path.join(self._source_subfolder, "src", "port")):
                    autotools.install(args=self._make_args)

            with tools.chdir(
                    os.path.join(self._source_subfolder, "src", "bin",
                                 "pg_config")):
                autotools.install(args=self._make_args)

            self._remove_unused_libraries_from_package()

            tools.rmdir(
                os.path.join(self.package_folder, "include", "postgresql",
                             "server"))
            self.copy(pattern="*.h",
                      dst=os.path.join("include", "catalog"),
                      src=os.path.join(self._source_subfolder, "src",
                                       "include", "catalog"))
        self.copy(pattern="*.h",
                  dst=os.path.join("include", "catalog"),
                  src=os.path.join(self._source_subfolder, "src", "backend",
                                   "catalog"))
        tools.rmdir(os.path.join(self.package_folder, "share"))
        tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
Exemplo n.º 23
0
 def build(self):
     be = AutoToolsBuildEnvironment(self)
     with tools.chdir(self._source_subfolder):
         with tools.environment_append(be.vars):
             be.configure()
             be.make()
Exemplo n.º 24
0
 def _configure_qemu(self):
     autotools = AutoToolsBuildEnvironment(self)
     autotools.configure(configure_dir=self._source_subfolder)
     return autotools
Exemplo n.º 25
0
    def _configure_autotools(self):
        if self._autotools:
            return self._autotools

        configure_dir = self._source_subfolder
        with tools.chdir(configure_dir):
            self.run("autoconf -i", win_bash=tools.os_info.is_windows)
        self._autotools = AutoToolsBuildEnvironment(
            self, win_bash=tools.os_info.is_windows)

        args = []
        args.append("--datarootdir={}".format(
            self._unix_path(os.path.join(self.package_folder, "res"))))
        # Shared/Static
        if self.options.shared:
            args.extend(["--disable-static", "--enable-shared"])
        else:
            args.extend(["--disable-shared", "--enable-static"])
        # Enable C++14 if requested in conan profile
        if self.settings.compiler.cppstd and tools.valid_min_cppstd(self, 14):
            args.append("--with-cpp14")
        # Debug
        if self.settings.build_type == "Debug":
            args.append("--enable-debug")
        # SIMD Intrinsics
        simd_intrinsics = self.options.get_safe("simd_intrinsics", False)
        if not simd_intrinsics:
            args.extend(["--without-sse", "--without-ssse3", "--without-avx"])
        elif simd_intrinsics == "sse":
            args.extend(["--with-sse", "--without-ssse3", "--without-avx"])
        elif simd_intrinsics == "ssse3":
            args.extend(["--with-sse", "--with-ssse3", "--without-avx"])
        elif simd_intrinsics == "avx":
            args.extend(["--with-sse", "--with-ssse3", "--with-avx"])
        # LTO (disabled)
        args.append("--disable-lto")
        # Symbols
        args.append("--with-hide_internal_symbols")
        # Do not add /usr/local/lib and /usr/local/include
        args.append("--without-local")
        # Threadsafe
        args.append("--with-threads={}".format(
            "yes" if self.options.threadsafe else "no"))
        # Depencencies:
        args.append("--with-proj=yes")  # always required !
        args.append(
            "--with-libz={}".format("yes" if self.options.with_zlib else "no"))
        args.append("--with-libiconv-prefix={}".format(
            self._unix_path(self.deps_cpp_info["libiconv"].rootpath)))
        args.append(
            "--with-liblzma=no"
        )  # always disabled: liblzma is an optional transitive dependency of gdal (through libtiff).
        args.append("--with-zstd={}".format(
            "yes" if self.options.get_safe("with_zstd") else "no"
        ))  # Optional direct dependency of gdal only if lerc lib enabled
        # Drivers:
        if not (self.options.with_zlib and self.options.with_png
                and bool(self.options.with_jpeg)):
            # MRF raster driver always depends on zlib, libpng and libjpeg: https://github.com/OSGeo/gdal/issues/2581
            if tools.Version(self.version) < "3.0.0":
                args.append("--without-mrf")
            else:
                args.append("--disable-driver-mrf")
        args.append(
            "--with-pg={}".format("yes" if self.options.with_pg else "no"))
        args.extend(["--without-grass", "--without-libgrass"
                     ])  # TODO: to implement when libgrass lib available
        args.append("--with-cfitsio={}".format(
            self._unix_path(self.deps_cpp_info["cfitsio"].rootpath) if self.
            options.with_cfitsio else "no"))
        args.append("--with-pcraster={}".format(
            "internal" if self.options.with_pcraster else "no"
        ))  # TODO: use conan recipe when available instead of internal one
        args.append("--with-png={}".format(
            self._unix_path(self.deps_cpp_info["libpng"].rootpath) if self.
            options.with_png else "no"))
        args.append(
            "--without-dds")  # TODO: to implement when crunch lib available
        args.append("--with-gta={}".format(
            self._unix_path(self.deps_cpp_info["libgta"].rootpath) if self.
            options.with_gta else "no"))
        args.append("--with-pcidsk={}".format(
            "internal" if self.options.with_pcidsk else "no"
        ))  # TODO: use conan recipe when available instead of internal one
        args.append("--with-libtiff={}".format(
            self._unix_path(
                self.deps_cpp_info["libtiff"].rootpath)))  # always required !
        args.append("--with-geotiff={}".format(
            self._unix_path(self.deps_cpp_info["libgeotiff"].rootpath))
                    )  # always required !
        if self.options.with_jpeg == "libjpeg":
            args.append("--with-jpeg={}".format(
                self._unix_path(self.deps_cpp_info["libjpeg"].rootpath)))
        elif self.options.with_jpeg == "libjpeg-turbo":
            args.append("--with-jpeg={}".format(
                self._unix_path(self.deps_cpp_info["libjpeg-turbo"].rootpath)))
        else:
            args.append("--without-jpeg")
        args.append("--without-jpeg12"
                    )  # disabled: it requires internal libjpeg and libgeotiff
        args.append("--with-charls={}".format(
            "yes" if self.options.with_charls else "no"))
        args.append("--with-gif={}".format(
            self._unix_path(self.deps_cpp_info["giflib"].rootpath) if self.
            options.with_gif else "no"))
        args.append(
            "--without-ogdi"
        )  # TODO: to implement when ogdi lib available (https://sourceforge.net/projects/ogdi/)
        args.append("--without-fme")  # commercial library
        args.append(
            "--without-sosi")  # TODO: to implement when fyba lib available
        args.append("--without-mongocxx"
                    )  # TODO: to implement when mongocxx lib available
        args.append(
            "--with-hdf4={}".format("yes" if self.options.with_hdf4 else "no"))
        args.append(
            "--with-hdf5={}".format("yes" if self.options.with_hdf5 else "no"))
        args.append(
            "--without-kea")  # TODO: to implement when kealib available
        args.append("--without-netcdf"
                    )  # TODO: to implement when netcdf-c lib available
        args.append("--with-jasper={}".format(
            self._unix_path(self.deps_cpp_info["jasper"].rootpath) if self.
            options.with_jasper else "no"))
        args.append("--with-openjpeg={}".format(
            "yes" if self.options.with_openjpeg else "no"))
        args.append(
            "--without-fgdb"
        )  # TODO: to implement when file-geodatabase-api lib available
        args.append("--without-ecw")  # commercial library
        args.append("--without-kakadu")  # commercial library
        args.extend(
            ["--without-mrsid", "--without-jp2mrsid",
             "--without-mrsid_lidar"])  # commercial library
        args.append("--without-jp2lura")  # commercial library
        args.append("--without-msg")  # commercial library
        args.append("--without-oci")  # TODO
        args.append(
            "--with-gnm={}".format("yes" if self.options.with_gnm else "no"))
        args.append("--with-mysql={}".format(
            "yes" if bool(self.options.with_mysql) else "no"))
        args.append("--without-ingres")  # commercial library
        args.append("--with-xerces={}".format(
            self._unix_path(self.deps_cpp_info["xerces-c"].rootpath) if self.
            options.with_xerces else "no"))
        args.append("--with-expat={}".format(
            "yes" if self.options.with_expat else "no"))
        args.append("--with-libkml={}".format(
            self._unix_path(self.deps_cpp_info["libkml"].rootpath) if self.
            options.with_libkml else "no"))
        args.append("--with-odbc={}".format(
            self._unix_path(self.deps_cpp_info["odbc"].rootpath) if self.
            options.with_odbc else "no"))
        args.append("--without-dods-root"
                    )  # TODO: to implement when libdap lib available
        args.append(
            "--with-curl={}".format("yes" if self.options.with_curl else "no"))
        args.append(
            "--with-xml2={}".format("yes" if self.options.with_xml2 else "no"))
        args.append("--without-spatialite"
                    )  # TODO: to implement when libspatialite lib available
        args.append("--with-sqlite3={}".format(
            "yes" if self.options.get_safe("with_sqlite3") else "no"))
        args.append("--without-rasterlite2"
                    )  # TODO: to implement when rasterlite2 lib available
        args.append("--with-pcre={}".format(
            "yes" if self.options.get_safe("with_pcre") else "no"))
        args.append("--without-teigha")  # commercial library
        args.append("--without-idb")  # commercial library
        args.append("--without-sde")  # commercial library
        args.append("--without-epsilon"
                    )  # TODO: to implement when epsilon lib available
        args.append("--with-webp={}".format(
            self._unix_path(self.deps_cpp_info["libwebp"].rootpath) if self.
            options.with_webp else "no"))
        args.append(
            "--with-geos={}".format("yes" if self.options.with_geos else "no"))
        args.append(
            "--without-sfcgal")  # TODO: to implement when sfcgal lib available
        args.append("--with-qhull={}".format(
            "yes" if self.options.with_qhull else "no"))
        args.append(
            "--without-opencl"
        )  # TODO: to implement when opencl-headers available (and also OpenCL lib?)
        args.append("--with-freexl={}".format(
            "yes" if self.options.with_freexl else "no"))
        args.append("--with-libjson-c={}".format(
            self._unix_path(
                self.deps_cpp_info["json-c"].rootpath)))  # always required !
        if self.options.without_pam:
            args.append("--without-pam")
        args.append("--without-poppler"
                    )  # TODO: to implement when poppler lib available
        args.append(
            "--without-podofo")  # TODO: to implement when podofo lib available
        args.append(
            "--without-pdfium")  # TODO: to implement when pdfium lib available
        args.append("--without-perl")
        args.append("--without-python")
        args.append("--without-java")
        args.append("--without-hdfs")
        if tools.Version(self.version) >= "3.0.0":
            args.append("--without-tiledb"
                        )  # TODO: to implement when tiledb lib available
        args.append("--without-mdb")
        args.append("--without-rasdaman"
                    )  # TODO: to implement when rasdaman lib available
        if tools.Version(self.version) >= "3.1.0":
            args.append("--without-rdb")  # commercial library
        args.append("--without-armadillo"
                    )  # TODO: to implement when armadillo lib available
        args.append("--without-cryptopp"
                    )  # TODO: to implement when cryptopp lib available
        args.append("--with-crypto={}".format(
            "yes" if self.options.with_crypto else "no"))
        args.append("--with-lerc={}".format(
            "no" if self.options.without_lerc else "yes"))
        if self.options.with_null:
            args.append("--with-null")
        if self.options.get_safe("with_exr") is not None:
            args.append("--with-exr={}".format(
                "yes" if self.options.with_exr else "no"))

        # Inject -stdlib=libc++ for clang with libc++
        env_build_vars = self._autotools.vars
        if self.settings.compiler == "clang" and \
           self.settings.os == "Linux" and self._stdcpp_library == "c++":
            env_build_vars["LDFLAGS"] = "-stdlib=libc++ {}".format(
                env_build_vars["LDFLAGS"])

        with tools.chdir(configure_dir):
            self._autotools.configure(args=args, vars=env_build_vars)
        return self._autotools
Exemplo n.º 26
0
 def package_autotools(self):
     with tools.chdir(self.build_folder):
         env_build = AutoToolsBuildEnvironment(self)
         env_build.make(args=["install", "-j1"])
Exemplo n.º 27
0
 def _autotools(self):
     if self.__autotools is None:
         self.__autotools = AutoToolsBuildEnvironment(self)
     return self.__autotools
Exemplo n.º 28
0
    def _configure_autotools(self):
        if not self._autotools:
            self._autotools = AutoToolsBuildEnvironment(self)
            # Getting build errors when cross-compiling webrtc on ARM
            # since we don't use it, just disable it for now
            args = []  # "--disable-libwebrtc"
            if self.options.shared:
                args.append("--enable-shared")
            if self.options.SSL:
                openSSLroot = self.deps_cpp_info[_openSSL].rootpath
                args.append("--with-ssl=%s" % openSSLroot)
                self.output.info("openSSLroot: %s" % openSSLroot)
            if self.options.disableSpeexAec:
                self._autotools.defines.append("PJMEDIA_HAS_SPEEX_AEC=0")
            # pjsip expects the architecture to be armv7hf-linux-gnueabihf
            host = self._autotools.host
            arch = str(self.settings.arch)

            # turn armv7* into armv7l*
            # autotools checks the architecture by running "config.sub"
            # which does not allow armv7l as architecture unless the manufacturer
            # is set to "unknown"
            if self.options.armv7l and arch.startswith(
                    "armv7") and host.startswith("arm-"):
                # a manufacturer entry was already specified
                if host.startswith("arm-unknown-"):
                    host = "armv7l-" + host[:12]
                else:
                    host = "armv7l-unknown-" + host[4:]
                self._autotools.host = host
                self.output.info("Forcing host to: %s" % self._autotools.host)
            #self.output.info(self.deps_cpp_info.lib_paths)
            self.output.info("autotools.library_paths: %s" %
                             self._autotools.library_paths)
            #self.output.info(self.deps_env_info.lib_paths)
            #vars = self._autotools.vars
            #vars["DYLD_LIBRARY_PATH"] = self._autotools.library_paths
            self.output.info("autotools.vars: %s" % self._autotools.vars)

            #with tools.environment_append({"DYLD_LIBRARY_PATH": self._autotools.library_paths}):
            #    self.run("DYLD_LIBRARY_PATH=%s ./configure --enable-shared" % os.environ['DYLD_LIBRARY_PATH'])
            #with tools.environment_append(self._autotools.vars):
            #    self.run("./configure --enable-shared")
            #    self.run("./configure '--enable-shared' '--prefix=/Users/jens/Develop/totemic/conan-pjsip/tmp/source/package' '--bindir=${prefix}/bin' '--sbindir=${prefix}/bin' '--libexecdir=${prefix}/bin' '--libdir=${prefix}/lib' '--includedir=${prefix}/include' '--oldincludedir=${prefix}/include' '--datarootdir=${prefix}/share' --build=x86_64-apple-darwin --host=x86_64-apple-darwin")

            copied_files = []
            # HACK: on OSX, if we compile using shared ssl libraries, a test program
            # compiled by autoconfig does not find the dlyb files in its path, even if
            # we set the DYLD_LIBRARY_PATH correctly, propbably because sub process don't
            # inherit it. To fix it, we simply copy the shared libraries into the build
            # directory and delete them afterwards
            # see also https://stackoverflow.com/questions/33991581/install-name-tool-to-update-a-executable-to-search-for-dylib-in-mac-os-x/33992190#33992190
            for path in self._autotools.library_paths:
                for file in glob.glob(path + "/*.dylib"):
                    filename = file[len(path) + 1:]
                    print(filename)
                    copied_files.append(filename)
                    shutil.copy(file, ".")

            self._autotools.configure(args=args)  #, vars=vars

            for copied_file in copied_files:
                os.remove(copied_file)
        return self._autotools
Exemplo n.º 29
0
    def _build_msvc(self):
        libmpdec_folder = os.path.join(self.build_folder,
                                       self._source_subfolder, "libmpdec")
        libmpdecpp_folder = os.path.join(self.build_folder,
                                         self._source_subfolder, "libmpdec++")
        vcbuild_folder = os.path.join(self.build_folder,
                                      self._source_subfolder, "vcbuild")
        arch_ext = "{}".format(32 if self.settings.arch == "x86" else 64)
        dist_folder = os.path.join(vcbuild_folder, "dist{}".format(arch_ext))
        os.mkdir(dist_folder)

        shutil.copy(os.path.join(libmpdec_folder, "Makefile.vc"),
                    os.path.join(libmpdec_folder, "Makefile"))

        autotools = AutoToolsBuildEnvironment(self)
        mpdec_extra_flags = []
        mpdecxx_extra_flags = []
        if tools.Version(self.version) >= "2.5.1":
            if self.options.shared:
                mpdec_extra_flags = ["-DMPDECIMAL_DLL"]
                mpdecxx_extra_flags = ["-DLIBMPDECXX_DLL"]

        mpdec_target = "libmpdec-{}.{}".format(
            self.version, "dll" if self.options.shared else "lib")
        mpdecpp_target = "libmpdec++-{}.{}".format(
            self.version, "dll" if self.options.shared else "lib")

        builds = [[libmpdec_folder, mpdec_target, mpdec_extra_flags]]
        if self.options.cxx:
            builds.append(
                [libmpdecpp_folder, mpdecpp_target, mpdecxx_extra_flags])
        with tools.vcvars(self):
            for build_dir, target, extra_flags in builds:
                with tools.chdir(build_dir):
                    self.run(
                        """nmake /nologo /f Makefile.vc {target} MACHINE={machine} DEBUG={debug} DLL={dll} CONAN_CFLAGS="{cflags}" CONAN_CXXFLAGS="{cxxflags}" CONAN_LDFLAGS="{ldflags}" """
                        .format(
                            target=target,
                            machine={
                                "x86": "ppro",
                                "x86_64": "x64"
                            }[str(self.settings.arch
                                  )],  # FIXME: else, use ansi32 and ansi64
                            debug="1"
                            if self.settings.build_type == "Debug" else "0",
                            dll="1" if self.options.shared else "0",
                            cflags=" ".join(autotools.flags + extra_flags),
                            cxxflags=" ".join(autotools.cxx_flags +
                                              extra_flags),
                            ldflags=" ".join(autotools.link_flags),
                        ))

        with tools.chdir(libmpdec_folder):
            shutil.copy("mpdecimal.h", dist_folder)
            if self.options.shared:
                shutil.copy(
                    "libmpdec-{}.dll".format(self.version),
                    os.path.join(dist_folder,
                                 "libmpdec-{}.dll".format(self.version)))
                shutil.copy(
                    "libmpdec-{}.dll.exp".format(self.version),
                    os.path.join(dist_folder,
                                 "libmpdec-{}.exp".format(self.version)))
                shutil.copy(
                    "libmpdec-{}.dll.lib".format(self.version),
                    os.path.join(dist_folder,
                                 "libmpdec-{}.lib".format(self.version)))
            else:
                shutil.copy(
                    "libmpdec-{}.lib".format(self.version),
                    os.path.join(dist_folder,
                                 "libmpdec-{}.lib".format(self.version)))
        if self.options.cxx:
            with tools.chdir(libmpdecpp_folder):
                shutil.copy("decimal.hh", dist_folder)
                shutil.copy(
                    "libmpdec++-{}.lib".format(self.version),
                    os.path.join(dist_folder,
                                 "libmpdec++-{}.lib".format(self.version)))
Exemplo n.º 30
0
 def build(self):
     with self._build_context():
         autotools = AutoToolsBuildEnvironment(self)
         autotools.make(vars=self._fixed_vars(autotools))