include certs in compiled output

This commit is contained in:
ading2210 2024-01-07 19:26:15 -05:00
parent 961ce1c37f
commit 663f31cd6e
4 changed files with 71 additions and 12 deletions

18
client/tools/generate_cert.sh Executable file
View file

@ -0,0 +1,18 @@
#!/bin/bash
#export ca certs to a c header file
set -e
CURL_PREFIX=$(realpath build/curl-wasm)
CACERT_FILE="$(realpath build/cacert.pem)"
CACERT_HEADER="$CURL_PREFIX/include/cacert.h"
CACERT_DIR="$(dirname $CACERT_FILE)"
REPLACE_STR="$(echo $CACERT_DIR | tr '/-' '_')"
if [ ! -f $CACERT_FILE ]; then
wget "https://curl.se/ca/cacert.pem" -O $CACERT_FILE
fi
xxd -i $CACERT_FILE > $CACERT_HEADER
sed -i "s/$REPLACE_STR//" $CACERT_HEADER