pocketpy/build_ios_libs.sh
Kanika Kapoor c7572c76ba Fix amalgamation script to work with python3-only environments (#444)
- Use sys.executable in Python scripts (amalgamate.py, cmake_build.py) instead of hardcoded 'python'
- Update shell scripts to prefer python3 over python with fallback
- Fix scripts/run_tests.py to detect python3 for CPython benchmarking

This fixes the issue where the amalgamation script fails on Linux systems
that only have python3 available and no 'python' symlink.
2025-12-27 00:42:53 +05:30

40 lines
1.1 KiB
Bash

set -e
# Use python3 if available, otherwise fall back to python
PYTHON=$(command -v python3 >/dev/null 2>&1 && echo python3 || echo python)
$PYTHON amalgamate.py
rm -rf build
mkdir build
cd build
FLAGS="-DCMAKE_TOOLCHAIN_FILE=3rd/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=13.0 \
-DPK_BUILD_STATIC_LIB=ON \
-DPK_ENABLE_OS=OFF \
-DPK_ENABLE_DETERMINISM=ON \
-DPK_BUILD_MODULE_LZ4=ON \
-DPK_BUILD_MODULE_CUTE_PNG=ON \
-DPK_BUILD_MODULE_MSGPACK=ON \
-DCMAKE_BUILD_TYPE=Release \
"
cmake -B os64 -G Xcode $FLAGS -DPLATFORM=OS64 ..
cmake --build os64 --config Release
cmake -B simulatorarm64 -G Xcode $FLAGS -DPLATFORM=SIMULATORARM64 ..
cmake --build simulatorarm64 --config Release
cd ../
HEADERS="amalgamated/pocketpy.h"
$PYTHON scripts/merge_built_libraries.py build/os64
$PYTHON scripts/merge_built_libraries.py build/simulatorarm64
xcodebuild -create-xcframework \
-library build/os64/libpocketpy.a -headers $HEADERS \
-library build/simulatorarm64/libpocketpy.a -headers $HEADERS \
-output build/pocketpy.xcframework