Added possibility to use custom build script to build application (to be compatible with configure-like scripts)

This commit is contained in:
pelya
2010-09-16 15:46:52 +03:00
parent b241a0de47
commit ab7f63b305
19 changed files with 106 additions and 48 deletions

View File

@@ -1,6 +1,6 @@
#!/bin/sh
CHANGE_APP_SETTINGS_VERSION=7
CHANGE_APP_SETTINGS_VERSION=8
AUTO=
if [ "X$1" = "X-a" ]; then
@@ -151,6 +151,12 @@ if [ -n "$var" ] ; then
CompiledLibraries="$var"
fi
echo -n "\nApplication uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n) ($CustomBuildScript): "
read var
if [ -n "$var" ] ; then
CustomBuildScript="$var"
fi
echo -n "\nAditional CFLAGS for application ($AppCflags): "
read var
if [ -n "$var" ] ; then
@@ -212,6 +218,7 @@ echo MultiABI=$MultiABI >> AndroidAppSettings.cfg
echo AppVersionCode=$AppVersionCode >> AndroidAppSettings.cfg
echo AppVersionName=\"$AppVersionName\" >> AndroidAppSettings.cfg
echo CompiledLibraries=\"$CompiledLibraries\" >> AndroidAppSettings.cfg
echo CustomBuildScript=$CustomBuildScript >> AndroidAppSettings.cfg
echo AppCflags=\'$AppCflags\' >> AndroidAppSettings.cfg
echo AppLdflags=\'$AppLdflags\' >> AndroidAppSettings.cfg
echo AppSubdirsBuild=\'$AppSubdirsBuild\' >> AndroidAppSettings.cfg
@@ -280,6 +287,10 @@ for lib in $CompiledLibraries; do
LibrariesToLoad="$LibrariesToLoad System.loadLibrary(\\\"$lib\\\");"
done
if [ "$CustomBuildScript" = "n" ] ; then
CustomBuildScript=
fi
ReadmeText="`echo $ReadmeText | sed 's/\"/\\\\\\\\\"/g' | sed 's/[&%]//g'`"
echo Creating symlink to libSDL
@@ -331,7 +342,8 @@ cat project/jni/Android.mk | \
sed "s^APPLICATION_ADDITIONAL_CFLAGS :=.*^APPLICATION_ADDITIONAL_CFLAGS := $AppCflags^" | \
sed "s^APPLICATION_ADDITIONAL_LDFLAGS :=.*^APPLICATION_ADDITIONAL_LDFLAGS := $AppLdflags^" | \
sed "s^SDL_ADDITIONAL_CFLAGS :=.*^SDL_ADDITIONAL_CFLAGS := $RedefinedKeycodes^" | \
sed "s^APPLICATION_SUBDIRS_BUILD :=.*^APPLICATION_SUBDIRS_BUILD := $AppSubdirsBuild^" > \
sed "s^APPLICATION_SUBDIRS_BUILD :=.*^APPLICATION_SUBDIRS_BUILD := $AppSubdirsBuild^" | \
sed "s^APPLICATION_CUSTOM_BUILD_SCRIPT :=.*^APPLICATION_CUSTOM_BUILD_SCRIPT := $CustomBuildScript^" > \
project/jni/Android.mk.1
if [ -n "`diff -w project/jni/Android.mk.1 project/jni/Android.mk`" ] ; then
mv -f project/jni/Android.mk.1 project/jni/Android.mk
@@ -358,9 +370,10 @@ mv -f project/res/values/strings.xml.1 project/res/values/strings.xml
echo Forcing rebuild of specific files
rm -rf project/libs/*
for OUT in bin/ndk obj; do
for OUT in obj; do
rm -rf project/$OUT/local/*/objs/sdl_main/* project/$OUT/local/*/libsdl_main.so
rm -rf project/$OUT/local/*/libsdl.so
rm -rf project/$OUT/local/*/libstlport.a # Should be re-linked if you're changing toolchain
rm -rf project/$OUT/local/*/objs/sdl/src/*/android
rm -rf project/$OUT/local/*/objs/sdl/src/video/SDL_video.o
rm -rf project/$OUT/local/*/objs/sdl/SDL_renderer_gles.o

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.sourceforge.clonekeenplus"
android:versionCode="32201"
android:versionName="0.3.2.2.01"
package="net.sourceforge.lgames.lbreakout2"
android:versionCode="26101"
android:versionName="2.6.1.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 := net_sourceforge_clonekeenplus
SDL_JAVA_PACKAGE_PATH := net_sourceforge_lgames_lbreakout2
# 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 := net_sourceforge_clonekeenplus
# 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 := net.sourceforge.clonekeenplus
SDL_CURDIR_PATH := net.sourceforge.lgames.lbreakout2
# Android Dev Phone G1 has trackball instead of cursor keys, and
# sends trackball movement events as rapid KeyDown/KeyUp events,
@@ -23,15 +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 :=
COMPILED_LIBRARIES := sdl_mixer sdl_image sdl_net intl
APPLICATION_ADDITIONAL_CFLAGS := -finline-functions -O2 -DTREMOR=1 -DBUILD_TYPE=LINUX32 -DTARGET_LNX=1
APPLICATION_ADDITIONAL_CFLAGS := -DHAVE_CONFIG_H -finline-functions -O2
APPLICATION_ADDITIONAL_LDFLAGS := -ltremor
APPLICATION_ADDITIONAL_LDFLAGS :=
APPLICATION_SUBDIRS_BUILD := src
APPLICATION_SUBDIRS_BUILD := src/dummy
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
APPLICATION_CUSTOM_BUILD_SCRIPT := y
SDL_ADDITIONAL_CFLAGS := -DSDL_ANDROID_KEYCODE_MOUSE=UNKNOWN -DSDL_ANDROID_KEYCODE_0=RETURN -DSDL_ANDROID_KEYCODE_1=SPACE -DSDL_ANDROID_KEYCODE_2=PAGEUP -DSDL_ANDROID_KEYCODE_3=PAGEDOWN
# 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
APP_MODULES := application sdl sdl_main stlport tremor png jpeg freetype sdl_mixer sdl_image sdl_net intl
APP_ABI := armeabi

