View | Details | Raw Unified | Return to bug 229699
Collapse All | Expand All

(-)b/games/freeorion/Makefile (+1 lines)
Lines 4-9 Link Here
4
PORTNAME=	freeorion
4
PORTNAME=	freeorion
5
DISTVERSIONPREFIX=	v
5
DISTVERSIONPREFIX=	v
6
DISTVERSION=	0.4.8-rc1
6
DISTVERSION=	0.4.8-rc1
7
PORTREVISION=	1
7
CATEGORIES=	games
8
CATEGORIES=	games
8
9
9
MAINTAINER=	amdmi3@FreeBSD.org
10
MAINTAINER=	amdmi3@FreeBSD.org
(-)b/games/freeorion/files/patch-boost168 (+168 lines)
Added Link Here
1
https://github.com/freeorion/freeorion/pull/2221
2
3
--- GG/CMakeLists.txt.orig	2018-06-14 14:12:09 UTC
4
+++ GG/CMakeLists.txt
5
@@ -144,6 +144,16 @@ if(USE_STATIC_LIBS)
6
     )
7
 endif()
8
 
9
+target_compile_definitions(GiGi
10
+    PRIVATE
11
+
12
+        # Starting with boost 1.68 boost::gil integrates support for
13
+        # grayscale-alpha png images, so prefer their implementation
14
+        # instead of our hacky gilext code.
15
+        $<$<VERSION_LESS:${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION},1.68>:GIGI_CONFIG_USE_OLD_IMPLEMENTATION_OF_GIL_PNG_IO>
16
+        $<$<VERSION_GREATER:${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION},1.67>:BOOST_GIL_IO_ENABLE_GRAY_ALPHA>
17
+)
18
+
19
 target_include_directories(GiGi SYSTEM
20
     PRIVATE
21
         ${Boost_INCLUDE_DIRS}
22
--- GG/src/GUI.cpp.orig	2018-06-14 14:12:09 UTC
23
+++ GG/src/GUI.cpp
24
@@ -37,14 +37,19 @@
25
 #include <GG/ZList.h>
26
 
27
 #if GG_HAVE_LIBPNG
28
-# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 7)
29
-#  pragma GCC diagnostic push
30
-#  pragma GCC diagnostic ignored "-Wunused-local-typedefs"
31
+# if GIGI_CONFIG_USE_OLD_IMPLEMENTATION_OF_GIL_PNG_IO
32
+#  if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 7)
33
+#   pragma GCC diagnostic push
34
+#   pragma GCC diagnostic ignored "-Wunused-local-typedefs"
35
+#  endif
36
+#  include "gilext/io/png_io.hpp"
37
+#  include "gilext/io/png_io_v2_compat.hpp"
38
+#  if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 7)
39
+#   pragma GCC diagnostic pop
40
+#  endif
41
+# else
42
+#  include <boost/gil/extension/io/png.hpp>
43
 # endif
44
-# include "gilext/io/png_io.hpp"
45
-# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 7)
46
-#  pragma GCC diagnostic pop
47
-# endif
48
 #endif
49
 
50
 #include <boost/algorithm/string/predicate.hpp>
51
@@ -132,12 +137,15 @@ namespace {
52
         glPopClientAttrib();
53
 
54
         using namespace boost::gil;
55
-        png_write_view(filename,
56
-                       flipped_up_down_view(
57
-                           interleaved_view(Value(size.x),
58
-                                            Value(size.y),
59
-                                            static_cast<rgba8_pixel_t*>(static_cast<void*>(&bytes[0])),
60
-                                            Value(size.x) * sizeof(rgba8_pixel_t))));
61
+        write_view(
62
+            filename,
63
+            flipped_up_down_view(
64
+                interleaved_view(
65
+                    Value(size.x),
66
+                    Value(size.y),
67
+                    static_cast<rgba8_pixel_t*>(static_cast<void*>(&bytes[0])),
68
+                    Value(size.x) * sizeof(rgba8_pixel_t))),
69
+            png_tag());
70
 #endif
71
     }
72
 }
