summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2007-06-25 11:12:51 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2007-06-25 11:12:51 +0000
commitf7ce4eb03c9890052873e54fcd8018acee7b79ca (patch)
treefc68e664c4be3b69d15daccd86e9a1c0a8b8d36c
parent489a777527ceca7c42c10f129d0803b08b471f8d (diff)
- use sysconf to obtain the pagesize (Ivan Kuten)
-rw-r--r--package/sdl/SDL-1.2.11-patch_PAGE_SIZE.patch59
-rw-r--r--package/sdl/sdl.mk13
2 files changed, 65 insertions, 7 deletions
diff --git a/package/sdl/SDL-1.2.11-patch_PAGE_SIZE.patch b/package/sdl/SDL-1.2.11-patch_PAGE_SIZE.patch
new file mode 100644
index 000000000..ece702d8d
--- /dev/null
+++ b/package/sdl/SDL-1.2.11-patch_PAGE_SIZE.patch
@@ -0,0 +1,59 @@
+diff -urN SDL-1.2.11.orig/src/video/fbcon/SDL_fbvideo.c SDL-1.2.11/src/video/fbcon/SDL_fbvideo.c
+--- SDL-1.2.11.orig/src/video/fbcon/SDL_fbvideo.c 2006-05-17 06:16:06.000000000 +0300
++++ SDL-1.2.11/src/video/fbcon/SDL_fbvideo.c 2007-06-24 22:19:41.000000000 +0300
+@@ -29,9 +29,17 @@
+ #include <unistd.h>
+ #include <sys/ioctl.h>
+ #include <sys/mman.h>
+-#include <asm/page.h> /* For definition of PAGE_SIZE */
+ #include <linux/vt.h>
+
++#if defined(linux)
++#define HAS_MMAP_ANON
++#include <sys/types.h>
++#include <sys/mman.h>
++#include <asm/page.h> /* PAGE_SIZE */
++#define HAS_SC_PAGESIZE /* _SC_PAGESIZE may be an enum for Linux */
++#define HAS_GETPAGESIZE
++#endif /* linux */
++
+ #include "SDL_video.h"
+ #include "SDL_mouse.h"
+ #include "../SDL_sysvideo.h"
+@@ -474,6 +482,7 @@
+ unsigned int current_h;
+ const char *SDL_fbdev;
+ FILE *modesdb;
++ int pagesize = -1;
+
+ /* Initialize the library */
+ SDL_fbdev = SDL_getenv("SDL_FBDEV");
+@@ -545,9 +554,27 @@
+ }
+ }
+
++#if defined(_SC_PAGESIZE) && defined(HAS_SC_PAGESIZE)
++ pagesize = sysconf(_SC_PAGESIZE);
++#endif
++#ifdef _SC_PAGE_SIZE
++ if (pagesize == -1)
++ pagesize = sysconf(_SC_PAGE_SIZE);
++#endif
++#ifdef HAS_GETPAGESIZE
++ if (pagesize == -1)
++ pagesize = getpagesize();
++#endif
++#ifdef PAGE_SIZE
++ if (pagesize == -1)
++ pagesize = PAGE_SIZE;
++#endif
++ if (pagesize == -1)
++ pagesize = 4096;
++
+ /* Memory map the device, compensating for buggy PPC mmap() */
+ mapped_offset = (((long)finfo.smem_start) -
+- (((long)finfo.smem_start)&~(PAGE_SIZE-1)));
++ (((long)finfo.smem_start)&~(pagesize-1)));
+ mapped_memlen = finfo.smem_len+mapped_offset;
+ mapped_mem = do_mmap(NULL, mapped_memlen,
+ PROT_READ|PROT_WRITE, MAP_SHARED, console_fd, 0);
diff --git a/package/sdl/sdl.mk b/package/sdl/sdl.mk
index c7a738e38..235b46940 100644
--- a/package/sdl/sdl.mk
+++ b/package/sdl/sdl.mk
@@ -16,13 +16,12 @@ sdl-source: $(DL_DIR)/$(SDL_SOURCE)
$(SDL_DIR)/.unpacked: $(DL_DIR)/$(SDL_SOURCE)
$(SDL_CAT) $(DL_DIR)/$(SDL_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
- touch $(SDL_DIR)/.unpacked
+ toolchain/patch-kernel.sh $(SDL_DIR) package/sdl sdl\*.patch
+ touch $@
$(SDL_DIR)/.configured: $(SDL_DIR)/.unpacked
- (cd $(SDL_DIR); \
+ (cd $(SDL_DIR); rm -rf config.cache ; \
$(TARGET_CONFIGURE_OPTS) \
- CFLAGS="$(TARGET_CFLAGS)" \
- LDFLAGS="$(TARGET_LDFLAGS)" \
./configure \
--target=$(GNU_TARGET_NAME) \
--host=$(GNU_TARGET_NAME) \
@@ -43,15 +42,15 @@ $(SDL_DIR)/.configured: $(SDL_DIR)/.unpacked
--disable-esd \
--disable-nasm \
--disable-video-x11 );
- touch $(SDL_DIR)/.configured
+ touch $@
$(SDL_DIR)/.compiled: $(SDL_DIR)/.configured
$(MAKE) -C $(SDL_DIR)
- touch $(SDL_DIR)/.compiled
+ touch $@
$(STAGING_DIR)/usr/lib/libSDL.so: $(SDL_DIR)/.compiled
$(MAKE) DESTDIR=$(STAGING_DIR) -C $(SDL_DIR) install;
- touch -c $(STAGING_DIR)/usr/lib/libSDL.so
+ touch -c $@
$(TARGET_DIR)/usr/lib/libSDL.so: $(STAGING_DIR)/usr/lib/libSDL.so
cp -dpf $(STAGING_DIR)/usr/lib/libSDL*.so* $(TARGET_DIR)/usr/lib/