コード例 #1
0
ファイル: conanfile.py プロジェクト: staiyeba/conan
    def build(self):
        os.unlink("musl/arch/{}/syscall_arch.h".format(self._find_arch()))
        # this will remove set_thread_area which is just a regular function now
        os.unlink("musl/src/thread/{}/__set_thread_area.s".format(
            self._find_arch()))
        host = self._find_host_arch() + "-pc-linux-gnu"
        triple = self._find_arch() + "-elf"
        args = ["--disable-shared", "--disable-gcc-wrapper"]
        if (self.settings.build_type == "Debug"):
            args.append("--enable-debug")
        env_build = AutoToolsBuildEnvironment(self)
        if str(self.settings.compiler) == 'clang':
            env_build.flags = [
                "-g", "-target {}-pc-linux-gnu".format(self._find_arch())
            ]
            args.append("--target={}-pc-linux-gnu".format(self._find_arch()))

        #TODO fix this is only correct if the host is x86_64
        if str(self.settings.compiler) == 'gcc':
            if self._find_arch() == "x86_64":
                env_build.flags = ["-g", "-m64"]
            if self._find_arch() == "i386":
                env_build.flags = ["-g", "-m32"]

        if self.settings.build_type == "Debug":
            env_build.flags += ["-g"]
        env_build.configure(configure_dir=self.source_folder + "/musl",
                            host=host,
                            target=triple,
                            args=args)  #what goes in here preferably
        env_build.make()
        env_build.install()
コード例 #2
0
ファイル: conanfile.py プロジェクト: sobotklp/conan-libjson
 def build(self):
     with tools.chdir("./libjson"):
         env_build = AutoToolsBuildEnvironment(self)
         env_build.flags = []  # libjson's makefile chokes if we pass this
         env_build.cxxflags = []
         self.run(
             "make"
         )  # Run make manually so AutoToolsBuildEnvironment doesn't pass the -j parameter. That breaks the build
コード例 #3
0
ファイル: conanfile.py プロジェクト: agagniere/MinilibX
 def build(self):
     self.run("tail +15 {0}.mk | grep -vP 'CFLAGS\s*=' > {0}.gen".format(
         os.path.join(self._source_subfolder, "Makefile")))
     autotools = AutoToolsBuildEnvironment(self)
     autotools.flags = [f"-O{self.options.optimisation}"]
     if self.options.debug:
         autotools.flags += ["-g"]
     autotools.make(
         args=["-C", self._source_subfolder, "-f", "Makefile.gen"])
コード例 #4
0
ファイル: conanfile.py プロジェクト: agagniere/MinilibX
 def build(self):
     autotools = AutoToolsBuildEnvironment(self)
     autotools.flags = [f"-O{self.options.optimisation}"]
     if self.options.debug:
         autotools.flags += ["-g"]
     if self.settings.os == "Macos":
         autotools.link_flags += ["-framework AppKit"]
     build_env = autotools.vars
     build_env["MLX_FOLDER"] = self._source_subfolder
     autotools.make(
         args=["shared" if self.options.shared else "static", "-j"],
         vars=build_env)
コード例 #5
0
ファイル: conanfile.py プロジェクト: madebr/conan-ps2dev
    def _build_install_newlib(self, target):
        ff = lambda a: not a.startswith("-m")
        autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
        conf_args = [
            "--prefix={}".format(os.path.join(self.package_folder, target).replace("\\", "/")),
            "--target={}".format(target),
        ]

        autotools.flags = list(filter(ff, autotools.flags))
        autotools.cxx_flags = list(filter(ff, autotools.cxx_flags))
        autotools.link_flags = list(filter(ff, autotools.link_flags))

        host = tools.get_gnu_triplet(str(self.settings.os), str(self.settings.arch), str(self.settings.compiler))
        build =  tools.get_gnu_triplet(tools.detected_os(), tools.detected_architecture())
        if tools.os_info.is_windows:
            build = "{}-w64-mingw32".format({
                "x86": "i686"
            }.get(str(self.settings.arch), str(self.settings.arch)))
        if self.settings.os == "Windows":
            host = "{}-w64-mingw32".format({
                "x86": "i686"
            }.get(str(self.settings.arch), str(self.settings.arch)))

        env = {
            "PATH": [os.path.join(self.package_folder, target, "bin")],
            "CPPFLAGS_FOR_TARGET": "-G0",
        }

        self.output.info("env={}".format(env))

        build_folder = os.path.join("build_newlib_{}".format(target))
        tools.mkdir(build_folder)
        with tools.chdir(build_folder):
            with tools.environment_append(env):
                self.output.info("Building newlib for target={}".format(target))
                autotools.configure(args=conf_args, configure_dir=os.path.join(self.source_folder, "newlib"), build=build, host=host)
                autotools.make(args=["-j1"])
                autotools.install()
