Example #1
0
    def build(self):
        if self.settings.os == "Windows" and self.version == "master":
            raise ConanException(
                "Trunk builds are not supported on Windows (cannot build directly from master git repository)."
            )

        if self.settings.compiler == "Visual Studio":
            env = VisualStudioBuildEnvironment(self)
            with tools.environment_append(env.vars):
                version = min(12, int(self.settings.compiler.version.value))
                version = 10 if version == 11 else version
                cd_build = "cd %s\\%s\\build\\vc%s" % (
                    self.conanfile_directory, self.source_directory, version)
                build_command = build_sln_command(self.settings, "glew.sln")
                vcvars = vcvars_command(self.settings)
                self.run(
                    "%s && %s && %s" %
                    (vcvars, cd_build, build_command.replace("x86", "Win32")))
        else:
            if self.version == "master":
                self.run("make extensions")

            replace_in_file(
                "%s/build/cmake/CMakeLists.txt" % self.source_directory,
                "include(GNUInstallDirs)", """
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
include(GNUInstallDirs)
""")
            cmake = CMake(self)
            cmake.configure(source_dir="%s/build/cmake" %
                            self.source_directory,
                            defs={"BUILD_UTILS": "OFF"})
            cmake.build()
Example #2
0
 def build(self):
     static_arg = "--static" if not self.options.shared else ""
     bindir = os.path.join(self.build_folder, "bin")
     destdir = os.path.join(self.build_folder, "site-packages")
     incdir = os.path.join(self.build_folder, "include")
     sipdir = os.path.join(self.build_folder, "sip")
     pyidir = os.path.join(self.build_folder, "site-packages", "PyQt5")
     if self.settings.compiler == "Visual Studio":
         env_build = VisualStudioBuildEnvironment(self)
         with tools.chdir(
                 os.path.join(self.source_folder, self._source_subfolder)):
             with tools.environment_append(env_build.vars):
                 vcvars = tools.vcvars_command(self.settings)
                 self.run(
                     f"{vcvars} && python configure.py --sip-module=PyQt5.sip {static_arg} --bindir={bindir} --destdir={destdir} --incdir={incdir} --bindir={bindir} --destdir={destdir} --incdir={incdir} --sipdir={sipdir} --pyidir={pyidir}"
                 )
                 self.run(f"{vcvars} && nmake")
                 self.run(f"{vcvars} && nmake install")
     else:
         with tools.chdir(
                 os.path.join(self.source_folder, self._source_subfolder)):
             self.run(
                 f"python configure.py --sip-module=PyQt5.sip {static_arg} --bindir={bindir} --destdir={destdir} --incdir={incdir} --bindir={bindir} --destdir={destdir} --incdir={incdir} --sipdir={sipdir} --pyidir={pyidir}"
             )
             self.run(f"make")
             self.run(f"make install")
Example #3
0
 def _build_msvc(self):
     env_build = VisualStudioBuildEnvironment(self)
     with tools.environment_append(env_build.vars):
         vcvars = tools.vcvars_command(self.settings)
         for make_dir, _ in self._msvc_build_dirs:
             with tools.chdir(make_dir):
                 self.run("%s && nmake /f makefile NEW_COMPILER=1 CPU=%s" % (vcvars, self._msvc_cpu))
Example #4
0
 def _build_context(self):
     if self.settings.compiler == "Visual Studio":
         env = {
             "CC":
             "{} cl -nologo".format(
                 tools.unix_path(
                     self._user_info_build["automake"].compile)),
             "LD":
             "link -nologo",
             "NM":
             "dumpbin -symbols",
             "STRIP":
             ":",
             "AR":
             "{} lib".format(
                 tools.unix_path(self._user_info_build["automake"].ar_lib)),
             "RANLIB":
             ":",
         }
         with tools.vcvars(self):
             with tools.environment_append(
                     VisualStudioBuildEnvironment(self).vars):
                 with tools.environment_append(env):
                     yield
     else:
         yield
