Skip to content

Commit 6bddb77

Browse files
committed
Added temporary crystax bootstrap
1 parent d38901f commit 6bddb77

21 files changed

Lines changed: 798 additions & 0 deletions

File tree

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
from pythonforandroid.toolchain import Bootstrap, shprint, current_directory, info, warning, ArchARM, info_main
2+
from os.path import join, exists
3+
from os import walk
4+
import glob
5+
import sh
6+
7+
class SDL2Bootstrap(Bootstrap):
8+
name = 'sdl2python3crystax'
9+
10+
recipe_depends = ['sdl2python3crystax', 'python3crystax']
11+
12+
can_be_chosen_automatically = False
13+
14+
def run_distribute(self):
15+
info_main('# Creating Android project from build and {} bootstrap'.format(
16+
self.name))
17+
18+
info('This currently just copies the SDL2 build stuff straight from the build dir.')
19+
shprint(sh.rm, '-rf', self.dist_dir)
20+
shprint(sh.cp, '-r', self.build_dir, self.dist_dir)
21+
with current_directory(self.dist_dir):
22+
with open('local.properties', 'w') as fileh:
23+
fileh.write('sdk.dir={}'.format(self.ctx.sdk_dir))
24+
25+
# AND: Hardcoding armeabi - naughty!
26+
arch = ArchARM(self.ctx)
27+
28+
with current_directory(self.dist_dir):
29+
info('Copying python distribution')
30+
31+
if not exists('private'):
32+
shprint(sh.mkdir, 'private')
33+
if not exists('assets'):
34+
shprint(sh.mkdir, 'assets')
35+
36+
hostpython = sh.Command(self.ctx.hostpython)
37+
38+
# AND: The compileall doesn't work with python3, tries to import a wrong-arch lib
39+
# shprint(hostpython, '-OO', '-m', 'compileall', join(self.ctx.build_dir, 'python-install'))
40+
# if not exists('python-install'):
41+
# shprint(sh.cp, '-a', join(self.ctx.build_dir, 'python-install'), '.')
42+
43+
self.distribute_libs(arch, [self.ctx.libs_dir])
44+
self.distribute_aars(arch)
45+
self.distribute_javaclasses(join(self.ctx.build_dir, 'java'))
46+
47+
info('Filling private directory')
48+
# if not exists(join('private', 'lib')):
49+
# info('private/lib does not exist, making')
50+
# shprint(sh.cp, '-a', join('python-install', 'lib'), 'private')
51+
# shprint(sh.mkdir, '-p', join('private', 'include', 'python3.4m'))
52+
53+
# AND: Copylibs stuff should go here
54+
# if exists(join('libs', 'armeabi', 'libpymodules.so')):
55+
# shprint(sh.mv, join('libs', 'armeabi', 'libpymodules.so'), 'private/')
56+
# shprint(sh.cp, join('python-install', 'include' , 'python3.4m', 'pyconfig.h'), join('private', 'include', 'python3.4m/'))
57+
58+
# info('Removing some unwanted files')
59+
# shprint(sh.rm, '-f', join('private', 'lib', 'libpython3.4m.so'))
60+
# shprint(sh.rm, '-f', join('private', 'lib', 'libpython3.so'))
61+
# shprint(sh.rm, '-rf', join('private', 'lib', 'pkgconfig'))
62+
63+
# with current_directory(join(self.dist_dir, 'private', 'lib', 'python3.4')):
64+
# # shprint(sh.xargs, 'rm', sh.grep('-E', '*\.(py|pyx|so\.o|so\.a|so\.libs)$', sh.find('.')))
65+
# removes = []
66+
# for dirname, something, filens in walk('.'):
67+
# for filename in filens:
68+
# for suffix in ('py', 'pyc', 'so.o', 'so.a', 'so.libs'):
69+
# if filename.endswith(suffix):
70+
# removes.append(filename)
71+
# shprint(sh.rm, '-f', *removes)
72+
73+
# info('Deleting some other stuff not used on android')
74+
# # To quote the original distribute.sh, 'well...'
75+
# # shprint(sh.rm, '-rf', 'ctypes')
76+
# shprint(sh.rm, '-rf', 'lib2to3')
77+
# shprint(sh.rm, '-rf', 'idlelib')
78+
# for filename in glob.glob('config/libpython*.a'):
79+
# shprint(sh.rm, '-f', filename)
80+
# shprint(sh.rm, '-rf', 'config/python.o')
81+
# # shprint(sh.rm, '-rf', 'lib-dynload/_ctypes_test.so')
82+
# # shprint(sh.rm, '-rf', 'lib-dynload/_testcapi.so')
83+
84+
85+
self.strip_libraries(arch)
86+
super(SDL2Bootstrap, self).run_distribute()
87+
88+
bootstrap = SDL2Bootstrap()
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Replace org.libsdl.app with the identifier of your game below, e.g.
3+
com.gamemaker.game
4+
-->
5+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
6+
package="org.kivy.android"
7+
android:versionCode="1"
8+
android:versionName="1.0"
9+
android:installLocation="auto">
10+
11+
<!-- Android 2.3.3 -->
12+
<uses-sdk android:minSdkVersion="12" android:targetSdkVersion="12" />
13+
14+
<!-- OpenGL ES 2.0 -->
15+
<uses-feature android:glEsVersion="0x00020000" />
16+
17+
<!-- Allow writing to external storage -->
18+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
19+
20+
<!-- Create a Java class extending SDLActivity and place it in a
21+
directory under src matching the package, e.g.
22+
src/com/gamemaker/game/MyGame.java
23+
24+
then replace "SDLActivity" with the name of your class (e.g. "MyGame")
25+
in the XML below.
26+
27+
An example Java class can be found in README-android.txt
28+
-->
29+
<application android:label="@string/app_name"
30+
android:icon="@drawable/icon"
31+
android:allowBackup="true"
32+
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
33+
android:hardwareAccelerated="true" >
34+
<activity android:name="org.kivy.android.PythonActivity"
35+
android:label="@string/app_name"
36+
android:configChanges="keyboardHidden|orientation"
37+
>
38+
<intent-filter>
39+
<action android:name="android.intent.action.MAIN" />
40+
<category android:name="android.intent.category.LAUNCHER" />
41+
</intent-filter>
42+
</activity>
43+
</application>
44+
45+
</manifest>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This file is used to override default values used by the Ant build system.
2+
#
3+
# This file must be checked into Version Control Systems, as it is
4+
# integral to the build system of your project.
5+
6+
# This file is only used by the Ant script.
7+
8+
# You can use this to override default values such as
9+
# 'source.dir' for the location of your java source folder and
10+
# 'out.dir' for the location of your output folder.
11+
12+
# You can also use it define how the release builds are signed by declaring
13+
# the following properties:
14+
# 'key.store' for the location of your keystore and
15+
# 'key.alias' for the name of the key to use.
16+
# The password will be asked during the build when you use the 'release' target.
17+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This file is used to override default values used by the Ant build system.
2+
#
3+
# This file must be checked in Version Control Systems, as it is
4+
# integral to the build system of your project.
5+
6+
# This file is only used by the Ant script.
7+
8+
# You can use this to override default values such as
9+
# 'source.dir' for the location of your java source folder and
10+
# 'out.dir' for the location of your output folder.
11+
12+
# You can also use it define how the release builds are signed by declaring
13+
# the following properties:
14+
# 'key.store' for the location of your keystore and
15+
# 'key.alias' for the name of the key to use.
16+
# The password will be asked during the build when you use the 'release' target.
17+

0 commit comments

Comments
 (0)