46 lines
2.5 KiB
Bash
Executable File
46 lines
2.5 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# /\ +------------------------------------------------------------+
|
|
# ____/ \____ /| zlib/MIT/Unlicenced game framework licensed to freely use, |
|
|
# \ / / | copy, modify and sell without restriction |
|
|
# +--\ ^__^ /--+ | |
|
|
# | ~/ \~ | | created for <https://foam.shampoo.ooo> |
|
|
# | ~~~~~~~~~~~~ | +------------------------------------------------------------+
|
|
# | SPACE ~~~~~ | /
|
|
# | ~~~~~~~ BOX |/
|
|
# +--------------+
|
|
#
|
|
# Text edits for skinning the SDL Android project skeleton
|
|
|
|
ANDROID_PACKAGE=$1
|
|
ANDROID_BUILD_DIR=$2
|
|
ANDROID_MANIFEST=$3
|
|
ANDROID_APP_MK=$4
|
|
ANDROID_MK=$5
|
|
ANDROID_CLASS=$6
|
|
ANDROID_APP_NAME=$7
|
|
ANDROID_MIN_TARGET=$8
|
|
ANDROID_NDK=$9
|
|
SB_SRC="${10}"
|
|
SB_LIB_SRC="${11}"
|
|
SRC="${12}"
|
|
|
|
sed -i "s/org.libsdl.app/$ANDROID_PACKAGE/" "$ANDROID_BUILD_DIR/app/build.gradle" "$ANDROID_BUILD_DIR/$ANDROID_MANIFEST"
|
|
sed -i "s/^#.*\(APP_STL\)/\1/" "$ANDROID_BUILD_DIR/$ANDROID_APP_MK"
|
|
echo "APP_CPPFLAGS := -std=c++17 -fexceptions -frtti" >> "$ANDROID_BUILD_DIR/$ANDROID_APP_MK"
|
|
sed -i -e 's/^LOCAL_LDLIBS.*/& -lGLESv3 -llog/' "$ANDROID_BUILD_DIR/$ANDROID_MK"
|
|
sed -i 's/0x0002/0x0003/' "$ANDROID_BUILD_DIR/$ANDROID_MANIFEST"
|
|
sed -i "s/\(minSdkVersion\).*16/\1 $ANDROID_MIN_TARGET/" "$ANDROID_BUILD_DIR/app/build.gradle" "$ANDROID_BUILD_DIR/$ANDROID_APP_MK"
|
|
sed -i "s/\(android\)-16/\1-$ANDROID_MIN_TARGET/" "$ANDROID_BUILD_DIR/app/build.gradle" "$ANDROID_BUILD_DIR/$ANDROID_APP_MK"
|
|
sed -i "11i\ ndkVersion \"$ANDROID_NDK\"" "$ANDROID_BUILD_DIR/app/build.gradle"
|
|
sed -i 's/1536m/4096m/' "$ANDROID_BUILD_DIR/gradle.properties"
|
|
sed -i "s/^#.*\(org.gradle.parallel\)/\1/" "$ANDROID_BUILD_DIR/gradle.properties"
|
|
sed -i 's/^LOCAL_SHARED_LIBRARIES.*/& SDL2_image SDL2_mixer SDL2_ttf/' "$ANDROID_BUILD_DIR/$ANDROID_MK"
|
|
sed -i "s#^LOCAL_C_INCLUDES.*#& \$(LOCAL_PATH)/../../../../../../$SB_LIB_SRC \$(LOCAL_PATH)/../../../../../../$SB_SRC#" \
|
|
"$ANDROID_BUILD_DIR/$ANDROID_MK"
|
|
sed -i "s#YourSourceHere.c#\$(wildcard \$(LOCAL_PATH)/../../../../../../*.cpp)#" "$ANDROID_BUILD_DIR/$ANDROID_MK"
|
|
sed -i 's#^LOCAL_SRC_FILES.*#& $(wildcard $(LOCAL_PATH)/../../../../../../../../src/*.cpp)#' "$ANDROID_BUILD_DIR/$ANDROID_MK"
|
|
sed -i 's#^LOCAL_SRC_FILES.*#& $(wildcard $(LOCAL_PATH)/../../../../../../../../lib/sdl2-gfx/*.c)#' "$ANDROID_BUILD_DIR/$ANDROID_MK"
|
|
sed -i "s/\(name=\)\"SDLActivity\"/\1\"$ANDROID_CLASS\"/" "$ANDROID_BUILD_DIR/$ANDROID_MANIFEST"
|
|
sed -i "s/Game/$ANDROID_APP_NAME/" "$ANDROID_BUILD_DIR/app/src/main/res/values/strings.xml"
|