Skip to content

Commit 4a9816b

Browse files
committed
add libcurl-macos target to build libcurl.a on macos
1 parent 04d1931 commit 4a9816b

File tree

2 files changed

+81
-1
lines changed

2 files changed

+81
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
*.sqlite
1010
*.a
1111
unittest
12+
/curl-src

Makefile

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Makefile for SQLite Sync Extension
22
# Supports compilation for Linux, macOS, Windows, Android and iOS
33

4+
# customize sqlite3 executable with
5+
# make test SQLITE3=/opt/homebrew/Cellar/sqlite/3.49.1/bin/sqlite3
6+
SQLITE3 ?= sqlite3
7+
48
# Set default platform if not specified
59
ifeq ($(OS),Windows_NT)
610
PLATFORM := windows
@@ -136,14 +140,89 @@ $(BUILD_TEST)/%.o: %.c
136140

137141
# Run code coverage (--css-file $(CUSTOM_CSS))
138142
test: $(TARGET) $(TEST_TARGET)
139-
sqlite3 ":memory:" -cmd ".bail on" ".load ./$<" "SELECT cloudsync_version();"
143+
$(SQLITE3) ":memory:" -cmd ".bail on" ".load ./$<" "SELECT cloudsync_version();"
140144
./$(TEST_TARGET)
141145
ifneq ($(COVERAGE),false)
142146
mkdir -p $(COV_DIR)
143147
lcov --capture --directory . --output-file $(COV_DIR)/coverage.info $(subst src, --include src,${COV_FILES})
144148
genhtml $(COV_DIR)/coverage.info --output-directory $(COV_DIR)
145149
endif
146150

151+
deps:
152+
brew install autoconf automake libtool pkg-config
153+
154+
curl-src:
155+
@if [ ! -d curl-src ]; then \
156+
git clone --depth 1 --branch curl-8_12_1 https://github.com/curl/curl.git curl-src; \
157+
fi
158+
159+
libcurl-macos: deps curl-src
160+
@if [ ! -f $(CONFIGURED_MARKER) ]; then \
161+
cd curl-src && ./buildconf && ./configure \
162+
--without-libpsl \
163+
--disable-alt-svc \
164+
--disable-ares \
165+
--disable-cookies \
166+
--disable-basic-auth \
167+
--disable-digest-auth \
168+
--disable-kerberos-auth \
169+
--disable-negotiate-auth \
170+
--disable-aws \
171+
--disable-dateparse \
172+
--disable-dnsshuffle \
173+
--disable-doh \
174+
--disable-form-api \
175+
--disable-hsts \
176+
--disable-ipv6 \
177+
--disable-libcurl-option \
178+
--disable-manual \
179+
--disable-mime \
180+
--disable-netrc \
181+
--disable-ntlm \
182+
--disable-ntlm-wb \
183+
--disable-progress-meter \
184+
--disable-proxy \
185+
--disable-pthreads \
186+
--disable-socketpair \
187+
--disable-threaded-resolver \
188+
--disable-tls-srp \
189+
--disable-verbose \
190+
--disable-versioned-symbols \
191+
--enable-symbol-hiding \
192+
--without-brotli \
193+
--without-zstd \
194+
--without-libidn2 \
195+
--without-librtmp \
196+
--without-zlib \
197+
--without-nghttp2 \
198+
--without-ngtcp2 \
199+
--disable-shared \
200+
--disable-ftp \
201+
--disable-file \
202+
--disable-ipfs \
203+
--disable-ldap \
204+
--disable-ldaps \
205+
--disable-rtsp \
206+
--disable-dict \
207+
--disable-telnet \
208+
--disable-tftp \
209+
--disable-pop3 \
210+
--disable-imap \
211+
--disable-smb \
212+
--disable-smtp \
213+
--disable-gopher \
214+
--disable-mqtt \
215+
--disable-docs \
216+
--enable-static \
217+
--with-secure-transport \
218+
CFLAGS="-arch x86_64 -arch arm64" \
219+
else \
220+
echo "Skipping configure: already configured."; \
221+
fi
222+
cd curl-src && make
223+
mkdir -p curl/macos
224+
mv curl-src/lib/.libs/libcurl.a curl/macos
225+
147226
# Clean up generated files
148227
clean:
149228
rm -rf $(BUILD_DIRS) $(DIST_DIR)/* $(COV_DIR) *.gcda *.gcno *.gcov

0 commit comments

Comments
 (0)