Merge remote-tracking branch 'upstream/sdl_android' into sdl_android

This commit is contained in:
2024-04-05 18:59:48 +01:00
27 changed files with 305 additions and 165 deletions

View File

@@ -31,12 +31,23 @@ jobs:
APP_NAME: ballfield
# It takes one hour per one architecture to build Boost and ICU libraries, and Github limits CI script duration to 6 hours
ARCH_LIST: armeabi-v7a arm64-v8a x86 x86_64
ANDROID_BUILD_TOOLS: 33.0.2
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Java 17
uses: actions/setup-java@v2
with:
java-version: 17
distribution: temurin
- name: Check out the repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: false
@@ -57,46 +68,6 @@ jobs:
run: |
sed -i "s/MultiABI=.*/MultiABI='${ARCH_LIST}'/g" project/jni/application/src/AndroidAppSettings.cfg
# - name: Get Boost revision
# id: boost-rev
# run: echo "::set-output name=BOOST_REV::`git -C project/jni/boost/src rev-parse HEAD`"
#
# - name: Get ICU revision
# id: icu-rev
# run: echo "::set-output name=ICU_REV::`git -C project/jni/iconv/src rev-parse HEAD`"
#
# - name: Copy Boost libraries from cache
# uses: actions/cache@v2
# id: cache-boost
# with:
# # The same SDL revision will produce the same libraries
# key: ${{steps.boost-rev.outputs.BOOST_REV}}
# path: |
# build-android/project/jni/boost/include
# build-android/project/jni/boost/lib
#
# - name: Copy ICU libraries from cache
# uses: actions/cache@v2
# id: cache-icu
# with:
# # The same SDL revision will produce the same libraries
# key: ${{steps.icu-rev.outputs.ICU_REV}}
# path: |
# build-android/project/jni/iconv/include
# build-android/project/jni/iconv/lib
# build-android/project/jni/icuuc/include
# build-android/project/jni/icuuc/lib
#
# - name: Touch cached Boost timestamps
# if: steps.cache-boost.outputs.cache-hit == 'true' || steps.cache-icu.outputs.cache-hit == 'true'
# working-directory: build-android
# run: touch project/jni/boost/lib/*/* || true
#
# - name: Touch cached ICU timestamps
# if: steps.cache-boost.outputs.cache-hit == 'true' || steps.cache-icu.outputs.cache-hit == 'true'
# working-directory: build-android
# run: touch project/jni/iconv/lib/*/* project/jni/icuuc/lib/*/* || true
- name: Patch Java files and build Boost, ICU, and OpenSSL
run: |
export PATH=$ANDROID_NDK_LATEST_HOME:$PATH
@@ -115,7 +86,7 @@ jobs:
- name: Hyper turbo build script GOOOOOOOOOOOO
run: |
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/31.0.0:$PATH
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS:$PATH
./build.sh
- name: App signing keys
@@ -130,7 +101,7 @@ jobs:
- name: Package
run: |
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/31.0.0:$PATH
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS:$PATH
if [ -e keystore.jks ]; then
export ANDROID_KEYSTORE_FILE=`pwd`/keystore.jks
fi
@@ -154,3 +125,18 @@ jobs:
name: ${{env.APP_NAME}}
path: upload
if-no-files-found: error
- uses: r0adkll/upload-google-play@v1
continue-on-error: true
with:
serviceAccountJsonPlainText: ${{secrets.SERVICE_ACCOUNT_JSON}}
packageName: net.olofson.ballfield
releaseFiles: upload/*.aab
#track: beta
track: production
status: completed
# inAppUpdatePriority: 2
# userFraction: 1
# whatsNewDirectory: distribution/whatsnew
# mappingFile: app/build/outputs/mapping/release/mapping.txt
# debugSymbols: app/intermediates/merged_native_libs/release/out/lib

160
.github/workflows/openttd.yml vendored Normal file
View File

@@ -0,0 +1,160 @@
# Copyright (C) 2021-2021 Sergii Pylypenko <x.pelya.x@gmail.com>
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, and must not be
# misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source distribution.
name: openttd
on:
push:
branches:
- '*'
tags:
- '*'
pull_request: {}
jobs:
build:
env:
APP_NAME: openttd
# It takes one hour per one architecture to build Boost and ICU libraries, and Github limits CI script duration to 6 hours
ARCH_LIST: armeabi-v7a arm64-v8a x86 x86_64
ANDROID_BUILD_TOOLS: 33.0.2
runs-on: ubuntu-latest
steps:
- name: Java 17
uses: actions/setup-java@v2
with:
java-version: 17
distribution: temurin
- name: Check out the repository
uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: false
- name: Check out submodules
# There are many more submodules in this repo, we don't need them all
run: >
git submodule update --init --recursive --depth=1
project/jni/application/${APP_NAME}
project/jni/boost/src project/jni/iconv/src
project/jni/sdl2 project/jni/sdl2_image
project/jni/sdl2_mixer project/jni/sdl2_ttf
- name: Symlink the application dir
run: |
ln -s ${APP_NAME} project/jni/application/src
- name: Set architectures list
run: |
sed -i "s/MultiABI=.*/MultiABI='${ARCH_LIST}'/g" project/jni/application/src/AndroidAppSettings.cfg
- name: Get ICU revision
id: icu-rev
run: echo "ICU_REV=`git -C project/jni/iconv/src rev-parse HEAD`::`echo ${ARCH_LIST} | sed 's/ /:/g'`" >> $GITHUB_ENV
- name: Copy ICU libraries from cache
uses: actions/cache@v2
id: cache-icu
with:
# The same SDL revision will produce the same libraries
key: ${{env.ICU_REV}}
path: |
project/jni/iconv/include
project/jni/iconv/lib
project/jni/icuuc/include
project/jni/icuuc/lib
project/jni/icuuc/share/icu
- name: Touch cached ICU timestamps
if: steps.cache-icu.outputs.cache-hit == 'true'
run: touch project/jni/iconv/lib/*/* project/jni/icuuc/lib/*/* project/jni/icuuc/share/icu/*/* || true
- name: Patch Java files and build Boost, ICU, and OpenSSL
run: |
export PATH=$ANDROID_NDK_LATEST_HOME:$PATH
./changeAppSettings.sh
- name: Set up Gradle and Android SDK licenses
working-directory: project
run: |
for Y in `seq 20`; do echo y; done | sudo $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses
./gradlew assembleRelease || true
for Y in `seq 20`; do echo y; done | sudo $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses --sdk_root=`pwd`
mkdir -p $HOME/.android
keytool -genkey -v -keystore $HOME/.android/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Debug, OU=Debug, O=Debug, L=Debug, ST=Debug, C=Debug"
echo "sdk.dir=$ANDROID_SDK_ROOT" > local.properties
echo "proguard.config=proguard.cfg;proguard-local.cfg" >> local.properties
- name: Hyper turbo build script GOOOOOOOOOOOO
run: |
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS:$PATH
./build.sh
- name: App signing keys
run: |
echo "$ANDROID_KEYSTORE_B64" | base64 -d > keystore.jks || true
echo "$ANDROID_UPLOAD_KEYSTORE_B64" | base64 -d > upload_keystore.jks || true
find keystore.jks -empty -delete || true
find upload_keystore.jks -empty -delete || true
env:
ANDROID_KEYSTORE_B64: "${{secrets.ANDROID_KEYSTORE_B64}}"
ANDROID_UPLOAD_KEYSTORE_B64: "${{secrets.ANDROID_UPLOAD_KEYSTORE_B64}}"
- name: Package
run: |
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS:$PATH
if [ -e keystore.jks ]; then
export ANDROID_KEYSTORE_FILE=`pwd`/keystore.jks
fi
if [ -e upload_keystore.jks ]; then
export ANDROID_UPLOAD_KEYSTORE_FILE=`pwd`/upload_keystore.jks
fi
mkdir -p upload/
./sign.sh
mv *.apk upload/
./signBundle.sh
mv *.aab upload/
env:
ANDROID_KEYSTORE_PASS: "${{secrets.ANDROID_KEYSTORE_PASS}}"
ANDROID_KEYSTORE_ALIAS: "${{secrets.ANDROID_KEYSTORE_ALIAS}}"
ANDROID_UPLOAD_KEYSTORE_PASS: "${{secrets.ANDROID_UPLOAD_KEYSTORE_PASS}}"
ANDROID_UPLOAD_KEYSTORE_ALIAS: "${{secrets.ANDROID_UPLOAD_KEYSTORE_ALIAS}}"
# Github actions is dumb and won't let you download single files from artifacts, so break up the artifacts instead
- uses: actions/upload-artifact@v2
with:
name: ${{env.APP_NAME}}
path: upload
if-no-files-found: error
- uses: r0adkll/upload-google-play@v1
continue-on-error: true
with:
serviceAccountJsonPlainText: ${{secrets.SERVICE_ACCOUNT_JSON}}
packageName: org.openttd.sdl
releaseFiles: upload/*.aab
track: beta
#track: production
status: completed
# inAppUpdatePriority: 2
# userFraction: 1
# whatsNewDirectory: distribution/whatsnew
# mappingFile: app/build/outputs/mapping/release/mapping.txt
# debugSymbols: app/intermediates/merged_native_libs/release/out/lib

View File

@@ -31,10 +31,17 @@ jobs:
APP_NAME: sdl2-demo
# It takes one hour per one architecture to build Boost and ICU libraries, and Github limits CI script duration to 6 hours
ARCH_LIST: armeabi-v7a arm64-v8a x86 x86_64
ANDROID_BUILD_TOOLS: 33.0.2
runs-on: ubuntu-latest
steps:
- name: Java 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
- name: Check out the repository
uses: actions/checkout@v2
with:
@@ -57,46 +64,6 @@ jobs:
run: |
sed -i "s/MultiABI=.*/MultiABI='${ARCH_LIST}'/g" project/jni/application/src/AndroidAppSettings.cfg
# - name: Get Boost revision
# id: boost-rev
# run: echo "::set-output name=BOOST_REV::`git -C project/jni/boost/src rev-parse HEAD`"
#
# - name: Get ICU revision
# id: icu-rev
# run: echo "::set-output name=ICU_REV::`git -C project/jni/iconv/src rev-parse HEAD`"
#
# - name: Copy Boost libraries from cache
# uses: actions/cache@v2
# id: cache-boost
# with:
# # The same SDL revision will produce the same libraries
# key: ${{steps.boost-rev.outputs.BOOST_REV}}
# path: |
# build-android/project/jni/boost/include
# build-android/project/jni/boost/lib
#
# - name: Copy ICU libraries from cache
# uses: actions/cache@v2
# id: cache-icu
# with:
# # The same SDL revision will produce the same libraries
# key: ${{steps.icu-rev.outputs.ICU_REV}}
# path: |
# build-android/project/jni/iconv/include
# build-android/project/jni/iconv/lib
# build-android/project/jni/icuuc/include
# build-android/project/jni/icuuc/lib
#
# - name: Touch cached Boost timestamps
# if: steps.cache-boost.outputs.cache-hit == 'true' || steps.cache-icu.outputs.cache-hit == 'true'
# working-directory: build-android
# run: touch project/jni/boost/lib/*/* || true
#
# - name: Touch cached ICU timestamps
# if: steps.cache-boost.outputs.cache-hit == 'true' || steps.cache-icu.outputs.cache-hit == 'true'
# working-directory: build-android
# run: touch project/jni/iconv/lib/*/* project/jni/icuuc/lib/*/* || true
- name: Patch Java files and build Boost, ICU, and OpenSSL
run: |
export PATH=$ANDROID_NDK_LATEST_HOME:$PATH
@@ -115,7 +82,7 @@ jobs:
- name: Hyper turbo build script GOOOOOOOOOOOO
run: |
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/31.0.0:$PATH
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS:$PATH
./build.sh
- name: App signing keys
@@ -130,7 +97,7 @@ jobs:
- name: Package
run: |
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/31.0.0:$PATH
export PATH=$ANDROID_NDK_LATEST_HOME:$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS:$PATH
if [ -e keystore.jks ]; then
export ANDROID_KEYSTORE_FILE=`pwd`/keystore.jks
fi

