CrystaX toolchain now can be specified through ChangeAppSettings.sh

This commit is contained in:
pelya
2010-10-05 15:47:30 +03:00
parent 825647a80b
commit b292e52900
18 changed files with 59 additions and 31 deletions

View File

@@ -1,6 +1,6 @@
#!/bin/sh
CHANGE_APP_SETTINGS_VERSION=9
CHANGE_APP_SETTINGS_VERSION=10
AUTO=
if [ "X$1" = "X-a" ]; then
@@ -183,6 +183,13 @@ if [ -n "$var" ] ; then
AppSubdirsBuild="$var"
fi
echo -n "\nApplication requires C++ RTTI and exceptions - you will need CrystaX toolchain installed at\n"
echo -n `which ndk-build | sed 's@/[^/]*/ndk-build@/android-ndk-r4-crystax@'` "(y) or (n) ($AppUseCrystaXToolchain): "
read var
if [ -n "$var" ] ; then
AppUseCrystaXToolchain="$var"
fi
echo -n "\nHere you may type some short readme text that will be shown when app data is downloaded."
echo -n "\nCurrent text:\n"
echo -n "`echo $ReadmeText | tr '^' '\\n'`"
@@ -231,6 +238,7 @@ echo CustomBuildScript=$CustomBuildScript >> AndroidAppSettings.cfg
echo AppCflags=\'$AppCflags\' >> AndroidAppSettings.cfg
echo AppLdflags=\'$AppLdflags\' >> AndroidAppSettings.cfg
echo AppSubdirsBuild=\'$AppSubdirsBuild\' >> AndroidAppSettings.cfg
echo AppUseCrystaXToolchain=$AppUseCrystaXToolchain >> AndroidAppSettings.cfg
echo ReadmeText=\'$ReadmeText\' >> AndroidAppSettings.cfg
AppShortName=`echo $AppName | sed 's/ //g'`
@@ -399,7 +407,7 @@ if [ "$LibSdlVersionOld" '!=' "$LibSdlVersion" ]; then
rm -rf project/$OUT/local/*/objs/application project/$OUT/local/*/libapplication.so
fi
# Do not rebuild libraries that do not need that
find project/$OUT/local -name "*.[oa]" -exec touch '{}' \;
# find project/$OUT/local -name "*.[oa]" -exec touch '{}' \;
done
echo Done

View File

@@ -35,9 +35,13 @@ for APP1 in project/jni/application/*/AppSettings.cfg; do
rm -rf project/bin/ndk/local/*/libapplication.so project/bin/ndk/local/*/objs/application
rm -rf project/bin/ndk/local/*/libsdl*.so project/bin/ndk/local/*/objs/sdl*
./ChangeAppSettings.sh -a
NDKBUILD=ndk-build
if grep "AppUseCrystaXToolchain=y" AndroidAppSettings.cfg > /dev/null ; then
NDKBUILD=`which ndk-build | sed 's@/[^/]*/ndk-build@/android-ndk-r4-crystax@'`/ndk-build
fi
echo Compiling $APP
OLDPATH="`pwd`"
( cd project && nice -n5 ndk-build -j2 V=1 && ant release && \
( cd project && nice -n5 $NDKBUILD -j2 V=1 && ant release && \
jarsigner -verbose -keystore "$KEYSTORE" -storepass "$PASSWORD" bin/DemoActivity-unsigned.apk $ALIAS && \
zipalign 4 bin/DemoActivity-unsigned.apk ../$APP.apk && cd .. ) || exit 1
done

View File

@@ -4,6 +4,10 @@
# export PATH=$PATH:~/src/endless_space/android-ndk-r4b
# Set environment to CrystaX NDK with RTTI and exceptions instead of original NDK
# export PATH=$PATH:~/src/endless_space/android-ndk-r4-crystax/ndk-build
NDKBUILD=ndk-build
if grep "AppUseCrystaXToolchain=y" AndroidAppSettings.cfg > /dev/null ; then
NDKBUILD=`which ndk-build | sed 's@/[^/]*/ndk-build@/android-ndk-r4-crystax@'`/ndk-build
fi
cd project && nice -n5 ndk-build -j2 V=1 && ant debug && cd bin && adb install -r DemoActivity-debug.apk
cd project && nice -n5 $NDKBUILD -j2 V=1 && ant debug && cd bin && adb install -r DemoActivity-debug.apk

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.googlecode.opentyrian"
android:versionCode="2114"
android:versionName="2.1.14 - game can be put to background with Home button and successfully restored back"
package="net.sourceforge.clonekeenplus"
android:versionCode="32201"
android:versionName="0.3.2.2.01"
android:installLocation="preferExternal"
>
<application android:label="@string/app_name"

View File

@@ -1,6 +1,6 @@
# The namespace in Java file, with dots replaced with underscores
SDL_JAVA_PACKAGE_PATH := com_googlecode_opentyrian
SDL_JAVA_PACKAGE_PATH := net_sourceforge_clonekeenplus
# Path to shared libraries - Android 1.6 cannot load them properly, thus we have to specify absolute path here
# SDL_SHARED_LIBRARIES_PATH := /data/data/de.schwardtnet.alienblaster/lib
@@ -10,7 +10,7 @@ SDL_JAVA_PACKAGE_PATH := com_googlecode_opentyrian
# Typically /sdcard/alienblaster
# Or /data/data/de.schwardtnet.alienblaster/files if you're planning to unpack data in application private folder
# Your application will just set current directory there
SDL_CURDIR_PATH := com.googlecode.opentyrian
SDL_CURDIR_PATH := net.sourceforge.clonekeenplus
# Android Dev Phone G1 has trackball instead of cursor keys, and
# sends trackball movement events as rapid KeyDown/KeyUp events,
@@ -23,17 +23,17 @@ SDL_TRACKBALL_KEYUP_DELAY := 1
# resized in HW-accelerated way, however it eats a tiny bit of CPU
SDL_VIDEO_RENDER_RESIZE := 1
COMPILED_LIBRARIES := sdl_net
COMPILED_LIBRARIES :=
APPLICATION_ADDITIONAL_CFLAGS := -finline-functions -O2
APPLICATION_ADDITIONAL_CFLAGS := -finline-functions -O2 -DTREMOR=1 -DBUILD_TYPE=LINUX32 -DTARGET_LNX=1 -Werror=strict-aliasing -Werror=cast-align -Werror=pointer-arith -Werror=address
APPLICATION_ADDITIONAL_LDFLAGS :=
APPLICATION_ADDITIONAL_LDFLAGS := -ltremor
APPLICATION_SUBDIRS_BUILD :=
APPLICATION_SUBDIRS_BUILD := src/src src/src/common src/src/common/Menu src/src/dialog src/src/engine src/src/engine/galaxy src/src/engine/galaxy/ai src/src/engine/infoscenes src/src/engine/playgame src/src/engine/vorticon src/src/engine/vorticon/ai src/src/engine/vorticon/finale src/src/engine/vorticon/playgame src/src/fileio src/src/fileio/compression src/src/graphics src/src/graphics/effects src/src/hqp src/src/scale2x src/src/sdl src/src/sdl/sound src/src/sdl/video src/src/vorbis
APPLICATION_CUSTOM_BUILD_SCRIPT :=
SDL_ADDITIONAL_CFLAGS := -DSDL_ANDROID_KEYCODE_MOUSE=UNKNOWN -DSDL_ANDROID_KEYCODE_0=SPACE -DSDL_ANDROID_KEYCODE_1=RETURN -DSDL_ANDROID_KEYCODE_2=LCTRL -DSDL_ANDROID_KEYCODE_3=LALT -DSDL_ANDROID_KEYCODE_4=SPACE
SDL_ADDITIONAL_CFLAGS := -DSDL_ANDROID_KEYCODE_MOUSE=UNKNOWN -DSDL_ANDROID_KEYCODE_0=LCTRL -DSDL_ANDROID_KEYCODE_1=LALT -DSDL_ANDROID_KEYCODE_2=SPACE -DSDL_ANDROID_KEYCODE_3=RETURN -DSDL_ANDROID_KEYCODE_4=RETURN
# If SDL_Mixer should link to libMAD
SDL_MIXER_USE_LIBMAD :=

View File

@@ -5,6 +5,6 @@ APP_PROJECT_PATH := $(call my-dir)/..
# sdl_image depends on png and jpeg
# sdl_ttf depends on freetype
APP_MODULES := application sdl sdl_main stlport tremor png jpeg freetype sdl_net
APP_MODULES := application sdl sdl_main stlport tremor png jpeg freetype
APP_ABI := armeabi

View File

@@ -1 +1 @@
opentyrian
commandergenius

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">OpenTyrian</string>
<string name="app_name">Commander Genius</string>
</resources>

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package com.googlecode.opentyrian;
package net.sourceforge.clonekeenplus;
import android.app.Activity;
import android.content.Context;

View File

@@ -1,6 +1,6 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change
// spaces amount
package com.googlecode.opentyrian;
package net.sourceforge.clonekeenplus;
import java.util.zip.*;
import java.io.*;

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package com.googlecode.opentyrian;
package net.sourceforge.clonekeenplus;
import android.app.Activity;

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package com.googlecode.opentyrian;
package net.sourceforge.clonekeenplus;
import android.app.Activity;
import android.content.Context;

View File

@@ -18,7 +18,7 @@
fixed with a hammer and rasp to work with libSDL port */
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package com.googlecode.opentyrian;
package net.sourceforge.clonekeenplus;
import java.io.Writer;
import java.util.ArrayList;

View File

@@ -1,14 +1,14 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount anywhere
package com.googlecode.opentyrian;
package net.sourceforge.clonekeenplus;
import android.app.Activity;
import android.content.Context;
class Globals {
public static String ApplicationName = "OpenTyrian";
public static String ApplicationName = "CommanderGenius";
// Should be zip file
public static String DataDownloadUrl = "Data files size is 11 Mb|http://sites.google.com/site/xpelyax/Home/tyrian21-data.zip?attredirects=0%26d=1|http://sitesproxy.goapk.com/site/xpelyax/Home/tyrian21-data.zip";
public static String DataDownloadUrl = "Data files are 2 Mb|https://sourceforge.net/projects/libsdl-android/files/CommanderGenius/commandergenius-data.zip/download^High-quality GFX and music - 40 Mb|https://sourceforge.net/projects/libsdl-android/files/CommanderGenius/commandergenius-hqp.zip/download";
// Set this value to true if you're planning to render 3D using OpenGL - it eats some GFX resources, so disabled for 2D
public static boolean NeedDepthBuffer = false;
@@ -19,7 +19,7 @@ class Globals {
// Readme text to be shown on download page
public static String ReadmeText = "^You may press \"Home\" now - the data will be downloaded in background".replace("^","\n");
public static boolean AppUsesMouse = true;
public static boolean AppUsesMouse = false;
public static boolean AppNeedsArrowKeys = true;
@@ -50,5 +50,5 @@ class Globals {
}
class LoadLibrary {
public LoadLibrary() { System.loadLibrary("sdl"); System.loadLibrary("sdl_net"); };
public LoadLibrary() { System.loadLibrary("sdl"); };
}

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package com.googlecode.opentyrian;
package net.sourceforge.clonekeenplus;
import android.app.Activity;
import android.content.Context;

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package com.googlecode.opentyrian;
package net.sourceforge.clonekeenplus;
import android.app.Activity;
import android.content.Context;

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package com.googlecode.opentyrian;
package net.sourceforge.clonekeenplus;
import javax.microedition.khronos.opengles.GL10;

View File

@@ -100,6 +100,18 @@ the app will re-download the data if URL does not match the saved URL from previ
If you'll add new libs - add them to project/jni/, copy Android.mk from existing lib, and
add libname to project/jni/<yourapp>/Android.mk
The ARM architecture has some limitations which you have to be aware about -
if you'll access integer that's not 4-byte aligned you'll get garbage instead of correct value,
and it's processor-model specific - it may work on some devices and do not work on another ones -
you may wish to check your code in Android 1.6 emulator from time to time to catch such bugs.
char * p = 0x13; // Non-4 byte aligned pointer
int i = (int *) p; // We have garbage inside i now
memcpy( &i, p, sizof(int) ); // The correct way to dereference a non-aligned pointer
This compiler flags will catch most obvious errors, you may add them to AppCflags var in settings:
-Werror=strict-aliasing -Werror=cast-align -Werror=pointer-arith -Werror=address
How to compile your own application using automake/configure scripts
====================================================================
@@ -156,7 +168,7 @@ gdb libsdl.so -ex "list *0x0002ca00"
It will output the exact line in your source where the application crashed.
Android Application lifectcle support
Android Application lifecycle support
=====================================
Application may be put to background at any time, for example if user gets phone call onto the device.