Skip to content

Commit 4728d64

Browse files
committed
add sdl + fix sdl sublib link + fix pygame recipes and add patch to fix compilation. now MODULES="sdl pygame" ./configure.sh is working !
1 parent f2dd25a commit 4728d64

File tree

732 files changed

+207746
-35
lines changed

Some content is hidden

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

732 files changed

+207746
-35
lines changed

recipes/pygame/Setup

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#This Setup file is used by the setup.py script to configure the
2+
#python extensions. You will likely use the "config.py" which will
3+
#build a correct Setup file for you based on your system settings.
4+
#If not, the format is simple enough to edit by hand. First change
5+
#the needed commandline flags for each dependency, then comment out
6+
#any unavailable optional modules in the first optional section.
7+
8+
9+
#--StartConfig
10+
SDL = -D_REENTRANT -lsdl -lm
11+
FONT = -lsdl_ttf
12+
IMAGE = -lsdl_image
13+
MIXER = -lsdl_mixer
14+
SMPEG = -lsmpeg
15+
PNG = -lpng -lz
16+
JPEG = -ljpeg
17+
SCRAP = -lX11
18+
PORTMIDI = -lportmidi
19+
PORTTIME = -lporttime
20+
#--EndConfig
21+
22+
#DEBUG = -C-W -C-Wall
23+
DEBUG =
24+
25+
#the following modules are optional. you will want to compile
26+
#everything you can, but you can ignore ones you don't have
27+
#dependencies for, just comment them out
28+
29+
imageext src/imageext.c $(SDL) $(IMAGE) $(PNG) $(JPEG) $(DEBUG)
30+
font src/font.c $(SDL) $(FONT) $(DEBUG)
31+
# mixer src/mixer.c $(SDL) $(MIXER) $(DEBUG)
32+
# mixer_music src/music.c $(SDL) $(MIXER) $(DEBUG)
33+
# _numericsurfarray src/_numericsurfarray.c $(SDL) $(DEBUG)
34+
# _numericsndarray src/_numericsndarray.c $(SDL) $(MIXER) $(DEBUG)
35+
# movie src/movie.c $(SDL) $(SMPEG) $(DEBUG)
36+
# scrap src/scrap.c $(SDL) $(SCRAP) $(DEBUG)
37+
# _camera src/_camera.c src/camera_v4l2.c src/camera_v4l.c $(SDL) $(DEBUG)
38+
# pypm src/pypm.c $(SDL) $(PORTMIDI) $(PORTTIME) $(DEBUG)
39+
40+
GFX = src/SDL_gfx/SDL_gfxPrimitives.c
41+
#GFX = src/SDL_gfx/SDL_gfxBlitFunc.c src/SDL_gfx/SDL_gfxPrimitives.c
42+
gfxdraw src/gfxdraw.c $(SDL) $(GFX) $(DEBUG)
43+
44+
45+
46+
#these modules are required for pygame to run. they only require
47+
#SDL as a dependency. these should not be altered
48+
49+
base src/base.c $(SDL) $(DEBUG)
50+
cdrom src/cdrom.c $(SDL) $(DEBUG)
51+
color src/color.c $(SDL) $(DEBUG)
52+
constants src/constants.c $(SDL) $(DEBUG)
53+
display src/display.c $(SDL) $(DEBUG)
54+
event src/event.c $(SDL) $(DEBUG)
55+
fastevent src/fastevent.c src/fastevents.c $(SDL) $(DEBUG)
56+
key src/key.c $(SDL) $(DEBUG)
57+
mouse src/mouse.c $(SDL) $(DEBUG)
58+
rect src/rect.c $(SDL) $(DEBUG)
59+
rwobject src/rwobject.c $(SDL) $(DEBUG)
60+
surface src/surface.c src/alphablit.c src/surface_fill.c $(SDL) $(DEBUG)
61+
surflock src/surflock.c $(SDL) $(DEBUG)
62+
time src/time.c $(SDL) $(DEBUG)
63+
joystick src/joystick.c $(SDL) $(DEBUG)
64+
draw src/draw.c $(SDL) $(DEBUG)
65+
image src/image.c $(SDL) $(DEBUG)
66+
overlay src/overlay.c $(SDL) $(DEBUG)
67+
transform src/transform.c src/rotozoom.c src/scale2x.c src/scale_mmx.c $(SDL) $(DEBUG) -D_NO_MMX_FOR_X86_64
68+
mask src/mask.c src/bitmask.c $(SDL) $(DEBUG)
69+
bufferproxy src/bufferproxy.c $(SDL) $(DEBUG)
70+
pixelarray src/pixelarray.c $(SDL) $(DEBUG)
71+
_arraysurfarray src/_arraysurfarray.c $(SDL) $(DEBUG)
72+
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
--- pygame-1.9.1release/src/_arraysurfarray.c.orig 2009-05-26 23:15:24.000000000 +0200
2+
+++ pygame-1.9.1release/src/_arraysurfarray.c 2012-01-06 15:10:08.273825849 +0100
3+
@@ -193,9 +193,6 @@
4+
case sizeof (Uint32):
5+
COPYMACRO_2D(Uint8, Uint32);
6+
break;
7+
- case sizeof (Uint64):
8+
- COPYMACRO_2D(Uint8, Uint64);
9+
- break;
10+
default:
11+
Py_DECREF(cobj);
12+
if (!PySurface_UnlockBy(surfobj, (PyObject *) arrayobj)) {
13+
@@ -223,9 +220,6 @@
14+
case sizeof (Uint32):
15+
COPYMACRO_2D(Uint16, Uint32);
16+
break;
17+
- case sizeof (Uint64):
18+
- COPYMACRO_2D(Uint16, Uint64);
19+
- break;
20+
default:
21+
Py_DECREF(cobj);
22+
if (!PySurface_UnlockBy(surfobj, (PyObject *) arrayobj)) {
23+
@@ -250,9 +244,6 @@
24+
case sizeof (Uint32):
25+
COPYMACRO_3D(Uint16, Uint32);
26+
break;
27+
- case sizeof (Uint64):
28+
- COPYMACRO_3D(Uint16, Uint64);
29+
- break;
30+
default:
31+
Py_DECREF(cobj);
32+
if (!PySurface_UnlockBy(surfobj, (PyObject *) arrayobj)) {
33+
@@ -316,9 +307,6 @@
34+
case sizeof (Uint32):
35+
COPYMACRO_3D_24(Uint32);
36+
break;
37+
- case sizeof (Uint64):
38+
- COPYMACRO_3D_24(Uint64);
39+
- break;
40+
default:
41+
Py_DECREF(cobj);
42+
if (!PySurface_UnlockBy(surfobj, (PyObject *) arrayobj)) {
43+
@@ -335,9 +323,6 @@
44+
case sizeof (Uint32):
45+
COPYMACRO_2D(Uint32, Uint32);
46+
break;
47+
- case sizeof (Uint64):
48+
- COPYMACRO_2D(Uint32, Uint64);
49+
- break;
50+
default:
51+
Py_DECREF(cobj);
52+
if (!PySurface_UnlockBy(surfobj, (PyObject *) arrayobj)) {
53+
@@ -362,9 +347,6 @@
54+
case sizeof (Uint32):
55+
COPYMACRO_3D(Uint32, Uint32);
56+
break;
57+
- case sizeof (Uint64):
58+
- COPYMACRO_3D(Uint32, Uint64);
59+
- break;
60+
default:
61+
Py_DECREF(cobj);
62+
if (!PySurface_UnlockBy(surfobj, (PyObject *) arrayobj)) {
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
--- pygame-1.9.1release/src/surface.c.orig 2012-01-06 15:05:14.457829356 +0100
2+
+++ pygame-1.9.1release/src/surface.c 2012-01-06 15:05:26.009829217 +0100
3+
@@ -1722,7 +1722,7 @@
4+
{
5+
SDL_Surface *surf = PySurface_AsSurface (self);
6+
/* Need to use 64bit vars so this works on 64 bit pythons. */
7+
- Uint64 r, g, b, a;
8+
+ unsigned long r, g, b, a;
9+
10+
if (!PyArg_ParseTuple (args, "(kkkk)", &r, &g, &b, &a))
11+
return NULL;
12+
@@ -1734,10 +1734,12 @@
13+
printf("what are: %d, %d, %d, %d\n", surf->format->Rmask, surf->format->Gmask, surf->format->Bmask, surf->format->Amask);
14+
*/
15+
16+
- surf->format->Rmask = (Uint32)r;
17+
- surf->format->Gmask = (Uint32)g;
18+
- surf->format->Bmask = (Uint32)b;
19+
- surf->format->Amask = (Uint32)a;
20+
+ SDL_PixelFormat *spf = surf->format;
21+
+
22+
+ spf->Rmask = (Uint32)r;
23+
+ spf->Gmask = (Uint32)g;
24+
+ spf->Bmask = (Uint32)b;
25+
+ spf->Amask = (Uint32)a;
26+
27+
Py_RETURN_NONE;
28+
}
29+
@@ -1762,7 +1764,7 @@
30+
surf_set_shifts (PyObject *self, PyObject *args)
31+
{
32+
SDL_Surface *surf = PySurface_AsSurface (self);
33+
- Uint64 r, g, b, a;
34+
+ unsigned long r, g, b, a;
35+
36+
if (!PyArg_ParseTuple (args, "(kkkk)", &r, &g, &b, &a))
37+
return NULL;

recipes/pygame/recipe.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,20 @@ BUILD_pygame=$BUILD_PATH/pygame/$(get_directory $URL_pygame)
99
RECIPE_pygame=$RECIPES_PATH/pygame
1010

1111
function prebuild_pygame() {
12-
true
12+
cd $BUILD_pygame
13+
14+
# check marker in our source build
15+
if [ -f .patched ]; then
16+
# no patch needed
17+
return
18+
fi
19+
20+
try cp $RECIPE_pygame/Setup .
21+
try patch -p1 < $RECIPE_pygame/patches/fix-surface-access.patch
22+
try patch -p1 < $RECIPE_pygame/patches/fix-array-surface.patch
23+
24+
# everything done, touch the marker !
25+
touch .patched
1326
}
1427

1528
function build_pygame() {

recipes/sdl/recipe.sh

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,23 @@
11
#!/bin/bash
22

33
PRIORITY_sdl=15
4-
VERSION_sdl=1.3
4+
VERSION_sdl=1.2.14
55
URL_sdl=
66
MD5_sdl=
7-
BUILD_sdl=$BUILD_PATH/sdl/SDL
7+
BUILD_sdl=$BUILD_PATH/sdl/SDL-$VERSION_sdl
88
RECIPE_sdl=$RECIPES_PATH/sdl
99

1010
function prebuild_sdl() {
11-
set -x
12-
# clone sdl repo
13-
if [ ! -f $BUILD_sdl ]; then
14-
cd $BUILD_PATH/sdl
15-
hg clone http://hg.libsdl.org/SDL
16-
fi
17-
18-
# make the symlink to sdl in src directory
19-
cd $SRC_PATH/jni
20-
rm sdl
21-
ln -s $BUILD_sdl sdl
11+
true
2212
}
2313

2414
function build_sdl() {
2515
cd $SRC_PATH/jni
2616
push_arm
27-
ndk-build V=1
17+
try ndk-build V=1
2818
pop_arm
2919

30-
# rename libs
31-
cp -a $SRC_PATH/libs/$ARCH/*.so $LIBS_PATH
32-
33-
# FIXME: patch jni compilation to make it work.
34-
cd $LIBS_PATH
35-
mv libsdl_image.so libSDL_image.so
36-
mv libsdl_image.so libSDL_image.so
37-
mv libsdl_main.so libSDL_main.so
38-
mv libsdl_mixer.so libSDL_mixer.so
39-
mv libsdl_ttf.so libSDL_ttf.so
20+
try cp -a $SRC_PATH/libs/$ARCH/*.so $LIBS_PATH
4021
}
4122

4223
function postbuild_sdl() {

src/jni/application/Android.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ LOCAL_SRC_FILES := $(foreach F, $(APP_SUBDIRS), $(addprefix $(F)/,$(notdir $(wil
3030
# Uncomment to also add C sources
3131
LOCAL_SRC_FILES += $(foreach F, $(APP_SUBDIRS), $(addprefix $(F)/,$(notdir $(wildcard $(LOCAL_PATH)/$(F)/*.c))))
3232

33-
LOCAL_SHARED_LIBRARIES := SDL $(COMPILED_LIBRARIES)
33+
LOCAL_SHARED_LIBRARIES := sdl $(COMPILED_LIBRARIES)
3434

3535
LOCAL_STATIC_LIBRARIES := jpeg png
3636

src/jni/jpeg/Android.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ LOCAL_CFLAGS += -O3 -fstrict-aliasing -fprefetch-loop-arrays
3434

3535
LOCAL_MODULE:= jpeg
3636

37-
include $(BUILD_STATIC_LIBRARY)
37+
include $(BUILD_SHARED_LIBRARY)

src/jni/png/Android.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ common_C_INCLUDES += \
3131
LOCAL_SRC_FILES := $(common_SRC_FILES)
3232
LOCAL_CFLAGS += $(common_CFLAGS)
3333
LOCAL_C_INCLUDES += $(common_C_INCLUDES)
34+
LOCAL_LDLIBS := -lz
3435

3536
LOCAL_MODULE:= png
3637

3738
LOCAL_COPY_HEADERS_TO := $(common_COPY_HEADERS_TO)
3839
LOCAL_COPY_HEADERS := $(common_COPY_HEADERS)
3940

40-
include $(BUILD_STATIC_LIBRARY)
41+
include $(BUILD_SHARED_LIBRARY)
4142

src/jni/sdl/Android.mk

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
LOCAL_PATH := $(call my-dir)
2+
3+
include $(CLEAR_VARS)
4+
5+
LOCAL_MODULE := sdl
6+
7+
ifndef SDL_JAVA_PACKAGE_PATH
8+
$(error Please define SDL_JAVA_PACKAGE_PATH to the path of your Java package with dots replaced with underscores, for example "com_example_SanAngeles")
9+
endif
10+
11+
LOCAL_CFLAGS := -I$(LOCAL_PATH)/include \
12+
-DSDL_JAVA_PACKAGE_PATH=$(SDL_JAVA_PACKAGE_PATH) \
13+
-DSDL_CURDIR_PATH=\"$(SDL_CURDIR_PATH)\" \
14+
-DSDL_TRACKBALL_KEYUP_DELAY=$(SDL_TRACKBALL_KEYUP_DELAY) \
15+
-DSDL_VIDEO_RENDER_RESIZE=$(SDL_VIDEO_RENDER_RESIZE) \
16+
$(SDL_ADDITIONAL_CFLAGS)
17+
18+
19+
SDL_SRCS := \
20+
src/*.c \
21+
src/audio/*.c \
22+
src/cdrom/*.c \
23+
src/cpuinfo/*.c \
24+
src/events/*.c \
25+
src/file/*.c \
26+
src/haptic/*.c \
27+
src/joystick/*.c \
28+
src/stdlib/*.c \
29+
src/thread/*.c \
30+
src/timer/*.c \
31+
src/video/*.c \
32+
src/main/*.c \
33+
src/power/*.c \
34+
src/thread/pthread/*.c \
35+
src/timer/unix/*.c \
36+
src/audio/android/*.c \
37+
src/cdrom/dummy/*.c \
38+
src/video/android/*.c \
39+
src/haptic/dummy/*.c \
40+
src/loadso/dlopen/*.c \
41+
src/atomic/dummy/*.c \
42+
43+
# TODO: use libcutils for atomic operations, but it's not included in NDK
44+
45+
# src/atomic/linux/*.c \
46+
# src/power/linux/*.c \
47+
# src/joystick/android/*.c \
48+
# src/haptic/android/*.c \
49+
# src/libm/*.c \
50+
51+
LOCAL_CPP_EXTENSION := .cpp
52+
53+
# Note this "simple" makefile var substitution, you can find even more complex examples in different Android projects
54+
LOCAL_SRC_FILES := $(foreach F, $(SDL_SRCS), $(addprefix $(dir $(F)),$(notdir $(wildcard $(LOCAL_PATH)/$(F)))))
55+
56+
LOCAL_LDLIBS := -lGLESv1_CM -ldl -llog
57+
58+
include $(BUILD_SHARED_LIBRARY)

src/jni/sdl/BUGS

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
Bugs are now managed in the SDL bug tracker, here:
3+
4+
http://bugzilla.libsdl.org/
5+
6+
You may report bugs there, and search to see if a given issue has already
7+
been reported, discussed, and maybe even fixed.
8+
9+
10+
11+
You may also find help at the SDL mailing list. Subscription information:
12+
13+
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
14+
15+
Bug reports are welcome here, but we really appreciate if you use Bugzilla, as
16+
bugs discussed on the mailing list may be forgotten or missed.
17+
18+

0 commit comments

Comments
 (0)