Skip to content

Commit 5665b3a

Browse files
committed
add android sources for some already prepared modules (freetype, jpeg, intl, png, ...)
1 parent 327dcb8 commit 5665b3a

File tree

1,315 files changed

+716586
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,315 files changed

+716586
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ build
22
*.swp
33
*.swo
44
*~
5+
src/obj

recipes/sdl/recipe.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
PRIORITY_sdl=15
4+
VERSION_sdl=1.3
5+
URL_sdl=http://www.libsdl.org/tmp/SDL-$VERSION_sdl.tar.gz
6+
MD5_sdl=7176d5f1a0f2683bf1394e0de18c74bb
7+
BUILD_sdl=$BUILD_PATH/sdl/$(get_directory $URL_sdl)
8+
RECIPE_sdl=$RECIPES_PATH/sdl
9+
10+
function prebuild_sdl() {
11+
# make the symlink to sdl in src directory
12+
cd $SRC_PATH/jni
13+
if [ ! -f sdl ]; then
14+
ln -s $BUILD_sdl sdl
15+
fi
16+
}
17+
18+
function build_sdl() {
19+
cd $SRC_PATH/jni
20+
ndk-build V=1
21+
}
22+
23+
function postbuild_sdl() {
24+
true
25+
}

recipes/sqlite3/recipe.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
PRIORITY_sqlite3=1
4+
VERSION_sqlite3=3
5+
URL_sqlite3=
6+
MD5_sqlite3=
7+
BUILD_sqlite3=$SRC_PATH/jni/sqlite3
8+
RECIPE_sqlite3=$RECIPES_PATH/sqlite3
9+
10+
function prebuild_sqlite3() {
11+
true
12+
}
13+
14+
function build_sqlite3() {
15+
cd $SRC_PATH/jni
16+
try ndk-build V=1 sqlite3
17+
}
18+
19+
function postbuild_sqlite3() {
20+
true
21+
}

src/AndroidManifest.xml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="test.boeh"
4+
android:versionCode="100"
5+
android:versionName="1.0"
6+
android:installLocation="auto"
7+
>
8+
9+
<application android:label="@string/appName"
10+
android:icon="@drawable/icon"
11+
>
12+
13+
<activity android:name="org.renpy.android.PythonActivity"
14+
android:label="@string/iconName"
15+
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|fontScale|uiMode"
16+
android:launchMode="singleTask"
17+
android:process=":python"
18+
android:screenOrientation="landscape"
19+
android:windowSoftInputMode="stateAlwaysHidden"
20+
>
21+
22+
23+
<intent-filter>
24+
<action android:name="android.intent.action.MAIN" />
25+
<category android:name="android.intent.category.LAUNCHER" />
26+
</intent-filter>
27+
28+
29+
</activity>
30+
31+
32+
33+
</application>
34+
35+
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="5"/>
36+
<uses-permission android:name="android.permission.WAKE_LOCK" />
37+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
38+
39+
40+
41+
<uses-feature android:glEsVersion="0x00020000" />
42+
</manifest>

src/build.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project name="touchtracer-1.0" default="help">
3+
4+
<loadproperties srcFile="local.properties" />
5+
<property file="ant.properties" />
6+
<loadproperties srcFile="project.properties" />
7+
8+
<fail
9+
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
10+
unless="sdk.dir"
11+
/>
12+
<target name="-pre-build">
13+
</target>
14+
<target name="-pre-compile">
15+
</target>
16+
<target name="-post-compile">
17+
</target>
18+
<import file="${sdk.dir}/tools/ant/build.xml" />
19+
20+
</project>