73
--- GG/src/Texture.cpp.orig	2018-06-14 14:12:09 UTC
74
+++ GG/src/Texture.cpp
75
@@ -36,7 +36,12 @@
76
 #include <boost/algorithm/string/case_conv.hpp>
77
 
78
 #if GG_HAVE_LIBPNG
79
-# include "gilext/io/png_dynamic_io.hpp"
80
+# if GIGI_CONFIG_USE_OLD_IMPLEMENTATION_OF_GIL_PNG_IO
81
+#  include "gilext/io/png_dynamic_io.hpp"
82
+#  include "gilext/io/png_io_v2_compat.hpp"
83
+# else
84
+#  include <boost/gil/extension/io/png.hpp>
85
+# endif
86
 #endif
87
 
88
 #include <iostream>
89
@@ -241,12 +246,12 @@ void Texture::Load(const boost::filesystem::path& path
90
         // formats above.
91
 #if GG_HAVE_LIBPNG
92
         if (extension == ".png")
93
-            gil::png_read_image(path, image);
94
+            gil::read_image(filename, image, gil::image_read_settings<gil::png_tag>());
95
         else
96
 #endif
97
 #if GG_HAVE_LIBTIFF
98
         if (extension == ".tif" || extension == ".tiff")
99
-            gil::tiff_read_image(filename, image);
100
+            gil::read_image(filename, image, gil::image_read_settings<gil::tiff_tag>());
101
         else
102
 #endif
103
             throw BadFile("Texture file \"" + filename + "\" does not have a supported file extension");
104
@@ -256,14 +261,14 @@ void Texture::Load(const boost::filesystem::path& path
105
 #if GG_HAVE_LIBPNG
106
         if (extension == ".png") {
107
             gil::rgba8_image_t rgba_image;
108
-            gil::png_read_and_convert_image(path, rgba_image);
109
+            gil::read_and_convert_image(filename, rgba_image, gil::image_read_settings<gil::png_tag>());
110
             image.move_in(rgba_image);
111
         }
112
 #endif
113
 #if GG_HAVE_LIBTIFF
114
         if (extension == ".tif" || extension == ".tiff") {
115
             gil::rgba8_image_t rgba_image;
116
-            gil::tiff_read_and_convert_image(filename, rgba_image);
117
+            gil::read_and_convert_image(filename, rgba_image, gil::image_read_settings<gil::tiff_tag>());
118
             image.move_in(rgba_image);
119
         }
120
 #endif
121
--- GG/src/gilext/io/png_io_v2_compat.hpp.orig	2018-07-20 13:44:48 UTC
122
+++ GG/src/gilext/io/png_io_v2_compat.hpp
123
@@ -0,0 +1,45 @@
124
+#ifndef GILEXT_PNG_IO_V2_COMPAT_H
125
+#define GILEXT_PNG_IO_V2_COMPAT_H
126
+
127
+namespace boost { namespace gil {
128
+
129
+struct png_tag {};
130
+
131
+template< typename Tag>
132
+struct image_read_settings {};
133
+
134
+template< typename String
135
+        , typename Image
136
+        , typename FormatTag
137
+        >
138
+inline
139
+void read_image( const String&    file_name
140
+               , Image&           image
141
+               , const FormatTag& tag
142
+               )
143
+{ boost::gil::png_read_image(file_name, image); }
144
+
145
+template< typename String
146
+        , typename Image
147
+        , typename FormatTag
148
+        >
149
+inline
150
+void read_and_convert_image( const String&    file_name
151
+                           , Image&           image
152
+                           , const FormatTag& tag
153
+                           )
154
+{ boost::gil::png_read_and_convert_image(file_name, image); }
155
+} }
156
+
157
+template< typename String
158
+        , typename View
159
+        , typename FormatTag
160
+        >
161
+inline
162
+void write_view( const String&    file_name
163
+               , const View&      view
164
+               , const FormatTag& tag
165
+               )
166
+{ boost::gil::png_write_view( file_name, view); }
167
+
168
+#endif

Return to bug 229699