From d630d6e421848c48e4ca2c03c2c4e7d6769ccbf8 Mon Sep 17 00:00:00 2001 From: Alexpux Date: Tue, 30 Sep 2014 17:07:31 +0400 Subject: [PATCH] wxPython: New package. --- mingw-w64-wxPython/001-mingw-python.patch | 67 ++++++++++++++++ mingw-w64-wxPython/002-system-includes.patch | 8 ++ mingw-w64-wxPython/003-fix-cast-error.patch | 11 +++ mingw-w64-wxPython/PKGBUILD | 83 ++++++++++++++++++++ 4 files changed, 169 insertions(+) create mode 100644 mingw-w64-wxPython/001-mingw-python.patch create mode 100644 mingw-w64-wxPython/002-system-includes.patch create mode 100644 mingw-w64-wxPython/003-fix-cast-error.patch create mode 100644 mingw-w64-wxPython/PKGBUILD diff --git a/mingw-w64-wxPython/001-mingw-python.patch b/mingw-w64-wxPython/001-mingw-python.patch new file mode 100644 index 0000000000..cdeacc4312 --- /dev/null +++ b/mingw-w64-wxPython/001-mingw-python.patch @@ -0,0 +1,67 @@ +--- a/wxPython/config.py.orig 2014-09-30 12:22:14.187740300 +0400 ++++ a/wxPython/config.py 2014-09-30 12:35:39.236109800 +0400 +@@ -311,10 +311,15 @@ + flags += ' --version=%s.%s' % (VER_MAJOR, VER_MINOR) + + searchpath = os.environ["PATH"] +- for p in searchpath.split(':'): ++ if sys.platform == 'win32': ++ psplit = ';' ++ else: ++ psplit = ':' ++ for p in searchpath.split(psplit): + fp = os.path.join(p, 'wx-config') + if os.path.exists(fp) and os.access(fp, os.X_OK): + # success ++ fp = fp.replace("\\", "/") + msg("Found wx-config: " + fp) + msg(" Using flags: " + flags) + WX_CONFIG = fp + flags +@@ -330,7 +335,7 @@ + + + def getWxConfigValue(flag): +- cmd = "%s --version=%s.%s %s" % (WX_CONFIG, VER_MAJOR, VER_MINOR, flag) ++ cmd = "%s \"%s --version=%s.%s %s\"" % ("sh -c", WX_CONFIG, VER_MAJOR, VER_MINOR, flag) + value = os.popen(cmd, 'r').read()[:-1] + return value + +@@ -602,7 +602,7 @@ + def findLib(name, libdirs): + name = makeLibName(name)[0] + if os.name == 'posix' or COMPILER == 'mingw32': +- lflags = getWxConfigValue('--libs') ++ lflags = getWxConfigValue('--libs all') + lflags = lflags.split() + + # if wx-config --libs output does not start with -L, wx is +@@ -856,14 +861,16 @@ + # gcc needs '.res' and '.rc' compiled to object files !!! + try: + #self.spawn(["windres", "-i", src, "-o", obj]) +- self.spawn(["windres", "-i", src, "-o", obj] + +- [arg for arg in cc_args if arg.startswith("-I")] ) ++ windresflags = getWxConfigValue('--rescomp') ++ windresflags = windresflags.split() ++ self.spawn(['sh', '-c', ' '.join(windresflags + ["-i", src, "-o", obj] + ++ [arg for arg in cc_args if arg.startswith("-I")]).replace("\\", "/")]) + except DistutilsExecError, msg: + raise CompileError, msg + else: # for other files use the C-compiler + try: +- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + +- extra_postargs) ++ self.spawn(['sh', '-c', ' '.join(self.compiler_so + cc_args + [src, '-o', obj] + ++ extra_postargs).replace("\\", "/")]) + except DistutilsExecError, msg: + raise CompileError, msg + +@@ -1046,7 +1046,7 @@ + else: + cflags.append('-O3') + +- lflags = getWxConfigValue('--libs') ++ lflags = getWxConfigValue('--libs all') + MONOLITHIC = (lflags.find("_xrc") == -1) + lflags = lflags.split() + diff --git a/mingw-w64-wxPython/002-system-includes.patch b/mingw-w64-wxPython/002-system-includes.patch new file mode 100644 index 0000000000..a06239b3e0 --- /dev/null +++ b/mingw-w64-wxPython/002-system-includes.patch @@ -0,0 +1,8 @@ +--- a/wxPython/src/wxc.rc.orig 2014-09-30 13:50:42.005946900 +0400 ++++ b/wxPython/src/wxc.rc 2014-09-30 13:51:10.565847000 +0400 +@@ -1,4 +1,4 @@ +-#include "wx/msw/wx.rc" ++#include + + + diff --git a/mingw-w64-wxPython/003-fix-cast-error.patch b/mingw-w64-wxPython/003-fix-cast-error.patch new file mode 100644 index 0000000000..6ad434f9fe --- /dev/null +++ b/mingw-w64-wxPython/003-fix-cast-error.patch @@ -0,0 +1,11 @@ +--- wxPython-src-3.0.1.1/wxPython/src/helpers.cpp.orig 2014-09-30 15:35:54.001641700 +0400 ++++ wxPython-src-3.0.1.1/wxPython/src/helpers.cpp 2014-09-30 15:40:54.393928800 +0400 +@@ -2152,7 +2152,7 @@ + long wxPyGetWinHandle(wxWindow* win) { + + #ifdef __WXMSW__ +- return (long)win->GetHandle(); ++ return (intptr_t)win->GetHandle(); + #endif + + #if defined(__WXGTK__) || defined(__WXX11__) diff --git a/mingw-w64-wxPython/PKGBUILD b/mingw-w64-wxPython/PKGBUILD new file mode 100644 index 0000000000..5c7f0cbeec --- /dev/null +++ b/mingw-w64-wxPython/PKGBUILD @@ -0,0 +1,83 @@ +# Maintainer: Alexey Pavlov + +_realname=wxPython +pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" +pkgver=3.0.1.1 +_editraver=0.7.20 +pkgrel=1 +pkgdesc="A wxWidgets GUI toolkit for Python (mingw-w64)" +arch=('any') +license=("custom:wxWindows") +groups=("${MINGW_PACKAGE_PREFIX}") +url="http://www.wxpython.org/" +depends=("${MINGW_PACKAGE_PREFIX}-python2" + "${MINGW_PACKAGE_PREFIX}-wxWidgets") +makedepends=("${MINGW_PACKAGE_PREFIX}-gcc") +options=('strip' 'staticlibs' 'buildflags') +source=(http://downloads.sourceforge.net/wxpython/${_realname}-src-${pkgver}.tar.bz2 + #http://editra.googlecode.com/files/Editra-${_editraver}.tar.gz + 001-mingw-python.patch + 002-system-includes.patch + 003-fix-cast-error.patch) +sha1sums=('d2c4719015d7c499a9765b1e5107fdf37a32abfb' + '5ed416e6ca1665e64d0b374d065042a02be43150' + 'fb96353201fb0b529a71e70710986246b2978e94' + '9fa4ac1988fec999feca090f8a8360807664f987') + +prepare() { + cd "${srcdir}/${_realname}-src-${pkgver}" + patch -p1 -i ${srcdir}/001-mingw-python.patch + patch -p1 -i ${srcdir}/002-system-includes.patch + patch -p1 -i ${srcdir}/003-fix-cast-error.patch + + #cd ${srcdir} + find . -type f -exec sed -i 's/env python/env python2/' {} \; + #sed -i 's/sys.exit(1)//' Editra-${_editraver}/setup.py +} + +build() { + #[[ -d ${srcdir}/build-${CARCH} ]] && rm -rf ${srcdir}/build-${CARCH} + #mkdir -p ${srcdir}/build-${CARCH} && cd ${srcdir}/build-${CARCH} + #CPPFLAGS+=" -fno-devirtualize" + #CFLAGS+=" -fno-devirtualize" + #CFLAGS+=" -fno-devirtualize" + export PYTHON=${MINGW_PREFIX}/bin/python2 + cd ${_realname}-src-${pkgver} + ./configure \ + --prefix=${MINGW_PREFIX} \ + --host=${MINGW_CHOST} \ + --target=${MINGW_CHOST} \ + --build=${MINGW_CHOST} \ + --with-msw \ + --disable-mslu \ + --enable-shared \ + --enable-iniconf \ + --enable-iff \ + --enable-permissive \ + --disable-monolithic \ + --disable-mediactrl \ + --enable-unicode \ + --enable-accessibility \ + --disable-precomp-headers + + echo "Package dir is ${pkgdir}; PREFIX is ${MINGW_PREFIX}" + cd wxPython + #CPPFLAGS+=" $(${MINGW_PREFIX}/bin/wx-config --cppflags)" + #CFLAGS+=" $(${MINGW_PREFIX}/bin/wx-config --cflags)" + #CXXFLAGS+=" $(${MINGW_PREFIX}/bin/wx-config --cxxflags)" + MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \ + ${MINGW_PREFIX}/bin/python2 setup.py WXPORT=msw BUILD_ACTIVEX=0 UNICODE=1 COMPILER=mingw32 build + #make VERBOSE=1 +} + +package() { + cd "${srcdir}/wxPython-src-${pkgver}/wxPython" + MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \ + ${MINGW_PREFIX}/bin/python2 setup.py WXPORT=msw BUILD_ACTIVEX=0 UNICODE=1 COMPILER=mingw32 install --prefix=${MINGW_PREFIX} --root="$pkgdir" + install -D -m644 ../docs/licence.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE" + + #cd "${srcdir}/Editra-${_editraver}" + #MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \ + #${MINGW_PREFIX}/bin/python2 setup.py install --root="${pkgdir}" --prefix=${MINGW_PREFIX} + #rm -r "${pkgdir}${MINGW_PREFIX}/lib/python2.7/site-packages/wx-3.0-gtk2/wx/tools/Editra" +}