Skip to content

Commit eb611d5

Browse files
shawnlaffangenio
authored andcommitted
Update to libgd 2.3.2
1 parent f841d10 commit eb611d5

File tree

6 files changed

+334
-2
lines changed

6 files changed

+334
-2
lines changed

blibgd

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
libiconv-1.17
2+
zlib-1.2.11
3+
jpeg-9c
4+
libXpm-3.5.12
5+
libpng-1.6.37
6+
tiff-4.5.0
7+
freetype-2.10.0
8+
9+
libgd-2.3.2 rebuild

build.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,10 @@ xxrun ./configure $HOSTBUILD --prefix=$OUT --disable-dependency-tracking --enabl
474474
patch_libtool
475475
xxrun make
476476
xxrun make install
477+
# disable next hack as 2.3.2 does not generate gdlib-config
477478
#hack: as we do not use install_bats we need to do some magic (copy features: line)
478-
F=`grep "echo *\"features:" $OUT/bin/gdlib-config | sed -e "s/^[[:blank:]]*//" -e "s/ */ /g" -e "s/\"//g"`
479-
sed "s/^echo features:.*$/$F/" gdlib-config.bat.win-gcc > $OUT/bin/gdlib-config.bat
479+
#F=`grep "echo *\"features:" $OUT/bin/gdlib-config | sed -e "s/^[[:blank:]]*//" -e "s/ */ /g" -e "s/\"//g"`
480+
#sed "s/^echo features:.*$/$F/" gdlib-config.bat.win-gcc > $OUT/bin/gdlib-config.bat
480481
;;
481482

