1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-22 04:17:44 +00:00

- Add missing USES and dependency on libX11

- Simplify hash_map handling, C++11 way (fixed build on CURRENT)
This commit is contained in:
Dmitry Marakasov 2019-10-24 14:30:30 +00:00
parent 395f224edf
commit 361c2522a3
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=515341
2 changed files with 27 additions and 20 deletions

View File

@ -23,10 +23,12 @@ LIB_DEPENDS= libode.so:devel/ode \
BROKEN_powerpc64= fails to compile: hashtable.h: no match for call to __gnu_cxx::hash
GNU_CONFIGURE= yes
USES= compiler:features dos2unix gmake jpeg localbase lua:51 sqlite
USES= compiler:features dos2unix gl gmake gnome jpeg localbase lua:51 sdl sqlite xorg
USE_GNOME= libxml2
USE_SDL= sdl mixer ttf net
USE_GL= gl glu
USE_CXXSTD= c++11
USE_XORG= x11
DOS2UNIX_GLOB= *.cpp *.h
CPPFLAGS+= -isystem${LUA_INCDIR}

View File

@ -1,28 +1,33 @@
--- src/include/xm_hashmap.h.orig 2011-10-11 20:18:17 UTC
--- src/include/xm_hashmap.h.orig 2019-10-23 11:51:33 UTC
+++ src/include/xm_hashmap.h
@@ -13,13 +13,18 @@
#include <hash_map>
namespace HashNamespace=std;
#endif
@@ -1,25 +1,11 @@
#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>
-namespace HashNamespace=std;
-#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
+#include <unordered_map>
+
+namespace HashNamespace {
+ template <class Key, class T, class Hash = std::hash<Key>, class Pred = std::equal_to<Key>, class Allocator = std::allocator< std::pair<const Key, T> >>
+ using hash_map = std::unordered_map<Key, T, Hash, Pred, Allocator>;
};
#endif