src/jni/Android.mk

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
# The namespace in Java file, with dots replaced with underscores
3+
SDL_JAVA_PACKAGE_PATH := org_renpy_android
4+
5+
# Path to shared libraries - Android 1.6 cannot load them properly, thus we have to specify absolute path here
6+
# SDL_SHARED_LIBRARIES_PATH := /data/data/de.schwardtnet.alienblaster/lib
7+
8+
# Path to files with application data - they should be downloaded from Internet on first app run inside
9+
# Java sources, or unpacked from resources (TODO)
10+
# Typically /sdcard/alienblaster
11+
# Or /data/data/de.schwardtnet.alienblaster/files if you're planning to unpack data in application private folder
12+
# Your application will just set current directory there
13+
SDL_CURDIR_PATH := org.renpy.android
14+
15+
# Android Dev Phone G1 has trackball instead of cursor keys, and
16+
# sends trackball movement events as rapid KeyDown/KeyUp events,
17+
# this will make Up/Down/Left/Right key up events with X frames delay,
18+
# so if application expects you to press and hold button it will process the event correctly.
19+
# TODO: create a libsdl config file for that option and for key mapping/on-screen keyboard
20+
SDL_TRACKBALL_KEYUP_DELAY := 1
21+
22+
# If the application designed for higher screen resolution enable this to get the screen
23+
# resized in HW-accelerated way, however it eats a tiny bit of CPU
24+
SDL_VIDEO_RENDER_RESIZE := 0
25+
26+
COMPILED_LIBRARIES := sdl_ttf sdl_image sdl_mixer
27+
28+
APPLICATION_ADDITIONAL_CFLAGS := -finline-functions -O2
29+
30+
APPLICATION_ADDITIONAL_LDFLAGS := -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions
31+
32+
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=RETURN
33+
34+
# If SDL_Mixer should link to libMAD
35+
SDL_MIXER_USE_LIBMAD :=
36+
ifneq ($(strip $(filter mad, $(COMPILED_LIBRARIES))),)
37+
SDL_MIXER_USE_LIBMAD := 1
38+
endif
39+
40+
include $(call all-subdir-makefiles)

src/jni/Application.mk

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
APP_PROJECT_PATH := $(call my-dir)/..
2+
3+
# Available libraries: mad sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx intl
4+
# sdl_mixer depends on tremor and optionally mad
5+
# sdl_image depends on png and jpeg
6+
# sdl_ttf depends on freetype
7+
8+
APP_MODULES := application sdl sdl_main tremor png jpeg freetype sdl_ttf sdl_image sqlite3
9+
10+
APP_ABI := $(ARCH)
11+
APP_STL := gnustl_static
12+
APP_CFLAGS += $(OFLAG)