コード例 #6
0
    def _configure_autotools(self):
        win_bash = tools.os_info.is_windows
        prefix = os.path.abspath(self.package_folder)
        if win_bash:
            prefix = tools.unix_path(prefix)
        args = [
            '--prefix=%s' % prefix, '--disable-examples',
            '--disable-unit-tests', '--disable-tools', '--disable-docs',
            '--enable-vp9-highbitdepth', '--as=yasm'
        ]
        if self.options.shared:
            args.extend(['--disable-static', '--enable-shared'])
        else:
            args.extend(['--disable-shared', '--enable-static'])
        if self.settings.os != 'Windows' and self.options.get_safe("fPIC"):
            args.append('--enable-pic')
        if self.settings.build_type == "Debug":
            args.append('--enable-debug')
        if self.settings.compiler == 'Visual Studio':
            if 'MT' in str(self.settings.compiler.runtime):
                args.append('--enable-static-msvcrt')

        arch = {
            'x86': 'x86',
            'x86_64': 'x86_64',
            'armv7': 'armv7',
            'armv8': 'arm64',
            'mips': 'mips32',
            'mips64': 'mips64',
            'sparc': 'sparc'
        }.get(str(self.settings.arch))
        build_compiler = str(self.settings.compiler)
        if build_compiler == 'Visual Studio':
            compiler = 'vs' + str(self.settings.compiler.version)
        elif build_compiler in ['gcc', 'clang', 'apple-clang']:
            compiler = 'gcc'
        else:
            raise ConanInvalidConfiguration(
                "Unsupported compiler '{}'.".format(build_compiler))

        build_os = str(self.settings.os)
        if build_os == 'Windows':
            os_name = 'win32' if self.settings.arch == 'x86' else 'win64'
        elif tools.is_apple_os(build_os):
            if self.settings.arch in ["x86", "x86_64"]:
                os_name = 'darwin11'
            elif self.settings.arch == "armv8" and self.settings.os == "Macos":
                os_name = 'darwin20'
            else:
                # Unrecognized toolchain 'arm64-darwin11-gcc', see list of toolchains in ./configure --help
                os_name = 'darwin'
        elif build_os == 'Linux':
            os_name = 'linux'
        elif build_os == 'Solaris':
            os_name = 'solaris'
        elif build_os == 'Android':
            os_name = 'android'
        target = "%s-%s-%s" % (arch, os_name, compiler)
        args.append('--target=%s' % target)
        if str(self.settings.arch) in ["x86", "x86_64"]:
            for name in self._arch_options:
                if not self.options.get_safe(name):
                    args.append('--disable-%s' % name)
        with tools.vcvars(
                self.settings
        ) if self.settings.compiler == 'Visual Studio' else tools.no_op():
            env_build = AutoToolsBuildEnvironment(self, win_bash=win_bash)
            if self.settings.compiler == "Visual Studio":
                # gen_msvs_vcxproj.sh doesn't like custom flags
                env_build.cxxflags = []
                env_build.flags = []
            if tools.is_apple_os(self.settings.os) and self.settings.get_safe(
                    "compiler.libcxx") == "libc++":
                # special case, as gcc/g++ is hard-coded in makefile, it implicitly assumes -lstdc++
                env_build.link_flags.append("-stdlib=libc++")
            env_build.configure(args=args,
                                configure_dir=self._source_subfolder,
                                host=False,
                                build=False,
                                target=False)
        return env_build
