From 4bfd9de1008c1fad3233c0f637044f2780421c08 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Wed, 21 Feb 2024 20:23:35 -0500 Subject: [PATCH] Give iOS the same openssl build treatment as android and mingw. #11 --- GNUmakefile | 7 +++++++ tools/ssl-ios | 21 +++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 0bffd4cd..0baa09f8 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -838,6 +838,13 @@ $(WINDOWS_DEPS): $(filter $(BUILD_DIR)/win%,$(APP_OBJS)): | $(WINDOWS_DEPS) endif +ifeq ($(UNAME_S),Darwin) +IOS_DEPS := deps/openssl/ios/usr/local/lib/libssl.a +$(IOS_DEPS): + +@tools/ssl-ios +$(filter $(BUILD_DIR)/ios%,$(APP_OBJS)): | $(IOS_DEPS) +endif + clean: rm -rf $(BUILD_DIR) .PHONY: clean diff --git a/tools/ssl-ios b/tools/ssl-ios index 0855ff1b..4fb50769 100755 --- a/tools/ssl-ios +++ b/tools/ssl-ios @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash OPENSSL_VERSION=3.2.1 @@ -8,17 +8,17 @@ BUILD_DIR=out/openssl_ios_build BUILD_TARGETS="ios64-xcrun iossimulator-xcrun" -rm -rfv openssl-${OPENSSL_VERSION} +rm -rfv out/openssl-${OPENSSL_VERSION} -if [ ! -d openssl-${OPENSSL_VERSION} ] +if [ ! -d out/openssl-${OPENSSL_VERSION} ] then - if [ ! -f openssl-${OPENSSL_VERSION}.tar.gz ] + if [ ! -f out/openssl-${OPENSSL_VERSION}.tar.gz ] then - curl https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz -o openssl-${OPENSSL_VERSION}.tar.gz || exit 128 + curl https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz -o out/openssl-${OPENSSL_VERSION}.tar.gz || exit 128 fi - tar xzf openssl-${OPENSSL_VERSION}.tar.gz || exit 128 + tar -C out/ -xzf out/openssl-${OPENSSL_VERSION}.tar.gz || exit 128 fi -WORK_DIR=openssl-${OPENSSL_VERSION} +WORK_DIR=out/openssl-${OPENSSL_VERSION} ##### export ndk directory. Required by openssl-build-scripts ##### @@ -37,7 +37,8 @@ build_the_thing() { for build_target in $BUILD_TARGETS do echo "Building $build_target" - cd $WORK_DIR || exit 128 + pwd + pushd $WORK_DIR || exit 128 case $build_target in ios64-xcrun) @@ -58,11 +59,11 @@ do rm -rf $DESTDIR build_the_thing - cd .. + popd #### copy libraries and includes to output-directory ##### echo WORK_DIR=$WORK_DIR rm -rf deps/openssl/ios/$build_target/ - mkdir -p deps/openssl/ios/$build_target/usr/local/include + mkdir -p deps/openssl/ios/$build_target/usr/local/include/ mkdir -p deps/openssl/ios/$build_target/usr/local/lib/ cp -R $WORK_DIR/include/* deps/openssl/ios/$build_target/usr/local/include/ cp $WORK_DIR/*.a deps/openssl/ios/$build_target/usr/local/lib/