Example #5
0
    def build(self):
        for patch in self.conan_data.get("patches", {}).get(self.version, []):
            tools.patch(**patch)

        with tools.environment_append(VisualStudioBuildEnvironment(self).vars) if self._is_msvc else tools.no_op():
            meson = self._configure_meson()
            meson.build()
Example #6
0
 def _build_msvc(self):
     with tools.chdir(self._source_subfolder):
         with tools.vcvars(self):
             with tools.environment_append(
                     VisualStudioBuildEnvironment(self).vars):
                 target = "libdeflate.dll" if self.options.shared else "libdeflatestatic.lib"
                 self.run("nmake /f Makefile.msc {}".format(target))
Example #7
0
    def build(self):
        pybin = "py -2" if self.settings.os == "Windows" else "python"
        installFolder = self.build_folder + "/install"
        bitness = "--enable-64bit" if self.settings.arch == "x86_64" else ""
        debugging = "--enable-debugging" if self.settings.build_type == "Debug" else ""

        configureStatic = "%s waf configure --libs-only --disable-java --disable-python --prefix=%s %s %s" % (
            pybin, installFolder, bitness, debugging)
        configureShared = "%s waf configure --libs-only --disable-java --disable-python --prefix=%s %s %s --shared" % (
            pybin, installFolder, bitness, debugging)
        buildAll = "%s waf install" % pybin
        buildNitfC = "%s waf install --target=nitf-c" % pybin

        if self.settings.os == "Windows" and self.settings.compiler == "Visual Studio":
            vsenv = VisualStudioBuildEnvironment(self)
            with tools.environment_append(vsenv.vars):
                vcvars = tools.vcvars_command(self.settings)
                self.run("%s && %s" % (vcvars, configureStatic), cwd="nitro")
                if self.options.shared:
                    self.run("%s && %s" % (vcvars, buildAll), cwd="nitro")
                    self.run("%s && %s" % (vcvars, configureShared),
                             cwd="nitro")
                self.run("%s && %s" % (vcvars, buildNitfC), cwd="nitro")
        else:
            self.run(configureStatic, cwd="nitro")
            if self.options.shared:
                self.run(buildAll, cwd="nitro")
                self.run(configureShared, cwd="nitro")
            self.run(buildNitfC, cwd="nitro")
Example #8
0
    def _build_msvc(self):
        with tools.chdir(self._source_subfolder):
            # https://cairographics.org/end_to_end_build_for_win32/
            win32_common = os.path.join('build', 'Makefile.win32.common')
            tools.replace_in_file(win32_common, '-MD ', '-%s ' % self.settings.compiler.runtime)
            tools.replace_in_file(win32_common, '-MDd ', '-%s ' % self.settings.compiler.runtime)
            tools.replace_in_file(win32_common, '$(ZLIB_PATH)/lib/zlib1.lib',
                                                self.deps_cpp_info['zlib'].libs[0] + '.lib')
            tools.replace_in_file(win32_common, '$(LIBPNG_PATH)/lib/libpng16.lib',
                                                self.deps_cpp_info['libpng'].libs[0] + '.lib')
            tools.replace_in_file(win32_common, '$(FREETYPE_PATH)/lib/freetype.lib',
                                                self.deps_cpp_info['freetype'].libs[0] + '.lib')
            with tools.vcvars(self.settings):
                env_msvc = VisualStudioBuildEnvironment(self)
                env_msvc.flags.append('/FS')  # C1041 if multiple CL.EXE write to the same .PDB file, please use /FS
                with tools.environment_append(env_msvc.vars):
                    env_build = AutoToolsBuildEnvironment(self)
                    args=[
                        "-f", "Makefile.win32",
                        "CFG={}".format(str(self.settings.build_type).lower()),
                        "CAIRO_HAS_FC_FONT=0",
                        "ZLIB_PATH={}".format(self.deps_cpp_info["zlib"].rootpath),
                        "LIBPNG_PATH={}".format(self.deps_cpp_info["libpng"].rootpath),
                        "PIXMAN_PATH={}".format(self.deps_cpp_info['pixman'].rootpath),
                        "FREETYPE_PATH={}".format(self.deps_cpp_info['freetype'].rootpath),
                        "GOBJECT_PATH={}".format(self.deps_cpp_info['glib'].rootpath)
                    ]

                    env_build.make(args=args)
                    env_build.make(args=['-C', os.path.join('util', 'cairo-gobject')] + args)
    def build(self):
        if self.settings.os == "Windows" and self.version == "master":
            raise ConanException(
                "Trunk builds are not supported on Windows (cannot build directly from master git repository)."
            )

        if self.settings.compiler == "Visual Studio":
            env = VisualStudioBuildEnvironment(self)
            with tools.environment_append(env.vars):
                version = min(12, int(self.settings.compiler.version.value))
                version = 10 if version == 11 else version
                cd_build = "cd %s\\%s\\build\\vc%s" % (
                    self.conanfile_directory, self.source_directory, version)
                build_command = build_sln_command(self.settings, "glew.sln")
                vcvars = vcvars_command(self.settings)
                self.run(
                    "%s && %s && %s" %
                    (vcvars, cd_build, build_command.replace("x86", "Win32")))
        else:
            if self.settings.os == "Windows":
                replace_in_file("%s/build/cmake/CMakeLists.txt" % self.source_directory, \
                                "if(WIN32 AND (NOT MSVC_VERSION LESS 1600)", \
                                "if(WIN32 AND MSVC AND (NOT MSVC_VERSION LESS 1600)")

            if self.version == "master":
                self.run("make extensions")

            cmake = CMake(self)
            cmake.configure(source_dir="%s/build/cmake" %
                            self.source_directory,
                            defs={"BUILD_UTILS": "OFF"})
            cmake.build()