View File

@@ -10,13 +10,14 @@ sign_apk=false
sign_bundle=false
build_release=true
do_zipalign=true
named_variant="sdl"
named_variant=""
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
[ -z "$ANDROID_SDK_ROOT" ] && ANDROID_SDK_ROOT="$ANDROID_HOME"
while getopts "sirqbhzv:" OPT
do
@@ -77,6 +78,7 @@ if [ "$#" -gt 0 ]; then
fi
base_app_name=$(grep -Po 'AppFullName\=\K[[:alnum:].]+\.(?=[[:alnum:]]+)' AndroidAppSettings.cfg)
[ -z "${named_variant}" ] && named_variant=$(grep -Po 'AppFullName\=\K[[:alnum:].]+' AndroidAppSettings.cfg | grep -Po '[[:alnum:]]+$')
function project_needs_setup {
local app_name=$(grep -Po 'AppFullName\=\K[.[:alnum:]]+' AndroidAppSettings.cfg)

View File

@@ -4,6 +4,7 @@ set -e
AUTO=a
CHANGED=
JAVA_SRC_PATH=project/java
[ -z "$ANDROID_SDK_ROOT" ] && ANDROID_SDK_ROOT="$ANDROID_HOME"
if [ "X$1" = "X-a" ]; then
AUTO=a
@@ -412,14 +413,14 @@ RedefinedKeysFourthGamepad="$RedefinedKeysFourthGamepad"
StartupMenuButtonTimeout=$StartupMenuButtonTimeout
# Menu items to hide from startup menu, available menu items (SDL 1.2 only):
# ${MenuOptionsAvailable%%[[:space:]]}
# ${MenuOptionsAvailable%[[:space:]]}
HiddenMenuOptions='$HiddenMenuOptions'
# Menu items to show at startup - this is Java code snippet, leave empty for default
# $FirstStartMenuOptionsDefault
# Available menu items:
# ${MenuOptionsAvailable%%[[:space:]]}
# ${MenuOptionsAvailable%[[:space:]]}
FirstStartMenuOptions='$FirstStartMenuOptions'
# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower
@@ -498,7 +499,7 @@ HorizontalOrientation=false
UsingSdl2=false
if [ "$LibSdlVersion" = "2.0" ] ; then
"$LibSdlVersion" = "2"
LibSdlVersion="2"
fi
if [ "$LibSdlVersion" = "2" ] ; then
UsingSdl2=true
@@ -775,7 +776,7 @@ for KEY in $RedefinedKeysFourthGamepad; do
done
if [ "$APP_PLATFORM" = "" ]; then
APP_PLATFORM=android-16
APP_PLATFORM=android-19
fi
if [ "$MultiABI" = "y" ] ; then
@@ -880,7 +881,7 @@ fi
echo Patching project/AndroidManifest.xml
cat $ANDROID_MANIFEST_TEMPLATE | \
sed "s/package=.*/package=\"$AppFullName\"/" | \
sed "s/package=.*//" | \
sed "s/android:screenOrientation=.*/android:screenOrientation=\"$ScreenOrientation1\"/" | \
sed "s^android:versionCode=.*^android:versionCode=\"$AppVersionCode\"^" | \
sed "s^android:versionName=.*^android:versionName=\"$AppVersionName\"^" | \
@@ -896,8 +897,19 @@ else
cat $F | sed "s/^package .*;/package $AppFullName;/" >> project/src/Advertisement.java
fi
if [ -z "$ANDROID_NDK_HOME" ]; then
export ANDROID_NDK_HOME="$(which ndk-build | sed 's@/ndk-build@@')"
fi
if [ -z "$ANDROID_NDK_HOME" ]; then
echo "Set ANDROID_NDK_HOME env variable, or put ndk-build into your PATH"
exit 1
fi
NDK_VER=$(echo ${ANDROID_NDK_HOME} | grep -Eo '[^/]+$')
cat project/app/build-template.gradle | \
sed 's/applicationId .*/applicationId "'"$AppFullName"'"/' > \
sed 's/applicationId .*/applicationId "'"${AppFullName}"'"/' | \
sed 's/namespace .*/namespace '"'"${AppFullName}"'"'/' | \
sed 's/ndkVersion .*/ndkVersion "'"${NDK_VER}"'"/' > \
project/app/build.gradle
echo "-keep class $AppFullName.** { *; }" > project/proguard-local.cfg
@@ -1111,6 +1123,7 @@ done
cd ../../..
SDK_DIR=`grep '^sdk.dir' project/local.properties | sed 's/.*=//'`
[ -z "$SDK_DIR" ] && SDK_DIR="$ANDROID_HOME"
[ -z "$SDK_DIR" ] && SDK_DIR=`which android | sed 's@/tools/android$@@'`
mkdir -p project/libs
echo "sdk.dir=$SDK_DIR" > project/local.properties
@@ -1129,17 +1142,6 @@ else
done
$SEDI "s/==GOOGLEPLAYGAMESERVICES_APP_ID==/$GooglePlayGameServicesId/g" project/res/values/strings.xml
PROGUARD=`which android`
[ -z "$PROGUARD" ] && PROGUARD=$ANDROID_SDK_ROOT/tools/android
PROGUARD=`dirname $PROGUARD`/proguard/lib/proguard.jar
java -jar $PROGUARD | grep 'ProGuard, version 5.3' || {
echo "Error: ProGuard is too old"
echo "You need to update ProGuard. Download it here:"
echo "https://sourceforge.net/projects/proguard/files/proguard/5.3/proguard5.3.3.zip"
echo "Unpack it, then place file proguard.jar to $PROGUARD"
exit 1
}
fi
if [ -e "project/jni/application/src/AndroidData/assetpack" ] ; then

View File

@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.package.name"
android:versionCode="100"
android:versionName="1.0.0"
android:installLocation="auto"

View File

@@ -3,13 +3,14 @@ plugins {
}
android {
compileSdk 31
namespace 'net.olofson.ballfield'
compileSdk 33
ndkVersion "25.2.9519653"
defaultConfig {
applicationId "net.olofson.ballfield"
minSdk 16
targetSdk 31
minSdk 19
targetSdk 33
}
buildTypes {
@@ -36,5 +37,5 @@ android {
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation 'com.google.android.gms:play-services-games:21.0.0' // ==GOOGLEPLAYGAMESERVICES==
implementation 'com.google.android.gms:play-services-games:23.1.0' // ==GOOGLEPLAYGAMESERVICES==
}

View File

@@ -1,17 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
plugins {
id 'com.android.application' version '8.0.1' apply false
id 'com.android.library' version '8.0.1' apply false
}

View File

@@ -12,8 +12,10 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true

View File

@@ -1,8 +1,6 @@
#Wed May 17 18:24:03 EEST 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=7ba68c54029790ab444b39d7e293d3236b2632631fb5f2e012bb28b4ff669e4b
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -6,6 +6,9 @@ endif
# Disable timidity library inside sdl2_mixer, we have our own version of timidity used by OpenTTD
SUPPORT_MID_TIMIDITY := 0
# Enable png and jpeg modules inside sdl2_image
SUPPORT_JPG := true
SUPPORT_PNG := true
NDK_VERSION := $(strip $(patsubst android-ndk-%,%,$(filter android-ndk-%, $(subst /, ,$(dir $(TARGET_CC))))))
#$(info NDK version $(NDK_VERSION)) # This warning puzzles ndk-gdb

View File

@@ -73,6 +73,7 @@ $(ICONV) $(ICU): iconv/src/build.sh
cp -f $$ARCH/include/*.h ../include/ ; \
mkdir -p ../../icuuc/lib/$$ARCH ../../icuuc/include/unicode ../../icuuc/include/layout ; \
cp -f $$ARCH/libicu*.a ../../icuuc/lib/$$ARCH/ ; \
[ -d ../../icuuc/share ] || cp -rf $$ARCH/share ../../icuuc/ ; \
cp -f $$ARCH/include/unicode/*.h ../../icuuc/include/unicode/ ; \
cp -f $$ARCH/include/layout/*.h ../../icuuc/include/layout/ ; \
cp -f $$ARCH/include/icu-le-hb/layout/*.h ../../icuuc/include/layout/ ; \

View File

@@ -273,11 +273,11 @@ NDK_TOOLCHAIN_VERSION=clang
# android-16 = Android 4.1, the earliest supported version in NDK r18.
# android-18 = Android 4.3, the first version supporting GLES3.
# android-21 = Android 5.1, the first version with SO_REUSEPORT defined.
APP_PLATFORM=21
APP_PLATFORM=19
# 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='armeabi-v7a arm64-v8a x86 x86_64'
# Optional shared libraries to compile - removing some of them will save space
# MP3 patents are expired, but libmad license is GPL, not LGPL

View File

@@ -5,6 +5,9 @@ LOCAL_PATH=`cd $LOCAL_PATH && pwd`
VER=build
[ -z "$BUILD_NUM_CPUS" ] && $BUILD_NUM_CPUS=8
export CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_NUM_CPUS
[ -d openttd-$VER-$1 ] || mkdir -p openttd-$VER-$1/bin/baseset
export ARCH=$1
@@ -85,6 +88,8 @@ export ARCH=$1
else
NINJA_PATH=$(which ninja)
fi
NINJA_ARGS=
[ -n "$NINJA_PATH" ] && NINJA_ARGS="-DCMAKE_MAKE_PROGRAM=$NINJA_PATH -GNinja"
${CMAKE_BIN_LOC}cmake \
-DCMAKE_MODULE_PATH=$LOCAL_PATH/openttd-$VER-$1/cmake \
@@ -96,8 +101,9 @@ export ARCH=$1
-DHOST_BINARY_DIR=$LOCAL_PATH/build-tools \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_PREFIX_PATH=$LOCAL_PATH/../../iconv/src/$ARCH/ \
-DCMAKE_MAKE_PROGRAM=$NINJA_PATH \
-GNinja \
"$([ -n "$CMAKE_C_FLAGS_RELWITHDEBINFO" ] && echo -DCMAKE_C_FLAGS_RELWITHDEBINFO="$CMAKE_C_FLAGS_RELWITHDEBINFO")" \
"$([ -n "$CMAKE_CXX_FLAGS_RELWITHDEBINFO" ] && echo -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$CMAKE_CXX_FLAGS_RELWITHDEBINFO")" \
$NINJA_ARGS \
-B ./openttd-$VER-$1 -S ./src
} || exit 1

View File

@@ -2,6 +2,14 @@
set -e
# Base game data
mkdir -p ./data-plat-indp
pushd ./data-plat-indp
cmp .ottdrev ../src/.ottdrev && {
echo "Version did not change - no need to download data files"
exit
}
GFX_VERSION=7.1
SFX_VERSION=1.0.3
MSX_VERSION=0.4.2
@@ -12,9 +20,6 @@ SFX_VERSION=$(curl --fail https://cdn.openttd.org/opensfx-releases/latest.yaml |
MSX_VERSION=$(curl --fail https://cdn.openttd.org/openmsx-releases/latest.yaml | grep -Po "version: \K[0-9.]+")
# Base game data
pushd ./data-plat-indp
if ! [ -e "./opengfx-${GFX_VERSION}.tar" ]; then
curl --fail https://cdn.openttd.org/opengfx-releases/${GFX_VERSION}/opengfx-${GFX_VERSION}-all.zip | jar xv
fi
@@ -25,3 +30,5 @@ if ! [ -d "./openmsx-${MSX_VERSION}/" ]; then
curl --fail https://cdn.openttd.org/openmsx-releases/${MSX_VERSION}/openmsx-${MSX_VERSION}-all.zip | jar xv
tar xvf ./openmsx-${MSX_VERSION}.tar && rm ./openmsx-${MSX_VERSION}.tar
fi
cp -f ../src/.ottdrev ./

View File

@@ -7,33 +7,41 @@ ARCH=$1
ANDROID_DATA_FULLPATH=$(realpath ./AndroidData/)
# Base game data
pushd ./data
rm -f ${ANDROID_DATA_FULLPATH}/openttd-data-*.zip.xz ${ANDROID_DATA_FULLPATH}/openttd-data-*.zip
[ -e ${ANDROID_DATA_FULLPATH}/openttd-data-$VER.zip.xz ] && [ -n "$NO_REBUILD_DATA" ] || {
pushd ./data
rm -f ${ANDROID_DATA_FULLPATH}/openttd-data-*.zip.xz ${ANDROID_DATA_FULLPATH}/openttd-data-*.zip
pushd ./baseset
cp ../../data-plat-indp/opengfx*.tar .
cp ../../data-plat-indp/opensfx*.tar .
cp -r ../../data-plat-indp/openmsx*/ .
popd
pushd ./baseset
cp ../../data-plat-indp/opengfx*.tar .
cp ../../data-plat-indp/opensfx*.tar .
cp -r ../../data-plat-indp/openmsx*/ .
popd
zip -0 -r ${ANDROID_DATA_FULLPATH}/openttd-data-$VER.zip ./ && xz -8 ${ANDROID_DATA_FULLPATH}/openttd-data-$VER.zip
popd
zip -0 -r ${ANDROID_DATA_FULLPATH}/openttd-data-$VER.zip ./ && xz -8 ${ANDROID_DATA_FULLPATH}/openttd-data-$VER.zip
popd
}
# Timidity
pushd ../../timidity/samples/
rm -f ${ANDROID_DATA_FULLPATH}/timidity.zip.xz ${ANDROID_DATA_FULLPATH}/timidity.zip
cp ./timidity.zip ${ANDROID_DATA_FULLPATH}/timidity.zip && xz -8 ${ANDROID_DATA_FULLPATH}/timidity.zip
popd
[ -e ${ANDROID_DATA_FULLPATH}/timidity.zip.xz ] && [ -n "$NO_REBUILD_DATA" ] || {
pushd ../../timidity/samples/
rm -f ${ANDROID_DATA_FULLPATH}/timidity.zip.xz ${ANDROID_DATA_FULLPATH}/timidity.zip
cp ./timidity.zip ${ANDROID_DATA_FULLPATH}/timidity.zip && xz -8 ${ANDROID_DATA_FULLPATH}/timidity.zip
popd
}
# ICU
# TODO handle versioning. Use Makefile var
pushd ../../iconv/src/$ARCH/
rm -f ${ANDROID_DATA_FULLPATH}/icudt62l.zip.xz ${ANDROID_DATA_FULLPATH}/icudt62l.zip
zip -0 ${ANDROID_DATA_FULLPATH}/icudt62l.zip share/icu/62.1/icudt62l.dat && xz -8 ${ANDROID_DATA_FULLPATH}/icudt62l.zip
popd
[ -e ${ANDROID_DATA_FULLPATH}/icudt62l.zip.xz ] && [ -n "$NO_REBUILD_DATA" ] || {
pushd ../../icuuc
rm -f ${ANDROID_DATA_FULLPATH}/icudt62l.zip.xz ${ANDROID_DATA_FULLPATH}/icudt62l.zip
zip -0 ${ANDROID_DATA_FULLPATH}/icudt62l.zip share/icu/62.1/icudt62l.dat && xz -8 ${ANDROID_DATA_FULLPATH}/icudt62l.zip
popd
}
# Fonts
pushd ../../freetype/
rm -f ${ANDROID_DATA_FULLPATH}/openttd-fonts.zip.xz ${ANDROID_DATA_FULLPATH}/openttd-fonts.zip
zip -0 -r ${ANDROID_DATA_FULLPATH}/openttd-fonts.zip ./fonts/ && xz -8 ${ANDROID_DATA_FULLPATH}/openttd-fonts.zip
popd
[ -e ${ANDROID_DATA_FULLPATH}/openttd-fonts.zip.xz ] && [ -n "$NO_REBUILD_DATA" ] || {
pushd ../../freetype/
rm -f ${ANDROID_DATA_FULLPATH}/openttd-fonts.zip.xz ${ANDROID_DATA_FULLPATH}/openttd-fonts.zip
zip -0 -r ${ANDROID_DATA_FULLPATH}/openttd-fonts.zip ./fonts/ && xz -8 ${ANDROID_DATA_FULLPATH}/openttd-fonts.zip
popd
}

View File

@@ -25,7 +25,7 @@ fi
ARCH=armeabi-v7a
GCCPREFIX=armv7a-linux-androideabi
BINUTILSPREFIX=arm-linux-androideabi
APILEVEL=21
APILEVEL=19
APP_MODULES=`grep 'APP_MODULES [:][=]' $LOCAL_PATH/../Settings.mk | sed 's@.*[=]\(.*\)@\1@' | sed 's@\b\(application\|sdl_main\|sdl_native_helpers\|c++_shared\)\b@@g'`

View File

@@ -24,7 +24,7 @@ else
fi
ARCH=x86
GCCPREFIX=i686-linux-android
APILEVEL=21
APILEVEL=19
APP_MODULES=`grep 'APP_MODULES [:][=]' $LOCAL_PATH/../Settings.mk | sed 's@.*[=]\(.*\)@\1@' | sed 's@\b\(application\|sdl_main\|sdl_native_helpers\|c++_shared\)\b@@g'`

View File

@@ -6,7 +6,7 @@ IFS='
NDK=${ANDROID_NDK_HOME:-$(dirname $(which ndk-build))}
if uname -s | grep -i "linux" > /dev/null ; then
MYARCH=linux-$(arch)
MYARCH=linux-$(uname -m)
NDK=`readlink -f $NDK`
elif uname -s | grep -i "darwin" > /dev/null ; then
MYARCH=darwin-x86_64

View File

@@ -30,6 +30,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <assert.h>
#include <unistd.h>
#if defined(HAVE_MMAP) || defined(__CYGWIN__)
# include <unistd.h>
# include <sys/mman.h>

Binary file not shown.

View File

@@ -1,2 +1,4 @@
/include
/lib
/share

View File

@@ -1 +1 @@
../sdl2_image/external/libpng-1.6.37
../sdl2_image/external/libpng

View File

@@ -1,3 +1,10 @@
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {