do not edit — generated by btf.
git.druid.rocksindexdruid520portsports/networking/curl/add.sh

ports/networking/curl/add.sh


set -e
 
# curl -sL, using the CURRENTLY-installed curl (see this port's own
# del.sh comment on why that's safe: it's never removed first). tiny-
# curl-8.4.0 is a fixed, curl.se-published release tarball -- no git
# mirror exists for it, so this is the only fetch path.
curl -sL https://curl.se/tiny/tiny-curl-8.4.0.tar.gz -o tiny-curl.tar.gz
tar xzf tiny-curl.tar.gz
cd tiny-curl-8.4.0
# CC/CFLAGS/LDFLAGS all come from /etc/mpx.env.d/curl.env (site
# config), NOT hardcoded here: this tree's own "no C compiler beyond
# tcc" direction, confirmed for real -- the entire tiny-curl source
# tree (BearSSL vtls backend included) compiles clean with tcc alone,
# zero gcc involved. That file also REPLACES (not appends to) this
# system's own ambient /etc/mpx.env CFLAGS/LDFLAGS ("-fPIC -static-pie
# -Os -g0 -s -pipe"), since tcc rejects "-static-pie" outright ("tcc:
# error: invalid option -- '-static-pie'", confirmed for real) and
# curl's own ./configure DOES read ambient CFLAGS/LDFLAGS unlike
# bearssl's plain Makefile -- make sure that file exists before
# installing this port, or configure's very first compiler sanity
# check fails.
#
# NOT fully static either (no "-static"/"-all-static"): tried both for
# real. Plain libtool "-static" is silently swallowed by libtool itself
# (it means "prefer this project's own .a over any .la-declared .so",
# not "pass -static to the linker" -- confirmed via "make V=1", the
# flag never reached tcc's own command line at all). "-all-static" DOES
# reach tcc, but then hits a real, confirmed tcc linker bug:
# "unresolved reference to 'abort'" -- traced this down for real:
# `abort` is NOT referenced by libcurl.a, libbearssl.a, or Sortix
# libz.a (checked all three directly via nm), and musl's own libc.a
# DOES define it correctly. The undefined reference has to be coming
# from tcc's own implicit runtime support object (libtcc1.a-style),
# which tcc's own static-link path apparently fails to resolve against
# libc for correctly -- a tcc bug, not anything wrong with curl/
# bearssl/libz's own code, and not something worth chasing further
# into tcc's own linker internals here. The resulting binary is
# dynamically linked against musl's libc only (libcurl and libbearssl
# themselves remain fully statically embedded, per --disable-shared/
# --enable-static above and bearssl only ever producing a .a) -- still
# 100% tcc-compiled, zero gcc/cmake/python/autotools involved, just not
# ALSO fully static the way the rest of this system's own binaries are.
#
# --with-bearssl=$MP_PREFIX, not curl_base/MP_PREFIX_BASE like the old
# --with-openssl did: bearssl has no history of the --inplace stale-
# path issue that motivated that distinction for OpenSSL-family
# backends (see this port's own git history), and a plain $MP_PREFIX
# is correct for the common (non-inplace) case this tree actually uses
# for curl (pkg_no_inplace="yes" above rules the other case out
# anyway).
./configure --prefix=$MP_PREFIX --with-bearssl=$MP_PREFIX --disable-progress-meter \
	--disable-shared --enable-static \
	--disable-ftp --disable-file --disable-ldap --disable-ldaps \
	--disable-rtsp --disable-dict --disable-telnet --disable-tftp \
	--disable-pop3 --disable-imap --disable-smtp --disable-gopher \
	--disable-mqtt --disable-manual --disable-docs --disable-libcurl-option \
	--without-libpsl --without-libidn2 --without-nghttp2 --without-brotli --without-zstd \
	$CONFIGURE_FLAGS
# LIBS="... $MP_PREFIX/lib/libz.a": a bare "-lz" here resolves to
# whatever the linker's own default preference is, which for tcc (like
# most linkers absent an explicit static/dynamic override) is the
# .so if one exists -- the OLD, upstream-zlib-content
# /usr/lib/libz.so.1 in this case (confirmed for real: curl --version
# reported "zlib/1.3.2.1-motley", the old .so's own version string, not
# the new libz's "1.2.8.f-sortix-libz"). The usual fix (-Wl,-Bstatic
# -lz -Wl,-Bdynamic, forcing just this one library static without a
# blanket -static/-all-static) doesn't work either: tcc's own linker
# doesn't implement -Bstatic/-Bdynamic at all ("unsupported linker
# option '-Bstatic'", confirmed for real). Referencing the .a by its
# literal path instead of via -lz sidesteps the whole static-vs-shared
# preference question -- there's no ambiguity left for the linker to
# resolve.
make -j$MP_JOBS LIBS="-lbearssl $MP_PREFIX/lib/libz.a"
make install
make clean || true
powered by btf.