Example #10
0
    def build(self):
        if self.settings.os == "Windows":
            raise ConanInvalidConfiguration(
                'GLib is not yet supported on windows')
        for filename in [
                os.path.join(self._source_subfolder, "meson.build"),
                os.path.join(self._source_subfolder, "glib", "meson.build"),
                os.path.join(self._source_subfolder, "gobject", "meson.build"),
                os.path.join(self._source_subfolder, "gio", "meson.build")
        ]:
            tools.replace_in_file(filename, "subdir('tests')",
                                  "#subdir('tests')")
        # allow to find gettext
        tools.replace_in_file(
            os.path.join(self._source_subfolder, "meson.build"),
            "libintl = cc.find_library('intl', required : false)",
            "libintl = cc.find_library('gnuintl', required : false)")
        if self.settings.os != "Linux":
            tools.replace_in_file(
                os.path.join(self._source_subfolder,
                             'meson.build'), "if cc.has_function('ngettext')",
                "if false #cc.has_function('ngettext')")

        with tools.environment_append(VisualStudioBuildEnvironment(
                self).vars) if self._is_msvc else tools.no_op():
            meson = self._configure_meson()
            meson.build()
Example #11
0
 def build_msvc(self):
     with tools.chdir(self.source_subfolder):
         # https://cairographics.org/end_to_end_build_for_win32/
         win32_common = os.path.join('build', 'Makefile.win32.common')
         tools.replace_in_file(win32_common, '-MD ',
                               '-%s ' % self.settings.compiler.runtime)
         tools.replace_in_file(win32_common, '-MDd ',
                               '-%s ' % self.settings.compiler.runtime)
         tools.replace_in_file(win32_common, '$(ZLIB_PATH)/zdll.lib',
                               self.deps_cpp_info['zlib'].libs[0] + '.lib')
         tools.replace_in_file(
             win32_common, '$(LIBPNG_PATH)/libpng.lib',
             self.deps_cpp_info['libpng'].libs[0] + '.lib')
         tools.replace_in_file(
             win32_common, '$(PIXMAN_PATH)/pixman/$(CFG)/pixman-1.lib',
             self.deps_cpp_info['pixman'].libs[0] + '.lib')
         with tools.vcvars(self.settings):
             env_msvc = VisualStudioBuildEnvironment(self)
             env_msvc.flags.append(
                 '/FS'
             )  # C1041 if multiple CL.EXE write to the same .PDB file, please use /FS
             with tools.environment_append(env_msvc.vars):
                 env_build = AutoToolsBuildEnvironment(self)
                 env_build.make(args=[
                     '-f', 'Makefile.win32',
                     'CFG=%s' % str(self.settings.build_type).lower()
                 ])
