Fetch and build OpenSSL as part of the code build.

This commit is contained in:
Cory McWilliams 2024-02-21 19:46:28 -05:00
parent 1db8eee9f7
commit 9dc6670795
3 changed files with 26 additions and 14 deletions

View File

@ -824,7 +824,19 @@ fetchdeps:
@test -f deps/prettier/html.mjs || curl -q --create-dirs -O --output-dir deps/prettier/ https://cdn.jsdelivr.net/npm/prettier@3.2.5/plugins/html.mjs @test -f deps/prettier/html.mjs || curl -q --create-dirs -O --output-dir deps/prettier/ https://cdn.jsdelivr.net/npm/prettier@3.2.5/plugins/html.mjs
@test -f deps/prettier/babel.mjs || curl -q --create-dirs -O --output-dir deps/prettier/ https://cdn.jsdelivr.net/npm/prettier@3.2.5/plugins/babel.mjs @test -f deps/prettier/babel.mjs || curl -q --create-dirs -O --output-dir deps/prettier/ https://cdn.jsdelivr.net/npm/prettier@3.2.5/plugins/babel.mjs
@test -f deps/prettier/estree.mjs || curl -q --create-dirs -O --output-dir deps/prettier/ https://cdn.jsdelivr.net/npm/prettier@3.2.5/plugins/estree.mjs @test -f deps/prettier/estree.mjs || curl -q --create-dirs -O --output-dir deps/prettier/ https://cdn.jsdelivr.net/npm/prettier@3.2.5/plugins/estree.mjs
.PHONE: fetchdeps .PHONY: fetchdeps
ANDROID_DEPS := deps/openssl/android/arm64-v8a/usr/local/lib/libssl.a
$(ANDROID_DEPS):
+@tools/ssl-android
$(filter $(BUILD_DIR)/android%,$(APP_OBJS)): | $(ANDROID_DEPS)
ifeq ($(HAVE_WIN),1)
WINDOWS_DEPS := deps/openssl/mingw64/usr/local/lib/libssl.a
$(WINDOWS_DEPS):
+@tools/ssl-mingw64
$(filter $(BUILD_DIR)/win%,$(APP_OBJS)): | $(WINDOWS_DEPS)
endif
clean: clean:
rm -rf $(BUILD_DIR) rm -rf $(BUILD_DIR)

View File

@ -13,9 +13,9 @@ BUILD_TARGETS="x86_64 x86 arm64-v8a armeabi-v7a"
rm -rf out/openssl-${OPENSSL_VERSION} rm -rf out/openssl-${OPENSSL_VERSION}
if [ ! -d openssl-${OPENSSL_VERSION} ] if [ ! -d out/openssl-${OPENSSL_VERSION} ]
then then
if [ ! -f openssl-${OPENSSL_VERSION}.tar.gz ] if [ ! -f out/openssl-${OPENSSL_VERSION}.tar.gz ]
then then
wget https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz -O out/openssl-${OPENSSL_VERSION}.tar.gz | exit 128 wget https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz -O out/openssl-${OPENSSL_VERSION}.tar.gz | exit 128
fi fi
@ -131,7 +131,7 @@ do
#### copy libraries and includes to output-directory ##### #### copy libraries and includes to output-directory #####
echo WORK_DIR=$WORK_DIR echo WORK_DIR=$WORK_DIR
rm -rf deps/openssl/android/$build_target/ rm -rf deps/openssl/android/$build_target/
mkdir -p deps/openssl/android/$build_target/usr/local/include mkdir -p deps/openssl/android/$build_target/usr/local/include/
mkdir -p deps/openssl/android/$build_target/usr/local/lib/ mkdir -p deps/openssl/android/$build_target/usr/local/lib/
cp -R $WORK_DIR/include/* deps/openssl/android/$build_target/usr/local/include/ cp -R $WORK_DIR/include/* deps/openssl/android/$build_target/usr/local/include/
cp $WORK_DIR/*.a deps/openssl/android/$build_target/usr/local/lib/ cp $WORK_DIR/*.a deps/openssl/android/$build_target/usr/local/lib/

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
OPENSSL_VERSION=3.2.1 OPENSSL_VERSION=3.2.1
@ -8,17 +8,17 @@ BUILD_DIR=out/openssl_mingw64_build
BUILD_TARGETS="mingw64" BUILD_TARGETS="mingw64"
rm -rfv openssl-${OPENSSL_VERSION} rm -rfv out/openssl-${OPENSSL_VERSION}
if [ ! -d openssl-${OPENSSL_VERSION} ] if [ ! -d out/openssl-${OPENSSL_VERSION} ]
then then
if [ ! -f openssl-${OPENSSL_VERSION}.tar.gz ] if [ ! -f out/openssl-${OPENSSL_VERSION}.tar.gz ]
then then
wget https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz || exit 128 wget https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz -O out/openssl-${OPENSSL_VERSION}.tar.gz || exit 128
fi fi
tar xzf openssl-${OPENSSL_VERSION}.tar.gz || exit 128 tar -C out/ -xzf out/openssl-${OPENSSL_VERSION}.tar.gz || exit 128
fi fi
WORK_DIR=openssl-${OPENSSL_VERSION} WORK_DIR=out/openssl-${OPENSSL_VERSION}
##### build-function ##### ##### build-function #####
build_the_thing() { build_the_thing() {
@ -34,7 +34,7 @@ build_the_thing() {
for build_target in $BUILD_TARGETS for build_target in $BUILD_TARGETS
do do
echo "Building $build_target" echo "Building $build_target"
cd $WORK_DIR || exit 128 pushd $WORK_DIR || exit 128
case $build_target in case $build_target in
mingw64) mingw64)
@ -46,11 +46,11 @@ do
rm -rf $DESTDIR rm -rf $DESTDIR
build_the_thing build_the_thing
cd .. popd
#### copy libraries and includes to output-directory ##### #### copy libraries and includes to output-directory #####
echo WORK_DIR=$WORK_DIR echo WORK_DIR=$WORK_DIR
rm -rf deps/openssl/$build_target/ rm -rf deps/openssl/$build_target/
mkdir -p deps/openssl/$build_target/usr/local/include mkdir -p deps/openssl/$build_target/usr/local/include/
mkdir -p deps/openssl/$build_target/usr/local/lib/ mkdir -p deps/openssl/$build_target/usr/local/lib/
cp -R $WORK_DIR/include/* deps/openssl/$build_target/usr/local/include/ cp -R $WORK_DIR/include/* deps/openssl/$build_target/usr/local/include/
cp $WORK_DIR/*.a deps/openssl/$build_target/usr/local/lib/ cp $WORK_DIR/*.a deps/openssl/$build_target/usr/local/lib/