-
Notifications
You must be signed in to change notification settings - Fork 5
/
curl.mak
49 lines (43 loc) · 1.51 KB
/
curl.mak
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
NAME := curl
CURL_VERSION := 7.83.1
CURL_URL := https://github.com/curl/curl/releases/download/curl-$(subst .,_,$(CURL_VERSION))/curl-$(CURL_VERSION).tar.gz
CURL_PROGRAMS := curl
CURL_LIBRARIES := libcurl.a
CURL_CONFIG =
# WolfSSL results in a much smaller binary (around 1MB).
# The only reason you'd use OpenSSL here is if you already
# need the library for other things and don't care about size.
CURL_SSL := wolfssl
# CURL_SSL := openssl
$(eval $(call create_recipes, \
$(NAME), \
$(CURL_VERSION), \
$(CURL_URL), \
$(CURL_PROGRAMS), \
$(CURL_LIBRARIES), \
))
# This package uses libtool and needs LDFLAGS to include -all-static
# in order to produce a statically linked binary. However, the
# configure script doesn't use libtool, so the flag must be injected
# at built-time only, otherwise the configure will fail.
# See https://stackoverflow.com/a/54168321/477563
$(BUILD_FLAG): $$(libz)
$(eval $(call activate_toolchain,$@))
cd "$(SRC)" && ./configure \
$(CONFIGURE_DEFAULTS) \
--disable-shared --enable-static --with-$(CURL_SSL) \
$(CURL_CONFIG) \
CFLAGS="$(CFLAGS)" LDFLAGS="$(filter -L%,$(LDFLAGS))"
$(MAKE) -C "$(SRC)" clean
$(MAKE) -C "$(SRC)" LDFLAGS="$(LDFLAGS) -all-static"
$(MAKE) -C "$(SRC)" install-exec
# Update dependencies based on chosen SSL library.
ifeq ($(CURL_SSL),wolfssl)
$(BUILD_FLAG): $$(libwolfssl)
else ifeq ($(CURL_SSL),openssl)
$(BUILD_FLAG): $$(libssl)
else
$(error Invalid CURL_SSL selection: $(CURL_SSL))
endif
ALL_PROGRAMS += $(CURL_PROGRAMS)
DEFAULT_PROGRAMS += $(CURL_PROGRAMS)