Example #12
0
 def _build_msvc(self):
     args = "freexl_i.lib FREEXL_EXPORT=-DDLL_EXPORT" if self.options.shared else "freexl.lib"
     with tools.chdir(self._source_subfolder):
         with tools.vcvars(self.settings):
             with tools.environment_append(
                     VisualStudioBuildEnvironment(self).vars):
                 self.run("nmake -f makefile.vc {}".format(args))
Example #13
0
    def _build_msvc(self, args):
        build_command = find_executable("jom.exe")
        if build_command:
            build_args = ["-j", str(tools.cpu_count())]
        else:
            build_command = "nmake.exe"
            build_args = []
        self.output.info("Using '%s %s' to build" % (build_command, " ".join(build_args)))

        env = {}
        env.update({'PATH': ['%s/qtbase/bin' % self.source_folder,
                             '%s/gnuwin32/bin' % self.source_folder,
                             '%s/qtrepotools/bin' % self.source_folder]})

        env_build = VisualStudioBuildEnvironment(self)
        env.update(env_build.vars)

        with tools.environment_append(env):
            vcvars = tools.vcvars_command(self.settings)

            args += ["-opengl %s" % self.options.opengl]
            if self.options.openssl == "no":
                args += ["-no-openssl"]
            elif self.options.openssl == "yes":
                args += ["-openssl"]
            else:
                args += ["-openssl-linked"]

            self.run("cd %s && %s && set" % (self.source_dir, vcvars))
            self.run("cd %s && %s && configure %s"
                     % (self.source_dir, vcvars, " ".join(args)))
            self.run("cd %s && %s && %s %s"
                     % (self.source_dir, vcvars, build_command, " ".join(build_args)))
            self.run("cd %s && %s && %s install" % (self.source_dir, vcvars, build_command))
Example #14
0
 def build(self):
     self._apply_patches()
     self._copy_pkg_config("glib")
     with tools.environment_append(VisualStudioBuildEnvironment(
             self).vars) if self._is_msvc else tools.no_op():
         meson = self._configure_meson()
         meson.build()
Example #15
0
 def build(self):
     self._patch_sources()
     with tools.environment_append(
         VisualStudioBuildEnvironment(self).vars
     ) if self._is_msvc else tools.no_op():
         meson = self._configure_meson()
         meson.build()
Example #16
0
    def windows_build(self):
        # Follow instructions in https://github.com/jtv/libpqxx/blob/master/win32/INSTALL.txt
        common_file = os.path.join(self.pq_source_dir, 'win32', 'common')
        with open(common_file, "w") as f:
            f.write('PGSQLSRC="{}"\n'.format(
                self.deps_cpp_info["postgresql"].rootpath))
            f.write('PGSQLINC=$(PGSQLSRC)\include\n')
            f.write('LIBPQINC=$(PGSQLSRC)\include\n')

            f.write('LIBPQPATH=$(PGSQLSRC)\lib\n')
            f.write('LIBPQDLL=libpq.dll\n')
            f.write('LIBPQLIB=libpq.lib\n')

            f.write('LIBPQDPATH=$(PGSQLSRC)\lib\n')
            f.write('LIBPQDDLL=libpq.dll\n')
            f.write('LIBPQDLIB=libpq.lib\n')

        target_dir = os.path.join(self.pq_source_dir, 'include', 'pqxx')
        with tools.chdir(
                os.path.join(self.pq_source_dir, 'config', 'sample-headers',
                             'compiler', 'VisualStudio2013', 'pqxx')):
            shutil.copy('config-internal-compiler.h', target_dir + "/")
            shutil.copy('config-public-compiler.h', target_dir + "/")

        vcvars = tools.vcvars_command(self.settings)
        self.run(vcvars)
        env = VisualStudioBuildEnvironment(self)
        with tools.environment_append(env.vars):
            with tools.chdir(self.pq_source_dir):
                target = "DLL" if self.options.shared else "STATIC"
                target += str(self.settings.build_type).upper()
                command = 'nmake /f win32/vc-libpqxx.mak %s' % target
                self.output.info(command)
                self.run(command)
 def _build_msvc(self):
     env_build = VisualStudioBuildEnvironment(self)
     with tools.environment_append(env_build.vars):
         vcvars = tools.vcvars_command(self.settings)
         with tools.chdir("CPP/7zip"):
             self.run("%s && nmake /f makefile PLATFORM=%s" % (
             vcvars, self._msvc_platforms[str(self.settings.arch_build)]))
