feat: Allow multiple full app names
This commit is contained in:
28
build.sh
28
build.sh
@@ -10,13 +10,15 @@ sign_apk=false
|
||||
sign_bundle=false
|
||||
build_release=true
|
||||
do_zipalign=true
|
||||
named_variant="sdl"
|
||||
base_app_name=""
|
||||
|
||||
# Fix Gradle compilation error
|
||||
if [ -z "$ANDROID_NDK_HOME" ]; then
|
||||
export ANDROID_NDK_HOME="$(which ndk-build | sed 's@/ndk-build@@')"
|
||||
fi
|
||||
|
||||
while getopts "sirqbhz" OPT
|
||||
while getopts "sirqbhzv:" OPT
|
||||
do
|
||||
case $OPT in
|
||||
s) sign_apk=true;;
|
||||
@@ -25,6 +27,7 @@ do
|
||||
q) echo "Quick rebuild does not work anymore with Gradle!";;
|
||||
b) sign_bundle=true;;
|
||||
z) do_zipalign=false;;
|
||||
v) named_variant=${OPTARG};;
|
||||
h)
|
||||
echo "Usage: $0 [-s] [-i] [-r] [-q] [debug|release] [app-name]"
|
||||
echo " -s: sign .apk file after building"
|
||||
@@ -32,6 +35,7 @@ do
|
||||
echo " -i: install APK file to device after building"
|
||||
echo " -r: run APK file on device after building"
|
||||
echo " -z: skip zipalign and apksigner"
|
||||
echo " -v <v>: choose variant, either sdl or fdroid"
|
||||
echo " debug: build debug package"
|
||||
echo " release: build release package (default)"
|
||||
echo " app-name: directory under project/jni/application to be compiled"
|
||||
@@ -72,8 +76,19 @@ if [ "$#" -gt 0 ]; then
|
||||
shift
|
||||
fi
|
||||
|
||||
if [ ! -e project/local.properties ] || \
|
||||
! grep -q "package $(grep -Po 'AppFullName\=\K[.[:alnum:]]+' AndroidAppSettings.cfg);" project/src/Globals.java || \
|
||||
base_app_name=$(grep -Po 'AppFullName\=\K[[:alnum:].]+\.(?=[[:alnum:]]+)' AndroidAppSettings.cfg)
|
||||
|
||||
function project_needs_setup {
|
||||
local app_name=$(grep -Po 'AppFullName\=\K[.[:alnum:]]+' AndroidAppSettings.cfg)
|
||||
|
||||
if [ -z "${base_app_name}" ]; then
|
||||
echo "Could not determine App base name";
|
||||
exit 2
|
||||
fi
|
||||
|
||||
[ ! -e project/local.properties ] || \
|
||||
! grep -q "package ${app_name};" project/src/Globals.java || \
|
||||
! grep -q "package ${base_app_name}${named_variant};" project/src/Globals.java || \
|
||||
[ "$(readlink AndroidAppSettings.cfg)" -nt "project/src/Globals.java" ] || \
|
||||
[ -n "$(find project/java/* \
|
||||
project/javaSDL2/* \
|
||||
@@ -82,9 +97,12 @@ if [ ! -e project/local.properties ] || \
|
||||
-cnewer \
|
||||
project/src/Globals.java \
|
||||
)" \
|
||||
];
|
||||
]
|
||||
}
|
||||
|
||||
if project_needs_setup;
|
||||
then
|
||||
./changeAppSettings.sh -a
|
||||
APP_FULL_NAME="${base_app_name}${named_variant}" ./changeAppSettings.sh -a
|
||||
sleep 1
|
||||
touch project/src/Globals.java
|
||||
fi
|
||||
|
||||
@@ -49,6 +49,12 @@ source ./AndroidAppSettings.cfg
|
||||
|
||||
var=""
|
||||
|
||||
if [ -n "${APP_FULL_NAME}" ]; then
|
||||
echo ${APP_FULL_NAME}
|
||||
AppFullName="${APP_FULL_NAME}"
|
||||
CHANGED=1
|
||||
fi
|
||||
|
||||
if [ "$CompatibilityHacks" = y ]; then
|
||||
SwVideoMode=y
|
||||
fi
|
||||
@@ -164,7 +170,7 @@ AppVersionCode=$AppVersionCode
|
||||
# Application user-visible version name (string)
|
||||
AppVersionName="$AppVersionName"
|
||||
|
||||
# Specify path to download application data in zip archive in the form "Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...
|
||||
# Specify path to download application data in zip archive in the form "Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
|
||||
# If you'll start Description with '!' symbol it will be enabled by default, '!!' will also hide the entry from the menu, so it cannot be disabled
|
||||
# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped
|
||||
# If the URL does not contain 'http://' or 'https://', it is treated as file from 'project/jni/application/src/AndroidData' dir -
|
||||
@@ -172,14 +178,6 @@ AppVersionName="$AppVersionName"
|
||||
# You can specify Google Play expansion files in the form 'obb:main.12345' or 'obb:patch.12345' where 12345 is the app version for the obb file
|
||||
# You can mount expansion files created with jobb tool if you put 'mnt:main.12345' or 'mnt:patch.12345'
|
||||
# The mount directory will be returned by calling getenv("ANDROID_OBB_MOUNT_DIR")
|
||||
# Android app bundles do not support .obb files, they use asset packs instead.
|
||||
# This app project includes one pre-configured install-time asset pack.
|
||||
# To put your data into asset pack, copy it to the directory AndroidData/assetpack
|
||||
# and run changeAppSettings.sh. The asset pack zip archive will be returned by
|
||||
# getenv("ANDROID_ASSET_PACK_PATH"), this call will return NULL if the asset pack is not installed.
|
||||
# You can put "assetpack" keyword to AppDataDownloadUrl, the code will check
|
||||
# if the asset pack is installed and will not download the data from other URLs.
|
||||
# You can extract files from the asset pack the same way you extract files from the app assets.
|
||||
# You can use .zip.xz archives for better compression, but you need to add 'lzma' to CompiledLibraries
|
||||
# Generate .zip.xz files like this: zip -0 -r data.zip your-data/* ; xz -8 data.zip
|
||||
AppDataDownloadUrl="$AppDataDownloadUrl"
|
||||
@@ -191,7 +189,7 @@ ResetSdlConfigForThisVersion=$ResetSdlConfigForThisVersion
|
||||
DeleteFilesOnUpgrade="$DeleteFilesOnUpgrade"
|
||||
|
||||
# Here you may type readme text, which will be shown during startup. Format is:
|
||||
# Text in English, use \\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/
|
||||
# Text in English, use \\\\\\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/
|
||||
ReadmeText='$ReadmeText' | sed 's/\\\\n/\\\\\\\\n/g'
|
||||
|
||||
# libSDL version to use (1.2/2)
|
||||
@@ -231,7 +229,7 @@ SdlVideoResize=$SdlVideoResize
|
||||
# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n)
|
||||
SdlVideoResizeKeepAspect=$SdlVideoResizeKeepAspect
|
||||
|
||||
Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer
|
||||
# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer
|
||||
InhibitSuspend=$InhibitSuspend
|
||||
|
||||
# Create Android service, so the app is less likely to be killed while in background
|
||||
@@ -410,7 +408,7 @@ RedefinedKeysThirdGamepad="$RedefinedKeysThirdGamepad"
|
||||
# Redefine keys for the fourth gamepad, same as the first gamepad if not set:
|
||||
RedefinedKeysFourthGamepad="$RedefinedKeysFourthGamepad"
|
||||
|
||||
"# How long to show startup menu button, in msec, 0 to disable startup menu
|
||||
# How long to show startup menu button, in msec, 0 to disable startup menu
|
||||
StartupMenuButtonTimeout=$StartupMenuButtonTimeout
|
||||
|
||||
# Menu items to hide from startup menu, available menu items (SDL 1.2 only):
|
||||
@@ -441,7 +439,8 @@ MultiABI='$MultiABI'
|
||||
|
||||
# Optional shared libraries to compile - removing some of them will save space
|
||||
# MP3 patents are expired, but libmad license is GPL, not LGPL
|
||||
rep 'Available' project/jni/SettingsTemplate.mk
|
||||
# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2
|
||||
# rep 'Available' project/jni/SettingsTemplate.mk
|
||||
CompiledLibraries="$CompiledLibraries"
|
||||
|
||||
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
AppName="OpenTTD"
|
||||
|
||||
# Specify reversed site name of application (e.x. com.mysite.myapp)
|
||||
AppFullName=org.openttd.fdroid
|
||||
AppFullName=org.openttd.sdl
|
||||
|
||||
# Application version code (integer)
|
||||
AppVersionCode=1220112
|
||||
@@ -12,7 +12,7 @@ AppVersionCode=1220112
|
||||
# Application user-visible version name (string)
|
||||
AppVersionName="12.2.rev112"
|
||||
|
||||
# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
|
||||
# Specify path to download application data in zip archive in the form "Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...'
|
||||
# If you'll start Description with '!' symbol it will be enabled by default, '!!' will also hide the entry from the menu, so it cannot be disabled
|
||||
# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped
|
||||
# If the URL does not contain 'http://' or 'https://', it is treated as file from 'project/jni/application/src/AndroidData' dir -
|
||||
@@ -32,9 +32,9 @@ DeleteFilesOnUpgrade="libsdl-DownloadFinished-0.flag ai/regression ai/stationlis
|
||||
|
||||
# Here you may type readme text, which will be shown during startup. Format is:
|
||||
# Text in English, use \\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/
|
||||
ReadmeText=''
|
||||
ReadmeText='' | sed 's/\\n/\\\\n/g'
|
||||
|
||||
# libSDL version to use (1.2/1.3/2.0)
|
||||
# libSDL version to use (1.2/2)
|
||||
LibSdlVersion=1.2
|
||||
|
||||
# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape
|
||||
@@ -215,9 +215,11 @@ RedefinedKeys="LALT RETURN NO_REMAP NO_REMAP SPACE DELETE"
|
||||
# Number of virtual keyboard keys - currently 12 keys is the maximum
|
||||
AppTouchscreenKeyboardKeysAmount=0
|
||||
|
||||
# Redefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom in/out and rotate left/right) + 6 additional keyboard keys
|
||||
# Multitouch gestures should be moved to a separate variable, but are left here for compatibility
|
||||
RedefinedKeysScreenKb="LALT RETURN KP_PLUS KP_MINUS SPACE DELETE MOUSE_WHEEL_UP MOUSE_WHEEL_DOWN 1 2"
|
||||
# Define SDL keysyms for multitouch gestures - pinch-zoom in, pinch-zoom out, rotate left, rotate right
|
||||
RedefinedKeysScreenGestures="MOUSE_WHEEL_UP MOUSE_WHEEL_DOWN 1 2 "
|
||||
|
||||
# Redefine on-screen keyboard keys to SDL keysyms - currently 12 keys is the maximum
|
||||
RedefinedKeysScreenKb="LALT RETURN KP_PLUS KP_MINUS SPACE DELETE "
|
||||
|
||||
# Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separated by spaces, they are used in SDL config menu
|
||||
RedefinedKeysScreenKbNames="LALT RETURN KP_PLUS KP_MINUS SPACE DELETE MOUSE_WHEEL_UP MOUSE_WHEEL_DOWN 1 2"
|
||||
@@ -251,14 +253,14 @@ RedefinedKeysFourthGamepad=""
|
||||
# How long to show startup menu button, in msec, 0 to disable startup menu
|
||||
StartupMenuButtonTimeout=1500
|
||||
|
||||
# Menu items to hide from startup menu, available menu items:
|
||||
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.StorageAccessConfig SettingsMenuMisc.CommandlineConfig SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout SettingsMenuKeyboard.ScreenKeyboardAdvanced
|
||||
# Menu items to hide from startup menu, available menu items (SDL 1.2 only):
|
||||
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.StorageAccessConfig SettingsMenuMisc.CommandlineConfig SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout SettingsMenuKeyboard.ScreenKeyboardAdvanced
|
||||
HiddenMenuOptions='SettingsMenuMouse.DisplaySizeConfig'
|
||||
|
||||
# Menu items to show at startup - this is Java code snippet, leave empty for default
|
||||
# new SettingsMenuMisc.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new SettingsMenuMouse.DisplaySizeConfig(true) : new SettingsMenu.DummyMenu()), new SettingsMenuMisc.OptionalDownloadConfig(true), new SettingsMenuMisc.GyroscopeCalibration()
|
||||
# Available menu items:
|
||||
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.StorageAccessConfig SettingsMenuMisc.CommandlineConfig SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout SettingsMenuKeyboard.ScreenKeyboardAdvanced
|
||||
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.StorageAccessConfig SettingsMenuMisc.CommandlineConfig SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout SettingsMenuKeyboard.ScreenKeyboardAdvanced
|
||||
FirstStartMenuOptions=''
|
||||
|
||||
# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower
|
||||
@@ -276,11 +278,11 @@ APP_PLATFORM=21
|
||||
# Specify architectures to compile, 'all' or 'y' to compile for all architectures.
|
||||
# Available architectures: armeabi-v7a arm64-v8a x86 x86_64
|
||||
MultiABI='arm64-v8a armeabi-v7a x86 x86_64'
|
||||
#MultiABI='arm64-v8a'
|
||||
|
||||
# Optional shared libraries to compile - removing some of them will save space
|
||||
# MP3 patents are expired, but libmad license is GPL, not LGPL
|
||||
# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2
|
||||
# rep 'Available' project/jni/SettingsTemplate.mk
|
||||
CompiledLibraries="c++_shared timidity expat fontconfig lzma lzo2 icui18n iculx icu-le-hb harfbuzz icudata icuuc"
|
||||
|
||||
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
|
||||
@@ -325,4 +327,3 @@ GooglePlayGameServicesId=942284197278
|
||||
|
||||
# The app will open files with following extension, file path will be added to commandline params
|
||||
AppOpenFileExtension=''
|
||||
|
||||
|
||||
Reference in New Issue
Block a user