482483
# ----------------------------------------------------------------------------
Lines changed: 241 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
Only in libgd-2.2.3-new: .vscode
2+
diff -ur libgd-2.2.3/CMakeLists.txt libgd-2.2.3-new/CMakeLists.txt
3+
--- libgd-2.2.3/CMakeLists.txt 2016-07-21 10:32:27.000000000 +0200
4+
+++ libgd-2.2.3-new/CMakeLists.txt 2016-09-24 10:02:06.156526100 +0200
5+
@@ -203,6 +207,7 @@
6+
ADD_DEFINITIONS("/D_CRT_SECURE_NO_DEPRECATE")
7+
endif(NOT MINGW AND MSVC_VERSION GREATER 1399)
8+
if (MINGW OR MSYS)
9+
+ SET(GD_LIB gd)
10+
ADD_DEFINITIONS("-mms-bitfields") # -m32
11+
endif (MINGW OR MSYS)
12+
else (WIN32)
13+
@@ -278,6 +282,6 @@
14+
"^${PROJECT_SOURCE_DIR}/old/"
15+
"^${PROJECT_SOURCE_DIR}/bld/"
16+
)
17+
-install(FILES ${top_level_DOCFILES} DESTINATION ${DOC_DIR})
18+
+# install(FILES ${top_level_DOCFILES} DESTINATION ${DOC_DIR})
19+
INCLUDE(CPack)
20+
21+
diff -ur libgd-2.2.3/config/gdlib.pc.in libgd-2.2.3-new/config/gdlib.pc.in
22+
--- libgd-2.2.3/config/gdlib.pc.in 2016-06-03 10:34:39.000000000 +0200
23+
+++ libgd-2.2.3-new/config/gdlib.pc.in 2016-09-25 11:09:38.702045800 +0200
24+
@@ -1,13 +1,13 @@
25+
-prefix=@prefix@
26+
-exec_prefix=@exec_prefix@
27+
-libdir=@libdir@
28+
-includedir=@includedir@
29+
+prefix=@CMAKE_INSTALL_PREFIX@
30+
+exec_prefix=${prefix}
31+
+libdir=${prefix}/lib
32+
+includedir=${prefix}/include/
33+
34+
Name: gd
35+
Description: GD graphics library
36+
-Version: @VERSION@
37+
-Requires:
38+
-Requires.private: @PKG_REQUIRES_PRIVATES@
39+
-Cflags: -I${includedir}
40+
-Libs.private: @LIBS_PRIVATES@ @LIBICONV@
41+
+Version: @GD_VERSION_STRING@
42+
+Requires:
43+
+Requires.private: @PKG_REQUIRES_PRIVATES@
44+
+Cflags: -I${includedir}
45+
+Libs.private: @PRIVLIBLIST@
46+
Libs: -L${libdir} -lgd
47+
diff -ur libgd-2.2.4/src/CMakeLists.txt.orig libgd-2.2.4/src/CMakeLists.txt
48+
--- libgd-2.2.4/src/CMakeLists.txt.orig 2017-01-18 06:01:19.000000000 -0500
49+
+++ libgd-2.2.4/src/CMakeLists.txt 2017-01-23 13:39:47.661420900 -0500
50+
@@ -105,14 +105,14 @@
51+
add_library(gd_programs_lib STATIC ${GD_PROGRAMS_LIB_SRC_FILES})
52+
endif()
53+
54+
-if (WIN32 AND NOT MINGW AND NOT MSYS)
55+
+if (WIN32)
56+
# SET_TARGET_PROPERTIES(${GD_LIB} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:msvcrt.lib")
57+
58+
if (BUILD_STATIC_LIBS)
59+
SET_PROPERTY(TARGET ${GD_LIB_STATIC} APPEND PROPERTY COMPILE_DEFINITIONS NONDLL=1)
60+
endif()
61+
62+
-ENDIF(WIN32 AND NOT MINGW AND NOT MSYS)
63+
+ENDIF(WIN32)
64+
65+
if (MINGW OR MSYS)
66+
ADD_DEFINITIONS("-mms-bitfields")
67+
@@ -157,7 +157,7 @@
68+
endif()
69+
70+
install(TARGETS ${GD_INSTALL_TARGETS}
71+
- RUNTIME DESTINATION bin
72+
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
73+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
74+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
75+
install(PROGRAMS bdftogd DESTINATION bin)
76+
@@ -176,7 +179,7 @@
77+
gdfontt.h
78+
gdfx.h
79+
gdpp.h
80+
- DESTINATION include)
81+
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
82+
83+
CONFIGURE_FILE(../config/gdlib.pc.cmake gdlib.pc @ONLY)
84+
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/gdlib.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
85+
diff -ur libgd-2.2.3/src/webpng.c libgd-2.2.3-new/src/webpng.c
86+
--- libgd-2.2.3/src/webpng.c 2016-06-03 10:34:39.000000000 +0200
87+
+++ libgd-2.2.3-new/src/webpng.c 2016-09-24 09:49:11.582098800 +0200
88+
@@ -18,6 +18,25 @@
89+
#include <unistd.h>
90+
#endif
91+
92+
+#if defined (_WIN32)
93+
+int opterr = 1, /* if error message should be printed */
94+
+ optind = 1, /* index into parent argv vector */
95+
+ optopt, /* character checked for validity */
96+
+ optreset; /* reset getopt */
97+
+char *optarg; /* argument associated with option */
98+
+
99+
+#define BADCH (int)'?'
100+
+#define BADARG (int)':'
101+
+#define EMSG ""
102+
+
103+
+/*
104+
+* getopt --
105+
+* Parse argc/argv argument vector.
106+
+*/
107+
+int getopt(int nargc, char * const nargv[], const char *ostr);
108+
+
109+
+#endif // defined (_WIN32)
110+
+
111+
#ifdef __clang__
112+
/* Workaround broken clang behavior: https://llvm.org/bugs/show_bug.cgi?id=20144 */
113+
#undef strcmp
114+
@@ -295,3 +314,66 @@
115+
/* All's well that ends well. */
116+
return 0;
117+
}
118+
+
119+
+#if defined (_WIN32)
120+
+/*
121+
+* getopt --
122+
+* Parse argc/argv argument vector.
123+
+*/
124+
+int
125+
+ getopt(int nargc, char * const nargv[], const char *ostr)
126+
+{
127+
+ static char *place = EMSG; /* option letter processing */
128+
+ const char *oli; /* option letter list index */
129+
+
130+
+ if (optreset || !*place) { /* update scanning pointer */
131+
+ optreset = 0;
132+
+ if (optind >= nargc || *(place = nargv[optind]) != '-') {
133+
+ place = EMSG;
134+
+ return (-1);
135+
+ }
136+
+ if (place[1] && *++place == '-') { /* found "--" */
137+
+ ++optind;
138+
+ place = EMSG;
139+
+ return (-1);
140+
+ }
141+
+ } /* option letter okay? */
142+
+ if ((optopt = (int)*place++) == (int)':' ||
143+
+ !(oli = strchr(ostr, optopt))) {
144+
+ /*
145+
+ * if the user didn't specify '-' as an option,
146+
+ * assume it means -1.
147+
+ */
148+
+ if (optopt == (int)'-')
149+
+ return (-1);
150+
+ if (!*place)
151+
+ ++optind;
152+
+ if (opterr && *ostr != ':')
153+
+ (void)printf("illegal option -- %c\n", optopt);
154+
+ return (BADCH);
155+
+ }
156+
+ if (*++oli != ':') { /* don't need argument */
157+
+ optarg = NULL;
158+
+ if (!*place)
159+
+ ++optind;
160+
+ }
161+
+ else { /* need an argument */
162+
+ if (*place) /* no white space */
163+
+ optarg = place;
164+
+ else if (nargc <= ++optind) { /* no arg */
165+
+ place = EMSG;
166+
+ if (*ostr == ':')
167+
+ return (BADARG);
168+
+ if (opterr)
169+
+ (void)printf("option requires an argument -- %c\n", optopt);
170+
+ return (BADCH);
171+
+ }
172+
+ else /* white space */
173+
+ optarg = nargv[optind];
174+
+ place = EMSG;
175+
+ ++optind;
176+
+ }
177+
+ return (optopt); /* dump back option letter */
178+
+}
179+
+#endif //defined (_WIN32)
180+
+
181+
--- libgd-2.2.5/src/gd.h.orig 2017-10-02 13:50:31.857516500 +0300
182+
+++ libgd-2.2.5/src/gd.h 2017-10-02 14:03:15.317333300 +0300
183+
@@ -46,34 +46,31 @@
184+
185+
/* http://gcc.gnu.org/wiki/Visibility */
186+
#if defined(_WIN32) || defined(CYGWIN) || defined(_WIN32_WCE)
187+
-# ifdef BGDWIN32
188+
-# ifdef NONDLL
189+
-# define BGD_EXPORT_DATA_PROT
190+
-# else
191+
-# ifdef __GNUC__
192+
-# define BGD_EXPORT_DATA_PROT __attribute__ ((__dllexport__))
193+
-# else
194+
-# define BGD_EXPORT_DATA_PROT __declspec(dllexport)
195+
-# endif
196+
-# endif
197+
-# else
198+
-# ifdef __GNUC__
199+
-# define BGD_EXPORT_DATA_PROT __attribute__ ((__dllimport__))
200+
-# else
201+
-# define BGD_EXPORT_DATA_PROT __declspec(dllimport)
202+
-# endif
203+
-# endif
204+
-# define BGD_STDCALL __stdcall
205+
-# define BGD_EXPORT_DATA_IMPL
206+
+ #ifdef NONDLL // static build
207+
+ #define BGD_EXPORT_DATA_PROT
208+
+ #define BGD_STDCALL
209+
+ #else
210+
+ #ifdef BGDWIN32 // defined if we are building the GD DLL (instead of using it)
211+
+ #define BGD_EXPORT_DATA_PROT __attribute__ ((dllexport))
212+
+ #else
213+
+ #define BGD_EXPORT_DATA_PROT __attribute__ ((dllimport))
214+
+ #endif
215+
+ #ifdef __MINGW32__
216+
+ #define BGD_STDCALL
217+
+ #else
218+
+ #define BGD_STDCALL __stdcall
219+
+ #endif
220+
+ #endif
221+
+ #define BGD_EXPORT_DATA_IMPL
222+
#else
223+
-# if defined(__GNUC__) || defined(__clang__)
224+
-# define BGD_EXPORT_DATA_PROT __attribute__ ((__visibility__ ("default")))
225+
-# define BGD_EXPORT_DATA_IMPL __attribute__ ((__visibility__ ("hidden")))
226+
-# else
227+
-# define BGD_EXPORT_DATA_PROT
228+
-# define BGD_EXPORT_DATA_IMPL
229+
-# endif
230+
-# define BGD_STDCALL
231+
+ #if defined(__GNUC__) || defined(__clang__)
232+
+ #define BGD_EXPORT_DATA_PROT __attribute__ ((visibility ("default")))
233+
+ #define BGD_EXPORT_DATA_IMPL __attribute__ ((visibility ("hidden")))
234+
+ #else
235+
+ #define BGD_EXPORT_DATA_PROT
236+
+ #define BGD_EXPORT_DATA_IMPL
237+
+ #endif
238+
+ #define BGD_STDCALL
239+
#endif
240+
241+
#define BGD_DECLARE(rt) BGD_EXPORT_DATA_PROT rt BGD_STDCALL
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
--- libgd-2.3.0/src/annotate.c.orig 2020-03-24 14:40:28.948198600 +0300
2+
+++ libgd-2.3.0/src/annotate.c 2020-03-24 14:40:39.318399700 +0300
3+
@@ -15,6 +15,60 @@
4+
*/
5+
6+
enum { left, center, right };
7+
+
8+
+#ifdef _WIN32
9+
+size_t getline(char **lineptr, size_t *n, FILE *stream) {
10+
+ char *bufptr = NULL;
11+
+ char *p = bufptr;
12+
+ size_t size;
13+
+ int c;
14+
+
15+
+ if (lineptr == NULL) {
16+
+ return -1;
17+
+ }
18+
+ if (stream == NULL) {
19+
+ return -1;
20+
+ }
21+
+ if (n == NULL) {
22+
+ return -1;
23+
+ }
24+
+ bufptr = *lineptr;
25+
+ size = *n;
26+
+
27+
+ c = fgetc(stream);
28+
+ if (c == EOF) {
29+
+ return -1;
30+
+ }
31+
+ if (bufptr == NULL) {
32+
+ bufptr = malloc(128);
33+
+ if (bufptr == NULL) {
34+
+ return -1;
35+
+ }
36+
+ size = 128;
37+
+ }
38+
+ p = bufptr;
39+
+ while(c != EOF) {
40+
+ if ((p - bufptr) > (size - 1)) {
41+
+ size = size + 128;
42+
+ bufptr = realloc(bufptr, size);
43+
+ if (bufptr == NULL) {
44+
+ return -1;
45+
+ }
46+
+ }
47+
+ *p++ = c;
48+
+ if (c == '\n') {
49+
+ break;
50+
+ }
51+
+ c = fgetc(stream);
52+
+ }
53+
+
54+
+ *p++ = '\0';
55+
+ *lineptr = bufptr;
56+
+ *n = size;
57+
+
58+
+ return p - bufptr - 1;
59+
+}
60+
+#endif
61+
62+
int main(int argc, char *argv[])
63+
{
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--- libgd-2.3.0/src/gd_topal.c.orig 2020-03-24 14:30:18.368423900 +0300
2+
+++ libgd-2.3.0/src/gd_topal.c 2020-03-24 14:34:05.629546300 +0300
3+
@@ -1527,8 +1527,12 @@
4+
/* liq requires 16 byte aligned heap memory */
5+
static void *malloc16(size_t size)
6+
{
7+
+#ifdef _WIN32
8+
+ return _aligned_malloc(16, size);
9+
+#else
10+
void *p;
11+
return posix_memalign(&p, 16, size) == 0 ? p : NULL;
12+
+#endif
13+
}
14+
#endif
15+

sources.list

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ https://download.savannah.gnu.org/releases/freetype/freetype-2.11.0.tar.gz
114114
https://bitbucket.org/libgd/gd-libgd/downloads/libgd-2.1.1.tar.gz
115115
https://github.com/libgd/libgd/releases/download/gd-2.2.4/libgd-2.2.4.tar.gz
116116
https://github.com/libgd/libgd/releases/download/gd-2.2.5/libgd-2.2.5.tar.gz
117+
https://github.com/libgd/libgd/releases/download/gd-2.3.2/libgd-2.3.2.tar.gz
117118

118119
#### giflib
119120
#URL http://sourceforge.net/projects/giflib/files/
@@ -219,12 +220,14 @@ ftp://ftp.gnu.org/gnu/mpfr/mpfr-3.1.3.tar.gz
219220
ftp://ftp.gnu.org/gnu/mpfr/mpfr-3.1.4.tar.gz
220221
ftp://ftp.gnu.org/gnu/mpfr/mpfr-3.1.5.tar.gz
221222
ftp://ftp.gnu.org/gnu/mpfr/mpfr-4.0.2.tar.gz
223+
https://ftp.gnu.org/gnu/mpfr/mpfr-4.2.0.tar.gz
222224

223225
#### mpc
224226
#URL http://www.multiprecision.org/mpc/download.html
225227
http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar.gz
226228
http://www.multiprecision.org/mpc/download/mpc-1.0.3.tar.gz
227229
https://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz
230+
https://ftp.gnu.org/gnu/mpc/mpc-1.3.1.tar.gz
228231

229232
#### freeglut
230233
#URL http://sourceforge.net/projects/freeglut/files/freeglut/

0 commit comments

Comments
 (0)