Example #18
0
    def _build_msvc(self, args):
        build_command = find_executable("jom.exe")
        if build_command:
            build_args = ["-j", str(cpu_count())]
        else:
            build_command = "nmake.exe"
            build_args = []
        self.output.info("Using '%s %s' to build" %
                         (build_command, " ".join(build_args)))

        env = {}
        env.update({
            'PATH': [
                '%s/qtbase/bin' % self.conanfile_directory,
                '%s/gnuwin32/bin' % self.conanfile_directory,
                '%s/qtrepotools/bin' % self.conanfile_directory
            ]
        })
        # it seems not enough to set the vcvars for older versions
        if self.settings.compiler == "Visual Studio":
            if self.settings.compiler.version == "14":
                env.update({'QMAKESPEC': 'win32-msvc2015'})
                args += ["-platform win32-msvc2015"]
            if self.settings.compiler.version == "12":
                env.update({'QMAKESPEC': 'win32-msvc2013'})
                args += ["-platform win32-msvc2013"]
            if self.settings.compiler.version == "11":
                env.update({'QMAKESPEC': 'win32-msvc2012'})
                args += ["-platform win32-msvc2012"]
            if self.settings.compiler.version == "10":
                env.update({'QMAKESPEC': 'win32-msvc2010'})
                args += ["-platform win32-msvc2010"]

        env_build = VisualStudioBuildEnvironment(self)
        env.update(env_build.vars)

        # Workaround for conan-io/conan#1408
        for name, value in env.items():
            if not value:
                del env[name]
        with tools.environment_append(env):
            vcvars = tools.vcvars_command(self.settings)

            args += ["-opengl %s" % self.options.opengl]
            if self.options.openssl == "no":
                args += ["-no-openssl"]
            elif self.options.openssl == "yes":
                args += ["-openssl"]
            else:
                args += ["-openssl-linked"]

            self.run("cd %s && %s && set" % (self.source_dir, vcvars))
            self.run("cd %s && %s && configure %s" %
                     (self.source_dir, vcvars, " ".join(args)))
            self.run(
                "cd %s && %s && %s %s" %
                (self.source_dir, vcvars, build_command, " ".join(build_args)))
            self.run("cd %s && %s && %s install" %
                     (self.source_dir, vcvars, build_command))
    def package(self):
        self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder)
        with tools.environment_append(VisualStudioBuildEnvironment(self).vars) if self._is_msvc else tools.no_op():
            meson = self._configure_meson()
            meson.install()

        self._fix_library_names(os.path.join(self.package_folder, "lib"))
        self._fix_library_names(os.path.join(self.package_folder, "lib", "gstreamer-1.0"))
 def build(self):
     for p in self.conan_data["patches"][self.version]:
         tools.patch(**p)
     self._copy_pkg_config("glib")
     self._copy_pkg_config("gstreamer")
     with tools.environment_append(VisualStudioBuildEnvironment(self).vars) if self._is_msvc else tools.no_op():
         meson = self._configure_meson()
         meson.build()
    def _build_windows(self):
        with tools.chdir(os.path.join(self._full_source_subfolder, 'win32')):
            debug = "yes" if self.settings.build_type == "Debug" else "no"
            static = "no" if self.options.shared else "yes"

            with tools.vcvars(self.settings):
                args = [
                    "cscript", "configure.js", "compiler=msvc",
                    "prefix=%s" % self.package_folder,
                    "cruntime=/%s" % self.settings.compiler.runtime,
                    "debug=%s" % debug,
                    "static=%s" % static,
                    'include="%s"' %
                    ";".join(self.deps_cpp_info.include_paths),
                    'lib="%s"' % ";".join(self.deps_cpp_info.lib_paths),
                    'iconv=no', 'xslt_debug=no'
                ]
                for name in self._option_names:
                    cname = {"plugins": "modules"}.get(name, name)
                    value = getattr(self.options, name)
                    value = "yes" if value else "no"
                    args.append("%s=%s" % (cname, value))
                configure_command = ' '.join(args)
                self.output.info(configure_command)
                self.run(configure_command)

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

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

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

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

                with tools.environment_append(
                        VisualStudioBuildEnvironment(self).vars):
                    self.run("nmake /f Makefile.msvc install")
