def METHOD_NAME(self, spec, prefix):
    cflags = []
    ldflags = []
    if spec.satisfies("%gcc@9:"):
        cflags.append("-Wno-error=deprecated-copy")
        cflags.append("-Wno-error=pessimizing-move")
        cflags.append("-Wno-error=redundant-move")
    if "+zlib" in self.spec:
        cflags.append("-I" + self.spec["zlib-api"].prefix.include)
        ldflags.append(self.spec["zlib-api"].libs.ld_flags)
    else:
        env["ROCKSDB_DISABLE_ZLIB"] = "YES"
    if "+bz2" in self.spec:
        cflags.append("-I" + self.spec["bz2"].prefix.include)
        ldflags.append(self.spec["bz2"].libs.ld_flags)
    else:
        env["ROCKSDB_DISABLE_BZIP"] = "YES"
    if "+tbb" in self.spec:
        cflags.append(spec["tbb"].headers.cpp_flags)
        ldflags.append("-L" + spec["tbb"].prefix.lib)
    else:
        env["ROCKSDB_DISABLE_TBB"] = "YES"
    for pkg in ["lz4", "snappy", "zstd"]:
        if "+" + pkg in self.spec:
            cflags.append(self.spec[pkg].headers.cpp_flags)
            ldflags.append(self.spec[pkg].libs.ld_flags)
        else:
            env["ROCKSDB_DISABLE_" + pkg.upper()] = "YES"
    cflags.append(self.spec["gflags"].headers.cpp_flags)
    ldflags.append(self.spec["gflags"].libs.ld_flags)
    env["CFLAGS"] = " ".join(cflags)
    env["PLATFORM_FLAGS"] = " ".join(ldflags)
    if "~werror" in self.spec:
        env["DISABLE_WARNING_AS_ERROR"] = "1"
    if "+rtti" in self.spec:
        env["USE_RTTI"] = "1"
    if self.spec.satisfies("@6.13.2:"):
        env["PREFIX"] = self.spec.prefix
    else:
        env["INSTALL_PATH"] = self.spec.prefix
    if "+static" in spec:
        make("install-static")
    # We need to clean before building the shared library, otherwise
    # we might end up with errors regarding missing -fPIC.
    if "+static+shared" in spec:
        make("clean")
    if "+shared" in spec:
        make("install-shared")