From 78928b7eb46f9762bacabc9c5c0616d290267223 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Mon, 17 Jun 2024 21:40:13 +0300 Subject: [PATCH] Ports: Add curl port! --- ports/curl/.gitignore | 1 + ports/curl/build.sh | 58 +++++++++++++++++++ .../patches/0001-add-banan_os-target.patch | 12 ++++ 3 files changed, 71 insertions(+) create mode 100644 ports/curl/.gitignore create mode 100755 ports/curl/build.sh create mode 100644 ports/curl/patches/0001-add-banan_os-target.patch diff --git a/ports/curl/.gitignore b/ports/curl/.gitignore new file mode 100644 index 0000000000..bfe0f4f1ee --- /dev/null +++ b/ports/curl/.gitignore @@ -0,0 +1 @@ +curl-* diff --git a/ports/curl/build.sh b/ports/curl/build.sh new file mode 100755 index 0000000000..fe90116484 --- /dev/null +++ b/ports/curl/build.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +if [ -z $BANAN_ARCH ]; then + echo "You must set the BANAN_ARCH environment variable" >&2 + exit 1 +fi + +if [ -z $BANAN_SYSROOT ]; then + echo "You must set the BANAN_ARCH environment variable" >&2 + exit 1 +fi + +if [ -z $BANAN_TOOLCHAIN_PREFIX ]; then + echo "You must set the BANAN_TOOLCHAIN_PREFIX environment variable" >&2 + exit 1 +fi + +CURL_VERSION="curl-8.8.0" +CURL_TAR="$CURL_VERSION.tar.gz" +CURL_URL="https://curl.se/download/$CURL_TAR" + +cd $(dirname $(realpath $0)) + +if [ ! -d $CURL_VERSION ]; then + if [ ! -f $CURL_TAR ]; then + wget $CURL_URL + fi + tar xf $CURL_TAR + + for patch in ./patches/*; do + patch -ruN -d $CURL_VERSION < "$patch" + done + + grep -qxF doom ../installed || echo curl >> ../installed +fi + +cd $CURL_VERSION + +export PATH="$BANAN_TOOLCHAIN_PREFIX/bin:$PATH" + +if [ ! -d "build-${BANAN_ARCH}" ]; then + mkdir -p "build-${BANAN_ARCH}" + cd "build-${BANAN_ARCH}" + + ../configure \ + --host=x86_64-banan_os \ + --prefix=$BANAN_SYSROOT/usr \ + --without-ssl \ + --disable-threaded-resolver \ + --disable-ipv6 \ + --disable-docs + + cd .. +fi + +cd "build-${BANAN_ARCH}" + +make && make install diff --git a/ports/curl/patches/0001-add-banan_os-target.patch b/ports/curl/patches/0001-add-banan_os-target.patch new file mode 100644 index 0000000000..24ba3d2c55 --- /dev/null +++ b/ports/curl/patches/0001-add-banan_os-target.patch @@ -0,0 +1,12 @@ +diff -ruN curl-8.8.0/config.sub curl-patched/config.sub +--- curl-8.8.0/config.sub 2023-03-13 00:39:42.000000000 +0200 ++++ curl-patched/config.sub 2024-06-17 21:16:00.348556957 +0300 +@@ -1754,7 +1754,7 @@ + | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ + | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ + | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ +- | fiwix* ) ++ | fiwix* | banan_os* ) + ;; + # This one is extra strict with allowed versions + sco3.2v2 | sco3.2v[4-9]* | sco5v6*)