Example #22
0
 def package(self):
     self.copy(pattern="COPYING",
               dst="licenses",
               src=self._source_subfolder)
     with tools.environment_append(VisualStudioBuildEnvironment(
             self).vars) if self._is_msvc else tools.no_op():
         meson = self._configure_meson()
         meson.install()
         self._fix_library_names()
Example #23
0
 def build(self):
     meson_build = os.path.join(self._source_subfolder, "meson.build")
     tools.replace_in_file(meson_build, "subdir('tests')", "")
     tools.replace_in_file(meson_build, "subdir('tools')", "")
     tools.replace_in_file(meson_build, "subdir('utils')", "")
     tools.replace_in_file(meson_build, "subdir('examples')", "")
     with tools.environment_append(VisualStudioBuildEnvironment(self).vars) if self._is_msvc else tools.no_op():
         meson = self._configure_meson()
         meson.build()
Example #24
0
 def _build_msvc(self):
     for make_dir, _ in self._msvc_build_dirs:
         with tools.vcvars(self):
             with tools.environment_append(
                     VisualStudioBuildEnvironment(self).vars):
                 with tools.chdir(make_dir):
                     self.run(
                         "nmake /f makefile NEW_COMPILER=1 CPU={}".format(
                             self._msvc_cpu))
Example #25
0
 def build(self):
     for filename in sorted(glob.glob("patches/*.patch")):
         self.output.info('applying patch "%s"' % filename)
         tools.patch(base_path=self._source_subfolder, patch_file=filename)
     libiconv_prefix = self.deps_cpp_info["libiconv"].rootpath
     libxml2_prefix = self.deps_cpp_info["libxml2"].rootpath
     libiconv_prefix = tools.unix_path(
         libiconv_prefix) if tools.os_info.is_windows else libiconv_prefix
     libxml2_prefix = tools.unix_path(
         libxml2_prefix) if tools.os_info.is_windows else libxml2_prefix
     args = [
         "HELP2MAN=/bin/true", "EMACS=no", "--disable-nls",
         "--disable-dependency-tracking", "--enable-relocatable",
         "--disable-c++", "--disable-java", "--disable-csharp",
         "--disable-libasprintf", "--disable-curses",
         "--with-libiconv-prefix=%s" % libiconv_prefix,
         "--with-libxml2-prefix=%s" % libxml2_prefix
     ]
     build = None
     host = None
     rc = None
     if self.options.get_safe("shared"):
         args.extend(["--disable-static", "--enable-shared"])
     else:
         args.extend(["--disable-shared", "--enable-static"])
     if self._is_msvc:
         # INSTALL.windows: Native binaries, built using the MS Visual C/C++ tool chain.
         build = False
         if self.settings.arch == "x86":
             host = "i686-w64-mingw32"
             rc = "windres --target=pe-i386"
         elif self.settings.arch == "x86_64":
             host = "x86_64-w64-mingw32"
             rc = "windres --target=pe-x86-64"
         automake_perldir = os.getenv('AUTOMAKE_PERLLIBDIR')
         if automake_perldir.startswith('/mnt/'):
             automake_perldir = automake_perldir[4:]
         args.extend([
             "CC=%s/compile cl -nologo" % automake_perldir, "LD=link",
             "NM=dumpbin -symbols", "STRIP=:",
             "AR=%s/ar-lib lib" % automake_perldir, "RANLIB=:"
         ])
         if rc:
             args.extend(['RC=%s' % rc, 'WINDRES=%s' % rc])
     with tools.vcvars(self.settings) if self._is_msvc else tools.no_op():
         with tools.environment_append(
                 VisualStudioBuildEnvironment(
                     self).vars) if self._is_msvc else tools.no_op():
             with tools.chdir(
                     os.path.join(self._source_subfolder,
                                  self._gettext_folder)):
                 env_build = AutoToolsBuildEnvironment(
                     self, win_bash=tools.os_info.is_windows)
                 if self._is_msvc:
                     env_build.flags.append("-FS")
                 env_build.configure(args=args, build=build, host=host)
                 env_build.make(self._make_args)
 def _build_msvc(self):
     makefile_msc_file = os.path.join(self._source_subfolder, "Makefile.msc")
     tools.replace_in_file(makefile_msc_file, "CFLAGS = /MD /O2 -I.", "CFLAGS = /nologo $(CFLAGS) -I.")
     tools.replace_in_file(makefile_msc_file, "LDFLAGS =", "")
     with tools.chdir(self._source_subfolder):
         with tools.vcvars(self.settings):
             with tools.environment_append(VisualStudioBuildEnvironment(self).vars):
                 target = "libdeflate.dll" if self.options.shared else "libdeflatestatic.lib"
                 self.run("nmake /f Makefile.msc {}".format(target))
