23 lines
1 KiB
Bash
Executable file
23 lines
1 KiB
Bash
Executable file
#!/bin/env -S NOT_SOURCED=1 /bin/bash
|
|
if ! [ "$NOT_SOURCED" = "1" ]; then
|
|
echo "Error: This script must not be sourced!" >&2
|
|
return 1
|
|
fi
|
|
get_abs_filename() {
|
|
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")" | sed 's@/\./@/@g' | sed 's@/\.$@@g'
|
|
}
|
|
|
|
export PROJECT_DIR="$(get_abs_filename $(dirname "$0"))"
|
|
export ANDROID_PROJECT_DIR="${PROJECT_DIR}/sdl-android-project"
|
|
export ANDROID_APP_DIR="${ANDROID_PROJECT_DIR}/app"
|
|
export ANDROID_JNI_DIR="${ANDROID_APP_DIR}/jni"
|
|
echo "Project directory: $PROJECT_DIR"
|
|
echo "Android project directory: $ANDROID_PROJECT_DIR"
|
|
echo "Android JNI symlink: $ANDROID_JNI_DIR -> $PROJECT_DIR"
|
|
pushd "${PROJECT_DIR}"
|
|
[ -d "$ANDROID_JNI_DIR" ] && rm -rf "$ANDROID_JNI_DIR"
|
|
ln -sf "$PROJECT_DIR" "$ANDROID_JNI_DIR"
|
|
rm -rf "${ANDROID_APP_DIR}/src/main/java/org"
|
|
cp -r "${PROJECT_DIR}/subprojects/SDL/android-project/app/src/main/java/org" "${ANDROID_APP_DIR}/src/main/java/org"
|
|
patch -N "${ANDROID_APP_DIR}/src/main/java/org/libsdl/app/SDLActivity.java" -i "${PROJECT_DIR}/libnames.patch"
|
|
popd
|