Beispiel #1
0
    def build(self):
        apply_conandata_patches(self)

        at = Autotools(self)

        build_script_folder = self._source_subfolder
        if self._is_msvc:
            self.conf["tools.gnu:make_program"] = "nmake"
            build_script_folder = os.path.join(build_script_folder, "win32")

            if "TMP" in os.environ:  # workaround for TMP in CCI containing both forward and back slashes
                os.environ["TMP"] = os.environ["TMP"].replace("/", "\\")

        with tools.vcvars(self):
            at.configure(build_script_folder=build_script_folder)
            at.make()
    def build(self):
        apply_conandata_patches(self)

        if self._is_msvc:
            self.conf["tools.gnu:make_program"] = "nmake"

            if "TMP" in os.environ:  # workaround for TMP in CCI containing both forward and back slashes
                os.environ["TMP"] = os.environ["TMP"].replace("/", "\\")

        with tools.vcvars(self):
            if conan_version < tools.Version("1.48.0"):
                at = Autotools(self)
                at.configure(build_script_folder=self._build_script_folder)
            else:
                at = Autotools(self,
                               build_script_folder=self._build_script_folder)
                at.configure()
            at.make()
    def build(self):
        apply_conandata_patches(self)

        cmake = CMake(self)

        if tools.is_apple_os(self.settings.os):
            cmake.definitions["PLATFORM"] = "apple-clang"
        elif self.settings.compiler == "Visual Studio":
            cmake.definitions["PLATFORM"] = "vc"
        else:
            cmake.definitions["PLATFORM"] = self.settings.os

        cmake.definitions[
            "ARCH"] = "x86_64"  # ARCH is used only for setting the output directory. So itsvalue does not matter here.
        cmake.definitions[
            "AAF_NO_STRUCTURED_STORAGE"] = not self.options.structured_storage
        cmake.configure(build_folder=self._build_subfolder)
        cmake.build()
Beispiel #4
0
def test_multiple_no_version(mock_patch_ng):
    conanfile = ConanFileMock()
    conanfile.display_name = 'mocked/ref'
    conanfile.conan_data = {
        'patches': [{
            'patch_file': 'patches/0001-buildflatbuffers-cmake.patch',
            'base_path': 'source_subfolder',
        }, {
            'patch_file':
            'patches/0002-implicit-copy-constructor.patch',
            'base_path':
            'source_subfolder',
            'patch_type':
            'backport',
            'patch_source':
            'https://github.com/google/flatbuffers/pull/5650',
            'patch_description':
            'Needed to build with modern clang compilers.'
        }]
    }
    apply_conandata_patches(conanfile)
    assert 'Apply patch (backport): Needed to build with modern clang compilers.\n' \
           == str(conanfile.output)
Beispiel #5
0
def test_multiple_with_version(mock_patch_ng):
    conanfile = ConanFileMock()
    conanfile.display_name = 'mocked/ref'
    conanfile.conan_data = {
        'patches': {
            "1.11.0": [{
                'patch_file': 'patches/0001-buildflatbuffers-cmake.patch',
                'base_path': 'source_subfolder',
            }, {
                'patch_file':
                'patches/0002-implicit-copy-constructor.patch',
                'base_path':
                'source_subfolder',
                'patch_type':
                'backport',
                'patch_source':
                'https://github.com/google/flatbuffers/pull/5650',
                'patch_description':
                'Needed to build with modern clang compilers.'
            }],
            "1.12.0": [
                {
                    'patch_file': 'patches/0001-buildflatbuffers-cmake.patch',
                    'base_path': 'source_subfolder',
                },
            ]
        }
    }

    with pytest.raises(AssertionError) as excinfo:
        apply_conandata_patches(conanfile)
    assert 'Can only be applied if conanfile.version is already defined' == str(
        excinfo.value)

    conanfile.version = "1.2.11"
    apply_conandata_patches(conanfile)
    assert len(str(conanfile.output)) == 0

    conanfile.version = "1.11.0"
    apply_conandata_patches(conanfile)
    assert 'Apply patch (backport): Needed to build with modern clang compilers.\n' \
           == str(conanfile.output)
