niobe/third_party/curl/BUILD.gn

337 lines
11 KiB
Plaintext

# Copyright (c) 2020 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
curl_source = [
"//third_party/curl/lib/altsvc.c",
"//third_party/curl/lib/amigaos.c",
"//third_party/curl/lib/asyn-ares.c",
"//third_party/curl/lib/asyn-thread.c",
"//third_party/curl/lib/base64.c",
"//third_party/curl/lib/bufref.c",
"//third_party/curl/lib/c-hyper.c",
"//third_party/curl/lib/conncache.c",
"//third_party/curl/lib/connect.c",
"//third_party/curl/lib/content_encoding.c",
"//third_party/curl/lib/cookie.c",
"//third_party/curl/lib/curl_addrinfo.c",
"//third_party/curl/lib/curl_ctype.c",
"//third_party/curl/lib/curl_des.c",
"//third_party/curl/lib/curl_endian.c",
"//third_party/curl/lib/curl_fnmatch.c",
"//third_party/curl/lib/curl_get_line.c",
"//third_party/curl/lib/curl_gethostname.c",
"//third_party/curl/lib/curl_gssapi.c",
"//third_party/curl/lib/curl_memrchr.c",
"//third_party/curl/lib/curl_multibyte.c",
"//third_party/curl/lib/curl_ntlm_core.c",
"//third_party/curl/lib/curl_ntlm_wb.c",
"//third_party/curl/lib/curl_path.c",
"//third_party/curl/lib/curl_range.c",
"//third_party/curl/lib/curl_rtmp.c",
"//third_party/curl/lib/curl_sasl.c",
"//third_party/curl/lib/curl_sspi.c",
"//third_party/curl/lib/curl_threads.c",
"//third_party/curl/lib/dict.c",
"//third_party/curl/lib/doh.c",
"//third_party/curl/lib/dotdot.c",
"//third_party/curl/lib/dynbuf.c",
"//third_party/curl/lib/easy.c",
"//third_party/curl/lib/easygetopt.c",
"//third_party/curl/lib/easyoptions.c",
"//third_party/curl/lib/escape.c",
"//third_party/curl/lib/file.c",
"//third_party/curl/lib/fileinfo.c",
"//third_party/curl/lib/formdata.c",
"//third_party/curl/lib/ftp.c",
"//third_party/curl/lib/ftplistparser.c",
"//third_party/curl/lib/getenv.c",
"//third_party/curl/lib/getinfo.c",
"//third_party/curl/lib/gopher.c",
"//third_party/curl/lib/hash.c",
"//third_party/curl/lib/hmac.c",
"//third_party/curl/lib/hostasyn.c",
"//third_party/curl/lib/hostcheck.c",
"//third_party/curl/lib/hostip.c",
"//third_party/curl/lib/hostip4.c",
"//third_party/curl/lib/hostip6.c",
"//third_party/curl/lib/hostsyn.c",
"//third_party/curl/lib/hsts.c",
"//third_party/curl/lib/http.c",
"//third_party/curl/lib/http_aws_sigv4.c",
"//third_party/curl/lib/http2.c",
"//third_party/curl/lib/http_chunks.c",
"//third_party/curl/lib/http_digest.c",
"//third_party/curl/lib/http_negotiate.c",
"//third_party/curl/lib/http_ntlm.c",
"//third_party/curl/lib/http_proxy.c",
"//third_party/curl/lib/idn_win32.c",
"//third_party/curl/lib/if2ip.c",
"//third_party/curl/lib/imap.c",
"//third_party/curl/lib/inet_ntop.c",
"//third_party/curl/lib/inet_pton.c",
"//third_party/curl/lib/krb5.c",
"//third_party/curl/lib/ldap.c",
"//third_party/curl/lib/llist.c",
"//third_party/curl/lib/md4.c",
"//third_party/curl/lib/md5.c",
"//third_party/curl/lib/memdebug.c",
"//third_party/curl/lib/mime.c",
"//third_party/curl/lib/mprintf.c",
"//third_party/curl/lib/mqtt.c",
"//third_party/curl/lib/multi.c",
"//third_party/curl/lib/netrc.c",
"//third_party/curl/lib/non-ascii.c",
"//third_party/curl/lib/nonblock.c",
"//third_party/curl/lib/openldap.c",
"//third_party/curl/lib/parsedate.c",
"//third_party/curl/lib/pingpong.c",
"//third_party/curl/lib/pop3.c",
"//third_party/curl/lib/progress.c",
"//third_party/curl/lib/psl.c",
"//third_party/curl/lib/rand.c",
"//third_party/curl/lib/rename.c",
"//third_party/curl/lib/rtsp.c",
"//third_party/curl/lib/select.c",
"//third_party/curl/lib/sendf.c",
"//third_party/curl/lib/setopt.c",
"//third_party/curl/lib/sha256.c",
"//third_party/curl/lib/share.c",
"//third_party/curl/lib/slist.c",
"//third_party/curl/lib/smb.c",
"//third_party/curl/lib/smtp.c",
"//third_party/curl/lib/socketpair.c",
"//third_party/curl/lib/socks.c",
"//third_party/curl/lib/socks_gssapi.c",
"//third_party/curl/lib/socks_sspi.c",
"//third_party/curl/lib/speedcheck.c",
"//third_party/curl/lib/splay.c",
"//third_party/curl/lib/strcase.c",
"//third_party/curl/lib/strdup.c",
"//third_party/curl/lib/strerror.c",
"//third_party/curl/lib/strtok.c",
"//third_party/curl/lib/strtoofft.c",
"//third_party/curl/lib/system_win32.c",
"//third_party/curl/lib/telnet.c",
"//third_party/curl/lib/tftp.c",
"//third_party/curl/lib/timeval.c",
"//third_party/curl/lib/transfer.c",
"//third_party/curl/lib/url.c",
"//third_party/curl/lib/urlapi.c",
"//third_party/curl/lib/vauth/cleartext.c",
"//third_party/curl/lib/vauth/cram.c",
"//third_party/curl/lib/vauth/digest.c",
"//third_party/curl/lib/vauth/digest_sspi.c",
"//third_party/curl/lib/vauth/gsasl.c",
"//third_party/curl/lib/vauth/krb5_gssapi.c",
"//third_party/curl/lib/vauth/krb5_sspi.c",
"//third_party/curl/lib/vauth/ntlm.c",
"//third_party/curl/lib/vauth/ntlm_sspi.c",
"//third_party/curl/lib/vauth/oauth2.c",
"//third_party/curl/lib/vauth/spnego_gssapi.c",
"//third_party/curl/lib/vauth/spnego_sspi.c",
"//third_party/curl/lib/vauth/vauth.c",
"//third_party/curl/lib/version.c",
"//third_party/curl/lib/version_win32.c",
"//third_party/curl/lib/vquic/ngtcp2.c",
"//third_party/curl/lib/vquic/quiche.c",
"//third_party/curl/lib/vquic/vquic.c",
"//third_party/curl/lib/vssh/libssh.c",
"//third_party/curl/lib/vssh/libssh2.c",
"//third_party/curl/lib/vssh/wolfssh.c",
"//third_party/curl/lib/vtls/bearssl.c",
"//third_party/curl/lib/vtls/gskit.c",
"//third_party/curl/lib/vtls/gtls.c",
"//third_party/curl/lib/vtls/keylog.c",
"//third_party/curl/lib/vtls/mbedtls.c",
"//third_party/curl/lib/vtls/mbedtls_threadlock.c",
"//third_party/curl/lib/vtls/mesalink.c",
"//third_party/curl/lib/vtls/nss.c",
"//third_party/curl/lib/vtls/openssl.c",
"//third_party/curl/lib/vtls/rustls.c",
"//third_party/curl/lib/vtls/schannel.c",
"//third_party/curl/lib/vtls/schannel_verify.c",
"//third_party/curl/lib/vtls/sectransp.c",
"//third_party/curl/lib/vtls/vtls.c",
"//third_party/curl/lib/vtls/wolfssl.c",
"//third_party/curl/lib/warnless.c",
"//third_party/curl/lib/wildcard.c",
"//third_party/curl/lib/x509asn1.c",
]
if (defined(ohos_lite)) {
import("//build/lite/config/component/lite_component.gni")
config("curl_config") {
include_dirs = [
"//third_party/curl/lib",
"//third_party/mbedtls/include",
]
if (ohos_kernel_type == "liteos_m") {
include_dirs += [ "//kernel/liteos_m/kal/posix/include" ]
}
cflags = [
"-DBUILDING_LIBCURL",
"-DHAVE_CONFIG_H",
"-D_GNU_SOURCE",
"-DOS=\"liteOS\"",
"-fPIC",
"-Wdeclaration-after-statement",
"-Wendif-labels",
"-Wfloat-equal",
"-Winline",
"-Wmissing-declarations",
"-Wmissing-prototypes",
"-Wnested-externs",
"-Wno-format-nonliteral",
"-Wno-implicit-function-declaration",
"-Wno-int-conversion",
"-Wno-long-long",
"-Wno-multichar",
"-Wno-nested-externs",
"-Wno-sign-compare",
"-Wno-system-headers",
"-Wno-varargs",
"-Wno-overflow",
"-Wpointer-arith",
"-Wstrict-prototypes",
"-Wunused",
"-Wwrite-strings",
"-Wno-unused-variable",
"-Wno-parentheses",
"-Wno-strict-prototypes",
"-Os",
"-ffunction-sections",
"-fdata-sections",
"-fno-unwind-tables",
"-fno-asynchronous-unwind-tables",
]
}
config("curl_config_public") {
include_dirs = [
"//third_party/curl/lib",
"//third_party/curl/include",
]
}
build_ext_component("patch") {
command = "sh build.sh ${ohos_kernel_type}"
exec_path = rebase_path(".", root_build_dir)
}
if (ohos_kernel_type == "liteos_m") {
static_library("libcurl_static") {
sources = curl_source
deps = [ ":patch" ]
deps += [ "//third_party/mbedtls:mbedtls_static" ]
deps += [ "//kernel/liteos_m/kal/posix" ]
configs += [
":curl_config",
":curl_config_public",
]
public_configs = [ ":curl_config_public" ]
}
} else {
shared_library("libcurl_shared") {
sources = curl_source
deps = [ ":patch" ]
deps += [ "//third_party/mbedtls:mbedtls_shared" ]
configs += [
":curl_config",
":curl_config_public",
]
public_configs = [ ":curl_config_public" ]
}
}
} else {
import("//build/ohos.gni")
config("curl_config") {
visibility = [ ":*" ]
include_dirs = [
"//third_party/curl/include",
"//third_party/curl/lib",
]
}
ohos_source_set("curl") {
configs = [ "//third_party/curl:curl_config" ]
configs += [ "//third_party/openssl:ssl_config_public" ]
sources = curl_source
if ("${current_os}_${current_cpu}" == "mingw_x86_64") {
cflags = [
"-g",
"-O2",
"-Wall",
"-w",
"-fno-strict-aliasing",
"-m64",
"-D_AMD64_",
"-DBUILDING_LIBCURL",
"-c",
"-DUSE_OPENSSL",
"-DHAVE_OPENSSL_ENGINE_H",
"-DHAVE_OPENSSL_PKCS12_H",
"-DHAVE_ENGINE_LOAD_BUILTIN_ENGINES",
"-DOPENSSL_NO_KRB5",
]
libs = [
"//prebuilts/mingw-w64/ohos/linux-x86_64/clang-mingw/x86_64-w64-mingw32/lib/libwsock32.a",
"//prebuilts/mingw-w64/ohos/linux-x86_64/clang-mingw/x86_64-w64-mingw32/lib/libmincore.a",
]
} else if (host_os == "mac") {
cflags = [
"-DHAVE_CONFIG_H",
"-Qunused-arguments",
"-Os",
"-mmacosx-version-min=10.8",
"-Werror=partial-availability",
"-fvisibility=hidden",
"-DBUILDING_LIBCURL",
"-c",
]
libs = [
# AppKit symbols NSFontWeightXXX may be dlsym'ed.
"AppKit.framework",
"ApplicationServices.framework",
"OpenGL.framework",
"CoreFoundation.framework",
"SystemConfiguration.framework",
]
} else if ("${current_cpu}" == "arm64" || "${current_cpu}" == "arm") {
cflags = [
"-fPIC",
"-g",
"-O2",
"-Wall",
"-w",
"-fno-strict-aliasing",
"-DBUILDING_LIBCURL",
"-c",
"-DHAVE_CONFIG_H",
]
}
deps = [
"//third_party/openssl:crypto_source",
"//third_party/openssl:ssl_source",
"//third_party/zlib:libz",
]
}
}