src/jni/application/Android.mk

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
LOCAL_PATH := $(call my-dir)
2+
3+
include $(CLEAR_VARS)
4+
5+
LOCAL_MODULE := application
6+
7+
APP_SUBDIRS := $(patsubst $(LOCAL_PATH)/%, %, $(shell find $(LOCAL_PATH)/src/ -type d))
8+
9+
LOCAL_CFLAGS := $(foreach D, $(APP_SUBDIRS), -I$(LOCAL_PATH)/$(D)) \
10+
-I$(LOCAL_PATH)/../sdl/include \
11+
-I$(LOCAL_PATH)/../sdl_mixer \
12+
-I$(LOCAL_PATH)/../sdl_image \
13+
-I$(LOCAL_PATH)/../sdl_ttf \
14+
-I$(LOCAL_PATH)/../sdl_net \
15+
-I$(LOCAL_PATH)/../sdl_blitpool \
16+
-I$(LOCAL_PATH)/../sdl_gfx \
17+
-I$(LOCAL_PATH)/../png \
18+
-I$(LOCAL_PATH)/../jpeg \
19+
-I$(LOCAL_PATH)/../intl \
20+
-I$(LOCAL_PATH)/.. \
21+
-I$(LOCAL_PATH)/../../../build/python-install/include/python2.7
22+
23+
24+
LOCAL_CFLAGS += $(APPLICATION_ADDITIONAL_CFLAGS)
25+
26+
#Change C++ file extension as appropriate
27+
LOCAL_CPP_EXTENSION := .cpp
28+
29+
LOCAL_SRC_FILES := $(foreach F, $(APP_SUBDIRS), $(addprefix $(F)/,$(notdir $(wildcard $(LOCAL_PATH)/$(F)/*.cpp))))
30+
# Uncomment to also add C sources
31+
LOCAL_SRC_FILES += $(foreach F, $(APP_SUBDIRS), $(addprefix $(F)/,$(notdir $(wildcard $(LOCAL_PATH)/$(F)/*.c))))
32+
33+
LOCAL_SHARED_LIBRARIES := sdl $(COMPILED_LIBRARIES)
34+
35+
LOCAL_STATIC_LIBRARIES := jpeg png
36+
37+
LOCAL_LDLIBS := -lpython2.7 -lGLESv1_CM -ldl -llog -lz
38+
39+
LOCAL_LDFLAGS += -L$(LOCAL_PATH)/../../python-install/lib $(APPLICATION_ADDITIONAL_LDFLAGS)
40+
41+
LIBS_WITH_LONG_SYMBOLS := $(strip $(shell \
42+
for f in $(LOCAL_PATH)/../../libs/$ARCH/*.so ; do \
43+
if echo $$f | grep "libapplication[.]so" > /dev/null ; then \
44+
continue ; \
45+
fi ; \
46+
if [ -e "$$f" ] ; then \
47+
if nm -g $$f | cut -c 12- | egrep '.{128}' > /dev/null ; then \
48+
echo $$f | grep -o 'lib[^/]*[.]so' ; \
49+
fi ; \
50+
fi ; \
51+
done \
52+
) )
53+
54+
ifneq "$(LIBS_WITH_LONG_SYMBOLS)" ""
55+
$(foreach F, $(LIBS_WITH_LONG_SYMBOLS), \
56+
$(info Library $(F): abusing symbol names are: \
57+
$(shell nm -g $(LOCAL_PATH)/../../libs/$ARCH/$(F) | cut -c 12- | egrep '.{128}' ) ) \
58+
$(info Library $(F) contains symbol names longer than 128 bytes, \
59+
YOUR CODE WILL DEADLOCK WITHOUT ANY WARNING when you'll access such function - \
60+
please make this library static to avoid problems. ) )
61+
$(error Detected libraries with too long symbol names. Remove all files under project/libs/$ARCH, make these libs static, and recompile)
62+
endif
63+
64+
include $(BUILD_SHARED_LIBRARY)
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/sh
2+
3+
# Set here your own NDK path if needed
4+
# export PATH=$PATH:~/src/endless_space/android-ndk-r4
5+
6+
IFS='
7+
'
8+
9+
NDK=`which ndk-build`
10+
NDK=`dirname $NDK`
11+
GCCVER=4.4.0
12+
PLATFORMVER=android-8
13+
LOCAL_PATH=`dirname $0`
14+
LOCAL_PATH=`cd $LOCAL_PATH && pwd`
15+
16+
# Hacks for broken configure scripts
17+
ln -sf libsdl_mixer.so $LOCAL_PATH/../../bin/ndk/local/armeabi/libSDL_mixer.so
18+
ln -sf libsdl_mixer.so $LOCAL_PATH/../../bin/ndk/local/armeabi/libSDL_Mixer.so
19+
ln -sf libsdl_net.so $LOCAL_PATH/../../bin/ndk/local/armeabi/libSDL_net.so
20+
21+
CFLAGS="-I$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/include \
22+
-fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums \
23+
-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DANDROID \
24+
-Wno-psabi -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -fno-rtti -mthumb -Os \
25+
-fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 \
26+
-Wa,--noexecstack -O2 -DNDEBUG -g \
27+
`grep '[-]I[$][(]LOCAL_PATH[)]/[.][.]/' $LOCAL_PATH/Android.mk | tr '\n' ' ' | sed 's/[\\]//g' | sed \"s@[\$][(]LOCAL_PATH[)]/@$LOCAL_PATH/@g\" | sed 's/[ ][ ]*/ /g'`"
28+
29+
LDFLAGS="-nostdlib -Wl,-soname,libapplication.so -Wl,-shared,-Bsymbolic \
30+
-Wl,--whole-archive -Wl,--no-whole-archive \
31+
$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/lib/gcc/arm-eabi/4.4.0/libgcc.a \
32+
`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@@"` \
33+
$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib/libc.so \
34+
$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib/libstdc++.so \
35+
$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib/libm.so \
36+
-Wl,--no-undefined -Wl,-z,noexecstack \
37+
-L$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib \
38+
-lGLESv1_CM -ldl -llog -lz \
39+
-Wl,-rpath-link=$NDK/build/platforms/$PLATFORMVER/arch-arm/usr/lib \
40+
-L$LOCAL_PATH/../../bin/ndk/local/armeabi"
41+
42+
env PATH=$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/bin:$LOCAL_PATH:$PATH \
43+
CFLAGS="$CFLAGS" \
44+
CXXFLAGS="$CFLAGS" \
45+
LDFLAGS="$LDFLAGS" \
46+
CC="$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/bin/arm-eabi-gcc" \
47+
CXX="$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/bin/arm-eabi-g++" \
48+
RANLIB="$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/bin/arm-eabi-ranlib" \
49+
LD="$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/bin/arm-eabi-gcc" \
50+
AR="$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/bin/arm-eabi-ar" \
51+
CPP="$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/bin/arm-eabi-cpp $CFLAGS" \
52+
NM="$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/bin/arm-eabi-nm" \
53+
AS="$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/bin/arm-eabi-as" \
54+
STRIP="$NDK/build/prebuilt/linux-x86/arm-eabi-$GCCVER/bin/arm-eabi-strip" \
55+
./configure --host=arm-eabi "$@"

0 commit comments

Comments
 (0)