diff --git a/.rive_head b/.rive_head index 36229491..8992f217 100644 --- a/.rive_head +++ b/.rive_head @@ -1 +1 @@ -236d788ea3cf8f184a026a1b69c14af60003169c +2c2ea44922f91b784ec16549ce1cda0346438fd0 diff --git a/.rive_renderer b/.rive_renderer index 1d499b92..dbdca233 100644 --- a/.rive_renderer +++ b/.rive_renderer @@ -1 +1 @@ -37532d9b2ca672b36968aff9435b413d846f6d23 +4bc1e5c1d5af8327b4d5afc8f53afd6d0a7a7d45 diff --git a/scripts/build.rive.sh b/scripts/build.rive.sh index c6f1a529..f24cdd0f 100755 --- a/scripts/build.rive.sh +++ b/scripts/build.rive.sh @@ -85,12 +85,12 @@ build_skia_renderer_macosx() { build_pls_renderer() { pushd $RIVE_PLS_DIR/out premake5 --scripts=$RIVE_RUNTIME_DIR/build --file=premake5_pls_renderer.lua --universal-release --no-rive-decoders --os=ios gmake2 - make config=release clean - make config=release -j12 rive_pls_renderer + make config=$1 clean + make config=$1 -j12 rive_pls_renderer popd - cp -r $RIVE_PLS_DIR/out/iphoneos_release/librive_pls_renderer.a $DEV_SCRIPT_DIR/../dependencies/debug/librive_pls_renderer.a - cp -r $RIVE_PLS_DIR/out/iphoneos_release/librive_pls_renderer.a $DEV_SCRIPT_DIR/../dependencies/release/librive_pls_renderer.a + cp -r $RIVE_PLS_DIR/out/iphoneos_$1/librive_pls_renderer.a $DEV_SCRIPT_DIR/../dependencies/$1/librive_pls_renderer.a + $DEV_SCRIPT_DIR/strip_static_lib.sh $DEV_SCRIPT_DIR/../dependencies/$1/librive_pls_renderer.a cp -r $RIVE_PLS_DIR/include $DEV_SCRIPT_DIR/../dependencies/includes/pls } @@ -98,12 +98,12 @@ build_pls_renderer() { build_pls_renderer_sim() { pushd $RIVE_PLS_DIR/out premake5 --scripts=$RIVE_RUNTIME_DIR/build --file=premake5_pls_renderer.lua --universal-release --no-rive-decoders --os=ios --variant=simulator gmake2 - make config=release clean - make config=release -j12 rive_pls_renderer + make config=$1 clean + make config=$1 -j12 rive_pls_renderer popd - cp -r $RIVE_PLS_DIR/out/iphonesimulator_release/librive_pls_renderer.a $DEV_SCRIPT_DIR/../dependencies/debug/librive_pls_renderer_sim.a - cp -r $RIVE_PLS_DIR/out/iphonesimulator_release/librive_pls_renderer.a $DEV_SCRIPT_DIR/../dependencies/release/librive_pls_renderer_sim.a + cp -r $RIVE_PLS_DIR/out/iphonesimulator_$1/librive_pls_renderer.a $DEV_SCRIPT_DIR/../dependencies/$1/librive_pls_renderer_sim.a + $DEV_SCRIPT_DIR/strip_static_lib_fat.sh $DEV_SCRIPT_DIR/../dependencies/$1/librive_pls_renderer_sim.a arm64 x86_64 cp -r $RIVE_PLS_DIR/include $DEV_SCRIPT_DIR/../dependencies/includes/pls } @@ -111,12 +111,12 @@ build_pls_renderer_sim() { build_pls_renderer_macosx() { pushd $RIVE_PLS_DIR/out premake5 --scripts=$RIVE_RUNTIME_DIR/build --file=premake5_pls_renderer.lua --universal-release --no-rive-decoders --os=macosx gmake2 - make config=release clean - make config=release -j12 rive_pls_renderer + make config=$1 clean + make config=$1 -j12 rive_pls_renderer popd - cp -r $RIVE_PLS_DIR/out/release/librive_pls_renderer.a $DEV_SCRIPT_DIR/../dependencies/debug/librive_pls_renderer_macos.a - cp -r $RIVE_PLS_DIR/out/release/librive_pls_renderer.a $DEV_SCRIPT_DIR/../dependencies/release/librive_pls_renderer_macos.a + cp -r $RIVE_PLS_DIR/out/$1/librive_pls_renderer.a $DEV_SCRIPT_DIR/../dependencies/$1/librive_pls_renderer_macos.a + $DEV_SCRIPT_DIR/strip_static_lib_fat.sh $DEV_SCRIPT_DIR/../dependencies/$1/librive_pls_renderer_macos.a arm64 x86_64 cp -r $RIVE_PLS_DIR/include $DEV_SCRIPT_DIR/../dependencies/includes/pls } @@ -159,9 +159,12 @@ all) build_skia_renderer_sim release build_skia_renderer_macosx debug build_skia_renderer_macosx release - build_pls_renderer - build_pls_renderer_sim - build_pls_renderer_macosx + build_pls_renderer debug + build_pls_renderer release + build_pls_renderer_sim debug + build_pls_renderer_sim release + build_pls_renderer_macosx debug + build_pls_renderer_macosx release ;; macosx) if (($# < 2)); then @@ -172,7 +175,7 @@ macosx) make_dependency_directories finalize_skia build_skia_renderer_macosx $2 - build_pls_renderer_macosx + build_pls_renderer_macosx $2 ;; *) usage @@ -188,7 +191,7 @@ ios) make_dependency_directories finalize_skia build_skia_renderer $2 - build_pls_renderer + build_pls_renderer $2 ;; *) usage @@ -204,7 +207,7 @@ ios_sim) make_dependency_directories finalize_skia build_skia_renderer_sim $2 - build_pls_renderer_sim + build_pls_renderer_sim $2 ;; *) usage diff --git a/scripts/strip_static_lib.sh b/scripts/strip_static_lib.sh new file mode 100755 index 00000000..7fb34aa1 --- /dev/null +++ b/scripts/strip_static_lib.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# usage: strip_static_lib.sh file.a +# Borrowed from: +# https://stackoverflow.com/questions/49630984/strip-remove-debug-symbols-and-archive-names-from-a-static-library +set -e + +if [ -z "$1" ]; then + echo "usage: strip_static_lib.sh file.a" + exit 1 +fi + +path=$(readlink -f "${BASH_SOURCE:-$0}") +SCRIPT_DIR=$(dirname $path) +TMP_DIR="$SCRIPT_DIR/strip_static_lib_tmp" + +if [ -d $TMP_DIR ]; then + rm -rf $TMP_DIR +fi + +BASENAME=${1##*/} +LIB=$(realpath $1) + +mkdir $TMP_DIR +cp $LIB $TMP_DIR +pushd $TMP_DIR + +ar xv $BASENAME +rm -f $BASENAME +i=1000 +for p in *.o ; do + strip -Sx $p -o ${i}.o + rm $p + ((i++)) +done + +ar crus $BASENAME *.o +mv $BASENAME $LIB + +popd +rm -rf $TMP_DIR +exit 0 diff --git a/scripts/strip_static_lib_fat.sh b/scripts/strip_static_lib_fat.sh new file mode 100755 index 00000000..3e4bffc7 --- /dev/null +++ b/scripts/strip_static_lib_fat.sh @@ -0,0 +1,32 @@ +#!/bin/bash +set -e + +path=$(readlink -f "${BASH_SOURCE:-$0}") +SCRIPT_DIR=$(dirname $path) +TMP_DIR="$SCRIPT_DIR/strip_static_lib_fat_tmp" + +BASENAME=${1##*/} +LIB=$(realpath $1) +shift + +if [ -d $TMP_DIR ]; then + rm -rf $TMP_DIR +fi + +mkdir $TMP_DIR +cp $LIB $TMP_DIR +pushd $TMP_DIR + +# Extract and strip each architecture. +for ARCH in "$@" +do + lipo $BASENAME -thin $ARCH -output ${BASENAME}_${ARCH}.a + $SCRIPT_DIR/strip_static_lib.sh ${BASENAME}_${ARCH}.a +done + +# Repack the stripped libs. +lipo -create ${BASENAME}_*.a -output $LIB + +popd +rm -rf $TMP_DIR +exit 0