From 45fbce38249744fdc25f72678b759e180033e761 Mon Sep 17 00:00:00 2001 From: Jeroen Ooms Date: Wed, 22 Jan 2025 20:02:06 +0100 Subject: [PATCH] adding curl --- libcurl | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 libcurl diff --git a/libcurl b/libcurl new file mode 100644 index 0000000000..949e59cf66 --- /dev/null +++ b/libcurl @@ -0,0 +1,30 @@ +# Require MacOS 11 or up now +if [ "x${OSTYPE:6:1}" = "x1" ]; then return 0; fi +bottle="https://github.com/autobrew/bundler/releases/download/curl-8.11.1_1/curl-lite-8.11.1_1-universal.tar.xz" + +# Skip if disabled +if [ "$DISABLE_AUTOBREW" ]; then return 0; fi +echo "Using autobrew bundle: $(basename $bottle)" + +# General setup +BREWDIR="$PWD/.deps" +mkdir -p $BREWDIR + +# Download if we did not do it yet +if [ ! -f "$BREWDIR/lib/libbrewcurl.a" ]; then + curl -sSL $bottle -o libs.tar.xz + tar -xf libs.tar.xz --strip 1 -C $BREWDIR + rm -f libs.tar.xz +fi + +# Hardcoded flags +PKG_CFLAGS="-I${BREWDIR}/include -mmacosx-version-min=11.0" +PKG_LIBS="-L${BREWDIR}/lib -lcurl -lnghttp2 -lssl -lcrypto -lldap $(krb5-config --libs) -lz -framework Security -framework SystemConfiguration" + +# Prevent linking against other libs in /usr/local/lib +for FILE in $BREWDIR/lib/*.a; do + BASENAME=$(basename $FILE) + LIBNAME=$(echo "${BASENAME%.*}" | cut -c4-) + cp -f $FILE $BREWDIR/lib/libbrew$LIBNAME.a + PKG_LIBS=$(echo $PKG_LIBS | sed "s/-l$LIBNAME /-lbrew$LIBNAME /g") +done