View File

@@ -5,17 +5,21 @@ include $(CLEAR_VARS)
LOCAL_MODULE := application
APP_SUBDIRS := $(patsubst $(LOCAL_PATH)/%, %, $(shell find $(LOCAL_PATH)/src/ -type d))
ifneq ($(APP_SUBDIRS_BUILD),)
APP_SUBDIRS := $(APP_SUBDIRS_BUILD)
ifneq ($(APPLICATION_SUBDIRS_BUILD),)
APP_SUBDIRS := $(APPLICATION_SUBDIRS_BUILD)
endif
LOCAL_CFLAGS :=
ifeq ($(CRYSTAX_TOOLCHAIN),)
LOCAL_CFLAGS += -I$(LOCAL_PATH)/../stlport/stlport
# Paths should be on newline so launchConfigure.sh will work properly
LOCAL_CFLAGS += \
-I$(LOCAL_PATH)/../stlport/stlport
endif
LOCAL_CFLAGS += $(foreach D, $(APP_SUBDIRS), -I$(LOCAL_PATH)/$(D)) \
# Paths should be on newline so launchConfigure.sh will work properly
LOCAL_CFLAGS += \
$(foreach D, $(APP_SUBDIRS), -I$(LOCAL_PATH)/$(D)) \
-I$(LOCAL_PATH)/../sdl/include \
-I$(LOCAL_PATH)/../sdl_mixer \
-I$(LOCAL_PATH)/../sdl_image \
@@ -38,20 +42,21 @@ LOCAL_SRC_FILES := $(foreach F, $(APP_SUBDIRS), $(addprefix $(F)/,$(notdir $(wil
# Uncomment to also add C sources
LOCAL_SRC_FILES += $(foreach F, $(APP_SUBDIRS), $(addprefix $(F)/,$(notdir $(wildcard $(LOCAL_PATH)/$(F)/*.c))))
ifneq ($(APPLICATION_CUSTOM_BUILD_SCRIPT),)
LOCAL_SRC_FILES := dummy.c
endif
LOCAL_SHARED_LIBRARIES := sdl $(COMPILED_LIBRARIES)
LOCAL_STATIC_LIBRARIES := stlport
LOCAL_LDLIBS := -lGLESv1_CM -ldl -llog -lz
ifeq ($(CRYSTAX_TOOLCHAIN),)
LOCAL_LDFLAGS := -Lbin/ndk/local/armeabi
else
LOCAL_LDFLAGS := -Lobj/local/armeabi
endif
LOCAL_LDFLAGS += $(APPLICATION_ADDITIONAL_LDFLAGS)
LIBS_WITH_LONG_SYMBOLS := $(strip $(shell \
for f in $(LOCAL_PATH)/../../libs/armeabi/*.so ; do \
if echo $$f | grep "libapplication[.]so" > /dev/null ; then \
@@ -76,3 +81,26 @@ $(error Detected libraries with too long symbol names. Remove all files under pr
endif
include $(BUILD_SHARED_LIBRARY)
ifneq ($(APPLICATION_CUSTOM_BUILD_SCRIPT),)
$(info LOCAL_PATH $(LOCAL_PATH) )
$(info $(LOCAL_PATH)/src/libapplication.so )
$(info $(realpath $(LOCAL_PATH)/../../obj/local/armeabi/libapplication.so) )
LOCAL_PATH_SDL_APPLICATION := $(LOCAL_PATH)
$(LOCAL_PATH)/src/libapplication.so: $(LOCAL_PATH)/src/AndroidBuild.sh $(LOCAL_PATH)/src/AndroidAppSettings.cfg
cd $(LOCAL_PATH_SDL_APPLICATION)/src && ./AndroidBuild.sh
# $(realpath $(LOCAL_PATH)/../../libs/armeabi/libapplication.so) \
$(realpath $(LOCAL_PATH)/../../obj/local/armeabi/libapplication.so): $(LOCAL_PATH)/src/libapplication.so OVERRIDE_CUSTOM_LIB
cp -f $< $@
# $(patsubst %-gcc,%-strip,$(TARGET_CC)) -g $@
.PHONY: OVERRIDE_CUSTOM_LIB
OVERRIDE_CUSTOM_LIB:
endif

View File

@@ -0,0 +1,7 @@
int
SDL_main(int argc, char *argv[])
{
return 0;
}

View File

@@ -14,9 +14,17 @@ LOCAL_PATH=`dirname $0`
LOCAL_PATH=`cd $LOCAL_PATH && pwd`
# Hacks for broken configure scripts
ln -sf libsdl_mixer.so $LOCAL_PATH/../../bin/ndk/local/armeabi/libSDL_mixer.so
ln -sf libsdl_mixer.so $LOCAL_PATH/../../bin/ndk/local/armeabi/libSDL_Mixer.so
ln -sf libsdl_net.so $LOCAL_PATH/../../bin/ndk/local/armeabi/libSDL_net.so
rm -rf $LOCAL_PATH/../../obj/local/armeabi/libSDL_*.so
rm -rf $LOCAL_PATH/../../obj/local/armeabi/libsdl_main.so
if [ -e $LOCAL_PATH/../../obj/local/armeabi/libsdl_mixer.so ] ; then
ln -sf libsdl_mixer.so $LOCAL_PATH/../../obj/local/armeabi/libSDL_Mixer.so
fi
for F in $LOCAL_PATH/../../obj/local/armeabi/libsdl_*.so; do
LIBNAME=`echo $F | sed "s@$LOCAL_PATH/../../obj/local/armeabi/libsdl_\(.*\)[.]so@\1@"`
ln -sf libsdl_$LIBNAME.so $LOCAL_PATH/../../obj/local/armeabi/libSDL_$LIBNAME.so
done
CFLAGS="-I$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/include \
-fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums \
@@ -28,9 +36,9 @@ CFLAGS="-I$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/include \
LDFLAGS="-nostdlib -Wl,-soname,libapplication.so -Wl,-shared,-Bsymbolic \
-Wl,--whole-archive -Wl,--no-whole-archive \
$LOCAL_PATH/../../bin/ndk/local/armeabi/libstlport.a \
$LOCAL_PATH/../../obj/local/armeabi/libstlport.a \
$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/lib/gcc/arm-eabi/4.4.0/libgcc.a \
`echo $LOCAL_PATH/../../bin/ndk/local/armeabi/*.so | sed "s@$LOCAL_PATH/../../bin/ndk/local/armeabi/libsdl_main.so@@" | sed "s@$LOCAL_PATH/../../bin/ndk/local/armeabi/libapplication.so@@"` \
`echo $LOCAL_PATH/../../obj/local/armeabi/*.so | sed "s@$LOCAL_PATH/../../obj/local/armeabi/libsdl_main.so@@" | sed "s@$LOCAL_PATH/../../obj/local/armeabi/libapplication.so@@"` \
$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib/libc.so \
$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib/libstdc++.so \
$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib/libm.so \
@@ -38,7 +46,7 @@ $NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib/libm.so \
-L$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib \
-lGLESv1_CM -ldl -llog -lz \
-Wl,-rpath-link=$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib \
-L$LOCAL_PATH/../../bin/ndk/local/armeabi"
-L$LOCAL_PATH/../../obj/local/armeabi"
env PATH=$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/bin:$LOCAL_PATH:$PATH \
CFLAGS="$CFLAGS" \

View File

@@ -1 +1 @@
commandergenius
lbreakout2

View File

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

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package net.sourceforge.clonekeenplus;
package net.sourceforge.lgames.lbreakout2;
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 net.sourceforge.clonekeenplus;
package net.sourceforge.lgames.lbreakout2;
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 net.sourceforge.clonekeenplus;
package net.sourceforge.lgames.lbreakout2;
import android.app.Activity;

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package net.sourceforge.clonekeenplus;
package net.sourceforge.lgames.lbreakout2;
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 net.sourceforge.clonekeenplus;
package net.sourceforge.lgames.lbreakout2;
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 net.sourceforge.clonekeenplus;
package net.sourceforge.lgames.lbreakout2;
import android.app.Activity;
import android.content.Context;
class Globals {
public static String ApplicationName = "CommanderGenius";
public static String ApplicationName = "LBreakout2";
// Should be zip file
public static String DataDownloadUrl = "Data files size is 2 Mb|https://sourceforge.net/projects/libsdl-android/files/CommanderGenius/commandergenius-data.zip/download";
public static String DataDownloadUrl = "App data size is 5 Mb|https://sourceforge.net/projects/libsdl-android/files/LBreakout2/lbreakout2-2.6.1-data.zip/download|http://sites.google.com/site/xpelyax/Home/lbreakout2-2.6.1-data.zip?attredirects=0%26d=1|http://sitesproxy.goapk.com/site/xpelyax/Home/lbreakout2-2.6.1-data.zip";
// 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,17 +19,17 @@ 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 = false;
public static boolean AppUsesMouse = true;
public static boolean AppNeedsArrowKeys = true;
public static boolean AppNeedsArrowKeys = false;
public static boolean AppUsesJoystick = false;
public static boolean AppUsesMultitouch = false;
public static int AppTouchscreenKeyboardKeysAmount = 4;
public static int AppTouchscreenKeyboardKeysAmount = 0;
public static int AppTouchscreenKeyboardKeysAmountAutoFire = 1;
public static int AppTouchscreenKeyboardKeysAmountAutoFire = 0;
// Phone-specific config
// It will download app data to /sdcard/alienblaster if set to true,
@@ -48,5 +48,5 @@ class Globals {
}
class LoadLibrary {
public LoadLibrary() { System.loadLibrary("sdl"); };
public LoadLibrary() { System.loadLibrary("sdl"); System.loadLibrary("sdl_mixer"); System.loadLibrary("sdl_image"); System.loadLibrary("sdl_net"); System.loadLibrary("intl"); };
}

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package net.sourceforge.clonekeenplus;
package net.sourceforge.lgames.lbreakout2;
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 net.sourceforge.clonekeenplus;
package net.sourceforge.lgames.lbreakout2;
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 net.sourceforge.clonekeenplus;
package net.sourceforge.lgames.lbreakout2;
import javax.microedition.khronos.opengles.GL10;

View File

@@ -4,7 +4,7 @@ Alien Blaster game is used as working example (original sources: http://www.schw
Installation
============
This should be compiled with Android 2.2 SDK and NDK r4 - google for them and install them as described in their docs
This should be compiled with Android 2.2 SDK and NDK r4b - google for them and install them as described in their docs
(the application will run on Android 1.6 and above).
You'll need to install Ant too.
The most supported environnment for that port is Linux, MacOs should be okay too,
@@ -110,7 +110,7 @@ though ./configure scripts tend to have stupid bugs in various places, avoid usi
(1.2 for lbreakout2), and correct libs (sdl_mixer sdl_image sdl_net for lbreakout2), also change name etc.
3. Launch ./build.sh, wait till it builds all .so files
4. Go to project/jni/application/lbreakout2-2.6.1 dir, and launch command
../launchConfigure.sh --disable-install --enable-sdl-net --disable-nls
../launchConfigure.sh --disable-install --enable-sdl-net LIBS=-lintl
5. Watch how ./configure configures, if it fails fix launchConfigure.sh, rinse and repeat.
6. Launch make, and pray. If you're lucky it will create application binary (lbreakout2-2.6.1/client/lbreakout2)
7. Move the application binary to dir project/libs/armeabi, rename it to libapplication.so (overwrite old file)