コード例 #7
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'
                ])
            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')
            assert not (self.options.x264 or self.options.x265
                        or self.options.postproc)
            args.append('--disable-gpl')

            # NOTE(a.kamyshev): Commented out lines are wrong, fdk_aac with lgpl does not require nonfree, it does so only for gpl license,
            # see https://www.ffmpeg.org/general.html#toc-OpenCORE_002c-VisualOn_002c-and-Fraunhofer-libraries
            #if self.options.fdk_aac:
            #    args.append('--enable-nonfree')
            args.append('--disable-nonfree')

            if self.settings.os == "Linux":
                # there is no option associated with alsa in ffmpeg 3.3.1
                # 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" and False:  # v.looze: ffmpeg 3.3.1 does not support these config options
                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'])

            # thanks to generators = "pkg_config", we will have all dependency
            # *.pc files in build folder, so pointing pkg-config there is enough
            pkg_config_path = os.path.abspath(self.build_folder)
            print("pkg_config_path or build_folder: " + pkg_config_path)
            pkg_config_path = tools.unix_path(
                pkg_config_path
            ) if self.settings.os == 'Windows' else pkg_config_path

            try:
                if self._is_msvc or self._is_mingw_windows:
                    # hack for MSYS2 which doesn't inherit PKG_CONFIG_PATH
                    for filename in ['.bashrc', '.bash_profile', '.profile']:
                        tools.run_in_windows_bash(
                            self, 'cp ~/%s ~/%s.bak' % (filename, filename))
                        command = 'echo "export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:%s" >> ~/%s'\
                                  % (pkg_config_path, filename)
                        tools.run_in_windows_bash(self, command)

                    # looks like msys2 package has pkg-config preinstalled,
                    # but we need to install it ourselves in case the msys in CONAN_MSYS_PATH does not have it
                    pkg_config_find_or_install_command = "pacman -Qs pkg-config || pacman -S --noconfirm pkg-config"
                    tools.run_in_windows_bash(
                        self, pkg_config_find_or_install_command)

                    # intel_media_sdk.pc contains info on a package libmfx, but ffmpeg's configure script doesn't recognize it
                    tools.run_in_windows_bash(
                        self, 'mv %s/intel_media_sdk.pc %s/libmfx.pc' %
                        (pkg_config_path, pkg_config_path))

                env_build = AutoToolsBuildEnvironment(
                    self, win_bash=self._is_mingw_windows or self._is_msvc)
                if self.settings.os == "Windows" and self.settings.build_type == "Debug":
                    # see https://trac.ffmpeg.org/ticket/6429 (ffmpeg does not build without compiler optimizations)
                    env_build.flags = ["-Zi", "-O2"]
                # 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,
                                    pkg_config_paths=[pkg_config_path])
                env_build.make()
                env_build.make(args=['install'])
            finally:
                if self._is_msvc or self._is_mingw_windows:
                    for filename in ['.bashrc', '.bash_profile', '.profile']:
                        tools.run_in_windows_bash(
                            self, 'cp ~/%s.bak ~/%s' % (filename, filename))
                        tools.run_in_windows_bash(self,
                                                  'rm -f ~/%s.bak' % filename)
コード例 #8
0
ファイル: conanfile.py プロジェクト: madebr/conan-ps2dev
    def _build_install_gcc(self, target, stage):
        autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
        conf_args = [
            "--prefix={}".format(os.path.join(self.package_folder, target).replace("\\", "/")),
            "--disable-build-warnings",
            "--target={}".format(target),
            "--with-newlib",
        ]
        env = {}
        if stage == 1:
            conf_args.extend([
                "--enable-languages=c",
                "--without-headers",
            ])
        else:
            conf_args.extend([
                "--enable-languages=c,c++",
                "--with-headers={}".format(tools.unix_path(os.path.join(self.package_folder, target, target, "include"))),
            ])
            ff = lambda a: not a.startswith("-m")
            env.update({
                "CFLAGS_FOR_BUILD": " ".join(autotools.flags),
                "CXXFLAGS_FOR_BUILD": " ".join(autotools.cxx_flags),
                "LDFLAGS_FOR_BUILD": " ".join(autotools.link_flags),
                "CFLAGS_FOR_TARGET": " ".join(filter(ff, autotools.flags)),
                "CXXFLAGS_FOR_TARGET": " ".join(filter(ff, autotools.cxx_flags)),
                "LDFLAGS_FOR_TARGET": " ".join(filter(ff, autotools.link_flags)),
            })
            autotools.flags = []
            autotools.cxx_flags = []
            autotools.link_flags = []

        autotools.flags.append("-DSTDC_HEADERS")

        host = tools.get_gnu_triplet(str(self.settings.os), str(self.settings.arch), str(self.settings.compiler))
        build =  tools.get_gnu_triplet(tools.detected_os(), tools.detected_architecture())
        if tools.os_info.is_windows:
            build = "{}-w64-mingw32".format({
                "x86": "i686"
            }.get(str(tools.detected_architecture()), str(tools.detected_architecture())))
        if self.settings.os == "Windows":
            host = "{}-w64-mingw32".format({
                "x86": "i686"
            }.get(str(self.settings.arch), str(self.settings.arch)))

        # Apple needs to pretend to be linux
        if tools.os_info.is_macos:
            build = "{}-linux-gnu".format({
                "x86": "i686"
            }.get(str(tools.detected_architecture()), str(tools.detected_architecture())))
        if tools.is_apple_os(self.settings.os):
            host = "{}-linux-gnu".format({
                "x86": "i686"
            }.get(str(self.settings.arch), str(self.settings.arch)))

        build_folder = os.path.join("build_gcc_stage{}_{}".format(stage, target))
        tools.mkdir(build_folder)
        with tools.chdir(build_folder):
            with tools.environment_append(env):
                with tools.environment_append({"PATH": [os.path.join(self.package_folder, target, "bin")]}):
                    self.output.info("Building gcc stage1 for target={}".format(target))
                    autotools.configure(args=conf_args, configure_dir=os.path.join(self.source_folder, "gcc"), build=build, host=host)
                    autotools.make()
                    autotools.install()