Example #27
0
    def _build_msvc(self):
        # Visual Studio build doesn't provide options, we need to manually edit gaiaconfig-msvc.h
        gaiaconfig_msvc = os.path.join(self._source_subfolder, "src",
                                       "headers", "spatialite",
                                       "gaiaconfig-msvc.h")
        if not self.options.mathsql:
            tools.replace_in_file(gaiaconfig_msvc, "/* #undef OMIT_MATHSQL */",
                                  "#define OMIT_MATHSQL 1")
        if self.options.geocallbacks:
            tools.replace_in_file(gaiaconfig_msvc,
                                  "#define OMIT_GEOCALLBACKS 1", "")
        if not self.options.knn:
            tools.replace_in_file(gaiaconfig_msvc, "/* #undef OMIT_KNN */",
                                  "#define OMIT_KNN 1")
        if not self.options.epsg:
            tools.replace_in_file(gaiaconfig_msvc, "/* #undef OMIT_EPSG */",
                                  "#define OMIT_EPSG 1")
        if not self.options.geopackage:
            tools.replace_in_file(gaiaconfig_msvc,
                                  "#define ENABLE_GEOPACKAGE 1", "")
        if not self.options.get_safe("gcp", False):
            tools.replace_in_file(gaiaconfig_msvc, "#define ENABLE_GCP 1", "")
        if not self.options.with_proj:
            tools.replace_in_file(gaiaconfig_msvc, "/* #undef OMIT_PROJ */",
                                  "#define OMIT_PROJ 1")
        if not self.options.with_iconv:
            tools.replace_in_file(gaiaconfig_msvc, "/* #undef OMIT_ICONV */",
                                  "#define OMIT_ICONV 1")
        if not self.options.with_freexl:
            tools.replace_in_file(gaiaconfig_msvc, "/* #undef OMIT_FREEXL */",
                                  "#define OMIT_FREEXL 1")
        if not self.options.with_geos:
            tools.replace_in_file(gaiaconfig_msvc, "/* #undef OMIT_GEOS */",
                                  "#define OMIT_GEOS 1")
        if not self.options.get_safe("with_rttopo", False):
            tools.replace_in_file(gaiaconfig_msvc, "#define ENABLE_RTTOPO 1",
                                  "")
        if not self.options.with_libxml2:
            tools.replace_in_file(gaiaconfig_msvc, "#define ENABLE_LIBXML2 1",
                                  "")
        if not self.options.with_minizip:
            tools.replace_in_file(gaiaconfig_msvc, "#define ENABLE_MINIZIP 1",
                                  "")

        target = "spatialite_i.lib" if self.options.shared else "spatialite.lib"
        optflags = ["-DYY_NO_UNISTD_H"]
        system_libs = [lib + ".lib" for lib in self.deps_cpp_info.system_libs]
        if self.options.shared:
            optflags.append("-DDLL_EXPORT")
        with tools.chdir(self._source_subfolder):
            with tools.vcvars(self):
                with tools.environment_append(
                        VisualStudioBuildEnvironment(self).vars):
                    self.run(
                        "nmake -f makefile.vc {} OPTFLAGS=\"{}\" SYSTEM_LIBS=\"{}\""
                        .format(target, " ".join(optflags),
                                " ".join(system_libs)))