Beispiel #6
0
 def build(self):
     apply_conandata_patches(self)
     cmake = self._configure_cmake()
     cmake.build()
Beispiel #7
0
 def _patch_sources(self):
     apply_conandata_patches(self)
Beispiel #8
0
    def _patch_sources(self):
        apply_conandata_patches(self)

        # Remove embedded dependencies
        embedded_libs = [
            os.path.join("alg", "internal_libqhull"),
            os.path.join("frmts", "gif", "giflib"),
            os.path.join("frmts", "jpeg", "libjpeg"),
            os.path.join("frmts", "png", "libpng"),
            os.path.join("frmts", "zlib"),
            # os.path.join("ogr", "ogrsf_frmts", "cad", "libopencad"), # TODO: uncomment when libopencad available
            os.path.join("ogr", "ogrsf_frmts", "geojson", "libjson"),
        ]
        if tools.Version(self.version) >= "3.1.0":
            embedded_libs.append(
                os.path.join("ogr", "ogrsf_frmts", "flatgeobuf",
                             "flatbuffers"))
        for lib_subdir in embedded_libs:
            tools.rmdir(os.path.join(self._source_subfolder, lib_subdir))

        # OpenCL headers
        tools.replace_in_file(
            os.path.join(self._source_subfolder, "alg",
                         "gdalwarpkernel_opencl.h"),
            "#include <OpenCL/OpenCL.h>", "#include <CL/opencl.h>")

        # More patches for autotools build
        if not is_msvc(self):
            configure_ac = os.path.join(self._source_subfolder, "configure.ac")
            # Workaround for nc-config not packaged in netcdf recipe (gdal relies on it to check nc4 and hdf4 support in netcdf):
            if self.options.with_netcdf and self.options[
                    "netcdf"].netcdf4 and self.options["netcdf"].with_hdf5:
                tools.replace_in_file(configure_ac, "NETCDF_HAS_NC4=no",
                                      "NETCDF_HAS_NC4=yes")
            # Fix zlib checks and -lz injection to ensure to use external zlib and not fail others checks
            if self.options.get_safe("with_zlib", True):
                zlib_name = self.deps_cpp_info["zlib"].libs[0]
                tools.replace_in_file(configure_ac, "AC_CHECK_LIB(z,",
                                      "AC_CHECK_LIB({},".format(zlib_name))
                tools.replace_in_file(configure_ac, "-lz ",
                                      "-l{} ".format(zlib_name))
            # Workaround for autoconf 2.71
            with open(os.path.join(self._source_subfolder, "config.rpath"),
                      "w"):
                pass

        # Disable tools
        if not self.options.tools:
            # autotools
            gnumakefile_apps = os.path.join(self._source_subfolder, "apps",
                                            "GNUmakefile")
            tools.replace_in_file(
                gnumakefile_apps,
                "default:	gdal-config-inst gdal-config $(BIN_LIST)",
                "default:	gdal-config-inst gdal-config")
            if tools.Version(self.version) < "3.4.0":
                clean_pattern = "$(RM) *.o $(BIN_LIST) core gdal-config gdal-config-inst"
            else:
                clean_pattern = "$(RM) *.o $(BIN_LIST) $(NON_DEFAULT_LIST) core gdal-config gdal-config-inst"
            tools.replace_in_file(
                gnumakefile_apps, clean_pattern,
                "$(RM) *.o core gdal-config gdal-config-inst")
            tools.replace_in_file(
                gnumakefile_apps,
                "for f in $(BIN_LIST) ; do $(INSTALL) $$f $(DESTDIR)$(INST_BIN) ; done",
                "")
            # msvc
            vcmakefile_apps = os.path.join(self._source_subfolder, "apps",
                                           "makefile.vc")
            tools.replace_in_file(vcmakefile_apps, "default:	",
                                  "default:	\n\nold-default:	")
            tools.replace_in_file(vcmakefile_apps, "copy *.exe $(BINDIR)", "")
 def build(self):
     apply_conandata_patches(self)
     cmake = CMake(self)
     cmake.configure()
     cmake.build()
Beispiel #10
0
 def build(self):
     tools.get(**self.conan_data["sources"][self.version],
               strip_root=True,
               destination=self._source_subfolder)
     apply_conandata_patches(self)