Hi,

> http://build-failures.rhaalovely.net/powerpc/2019-10-11/games/xmoto.log
> http://build-failures.rhaalovely.net/sparc64/2019-10-11/games/xmoto.log

This is happening since the font fix on base-clang archs [0]

Upstream has a better fix than FreeBSD [1], that uses TR1's
unordered_map, standardised in C++11. The problem is that it would
need further modifications because base-clang can't find
<tr1/unordered_map> OOTB.

So to simplify things, with the below diff, all C++>=11 capable
compilers will use the standardised unordered_map, and base-gcc the
TR1 version.

On macppc, it builds and works fine with any [2] gcc used. I've
removed the COMPILER line so it builds quite faster using base-gcc.
On amd64, the font issue is still fixed :)

While here, i've regen WANTLIB, so it's pretty.

Comments/feedback are welcome,

Charlène.


[0] https://marc.info/?l=openbsd-ports&m=157020747523110&w=2
[1]
https://github.com/xmoto/xmoto/commit/be99b6d080751eb7b8b69ede64d136f227467197
[2] https://bin.charlenew.xyz/xmoto.log


Index: Makefile
===================================================================
RCS file: /cvs/ports/games/xmoto/Makefile,v
retrieving revision 1.35
diff -u -p -u -p -r1.35 Makefile
--- Makefile    9 Oct 2019 17:59:09 -0000       1.35
+++ Makefile    1 Nov 2019 12:46:17 -0000
@@ -3,7 +3,7 @@
 COMMENT =      challenging 2D motocross platform game
 
 V =            0.5.11
-REVISION =     8
+REVISION =     9
 DISTNAME =     xmoto-${V}-src
 PKGNAME =      xmoto-${V}
 CATEGORIES =   games
@@ -17,10 +17,9 @@ MASTER_SITES =       https://download.tuxfamil
 # GPLv2
 PERMIT_PACKAGE =       Yes
 
-WANTLIB += GL GLU SDL SDL_mixer SDL_net SDL_ttf X11 bz2 c curl iconv intl jpeg
-WANTLIB += ${MODLUA_WANTLIB} m ode png pthread sqlite3 ${COMPILER_LIBCXX} 
xdg-basedir lzma xml2 z
-
-COMPILER =             base-clang ports-gcc base-gcc
+WANTLIB += ${COMPILER_LIBCXX} ${MODLUA_WANTLIB} GL GLU SDL SDL_mixer
+WANTLIB += SDL_net SDL_ttf X11 bz2 c curl iconv intl jpeg lzma m ode
+WANTLIB += png sqlite3 xdg-basedir xml2 z
 
 MODULES=       lang/lua
 MODLUA_SA=     Yes
Index: patches/patch-src_VTexture_h
===================================================================
RCS file: /cvs/ports/games/xmoto/patches/patch-src_VTexture_h,v
retrieving revision 1.1
diff -u -p -u -p -r1.1 patch-src_VTexture_h
--- patches/patch-src_VTexture_h        9 Oct 2019 17:59:09 -0000       1.1
+++ patches/patch-src_VTexture_h        1 Nov 2019 12:46:17 -0000
@@ -10,7 +10,7 @@ Index: src/VTexture.h
    void cleanUnregistredTextures();
  
 -  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<int*> m_textureSizeCacheValues;
  
Index: patches/patch-src_drawlib_DrawLibOpenGL_cpp
===================================================================
RCS file: /cvs/ports/games/xmoto/patches/patch-src_drawlib_DrawLibOpenGL_cpp,v
retrieving revision 1.1
diff -u -p -u -p -r1.1 patch-src_drawlib_DrawLibOpenGL_cpp
--- patches/patch-src_drawlib_DrawLibOpenGL_cpp 9 Oct 2019 17:59:09 -0000       
1.1
+++ patches/patch-src_drawlib_DrawLibOpenGL_cpp 1 Nov 2019 12:46:17 -0000
@@ -10,30 +10,49 @@ Index: src/drawlib/DrawLibOpenGL.cpp
    /*kejo:why not just grrr create a copy contructor*/
    GLFontGlyph(const std::string& i_value,
 -            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();
  
    std::string Value() const;
-@@ -132,11 +132,11 @@ class GLFontManager : public FontManager { (public)
+@@ -132,12 +132,10 @@ class GLFontManager : public FontManager { (public)
  private:
    std::vector<std::string> m_glyphsKeys;
    std::vector<GLFontGlyph*> m_glyphsValues;
 -  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<GLFontGlyphLetter*> m_glyphsLettersValues;
 -  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);
  };
-@@ -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,
 -                       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;
    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 */
Index: patches/patch-src_include_xm_hashmap_h
===================================================================
RCS file: /cvs/ports/games/xmoto/patches/patch-src_include_xm_hashmap_h,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 patch-src_include_xm_hashmap_h
--- patches/patch-src_include_xm_hashmap_h      9 Oct 2019 17:59:09 -0000       
1.2
+++ patches/patch-src_include_xm_hashmap_h      1 Nov 2019 12:46:17 -0000
@@ -1,31 +1,44 @@
 $OpenBSD: patch-src_include_xm_hashmap_h,v 1.2 2019/10/09 17:59:09 kirby 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
 --- src/include/xm_hashmap.h.orig
 +++ src/include/xm_hashmap.h
-@@ -13,13 +13,18 @@
- #include <hash_map>
+@@ -1,25 +1,12 @@
+ #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;
- #endif
+-#endif
 -struct hashcmp_str {
 -  bool operator()(const char* s1, const char* s2) {
 -    if(s1 == NULL || s2 == NULL) {
 -      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;
 -  }
 -};
-+  };
-+}
-+#endif // _LIBCPP_VERSION
++#else
++#include <tr1/unordered_map>
++namespace HashNamespace=std::tr1;
++#endif /* __cplusplus >= 201103L */
  
- #endif
\ No newline at end of file
+-#endif
++#endif /* _XMHASHMAP_H__ */

Reply via email to