Example #28
0
 def build(self):
     for patch in self.conan_data.get("patches", {}).get(self.version, []):
         tools.patch(**patch)
     libiconv_prefix = self.deps_cpp_info["libiconv"].rootpath
     libiconv_prefix = tools.unix_path(
         libiconv_prefix) if tools.os_info.is_windows else libiconv_prefix
     args = [
         "HELP2MAN=/bin/true", "EMACS=no", "--disable-nls",
         "--disable-dependency-tracking", "--enable-relocatable",
         "--disable-c++", "--disable-java", "--disable-csharp",
         "--disable-libasprintf", "--disable-curses",
         "--disable-threads" if self.options.threads == "disabled" else
         ("--enable-threads=" + str(self.options.threads)),
         "--with-libiconv-prefix=%s" % libiconv_prefix
     ]
     build = None
     host = None
     rc = None
     if self.options.shared:
         args.extend(["--disable-static", "--enable-shared"])
     else:
         args.extend(["--disable-shared", "--enable-static"])
     if self._is_msvc:
         # INSTALL.windows: Native binaries, built using the MS Visual C/C++ tool chain.
         build = False
         if self.settings.arch == "x86":
             host = "i686-w64-mingw32"
             rc = "windres --target=pe-i386"
         elif self.settings.arch == "x86_64":
             host = "x86_64-w64-mingw32"
             rc = "windres --target=pe-x86-64"
         args.extend([
             "CC=%s cl -nologo" %
             tools.unix_path(self._user_info_build["automake"].compile),
             "LD=link", "NM=dumpbin -symbols", "STRIP=:",
             "AR=%s lib" %
             tools.unix_path(self._user_info_build["automake"].ar_lib),
             "RANLIB=:"
         ])
         if rc:
             args.extend(['RC=%s' % rc, 'WINDRES=%s' % rc])
     with tools.vcvars(self.settings) if self._is_msvc else tools.no_op():
         with tools.environment_append(
                 VisualStudioBuildEnvironment(
                     self).vars) if self._is_msvc else tools.no_op():
             with tools.chdir(
                     os.path.join(self._source_subfolder,
                                  self._gettext_folder)):
                 env_build = AutoToolsBuildEnvironment(
                     self, win_bash=tools.os_info.is_windows)
                 if self._is_msvc:
                     if not (self.settings.compiler == "Visual Studio"
                             and tools.Version(
                                 self.settings.compiler.version) < "12"):
                         env_build.flags.append("-FS")
                 env_build.configure(args=args, build=build, host=host)
                 env_build.make(self._make_args)
Example #29
0
 def _build_context(self):
     if self._is_msvc:
         env_build = VisualStudioBuildEnvironment(self)
         if not self.options.shared:
             env_build.flags.append("-DCAIRO_WIN32_STATIC_BUILD")
             env_build.cxx_flags.append("-DCAIRO_WIN32_STATIC_BUILD")
         with tools.environment_append(env_build.vars):
             yield
     else:
         yield
Example #30
0
 def package(self):
     self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder)
     with tools.environment_append(VisualStudioBuildEnvironment(self).vars) if self._is_msvc else tools.no_op():
         meson = self._configure_meson()
         meson.install()
         self._fix_library_names()
     tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
     shutil.move(os.path.join(self.package_folder, "share"), os.path.join(self.package_folder, "res"))
     for pdb_file in glob.glob(os.path.join(self.package_folder, "bin", "*.pdb")):
         os.unlink(pdb_file)