mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-09 21:30:08 +02:00
379 lines
13 KiB
Plaintext
379 lines
13 KiB
Plaintext
From 266fb5c31a3a4a9ac69b04778c4c84b2072e994f Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
|
|
Date: Sun, 6 Aug 2017 17:59:18 +0200
|
|
Subject: [PATCH] Haiku patches
|
|
|
|
---
|
|
Setup.in | 6 +-
|
|
config.py | 4 +
|
|
config_haiku.py | 221 ++++++++++++++++++++++++++++++++++++++++++++
|
|
pygame.egg-info/SOURCES.txt | 6 +-
|
|
setup.py | 18 +---
|
|
src/pgcompat.h | 4 +-
|
|
src/transform.c | 2 +-
|
|
7 files changed, 232 insertions(+), 29 deletions(-)
|
|
create mode 100644 config_haiku.py
|
|
|
|
diff --git a/Setup.in b/Setup.in
|
|
index ae6791b..28e7f20 100644
|
|
--- a/Setup.in
|
|
+++ b/Setup.in
|
|
@@ -29,8 +29,8 @@ imageext src/imageext.c $(SDL) $(IMAGE) $(PNG) $(JPEG) $(DEBUG)
|
|
font src/font.c $(SDL) $(FONT) $(DEBUG)
|
|
mixer src/mixer.c $(SDL) $(MIXER) $(DEBUG)
|
|
mixer_music src/music.c $(SDL) $(MIXER) $(DEBUG)
|
|
-scrap src/scrap.c $(SDL) $(SCRAP) $(DEBUG)
|
|
-pypm src/pypm.c $(SDL) $(PORTMIDI) $(PORTTIME) $(DEBUG)
|
|
+#scrap src/scrap.c $(SDL) $(SCRAP) $(DEBUG)
|
|
+#pypm src/pypm.c $(SDL) $(PORTMIDI) $(PORTTIME) $(DEBUG)
|
|
|
|
GFX = src/SDL_gfx/SDL_gfxPrimitives.c
|
|
#GFX = src/SDL_gfx/SDL_gfxBlitFunc.c src/SDL_gfx/SDL_gfxPrimitives.c
|
|
@@ -61,7 +61,7 @@ joystick src/joystick.c $(SDL) $(DEBUG)
|
|
draw src/draw.c $(SDL) $(DEBUG)
|
|
image src/image.c $(SDL) $(DEBUG)
|
|
overlay src/overlay.c $(SDL) $(DEBUG)
|
|
-transform src/transform.c src/rotozoom.c src/scale2x.c src/scale_mmx.c $(SDL) $(DEBUG) -D_NO_MMX_FOR_X86_64
|
|
+transform src/transform.c src/rotozoom.c src/scale2x.c $(SDL) $(DEBUG) -D_NO_MMX_FOR_X86_64
|
|
mask src/mask.c src/bitmask.c $(SDL) $(DEBUG)
|
|
bufferproxy src/bufferproxy.c $(SDL) $(DEBUG)
|
|
pixelarray src/pixelarray.c $(SDL) $(DEBUG)
|
|
diff --git a/config.py b/config.py
|
|
index 8418946..8ea4de9 100644
|
|
--- a/config.py
|
|
+++ b/config.py
|
|
@@ -142,12 +142,16 @@ def main():
|
|
elif sys.platform == 'win32':
|
|
print_('Using WINDOWS mingw/msys configuration...\n')
|
|
import config_msys as CFG
|
|
+ elif sys.platform == 'haiku1' or sys.platform == 'haiku1_x86':
|
|
+ print_('Using Haiku configuration...\n')
|
|
+ import config_haiku as CFG
|
|
elif sys.platform == 'darwin':
|
|
print_('Using Darwin configuration...\n')
|
|
import config_darwin as CFG
|
|
additional_platform_setup = open("Setup_Darwin.in", "r").readlines()
|
|
else:
|
|
print_('Using UNIX configuration...\n')
|
|
+ print_(sys.platform)
|
|
import config_unix as CFG
|
|
additional_platform_setup = open("Setup_Unix.in", "r").readlines()
|
|
|
|
diff --git a/config_haiku.py b/config_haiku.py
|
|
new file mode 100644
|
|
index 0000000..8c4dd8e
|
|
--- /dev/null
|
|
+++ b/config_haiku.py
|
|
@@ -0,0 +1,221 @@
|
|
+"""Config on Haiku"""
|
|
+
|
|
+import os, sys
|
|
+from glob import glob
|
|
+from distutils.sysconfig import get_python_inc
|
|
+
|
|
+# Python 2.x/3.x compatibility
|
|
+try:
|
|
+ raw_input
|
|
+except NameError:
|
|
+ raw_input = input
|
|
+
|
|
+configcommand = os.environ.get('SDL_CONFIG', 'sdl-config',)
|
|
+configcommand = configcommand + ' --version --cflags --libs'
|
|
+localbase = os.environ.get('LOCALBASE', '')
|
|
+
|
|
+#these get prefixes with '/usr' and '/usr/local' or the $LOCALBASE
|
|
+origincdirs = ['/develop/headers', '/develop/headers/SDL', '/develop/headers/x86/SDL']
|
|
+origlibdirs = ['/develop/lib','/develop/lib/x86']
|
|
+if 'ORIGLIBDIRS' in os.environ and os.environ['ORIGLIBDIRS'] != "":
|
|
+ origlibdirs = os.environ['ORIGLIBDIRS'].split(":")
|
|
+
|
|
+
|
|
+def confirm(message):
|
|
+ "ask a yes/no question, return result"
|
|
+ if not sys.stdout.isatty():
|
|
+ return False
|
|
+ reply = raw_input('\n' + message + ' [Y/n]:')
|
|
+ if reply and (reply[0].lower()) == 'n':
|
|
+ return False
|
|
+ return True
|
|
+
|
|
+class DependencyProg:
|
|
+ def __init__(self, name, envname, exename, minver, defaultlibs, version_flag="--version"):
|
|
+ self.name = name
|
|
+ command = os.environ.get(envname, exename)
|
|
+ self.lib_dir = ''
|
|
+ self.inc_dir = ''
|
|
+ self.libs = []
|
|
+ self.cflags = ''
|
|
+ try:
|
|
+ # freetype-config for freetype2 version 2.3.7 on Debian lenny
|
|
+ # does not recognize multiple command line options. So execute
|
|
+ # 'command' separately for each option.
|
|
+ config = (os.popen(command + ' ' + version_flag).readlines() +
|
|
+ os.popen(command + ' --cflags').readlines() +
|
|
+ os.popen(command + ' --libs').readlines())
|
|
+ flags = ' '.join(config[1:]).split()
|
|
+
|
|
+ # remove this GNU_SOURCE if there... since python has it already,
|
|
+ # it causes a warning.
|
|
+ if '-D_GNU_SOURCE=1' in flags:
|
|
+ flags.remove('-D_GNU_SOURCE=1')
|
|
+ self.ver = config[0].strip()
|
|
+ if minver and self.ver < minver:
|
|
+ err= 'WARNING: requires %s version %s (%s found)' % (self.name, self.ver, minver)
|
|
+ raise ValueError(err)
|
|
+ self.found = 1
|
|
+ self.cflags = ''
|
|
+ for f in flags:
|
|
+ if f[:2] in ('-l', '-D', '-I', '-L'):
|
|
+ self.cflags += f + ' '
|
|
+ elif f[:3] == '-Wl':
|
|
+ self.cflags += f + ' '
|
|
+ if self.name == 'SDL':
|
|
+ inc = '-I' + '/boot/system/develop/headers/SDL'
|
|
+ self.cflags = inc + ' ' + self.cflags
|
|
+ except:
|
|
+ print ('WARNING: "%s" failed!' % command)
|
|
+ self.found = 0
|
|
+ self.ver = '0'
|
|
+ self.libs = defaultlibs
|
|
+
|
|
+ def configure(self, incdirs, libdir):
|
|
+ if self.found:
|
|
+ print (self.name + ' '[len(self.name):] + ': found ' + self.ver)
|
|
+ self.found = 1
|
|
+ else:
|
|
+ print (self.name + ' '[len(self.name):] + ': not found')
|
|
+
|
|
+class Dependency:
|
|
+ def __init__(self, name, checkhead, checklib, libs):
|
|
+ self.name = name
|
|
+ self.inc_dir = None
|
|
+ self.lib_dir = None
|
|
+ self.libs = libs
|
|
+ self.found = 0
|
|
+ self.checklib = checklib
|
|
+ self.checkhead = checkhead
|
|
+ self.cflags = ''
|
|
+
|
|
+ def configure(self, incdirs, libdirs):
|
|
+ incname = self.checkhead
|
|
+ libnames = self.checklib, self.name.lower()
|
|
+
|
|
+ if incname:
|
|
+ for dir in incdirs:
|
|
+ path = os.path.join(dir, incname)
|
|
+ if os.path.isfile(path):
|
|
+ self.inc_dir = dir
|
|
+
|
|
+ for dir in libdirs:
|
|
+ for name in libnames:
|
|
+ path = os.path.join(dir, name)
|
|
+ if filter(os.path.isfile, glob(path+'*')):
|
|
+ self.lib_dir = dir
|
|
+
|
|
+ if (incname and self.lib_dir and self.inc_dir) or (not incname and self.lib_dir):
|
|
+ print (self.name + ' '[len(self.name):] + ': found')
|
|
+ self.found = 1
|
|
+ else:
|
|
+ print (self.name + ' '[len(self.name):] + ': not found')
|
|
+
|
|
+
|
|
+class DependencyPython:
|
|
+ def __init__(self, name, module, header):
|
|
+ self.name = name
|
|
+ self.lib_dir = ''
|
|
+ self.inc_dir = ''
|
|
+ self.libs = []
|
|
+ self.cflags = ''
|
|
+ self.found = 0
|
|
+ self.ver = '0'
|
|
+ self.module = module
|
|
+ self.header = header
|
|
+
|
|
+ def configure(self, incdirs, libdirs):
|
|
+ self.found = 1
|
|
+ if self.module:
|
|
+ try:
|
|
+ self.ver = __import__(self.module).__version__
|
|
+ except ImportError:
|
|
+ self.found = 0
|
|
+ if self.found and self.header:
|
|
+ fullpath = os.path.join(get_python_inc(0), self.header)
|
|
+ if not os.path.isfile(fullpath):
|
|
+ self.found = 0
|
|
+ else:
|
|
+ self.inc_dir = os.path.split(fullpath)[0]
|
|
+ if self.found:
|
|
+ print (self.name + ' '[len(self.name):] + ': found', self.ver)
|
|
+ else:
|
|
+ print (self.name + ' '[len(self.name):] + ': not found')
|
|
+
|
|
+sdl_lib_name = 'SDL'
|
|
+
|
|
+def main():
|
|
+ print ('\nHunting dependencies...')
|
|
+
|
|
+ def get_porttime_dep():
|
|
+ """ returns the porttime Dependency
|
|
+
|
|
+ On some distributions, such as Fedora, porttime is compiled into portmidi.
|
|
+ On others, such as Debian, it is a separate library.
|
|
+ """
|
|
+ portmidi_as_porttime = True
|
|
+
|
|
+ if 'PORTMIDI_INC_PORTTIME' in os.environ:
|
|
+ inc_porttime = os.environ.get('PORTMIDI_INC_PORTTIME')
|
|
+ portmidi_as_porttime = True if inc_porttime in ['1', 'True'] else False
|
|
+ else:
|
|
+ if os.path.exists('/etc/redhat-release'):
|
|
+ portmidi_as_porttime = True
|
|
+ else:
|
|
+ portmidi_as_porttime = False
|
|
+
|
|
+ if portmidi_as_porttime:
|
|
+ return Dependency('PORTTIME', 'porttime.h', 'libportmidi.so', ['portmidi'])
|
|
+ else:
|
|
+ return Dependency('PORTTIME', 'porttime.h', 'libporttime.so', ['porttime'])
|
|
+
|
|
+ porttime_dep = get_porttime_dep()
|
|
+
|
|
+ DEPS = [
|
|
+ DependencyProg('SDL', 'SDL_CONFIG', 'sdl-config', '1.2', ['sdl']),
|
|
+ Dependency('FONT', 'SDL_ttf.h', 'libSDL_ttf.so', ['SDL_ttf']),
|
|
+ Dependency('IMAGE', 'SDL_image.h', 'libSDL_image.so', ['SDL_image']),
|
|
+ Dependency('MIXER', 'SDL_mixer.h', 'libSDL_mixer.so', ['SDL_mixer']),
|
|
+ Dependency('PNG', 'png.h', 'libpng', ['png']),
|
|
+ Dependency('JPEG', 'jpeglib.h', 'libjpeg', ['jpeg']),
|
|
+ Dependency('SCRAP', '', 'libX11', ['X11']),
|
|
+ Dependency('PORTMIDI', 'portmidi.h', 'libportmidi.so', ['portmidi']),
|
|
+ porttime_dep,
|
|
+ DependencyProg('FREETYPE', 'FREETYPE_CONFIG', 'freetype-config', '2.0',
|
|
+ ['freetype'], '--ftversion'),
|
|
+ #Dependency('GFX', 'SDL_gfxPrimitives.h', 'libSDL_gfx.so', ['SDL_gfx']),
|
|
+ ]
|
|
+ if not DEPS[0].found:
|
|
+ sys.exit('Unable to run "sdl-config". Please make sure a development version of SDL is installed.')
|
|
+
|
|
+ incdirs = []
|
|
+ libdirs = []
|
|
+ incdirs += ["/system"+d for d in origincdirs]
|
|
+ libdirs += ["/system"+d for d in origlibdirs]
|
|
+ if localbase:
|
|
+ incdirs = [localbase+d for d in origincdirs]
|
|
+ libdirs = [localbase+d for d in origlibdirs]
|
|
+
|
|
+ for arg in DEPS[0].cflags.split():
|
|
+ if arg[:2] == '-I':
|
|
+ incdirs.append(arg[2:])
|
|
+ elif arg[:2] == '-L':
|
|
+ libdirs.append(arg[2:])
|
|
+ for d in DEPS:
|
|
+ d.configure(incdirs, libdirs)
|
|
+
|
|
+ for d in DEPS[1:]:
|
|
+ if not d.found:
|
|
+ if "-auto" not in sys.argv and not confirm("""
|
|
+Warning, some of the pygame dependencies were not found. Pygame can still
|
|
+compile and install, but games that depend on those missing dependencies
|
|
+will not run. Would you like to continue the configuration?"""):
|
|
+ raise SystemExit("Missing dependencies")
|
|
+ break
|
|
+
|
|
+ return DEPS
|
|
+
|
|
+if __name__ == '__main__':
|
|
+ print ("""This is the configuration subscript for Unix.
|
|
+Please run "config.py" for full configuration.""")
|
|
+
|
|
diff --git a/pygame.egg-info/SOURCES.txt b/pygame.egg-info/SOURCES.txt
|
|
index 82ff000..f9a302f 100644
|
|
--- a/pygame.egg-info/SOURCES.txt
|
|
+++ b/pygame.egg-info/SOURCES.txt
|
|
@@ -556,11 +556,7 @@ src/pypm.pyx
|
|
src/rect.c
|
|
src/rotozoom.c
|
|
src/rwobject.c
|
|
-src/scale.h
|
|
src/scale2x.c
|
|
-src/scale_mmx.c
|
|
-src/scale_mmx32.c
|
|
-src/scale_mmx64.c
|
|
src/scale_mmx64_gcc.c
|
|
src/scale_mmx64_msvc.c
|
|
src/scrap.c
|
|
@@ -836,4 +832,4 @@ test/util/build_page/results/.htaccess
|
|
test/util/build_page/results/index.py
|
|
test/util/build_page/results/results.css
|
|
test/util/build_page/upload_results/.htaccess
|
|
-test/util/build_page/upload_results/index.py
|
|
\ No newline at end of file
|
|
+test/util/build_page/upload_results/index.py
|
|
diff --git a/setup.py b/setup.py
|
|
index e9fc8b4..4aa891a 100644
|
|
--- a/setup.py
|
|
+++ b/setup.py
|
|
@@ -163,7 +163,7 @@ else:
|
|
|
|
#headers to install
|
|
headers = glob.glob(os.path.join('src', '*.h'))
|
|
-headers.remove(os.path.join('src', 'scale.h'))
|
|
+#headers.remove(os.path.join('src', 'scale.h'))
|
|
|
|
# option for not installing the headers.
|
|
if "-noheaders" in sys.argv:
|
|
@@ -457,22 +457,6 @@ if sys.platform == 'win32':
|
|
build_ext.run(self)
|
|
cmdclass['build_ext'] = WinBuildExt
|
|
|
|
- # Add the precompiled smooth scale MMX functions to transform.
|
|
- def replace_scale_mmx():
|
|
- for e in extensions:
|
|
- if e.name == 'transform':
|
|
- if '64 bit' in sys.version:
|
|
- e.extra_objects.append(
|
|
- os.path.join('obj', 'win64', 'scale_mmx.obj'))
|
|
- else:
|
|
- e.extra_objects.append(
|
|
- os.path.join('obj', 'win32', 'scale_mmx.obj'))
|
|
- for i in range(len(e.sources)):
|
|
- if e.sources[i].endswith('scale_mmx.c'):
|
|
- del e.sources[i]
|
|
- return
|
|
- replace_scale_mmx()
|
|
-
|
|
|
|
#clean up the list of extensions
|
|
for e in extensions[:]:
|
|
diff --git a/src/pgcompat.h b/src/pgcompat.h
|
|
index bd18431..324130f 100644
|
|
--- a/src/pgcompat.h
|
|
+++ b/src/pgcompat.h
|
|
@@ -81,9 +81,7 @@
|
|
#define DECREF_MOD(mod)
|
|
|
|
/* Type header differs. */
|
|
-#define TYPE_HEAD(x,y) \
|
|
- PyObject_HEAD_INIT(x) \
|
|
- 0,
|
|
+#define TYPE_HEAD(x,y) PyObject_HEAD_INIT(x) 0,
|
|
|
|
/* Text interface. Use ascii strings. */
|
|
#define Text_Type PyString_Type
|
|
diff --git a/src/transform.c b/src/transform.c
|
|
index c1c77f7..919ae51 100644
|
|
--- a/src/transform.c
|
|
+++ b/src/transform.c
|
|
@@ -29,7 +29,7 @@
|
|
#include "doc/transform_doc.h"
|
|
#include <math.h>
|
|
#include <string.h>
|
|
-#include "scale.h"
|
|
+//#include "scale.h"
|
|
|
|
|
|
typedef void (* SMOOTHSCALE_FILTER_P)(Uint8 *, Uint8 *, int, int, int, int, int);
|
|
--
|
|
2.16.4
|
|
|