xmoto: use upstream fix for the fonts display issue on base-clang archs,
so it builds on base-gcc archs again. Also drop COMPILER line, despite COMPILER_LIBCXX being in WANTLIB; it builds fine with base-gcc. Tested on sparc64 by kirby@, macppc by me, and amd64 by the both of us. OK kirby@ (maintainer)
This commit is contained in:
parent
6d207e36e6
commit
b4a0f86a1a
@ -1,9 +1,9 @@
|
|||||||
# $OpenBSD: Makefile,v 1.35 2019/10/09 17:59:09 kirby Exp $
|
# $OpenBSD: Makefile,v 1.36 2019/11/06 16:19:52 cwen Exp $
|
||||||
|
|
||||||
COMMENT = challenging 2D motocross platform game
|
COMMENT = challenging 2D motocross platform game
|
||||||
|
|
||||||
V = 0.5.11
|
V = 0.5.11
|
||||||
REVISION = 8
|
REVISION = 9
|
||||||
DISTNAME = xmoto-${V}-src
|
DISTNAME = xmoto-${V}-src
|
||||||
PKGNAME = xmoto-${V}
|
PKGNAME = xmoto-${V}
|
||||||
CATEGORIES = games
|
CATEGORIES = games
|
||||||
@ -17,10 +17,9 @@ MASTER_SITES = https://download.tuxfamily.org/xmoto/xmoto/${V}/
|
|||||||
# GPLv2
|
# GPLv2
|
||||||
PERMIT_PACKAGE = Yes
|
PERMIT_PACKAGE = Yes
|
||||||
|
|
||||||
WANTLIB += GL GLU SDL SDL_mixer SDL_net SDL_ttf X11 bz2 c curl iconv intl jpeg
|
WANTLIB += ${COMPILER_LIBCXX} ${MODLUA_WANTLIB} GL GLU SDL SDL_mixer
|
||||||
WANTLIB += ${MODLUA_WANTLIB} m ode png pthread sqlite3 ${COMPILER_LIBCXX} xdg-basedir lzma xml2 z
|
WANTLIB += SDL_net SDL_ttf X11 bz2 c curl iconv intl jpeg lzma m ode
|
||||||
|
WANTLIB += png sqlite3 xdg-basedir xml2 z
|
||||||
COMPILER = base-clang ports-gcc base-gcc
|
|
||||||
|
|
||||||
MODULES= lang/lua
|
MODULES= lang/lua
|
||||||
MODLUA_SA= Yes
|
MODLUA_SA= Yes
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
$OpenBSD: patch-src_VTexture_h,v 1.1 2019/10/09 17:59:09 kirby Exp $
|
$OpenBSD: patch-src_VTexture_h,v 1.2 2019/11/06 16:19:52 cwen Exp $
|
||||||
|
|
||||||
Fix text rendering
|
Fix text rendering
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ Index: src/VTexture.h
|
|||||||
void cleanUnregistredTextures();
|
void cleanUnregistredTextures();
|
||||||
|
|
||||||
- HashNamespace::hash_map<const char*, int*, HashNamespace::hash<const char*>, hashcmp_str> m_textureSizeCache;
|
- HashNamespace::hash_map<const char*, int*, HashNamespace::hash<const char*>, hashcmp_str> m_textureSizeCache;
|
||||||
+ HashNamespace::hash_map<std::string, int*> m_textureSizeCache;
|
+ HashNamespace::unordered_map<std::string, int*> m_textureSizeCache;
|
||||||
std::vector<std::string> m_textureSizeCacheKeys;
|
std::vector<std::string> m_textureSizeCacheKeys;
|
||||||
std::vector<int*> m_textureSizeCacheValues;
|
std::vector<int*> m_textureSizeCacheValues;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
$OpenBSD: patch-src_drawlib_DrawLibOpenGL_cpp,v 1.1 2019/10/09 17:59:09 kirby Exp $
|
$OpenBSD: patch-src_drawlib_DrawLibOpenGL_cpp,v 1.2 2019/11/06 16:19:52 cwen Exp $
|
||||||
|
|
||||||
Fix text rendering
|
Fix text rendering
|
||||||
|
|
||||||
@ -10,30 +10,49 @@ Index: src/drawlib/DrawLibOpenGL.cpp
|
|||||||
/*kejo:why not just grrr create a copy contructor*/
|
/*kejo:why not just grrr create a copy contructor*/
|
||||||
GLFontGlyph(const std::string& i_value,
|
GLFontGlyph(const std::string& i_value,
|
||||||
- HashNamespace::hash_map<const char*, GLFontGlyphLetter*, HashNamespace::hash<const char*>, hashcmp_str>& i_glyphsLetters);
|
- HashNamespace::hash_map<const char*, GLFontGlyphLetter*, HashNamespace::hash<const char*>, hashcmp_str>& i_glyphsLetters);
|
||||||
+ HashNamespace::hash_map<std::string, GLFontGlyphLetter*>& i_glyphsLetters);
|
+ HashNamespace::unordered_map<std::string, GLFontGlyphLetter*>& i_glyphsLetters);
|
||||||
virtual ~GLFontGlyph();
|
virtual ~GLFontGlyph();
|
||||||
|
|
||||||
std::string Value() const;
|
std::string Value() const;
|
||||||
@@ -132,11 +132,11 @@ class GLFontManager : public FontManager { (public)
|
@@ -132,12 +132,10 @@ class GLFontManager : public FontManager { (public)
|
||||||
private:
|
private:
|
||||||
std::vector<std::string> m_glyphsKeys;
|
std::vector<std::string> m_glyphsKeys;
|
||||||
std::vector<GLFontGlyph*> m_glyphsValues;
|
std::vector<GLFontGlyph*> m_glyphsValues;
|
||||||
- HashNamespace::hash_map<const char*, GLFontGlyph*, HashNamespace::hash<const char*>, hashcmp_str> m_glyphs;
|
- HashNamespace::hash_map<const char*, GLFontGlyph*, HashNamespace::hash<const char*>, hashcmp_str> m_glyphs;
|
||||||
+ HashNamespace::hash_map<std::string, GLFontGlyph*> m_glyphs;
|
-
|
||||||
|
+ HashNamespace::unordered_map<std::string, GLFontGlyph*> m_glyphs;
|
||||||
std::vector<std::string> m_glyphsLettersKeys;
|
std::vector<std::string> m_glyphsLettersKeys;
|
||||||
std::vector<GLFontGlyphLetter*> m_glyphsLettersValues;
|
std::vector<GLFontGlyphLetter*> m_glyphsLettersValues;
|
||||||
- HashNamespace::hash_map<const char*, GLFontGlyphLetter*, HashNamespace::hash<const char*>, hashcmp_str> m_glyphsLetters;
|
- HashNamespace::hash_map<const char*, GLFontGlyphLetter*, HashNamespace::hash<const char*>, hashcmp_str> m_glyphsLetters;
|
||||||
+ HashNamespace::hash_map<std::string, GLFontGlyphLetter*> m_glyphsLetters;
|
-
|
||||||
|
+ HashNamespace::unordered_map<std::string, GLFontGlyphLetter*> m_glyphsLetters;
|
||||||
unsigned int getLonguestLineSize(const std::string& i_value, unsigned int i_start = 0, unsigned int i_nbLinesToRead = -1);
|
unsigned int getLonguestLineSize(const std::string& i_value, unsigned int i_start = 0, unsigned int i_nbLinesToRead = -1);
|
||||||
};
|
};
|
||||||
@@ -825,7 +825,7 @@ GLFontGlyph::GLFontGlyph(const std::string& i_value) {
|
|
||||||
|
@@ -825,7 +823,7 @@ GLFontGlyph::GLFontGlyph(const std::string& i_value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFontGlyph::GLFontGlyph(const std::string& i_value,
|
GLFontGlyph::GLFontGlyph(const std::string& i_value,
|
||||||
- HashNamespace::hash_map<const char*, GLFontGlyphLetter*, HashNamespace::hash<const char*>, hashcmp_str>& i_glyphsLetters) {
|
- HashNamespace::hash_map<const char*, GLFontGlyphLetter*, HashNamespace::hash<const char*>, hashcmp_str>& i_glyphsLetters) {
|
||||||
+ HashNamespace::hash_map<std::string, GLFontGlyphLetter*>& i_glyphsLetters) {
|
+ HashNamespace::unordered_map<std::string, GLFontGlyphLetter*>& i_glyphsLetters) {
|
||||||
GLFontGlyph* v_glyph;
|
GLFontGlyph* v_glyph;
|
||||||
std::string v_char;
|
std::string v_char;
|
||||||
|
|
||||||
|
@@ -850,7 +848,7 @@ GLFontGlyph::GLFontGlyph(const std::string& i_value,
|
||||||
|
v_maxHeight = 0;
|
||||||
|
v_curWidth = 0;
|
||||||
|
} else {
|
||||||
|
- v_glyph = i_glyphsLetters[v_char.c_str()];
|
||||||
|
+ v_glyph = i_glyphsLetters[v_char];
|
||||||
|
if(v_glyph != NULL) {
|
||||||
|
if(v_glyph->realHeight() > v_maxHeight)
|
||||||
|
v_maxHeight = v_glyph->realHeight();
|
||||||
|
@@ -967,7 +965,7 @@ FontGlyph* GLFontManager::getGlyph(const std::string&
|
||||||
|
GLFontGlyph *v_glyph;
|
||||||
|
GLFontGlyphLetter *v_glyphLetter;
|
||||||
|
|
||||||
|
- v_glyph = m_glyphs[i_string.c_str()];
|
||||||
|
+ v_glyph = m_glyphs[i_string];
|
||||||
|
if(v_glyph != NULL) return v_glyph;
|
||||||
|
|
||||||
|
/* make sure that chars exists into the hashmap before continuing */
|
||||||
|
@ -1,31 +1,44 @@
|
|||||||
$OpenBSD: patch-src_include_xm_hashmap_h,v 1.2 2019/10/09 17:59:09 kirby Exp $
|
$OpenBSD: patch-src_include_xm_hashmap_h,v 1.3 2019/11/06 16:19:52 cwen Exp $
|
||||||
|
|
||||||
|
Related to patches for font display.
|
||||||
|
|
||||||
|
unordered_map() was standardised in C++11, before that it was in TR1.
|
||||||
|
Using the C++11 version fixes the build with base-clang, while still
|
||||||
|
keeping the TR1 one is needed for building with base-gcc.
|
||||||
|
|
||||||
Index: src/include/xm_hashmap.h
|
Index: src/include/xm_hashmap.h
|
||||||
--- src/include/xm_hashmap.h.orig
|
--- src/include/xm_hashmap.h.orig
|
||||||
+++ src/include/xm_hashmap.h
|
+++ src/include/xm_hashmap.h
|
||||||
@@ -13,13 +13,18 @@
|
@@ -1,25 +1,12 @@
|
||||||
#include <hash_map>
|
#ifndef __XMHASHMAP_H__
|
||||||
|
#define __XMHASHMAP_H__
|
||||||
|
|
||||||
|
-#ifdef __GNUC__
|
||||||
|
-#if (__GNUC__ >= 3)
|
||||||
|
-#include <ext/hash_map>
|
||||||
|
- namespace HashNamespace=__gnu_cxx;
|
||||||
|
-#else
|
||||||
|
-#include <hash_map>
|
||||||
|
-#define HashNamespace std
|
||||||
|
-#endif
|
||||||
|
-#else // #ifdef __GNUC__
|
||||||
|
-#include <hash_map>
|
||||||
|
+#if __cplusplus >= 201103L
|
||||||
|
+#include <unordered_map>
|
||||||
namespace HashNamespace=std;
|
namespace HashNamespace=std;
|
||||||
#endif
|
-#endif
|
||||||
-struct hashcmp_str {
|
-struct hashcmp_str {
|
||||||
- bool operator()(const char* s1, const char* s2) {
|
- bool operator()(const char* s1, const char* s2) {
|
||||||
- if(s1 == NULL || s2 == NULL) {
|
- if(s1 == NULL || s2 == NULL) {
|
||||||
- return false;
|
- return false;
|
||||||
+
|
- }
|
||||||
+#ifdef _LIBCPP_VERSION
|
|
||||||
+namespace __gnu_cxx {
|
|
||||||
+ template<> struct hash<std::string>
|
|
||||||
+ : public unary_function<std::string, size_t>
|
|
||||||
+ {
|
|
||||||
+ size_t operator()(const std::string& s) const
|
|
||||||
+ {
|
|
||||||
+ return hash<const char*>()(s.c_str());
|
|
||||||
}
|
|
||||||
- return strcmp(s1, s2) == 0;
|
- return strcmp(s1, s2) == 0;
|
||||||
- }
|
- }
|
||||||
-};
|
-};
|
||||||
+ };
|
+#else
|
||||||
+}
|
+#include <tr1/unordered_map>
|
||||||
+#endif // _LIBCPP_VERSION
|
+namespace HashNamespace=std::tr1;
|
||||||
|
+#endif /* __cplusplus >= 201103L */
|
||||||
|
|
||||||
#endif
|
-#endif
|
||||||
|
+#endif /* _XMHASHMAP_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user