Skip to content

Commit

Permalink
libraries: Add curl
Browse files Browse the repository at this point in the history
  • Loading branch information
endrift committed Oct 24, 2022
1 parent edd3c0a commit 0aef682
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,6 @@
[submodule "libraries/libedit"]
path = libraries/libedit
url = https://salsa.debian.org/debian/libedit.git
[submodule "libraries/curl"]
path = libraries/curl
url = https://github.com/curl/curl.git
13 changes: 10 additions & 3 deletions libraries/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROJECTS := ffmpeg lame libpng libvpx libwebp libzip lua nv-codec-headers opus qt5 sqlite3 sdl2 x264 x265 zlib
PROJECTS := curl ffmpeg lame libpng libvpx libwebp libzip lua nv-codec-headers opus qt5 sqlite3 sdl2 x264 x265 zlib
ROOT ?= /
CPPFLAGS += -I$(ROOT)/include
LDFLAGS += -L$(ROOT)/lib
Expand All @@ -9,9 +9,11 @@ ifneq ($(HOST),)
PROJECTS += libelf
ifneq ($(findstring darwin,$(HOST)),)
DARWIN := 1
CURL_SSL := secure-transport
else
PROJECTS += libepoxy openssl
CROSS_PREFIX ?= $(HOST)-
CURL_SSL := openssl
endif
ifeq ($(findstring mingw,$(HOST)),)
PROJECTS += libedit
Expand All @@ -33,6 +35,7 @@ ifneq ($(HOST),)
else
PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/lib/pkgconfig:/usr/lib/$(shell gcc -print-multiarch)/pkgconfig
PROJECTS += libedit openssl
CURL_SSL := openssl
ifneq ($(findstring x86_64,$(shell uname -m)),)
ARCHFLAGS += -msse2 -msse3
endif
Expand Down Expand Up @@ -63,7 +66,7 @@ all: $(PROJECTS)
clean: $(foreach PROJECT, $(PROJECTS),clean-$(PROJECT))

CLEAN_PROJECTS = $(foreach PROJECT, $(PROJECTS),clean-$(PROJECT))
CUSTOM_PROJECTS = lua luajit sdl2
CUSTOM_PROJECTS = curl lua luajit sdl2
CUSTOM_CLEAN = clean-qt5 clean-luajit

$(foreach PROJECT, $(filter-out $(CUSTOM_CLEAN),$(CLEAN_PROJECTS)),$(PROJECT)):
Expand All @@ -76,6 +79,9 @@ $(foreach PROJECT, $(PROJECTS),$(PROJECT)): INSTALL=install
$(foreach PROJECT, $(filter-out $(CUSTOM_PROJECTS),$(PROJECTS)),$(PROJECT)):
cd $(BASEDIR) && $(CONFIGURE) && $(MAKE) $(TARGET) && $(MAKE) $(INSTALL)

curl: $(CURL_SSL)
cd curl && ../buildscripts/configure-curl.sh "$(CMAKE_TOOLCHAIN_FILE)" $(ROOT) && cd build && $(MAKE) install

ffmpeg: CONFIGURE=../buildscripts/configure-ffmpeg.sh "$(CROSS_PREFIX)" $(ROOT)
ffmpeg: lame libpng libvpx libwebp nv-codec-headers opus x264 x265 zlib
ffmpeg: clean-ffmpeg
Expand Down Expand Up @@ -133,4 +139,5 @@ x265: CONFIGURE=../buildscripts/configure-x265.sh "$(CMAKE_TOOLCHAIN_FILE)" $(RO

zlib: CONFIGURE=./configure --static --prefix=$(ROOT)

.PHONY: clean $(foreach PROJECT, $(PROJECTS),$(PROJECT)-clean) $(foreach PROJECT, $(PROJECTS),$(PROJECT))
secure-transport:
.PHONY: clean $(foreach PROJECT, $(PROJECTS),$(PROJECT)-clean) $(foreach PROJECT, $(PROJECTS),$(PROJECT)) secure-transport
32 changes: 32 additions & 0 deletions libraries/buildscripts/configure-curl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
if [ -z "$CMAKE_TOOLCHAIN_FILE" ]; then
export CMAKE_TOOLCHAIN_FILE=$1
fi
if [ -z "$ROOT" ]; then
export ROOT=$2
fi

BASEDIR=$(dirname $0)
. $BASEDIR/identify-toolchain.sh
OS=$(identify_os $CC)
CMAKE_EXTRA=""
case $OS in
OSX*)
ARCH=${HOST%%-*}
if [ -z "$ARCH" ]; then
ARCH=$(arch)
fi
if [ $ARCH == aarch64 ]; then
ARCH=arm64
else
CMAKE_EXTRA="-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13"
fi
CMAKE_EXTRA="$CMAKE_EXTRA -DCMAKE_OSX_ARCHITECTURES=$ARCH"
;;
esac

mkdir -p build
cd build && cmake .. \
-DCMAKE_INSTALL_PREFIX="$ROOT" \
-DCMAKE_TOOLCHAIN_FILE="$CMAKE_TOOLCHAIN_FILE" \
$CMAKE_EXTRA
1 change: 1 addition & 0 deletions libraries/curl
Submodule curl added at 93d092

0 comments on commit 0aef682

Please sign in to comment.