コード例 #9
0
    def _configure_autotools(self):
        args = [
            "--prefix={}".format(tools.unix_path(self.package_folder)),
            "--disable-examples",
            "--disable-unit-tests",
            "--disable-tools",
            "--disable-docs",
            "--enable-vp9-highbitdepth",
            "--as=yasm",
        ]
        if self.options.shared:
            args.extend(['--disable-static', '--enable-shared'])
        else:
            args.extend(['--disable-shared', '--enable-static'])
        if self.settings.os != 'Windows' and self.options.get_safe(
                "fPIC", True):
            args.append('--enable-pic')
        if self.settings.build_type == "Debug":
            args.append('--enable-debug')
        if self._is_msvc and "MT" in msvc_runtime_flag(self):
            args.append('--enable-static-msvcrt')

        arch = {
            'x86': 'x86',
            'x86_64': 'x86_64',
            'armv7': 'armv7',
            'armv8': 'arm64',
            'mips': 'mips32',
            'mips64': 'mips64',
            'sparc': 'sparc'
        }.get(str(self.settings.arch))
        if self._is_msvc:
            if self.settings.compiler == "Visual Studio":
                vc_version = self.settings.compiler.version
            else:
                vc_version = msvc_version_to_vs_ide_version(
                    self.settings.compiler.version)
            compiler = "vs{}".format(vc_version)
        elif self.settings.compiler in ["gcc", "clang", "apple-clang"]:
            compiler = 'gcc'

        host_os = str(self.settings.os)
        if host_os == 'Windows':
            os_name = 'win32' if self.settings.arch == 'x86' else 'win64'
        elif tools.is_apple_os(host_os):
            if self.settings.arch in ["x86", "x86_64"]:
                os_name = 'darwin11'
            elif self.settings.arch == "armv8" and self.settings.os == "Macos":
                os_name = 'darwin20'
            else:
                # Unrecognized toolchain 'arm64-darwin11-gcc', see list of toolchains in ./configure --help
                os_name = 'darwin'
        elif host_os == 'Linux':
            os_name = 'linux'
        elif host_os == 'Solaris':
            os_name = 'solaris'
        elif host_os == 'Android':
            os_name = 'android'
        target = "%s-%s-%s" % (arch, os_name, compiler)
        args.append('--target=%s' % target)
        if str(self.settings.arch) in ["x86", "x86_64"]:
            for name in self._arch_options:
                if not self.options.get_safe(name):
                    args.append('--disable-%s' % name)
        autotools = AutoToolsBuildEnvironment(
            self, win_bash=tools.os_info.is_windows)
        if self._is_msvc:
            # gen_msvs_vcxproj.sh doesn't like custom flags
            autotools.cxxflags = []
            autotools.flags = []
        if tools.is_apple_os(self.settings.os) and self.settings.get_safe(
                "compiler.libcxx") == "libc++":
            # special case, as gcc/g++ is hard-coded in makefile, it implicitly assumes -lstdc++
            autotools.link_flags.append("-stdlib=libc++")
        autotools.configure(args=args,
                            configure_dir=self._source_subfolder,
                            host=False,
                            build=False,
                            target=False)
        return autotools