Skip to content

Commit

Permalink
qt4: Fix building with system libmng.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexpux committed Jul 15, 2015
1 parent 74a69ab commit 88280df
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 17 deletions.
6 changes: 3 additions & 3 deletions mingw-w64-qt4/PKGBUILD
Expand Up @@ -73,7 +73,7 @@ source=("http://download.qt-project.org/official_releases/qt/${pkgver%.*}/${pkgv
qt4-build-debug-qmake.patch
qt-4.8.7-mingw-configure.patch
qt-4.8.7-mingw-unix-tests.patch
qt-4.8.7-mingw-use-shared-libmng.patch)
qt-4.8.7-MinGW-w64-fix-qmng-define-MNG_USE_DLL-and-use-MNG_DECL.patch)
md5sums=('d990ee66bf7ab0c785589776f35ba6ad'
'3795e9f26a38045b69bb411f307905ac'
'63dc5a13265ed82b2ba3abd0aa7a59f7'
Expand All @@ -96,7 +96,7 @@ md5sums=('d990ee66bf7ab0c785589776f35ba6ad'
'49c33922e8f3c506cb7cc15cbe9b4a0a'
'de870877cb94f64a57c81d52ce6327e5'
'fc3b3f45db0eda55d429310faf529ae9'
'7370d976dc950404b65e4958ceadb4c7')
'cd1be38b3166cde16e29f255d092ecd4')

prepare() {
cd ${srcdir}/${_pkgfqn}
Expand All @@ -120,7 +120,7 @@ prepare() {
patch -p1 -i ${srcdir}/qt-4.8.7-dont-add-resource-files-to-qmake-libs.patch
patch -p1 -i ${srcdir}/qt-4.8.7-mingw-configure.patch
patch -p1 -i ${srcdir}/qt-4.8.7-mingw-unix-tests.patch
patch -p1 -i ${srcdir}/qt-4.8.7-mingw-use-shared-libmng.patch
patch -p1 -i ${srcdir}/qt-4.8.7-MinGW-w64-fix-qmng-define-MNG_USE_DLL-and-use-MNG_DECL.patch

if check_option "debug" "y"; then
patch -p1 -i ${srcdir}/qt4-build-debug-qmake.patch
Expand Down
@@ -0,0 +1,132 @@
--- qt-everywhere-opensource-src-4.8.7/src/gui/image/qmnghandler.cpp 2015-05-07 15:14:44.000000000 +0100
+++ qt4-4.8.7/src/gui/image/qmnghandler.cpp 2015-07-15 10:44:14.858545100 +0100
@@ -45,7 +45,12 @@
#include "qvariant.h"
#include "qcolor.h"

-#define MNG_USE_SO
+#if defined(Q_OS_WIN)
+ #define MNG_USE_DLL
+#else
+ #define MNG_USE_SO
+#endif
+
#include <libmng.h>

QT_BEGIN_NAMESPACE
@@ -82,7 +87,7 @@
QMngHandler *q_ptr;
};

-static mng_bool myerror(mng_handle /*hMNG*/,
+static mng_bool MNG_DECL myerror(mng_handle /*hMNG*/,
mng_int32 iErrorcode,
mng_int8 /*iSeverity*/,
mng_chunkid iChunkname,
@@ -101,7 +106,7 @@
return TRUE;
}

-static mng_ptr myalloc(mng_size_t iSize)
+static mng_ptr MNG_DECL myalloc(mng_size_t iSize)
{
#if defined(Q_OS_WINCE)
mng_ptr ptr = malloc(iSize);
@@ -112,24 +117,24 @@
#endif
}

-static void myfree(mng_ptr pPtr, mng_size_t /*iSize*/)
+static void MNG_DECL myfree(mng_ptr pPtr, mng_size_t /*iSize*/)
{
free(pPtr);
}

-static mng_bool myopenstream(mng_handle)
+static mng_bool MNG_DECL myopenstream(mng_handle)
{
return MNG_TRUE;
}

-static mng_bool myclosestream(mng_handle hMNG)
+static mng_bool MNG_DECL myclosestream(mng_handle hMNG)
{
QMngHandlerPrivate *pMydata = reinterpret_cast<QMngHandlerPrivate *>(mng_get_userdata(hMNG));
pMydata->haveReadAll = true;
return MNG_TRUE;
}

-static mng_bool myreaddata(mng_handle hMNG,
+static mng_bool MNG_DECL myreaddata(mng_handle hMNG,
mng_ptr pBuf,
mng_uint32 iSize,
mng_uint32p pRead)
@@ -138,7 +143,7 @@
return pMydata->readData(pBuf, iSize, pRead);
}

-static mng_bool mywritedata(mng_handle hMNG,
+static mng_bool MNG_DECL mywritedata(mng_handle hMNG,
mng_ptr pBuf,
mng_uint32 iSize,
mng_uint32p pWritten)
@@ -147,7 +152,7 @@
return pMydata->writeData(pBuf, iSize, pWritten);
}

-static mng_bool myprocessheader(mng_handle hMNG,
+static mng_bool MNG_DECL myprocessheader(mng_handle hMNG,
mng_uint32 iWidth,
mng_uint32 iHeight)
{
@@ -155,14 +160,14 @@
return pMydata->processHeader(iWidth, iHeight);
}

-static mng_ptr mygetcanvasline(mng_handle hMNG,
+static mng_ptr MNG_DECL mygetcanvasline(mng_handle hMNG,
mng_uint32 iLinenr)
{
QMngHandlerPrivate *pMydata = reinterpret_cast<QMngHandlerPrivate *>(mng_get_userdata(hMNG));
return (mng_ptr)pMydata->image.scanLine(iLinenr);
}

-static mng_bool myrefresh(mng_handle /*hMNG*/,
+static mng_bool MNG_DECL myrefresh(mng_handle /*hMNG*/,
mng_uint32 /*iX*/,
mng_uint32 /*iY*/,
mng_uint32 /*iWidth*/,
@@ -171,13 +176,13 @@
return MNG_TRUE;
}

-static mng_uint32 mygettickcount(mng_handle hMNG)
+static mng_uint32 MNG_DECL mygettickcount(mng_handle hMNG)
{
QMngHandlerPrivate *pMydata = reinterpret_cast<QMngHandlerPrivate *>(mng_get_userdata(hMNG));
return pMydata->elapsed++;
}

-static mng_bool mysettimer(mng_handle hMNG,
+static mng_bool MNG_DECL mysettimer(mng_handle hMNG,
mng_uint32 iMsecs)
{
QMngHandlerPrivate *pMydata = reinterpret_cast<QMngHandlerPrivate *>(mng_get_userdata(hMNG));
@@ -186,7 +191,7 @@
return MNG_TRUE;
}

-static mng_bool myprocessterm(mng_handle hMNG,
+static mng_bool MNG_DECL myprocessterm(mng_handle hMNG,
mng_uint8 iTermaction,
mng_uint8 /*iIteraction*/,
mng_uint32 /*iDelay*/,
@@ -198,7 +203,7 @@
return MNG_TRUE;
}

-static mng_bool mytrace(mng_handle,
+static mng_bool MNG_DECL mytrace(mng_handle,
mng_int32 iFuncnr,
mng_int32 iFuncseq,
mng_pchar zFuncname)
14 changes: 0 additions & 14 deletions mingw-w64-qt4/qt-4.8.7-mingw-use-shared-libmng.patch

This file was deleted.

0 comments on commit 88280df

Please sign in to comment.