On Wed, Jul 16, 2008 at 3:33 PM, Tim Baumgartner <[EMAIL PROTECTED]> wrote: > There is a Leopard compile problem (http://gna.org/bugs/?11940) in which > QuesoGLC fails to link due to the location of some inline function > definitions. I came up with a patch that fixes the issue (and submitted it > to the QuesoGLC tracker) but I don't know when the problem will be fixed on > the official QuesoGLC version. > > So that the problem doesn't persist for Leopard users trying to compile the > Warzone trunk and/or 2.1 branch, I've modified the Xcode file so that it > automatically applies the QuesoGLC patch during compilation. If this > solution works for everyone (until QuesoGLC itself is fixed), I've attached > both the QuesoGLC and Xcode patches. The script assumes the QuesoGLC patch > is located in macosx/Resources/ because I didn't know a better place to put > it but the location can easily be changed.
My standard procedure would be to commit the patch into /macosx/external/. Also, the patch should probably be applied in the script that extracts the QuesoGLC code into that directory, and only if the extraction takes place. That would avoid multiple applications of the patch, although it would require a rm -rf macosx/external/quesoglc in existing checkouts. Oh, how I'd love for a better way to do it. But that's the best I came up with and it works pretty well, on the whole. :) Ari > > Tim > > > Index: macosx/Warzone.xcodeproj/project.pbxproj > =================================================================== > --- macosx/Warzone.xcodeproj/project.pbxproj (revision 5562) > +++ macosx/Warzone.xcodeproj/project.pbxproj (working copy) > @@ -3171,6 +3171,7 @@ > buildConfigurationList = 0223BBD30CFE3D5C0056EF85 /* > Build configuration list for PBXNativeTarget "QuesoGLC" */; > buildPhases = ( > 0223BBDD0CFE3E290056EF85 /* Fetch source */, > + 22E849A80E2E0E8F002591A4 /* Patch */, > 02F5CC4F0D148FC30000A2D0 /* Create database.c > */, > 0223BBCC0CFE3D5C0056EF85 /* Headers */, > 0223BBCD0CFE3D5C0056EF85 /* Resources */, > @@ -3741,6 +3742,20 @@ > shellPath = /bin/sh; > shellScript = > "DIRECTORY=\"SDL_net-1.2.6\"\nOUTDIR=\"SDL_net\"\nFILENAME=\"SDL_net-1.2.6.tar.gz\"\nSOURCE=\"http://www.libsdl.org/projects/SDL_net/release/SDL_net-1.2.6.tar.gz\"\nMD5=\"7be5b9ef36129ee187ace96906cd264c\"\n\ncd > external\n\nif [ -d \"$OUTDIR\" ]; then\n echo \"$OUTDIR already exists, > skipping\"\n exit 0\nfi\n\nif [ -d \"$DIRECTORY\" ]; then\n echo > \"$DIRECTORY exists, probably from an earlier failed run\" >&2\n exit > 1\nfi\n\nif [ ! -r \"$FILENAME\" ]; then\n echo \"Fetching $SOURCE\"\n if > ! curl -L -o \"$FILENAME\" \"$SOURCE\"; then\n echo \"Unable to fetch > $SOURCE\" >&2\n exit 1\n fi\nfi\n\nHAVEMD5=`md5 \"$FILENAME\" | sed -n > -e 's/^MD5 (\\(.*\\)) = \\(.*\\)$/\\2/p'`\n\nif [ -z \"$HAVEMD5\" ]; then\n > echo \"Unable to compute md5 for $FILENAME\" >&2\n exit 1\nfi\n\nif [ > \"$HAVEMD5\" != \"$MD5\" ]; then\n echo \"Md5 does not match for > $FILENAME\" >&2\n exit 1\nfi\n\nEXTENSION=`echo $FILENAME | sed -e > 's/^.*\\.\\([^.]*\\)/\\1/'`\n\nif [ \"$EXTENSION\" = \"gz\" ]; then\n if ! > tar -zxf \"$FILENAME\"; then\n echo \"Unpacking $FILENAME failed\" >&2\n > exit 1\n fi\nelif [ \"$EXTENSION\" = \"bz2\" ]; then\n if ! tar -jxf > \"$FILENAME\"; then\n echo \"Unpacking $FILENAME failed\" >&2\n exit > 1\n fi\nelse\n echo \"Unable to unpack $FILENAME\" >&2\n exit 1\nfi\n\nif > [ ! -d \"$DIRECTORY\" ]; then\n echo \"Can't find $DIRECTORY to rename\" >>&2\n exit 1\nfi\n\nmv \"$DIRECTORY\" \"$OUTDIR\"\n"; > }; > + 22E849A80E2E0E8F002591A4 /* Patch */ = { > + isa = PBXShellScriptBuildPhase; > + buildActionMask = 2147483647; > + files = ( > + ); > + inputPaths = ( > + ); > + name = Patch; > + outputPaths = ( > + ); > + runOnlyForDeploymentPostprocessing = 0; > + shellPath = /bin/sh; > + shellScript = > "GLCDIR=\"external/quesoglc/\"\nPATCHDIR=\"Resources/\"\nPATCH0=\"quesoglc_inline_0.diff\" > # Fixes inline function linking error on Leopard systems (bug #11940)\n\nif > [ ! -d \"$GLCDIR\" ]; then\n echo \"$GLCDIR does not exist. QuesoGLC could > not be patched.\" >&2\n exit 1\nfi\n\nif [ ! -e \"$PATCHDIR\"\"$PATCH0\" ]; > then\n echo \"$PATCHDIR$PATCH0 does not exist. QuesoGLC could not be > patched.\" >&2\n exit 1\nfi\n\n## Patch 0 ##\n\n# Check if the patch > already exists in the QuesoGLC directory.\n# If so, assume the patch has > already been applied.\nif [ ! -e \"$GLCDIR\"\"$PATCH0\" ]; then\n\n # Copy > patch to QuesoGLC directory\n cp -f \"$PATCHDIR\"\"$PATCH0\" \"$GLCDIR\"\n > if [ $? -ne 0 ]; then\n echo \"Unable to copy patch $PATCHDIR$PATCH0 to > $GLCDIR.\" >&2\n exit 1\n fi\n \n cd \"$GLCDIR\"\n patch -p0 < > \"$PATCH0\"\n \n if [ $? -ne 0 ]; then\n echo \"Unable to patch > QuesoGLC using $GLCDIR$PATCH0 as the patch command returned with an error. > $?\" >&2\n exit 1\n fi\n \n cd -\nfi # ~Patch 0\n"; > + }; > /* End PBXShellScriptBuildPhase section */ > > /* Begin PBXSourcesBuildPhase section */ > > --- src/ofont.h.orig 2008-06-19 12:00:54.000000000 -0700 > +++ src/ofont.h 2008-07-06 15:12:56.000000000 -0700 > @@ -54,24 +54,87 @@ > GLfloat* outVec, __GLCcontext* inContext, > GLfloat inScaleX, GLfloat inScaleY); > #ifndef GLC_FT_CACHE > -inline void* __glcFontOpen(__GLCfont* This, __GLCcontext* inContext); > -inline void __glcFontClose(__GLCfont* This); > +static inline void* __glcFontOpen(__GLCfont* This, __GLCcontext* > inContext); > +static inline void __glcFontClose(__GLCfont* This); > #endif > GLboolean __glcFontPrepareGlyph(__GLCfont* This, __GLCcontext* inContext, > GLfloat inScaleX, GLfloat inScaleY, > GLCulong inGlyphIndex); > -inline GLboolean __glcFontGetBitmapSize(__GLCfont* This, GLint* outWidth, > +static inline GLboolean __glcFontGetBitmapSize(__GLCfont* This, GLint* > outWidth, > GLint *outHeight, GLint* > outBoundingBox, > GLfloat inScaleX, GLfloat inScaleY, > int inFactor, __GLCcontext* > inContext); > -inline GLfloat* __glcFontGetMaxMetric(__GLCfont* This, GLfloat* outVec, > +static inline GLfloat* __glcFontGetMaxMetric(__GLCfont* This, GLfloat* > outVec, > __GLCcontext* inContext); > -inline GLboolean __glcFontOutlineDecompose(__GLCfont* This, > +static inline GLboolean __glcFontOutlineDecompose(__GLCfont* This, > __GLCrendererData* inData, > __GLCcontext* inContext); > -inline GLboolean __glcFontGetBitmap(__GLCfont* This, GLint inWidth, > +static inline GLboolean __glcFontGetBitmap(__GLCfont* This, GLint inWidth, > GLint inHeight, void* inBuffer, > __GLCcontext* inContext); > -inline GLboolean __glcFontOutlineEmpty(__GLCfont* This, > +static inline GLboolean __glcFontOutlineEmpty(__GLCfont* This, > __GLCcontext* inContext); > + > +/** Inline function definitions **/ > + > +#ifndef GLC_FT_CACHE > +/* Open the font file */ > +static inline void* __glcFontOpen(__GLCfont* This, __GLCcontext* inContext) > +{ > + return __glcFaceDescOpen(This->faceDesc, inContext); > +} > + > +/* Close the font file */ > +static inline void __glcFontClose(__GLCfont* This) > +{ > + __glcFaceDescClose(This->faceDesc); > +} > +#endif > + > +/* Get the size of the bitmap in which the glyph will be rendered */ > +static inline GLboolean __glcFontGetBitmapSize(__GLCfont* This, GLint* > outWidth, > + GLint *outHeight, GLint* > outBoundingBox, > + GLfloat inScaleX, GLfloat inScaleY, > + int inFactor, __GLCcontext* > inContext) > +{ > + return __glcFaceDescGetBitmapSize(This->faceDesc, outWidth, outHeight, > + outBoundingBox, inScaleX, inScaleY, > + inFactor, inContext); > +} > + > +/* Get the maximum metrics of a face that is the bounding box that encloses > + * every glyph of the face, and the maximum advance of the face. > + */ > +static inline GLfloat* __glcFontGetMaxMetric(__GLCfont* This, GLfloat* > outVec, > + __GLCcontext* inContext) > +{ > + return __glcFaceDescGetMaxMetric(This->faceDesc, outVec, inContext); > +} > + > +/* Decompose the outline of a glyph */ > +static inline GLboolean __glcFontOutlineDecompose(__GLCfont* This, > + __GLCrendererData* inData, > + __GLCcontext* inContext) > +{ > + return __glcFaceDescOutlineDecompose(This->faceDesc, inData, inContext); > +} > + > +/* Render the glyph in a bitmap */ > +static inline GLboolean __glcFontGetBitmap(__GLCfont* This, GLint inWidth, > + GLint inHeight, void* inBuffer, > + __GLCcontext* inContext) > +{ > + return __glcFaceDescGetBitmap(This->faceDesc, inWidth, inHeight, > inBuffer, > + inContext); > +} > + > +/* Chek if the outline of the glyph is empty (which means it is a spacing > + * character). > + */ > +static inline GLboolean __glcFontOutlineEmpty(__GLCfont* This, > + __GLCcontext* inContext) > +{ > + return __glcFaceDescOutlineEmpty(This->faceDesc, inContext); > +} > + > #endif /* __glc_ofont_h */ > --- src/ofont.c.orig 2008-06-19 12:00:54.000000000 -0700 > +++ src/ofont.c 2008-07-06 14:40:23.000000000 -0700 > @@ -281,25 +281,6 @@ > } > > > - > -#ifndef GLC_FT_CACHE > -/* Open the font file */ > -inline void* __glcFontOpen(__GLCfont* This, __GLCcontext* inContext) > -{ > - return __glcFaceDescOpen(This->faceDesc, inContext); > -} > - > - > - > -/* Close the font file */ > -inline void __glcFontClose(__GLCfont* This) > -{ > - __glcFaceDescClose(This->faceDesc); > -} > -#endif > - > - > - > /* Load a glyph of the current font face and stores the corresponding data > in > * the corresponding face. The size of the glyph is given by inScaleX and > * inScaleY. 'inGlyphIndex' contains the index of the glyph in the font > file. > @@ -318,57 +299,3 @@ > return result; > } > > - > - > -/* Get the size of the bitmap in which the glyph will be rendered */ > -inline GLboolean __glcFontGetBitmapSize(__GLCfont* This, GLint* outWidth, > - GLint *outHeight, GLint* > outBoundingBox, > - GLfloat inScaleX, GLfloat inScaleY, > - int inFactor, __GLCcontext* > inContext) > -{ > - return __glcFaceDescGetBitmapSize(This->faceDesc, outWidth, outHeight, > - outBoundingBox, inScaleX, inScaleY, > - inFactor, inContext); > -} > - > - > - > -/* Get the maximum metrics of a face that is the bounding box that encloses > - * every glyph of the face, and the maximum advance of the face. > - */ > -inline GLfloat* __glcFontGetMaxMetric(__GLCfont* This, GLfloat* outVec, > - __GLCcontext* inContext) > -{ > - return __glcFaceDescGetMaxMetric(This->faceDesc, outVec, inContext); > -} > - > - > - > -/* Decompose the outline of a glyph */ > -inline GLboolean __glcFontOutlineDecompose(__GLCfont* This, > - __GLCrendererData* inData, > - __GLCcontext* inContext) > -{ > - return __glcFaceDescOutlineDecompose(This->faceDesc, inData, inContext); > -} > - > - > - > -/* Render the glyph in a bitmap */ > -inline GLboolean __glcFontGetBitmap(__GLCfont* This, GLint inWidth, > - GLint inHeight, void* inBuffer, > - __GLCcontext* inContext) > -{ > - return __glcFaceDescGetBitmap(This->faceDesc, inWidth, inHeight, > inBuffer, > - inContext); > -} > - > - > - > -/* Chek if the outline of the glyph is empty (which means it is a spacing > - * character). > - */ > -inline GLboolean __glcFontOutlineEmpty(__GLCfont* This, __GLCcontext* > inContext) > -{ > - return __glcFaceDescOutlineEmpty(This->faceDesc, inContext); > -} > > _______________________________________________ > Warzone-dev mailing list > [email protected] > https://mail.gna.org/listinfo/warzone-dev > > _______________________________________________ Warzone-dev mailing list [email protected] https://mail.gna.org/listinfo/warzone-dev
