コード例 #1
0
    def build(self):
        if self.settings.compiler == "Visual Studio":
            env = VisualStudioBuildEnvironment(self)
            with tools.environment_append(env.vars):
                with tools.chdir(os.path.join(self.source_subfolder, "win32", "VS2015")):
                    vcvars = tools.vcvars_command(self.settings)
                    btype = "%s%s%s" % (self.settings.build_type, "DLL" if self.options.shared else "", "_fixed" if self.options.shared and self.options.fixed_point else "")
                    # Instead of using "replace" here below, would we could add the "arch" parameter, but it doesn't work when we are also
                    # using the build_type parameter on conan 0.29.2 (conan bug?)
                    build_command = tools.build_sln_command(self.settings, "opus.sln", build_type = btype).replace("x86", "Win32")
                    self.output.info("Build command: %s" % build_command)
                    self.run("%s && %s" % (vcvars, build_command))
        else:
            env = AutoToolsBuildEnvironment(self)

            if self.settings.os != "Windows":
                env.fpic = self.options.fPIC

            with tools.environment_append(env.vars):

                with tools.chdir(self.source_subfolder):
                    if self.settings.os == "Macos":
                        tools.replace_in_file("configure", r"-install_name \$rpath/", "-install_name ")

                    if self.settings.os == "Windows":
                        tools.run_in_windows_bash(self, "./configure%s" % (" --enable-fixed-point" if self.options.fixed_point else ""))
                        tools.run_in_windows_bash(self, "make")
                    else:
                        configure_options = " --prefix=%s" % os.path.join(self.build_folder, self.install_subfolder)
                        if self.options.fixed_point:
                            configure_options += " --enable-fixed-point"
                        if self.options.shared:
                            configure_options += " --disable-static --enable-shared"
                        else:
                            configure_options += " --disable-shared --enable-static"
                        self.run("chmod +x configure")
                        self.run("./configure%s" % configure_options)
                        self.run("make")
                        self.run("make install")
コード例 #2
0
    def build(self):
        if self.settings.compiler == "Visual Studio":

            env = VisualStudioBuildEnvironment(self)
            with tools.environment_append(env.vars):

                if self.options.shared:
                    vs_suffix = "_dynamic"
                else:
                    vs_suffix = "_static"

                libdirs = "<AdditionalLibraryDirectories>"
                libdirs_ext = "<AdditionalLibraryDirectories>$(LIB);"
                if self.options.shared:
                    replace_in_file(
                        "%s\\%s\\win32\\VS2010\\libvorbis\\libvorbis%s.vcxproj"
                        % (self.conanfile_directory, self.sources_folder,
                           vs_suffix), libdirs, libdirs_ext)
                    replace_in_file(
                        "%s\\%s\\win32\\VS2010\\libvorbis\\libvorbis%s.vcxproj"
                        % (self.conanfile_directory, self.sources_folder,
                           vs_suffix), "libogg.lib", "ogg.lib")
                if self.options.shared:
                    replace_in_file(
                        "%s\\%s\\win32\\VS2010\\libvorbisfile\\libvorbisfile%s.vcxproj"
                        % (self.conanfile_directory, self.sources_folder,
                           vs_suffix), libdirs, libdirs_ext)
                    replace_in_file(
                        "%s\\%s\\win32\\VS2010\\libvorbisfile\\libvorbisfile%s.vcxproj"
                        % (self.conanfile_directory, self.sources_folder,
                           vs_suffix), "libogg.lib", "ogg.lib")
                replace_in_file(
                    "%s\\%s\\win32\\VS2010\\vorbisdec\\vorbisdec%s.vcxproj" %
                    (self.conanfile_directory, self.sources_folder, vs_suffix),
                    libdirs, libdirs_ext)

                if self.options.shared:
                    replace_in_file(
                        "%s\\%s\\win32\\VS2010\\vorbisdec\\vorbisdec%s.vcxproj"
                        % (self.conanfile_directory, self.sources_folder,
                           vs_suffix), "libogg.lib", "ogg.lib")
                else:
                    replace_in_file(
                        "%s\\%s\\win32\\VS2010\\vorbisdec\\vorbisdec%s.vcxproj"
                        % (self.conanfile_directory, self.sources_folder,
                           vs_suffix), "libogg_static.lib", "ogg.lib")

                replace_in_file(
                    "%s\\%s\\win32\\VS2010\\vorbisenc\\vorbisenc%s.vcxproj" %
                    (self.conanfile_directory, self.sources_folder, vs_suffix),
                    libdirs, libdirs_ext)
                if self.options.shared:
                    replace_in_file(
                        "%s\\%s\\win32\\VS2010\\vorbisenc\\vorbisenc%s.vcxproj"
                        % (self.conanfile_directory, self.sources_folder,
                           vs_suffix), "libogg.lib", "ogg.lib")
                else:
                    replace_in_file(
                        "%s\\%s\\win32\\VS2010\\vorbisenc\\vorbisenc%s.vcxproj"
                        % (self.conanfile_directory, self.sources_folder,
                           vs_suffix), "libogg_static.lib", "ogg.lib")

                vcvars = tools.vcvars_command(self.settings)
                cd_build = "cd %s\\%s\\win32\\VS2010" % (
                    self.conanfile_directory, self.sources_folder)
                build_command = build_sln_command(self.settings,
                                                  "vorbis%s.sln" % vs_suffix)
                self.run(
                    "%s && %s && %s" %
                    (vcvars, cd_build, build_command.replace("x86", "Win32")))

        else:
            base_path = ("%s/" % self.conanfile_directory
                         ) if self.settings.os != "Windows" else ""
            cd_build = "cd %s%s" % (base_path, self.sources_folder)

            env = AutoToolsBuildEnvironment(self)

            if self.settings.os != "Windows":
                env.fpic = self.options.fPIC

            with tools.environment_append(env.vars):

                if self.settings.os == "Macos":
                    old_str = '-install_name \\$rpath/\\$soname'
                    new_str = '-install_name \\$soname'
                    replace_in_file(
                        "%s/%s/configure" %
                        (self.conanfile_directory, self.sources_folder),
                        old_str, new_str)

                if self.settings.os == "Windows":
                    run_in_windows_bash(self, "%s && ./configure" % cd_build)
                    run_in_windows_bash(self, "%s && make" % cd_build)
                else:
                    configure_options = " --prefix=%s" % self.package_folder
                    if self.options.shared:
                        configure_options += " --disable-static --enable-shared"
                    else:
                        configure_options += " --disable-shared --enable-static"
                    self.run("%s && chmod +x ./configure" % cd_build)
                    self.run("%s && chmod +x ./install-sh" % cd_build)
                    self.run("%s && ./configure%s" %
                             (cd_build, configure_options))
                    self.run("%s && make" % cd_build)
                    self.run("%s && make install" % cd_build)