Revert "libgd: update to 2.3.3"

This reverts commit 607dbfd5b0.

Was broken on mingw32/clang32. For example "dot -c" failed to run.
This commit is contained in:
Christoph Reiter
2022-08-21 18:52:30 +02:00
parent 719313cfa9
commit b73b13dcf5
5 changed files with 266 additions and 86 deletions

View File

@@ -1,17 +0,0 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -86,10 +86,10 @@
else (USE_EXT_GD)
MACRO(GV VER VAR)
- execute_process(
- COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/config/getver.sh ${VER}
- OUTPUT_VARIABLE ${VAR}
- )
+ file (STRINGS "src/gd.h" _VERSION_LINE REGEX "define[ ]+GD_${VER}_VERSION")
+ if ( _VERSION_LINE )
+ string ( REGEX REPLACE ".*define[ ]+GD_${VER}_VERSION[ ]+\"?([^ \"]*)\"?[ ]+.*" "\\1" ${VAR} "${_VERSION_LINE}" )
+ endif ()
ENDMACRO(GV)
GV(MAJOR GDLIB_MAJOR)

View File

@@ -3,8 +3,8 @@
_realname=libgd
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.3.3
pkgrel=1
pkgver=2.3.2
pkgrel=3
pkgdesc="GD is an open source code library for the dynamic creation of images by programmers (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
@@ -19,7 +19,6 @@ depends=("${MINGW_PACKAGE_PREFIX}-libpng"
"${MINGW_PACKAGE_PREFIX}-freetype"
"${MINGW_PACKAGE_PREFIX}-fontconfig"
"${MINGW_PACKAGE_PREFIX}-libimagequant"
"${MINGW_PACKAGE_PREFIX}-libraqm"
"${MINGW_PACKAGE_PREFIX}-libwebp"
"${MINGW_PACKAGE_PREFIX}-xpm-nox"
"${MINGW_PACKAGE_PREFIX}-zlib")
@@ -28,29 +27,24 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-cmake"
"${MINGW_PACKAGE_PREFIX}-ninja"
"${MINGW_PACKAGE_PREFIX}-cc")
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/libgd/libgd/releases/download/gd-${pkgver}/${_realname}-${pkgver}.tar.gz"
"001-mingw-replace-posix_memalign.patch"
"002-get-version.patch"
"003-enable-webpng-annotate.patch")
sha256sums=('dd3f1f0bb016edcc0b2d082e8229c822ad1d02223511997c80461481759b1ed2'
"libgd-export-pkg-config-build-in-subdirs.patch"
"mingw-replace-posix_memalign.patch"
"mingw-getline-link.patch")
sha256sums=('ee0c74852c102140fc590541950127b63a3c6fa4592305c16738d23ed65f8ac3'
'cd8b1a2dc1515d717c7359d787ff08138af449512ed9280859b5a630886a65e1'
'c3e69c7e59c280e5cc561c984c906b5cfa5ee56aff0b173c0febfdbf90cb048f'
'ed5ff3e9a3849c086c0ca33b586718efb584d3f770d6c358e5c2818ca592ac02'
'93ad0e41f6ca1cb20946ef6bd80c988e4876f5c408a1ec31a71f275a5ceedea7')
# Helper macros to help make tasks easier #
apply_patch_with_msg() {
for _patch in "$@"
do
msg2 "Applying ${_patch}"
patch -Nbp1 -i "${srcdir}/${_patch}"
done
}
'b52ec6485d43b511b9b399cda41fc85d5f15f5ebccad1dfc76bb89b451aae512')
prepare() {
cd "${srcdir}/${_realname}-${pkgver}"
apply_patch_with_msg \
001-mingw-replace-posix_memalign.patch \
002-get-version.patch \
003-enable-webpng-annotate.patch
#This patch actually does more than simply export dirs into a subdir
#It also is responsible for creating the pkg_config file and now also
#the gdlib-config file that some build scripts seem to still require
#in spite of that mechanism being depreciated.
patch -Nbp1 -i "${srcdir}/libgd-export-pkg-config-build-in-subdirs.patch"
patch -Nbp1 -i "${srcdir}/mingw-replace-posix_memalign.patch"
patch -Nbp1 -i "${srcdir}/mingw-getline-link.patch"
}
build() {
@@ -58,7 +52,7 @@ build() {
mkdir -p ${srcdir}/build-${MSYSTEM} && cd ${srcdir}/build-${MSYSTEM}
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
${MINGW_PREFIX}/bin/cmake.exe -Wno-dev \
${MINGW_PREFIX}/bin/cmake.exe \
-GNinja \
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
-DBUILD_{SHARED,STATIC}_LIBS=ON \
@@ -73,11 +67,12 @@ build() {
-DENABLE_FREETYPE=ON \
-DENABLE_WEBP=ON \
-DENABLE_LIQ=ON \
-DENABLE_RAQM=ON \
-DENABLE_GD_FORMATS=ON \
-DENABLE_CPP=ON \
-DXPM_XPM_INCLUDE_DIR="${MINGW_PREFIX}/include/X11" \
-DWEBP_INCLUDE_DIR="${MINGW_PREFIX}/include/webp/" \
-DLIQ_INCLUDE_DIR="${MINGW_PREFIX}/include/libimagequant" \
-DFREETYPE_INCLUDE_DIR_freetype2="${MINGW_PREFIX}/include/freetype2" \
-DFREETYPE_INCLUDE_DIRS="${MINGW_PREFIX}/include/freetype2" \
../${_realname}-${pkgver}
${MINGW_PREFIX}/bin/cmake --build ./
@@ -86,7 +81,7 @@ build() {
package() {
cd "${srcdir}/build-${MSYSTEM}"
DESTDIR="${pkgdir}" ${MINGW_PREFIX}/bin/cmake --install .
DESTDIR="${pkgdir}" ${MINGW_PREFIX}/bin/cmake --build ./ --target install
install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
@@ -94,8 +89,6 @@ package() {
files=("/lib/pkgconfig/gdlib.pc")
for f in "${files[@]}"
do
sed "s|${PREFIX_WIN}|${MINGW_PREFIX}|g" -i "${pkgdir}"${MINGW_PREFIX}${f}
sed "s|${MINGW_PREFIX}|\${prefix}|g" -i "${pkgdir}"${MINGW_PREFIX}${f}
sed -i "1s|^|prefix=${MINGW_PREFIX}\\n|" "${pkgdir}"${MINGW_PREFIX}${f}
sed -e "s|${PREFIX_WIN}|${MINGW_PREFIX}|g" -i ${pkgdir}${MINGW_PREFIX}${f}
done
}

View File

@@ -0,0 +1,241 @@
Only in libgd-2.2.3-new: .vscode
diff -ur libgd-2.2.3/CMakeLists.txt libgd-2.2.3-new/CMakeLists.txt
--- libgd-2.2.3/CMakeLists.txt 2016-07-21 10:32:27.000000000 +0200
+++ libgd-2.2.3-new/CMakeLists.txt 2016-09-24 10:02:06.156526100 +0200
@@ -203,6 +207,7 @@
ADD_DEFINITIONS("/D_CRT_SECURE_NO_DEPRECATE")
endif(NOT MINGW AND MSVC_VERSION GREATER 1399)
if (MINGW OR MSYS)
+ SET(GD_LIB gd)
ADD_DEFINITIONS("-mms-bitfields") # -m32
endif (MINGW OR MSYS)
else (WIN32)
@@ -278,6 +282,6 @@
"^${PROJECT_SOURCE_DIR}/old/"
"^${PROJECT_SOURCE_DIR}/bld/"
)
-install(FILES ${top_level_DOCFILES} DESTINATION ${DOC_DIR})
+# install(FILES ${top_level_DOCFILES} DESTINATION ${DOC_DIR})
INCLUDE(CPack)
diff -ur libgd-2.2.3/config/gdlib.pc.in libgd-2.2.3-new/config/gdlib.pc.in
--- libgd-2.2.3/config/gdlib.pc.in 2016-06-03 10:34:39.000000000 +0200
+++ libgd-2.2.3-new/config/gdlib.pc.in 2016-09-25 11:09:38.702045800 +0200
@@ -1,13 +1,13 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${prefix}/lib
+includedir=${prefix}/include/
Name: gd
Description: GD graphics library
-Version: @VERSION@
-Requires:
-Requires.private: @PKG_REQUIRES_PRIVATES@
-Cflags: -I${includedir}
-Libs.private: @LIBS_PRIVATES@ @LIBICONV@
+Version: @GD_VERSION_STRING@
+Requires:
+Requires.private: @PKG_REQUIRES_PRIVATES@
+Cflags: -I${includedir}
+Libs.private: @PRIVLIBLIST@
Libs: -L${libdir} -lgd
diff -ur libgd-2.2.4/src/CMakeLists.txt.orig libgd-2.2.4/src/CMakeLists.txt
--- libgd-2.2.4/src/CMakeLists.txt.orig 2017-01-18 06:01:19.000000000 -0500
+++ libgd-2.2.4/src/CMakeLists.txt 2017-01-23 13:39:47.661420900 -0500
@@ -105,14 +105,14 @@
add_library(gd_programs_lib STATIC ${GD_PROGRAMS_LIB_SRC_FILES})
endif()
-if (WIN32 AND NOT MINGW AND NOT MSYS)
+if (WIN32)
# SET_TARGET_PROPERTIES(${GD_LIB} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:msvcrt.lib")
if (BUILD_STATIC_LIBS)
SET_PROPERTY(TARGET ${GD_LIB_STATIC} APPEND PROPERTY COMPILE_DEFINITIONS NONDLL=1)
endif()
-ENDIF(WIN32 AND NOT MINGW AND NOT MSYS)
+ENDIF(WIN32)
if (MINGW OR MSYS)
ADD_DEFINITIONS("-mms-bitfields")
@@ -157,7 +157,7 @@
endif()
install(TARGETS ${GD_INSTALL_TARGETS}
- RUNTIME DESTINATION bin
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(PROGRAMS bdftogd DESTINATION bin)
@@ -176,7 +179,7 @@
gdfontt.h
gdfx.h
gdpp.h
- DESTINATION include)
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
CONFIGURE_FILE(../config/gdlib.pc.cmake gdlib.pc @ONLY)
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/gdlib.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
diff -ur libgd-2.2.3/src/webpng.c libgd-2.2.3-new/src/webpng.c
--- libgd-2.2.3/src/webpng.c 2016-06-03 10:34:39.000000000 +0200
+++ libgd-2.2.3-new/src/webpng.c 2016-09-24 09:49:11.582098800 +0200
@@ -18,6 +18,25 @@
#include <unistd.h>
#endif
+#if defined (_WIN32)
+int opterr = 1, /* if error message should be printed */
+ optind = 1, /* index into parent argv vector */
+ optopt, /* character checked for validity */
+ optreset; /* reset getopt */
+char *optarg; /* argument associated with option */
+
+#define BADCH (int)'?'
+#define BADARG (int)':'
+#define EMSG ""
+
+/*
+* getopt --
+* Parse argc/argv argument vector.
+*/
+int getopt(int nargc, char * const nargv[], const char *ostr);
+
+#endif // defined (_WIN32)
+
#ifdef __clang__
/* Workaround broken clang behavior: https://llvm.org/bugs/show_bug.cgi?id=20144 */
#undef strcmp
@@ -295,3 +314,66 @@
/* All's well that ends well. */
return 0;
}
+
+#if defined (_WIN32)
+/*
+* getopt --
+* Parse argc/argv argument vector.
+*/
+int
+ getopt(int nargc, char * const nargv[], const char *ostr)
+{
+ static char *place = EMSG; /* option letter processing */
+ const char *oli; /* option letter list index */
+
+ if (optreset || !*place) { /* update scanning pointer */
+ optreset = 0;
+ if (optind >= nargc || *(place = nargv[optind]) != '-') {
+ place = EMSG;
+ return (-1);
+ }
+ if (place[1] && *++place == '-') { /* found "--" */
+ ++optind;
+ place = EMSG;
+ return (-1);
+ }
+ } /* option letter okay? */
+ if ((optopt = (int)*place++) == (int)':' ||
+ !(oli = strchr(ostr, optopt))) {
+ /*
+ * if the user didn't specify '-' as an option,
+ * assume it means -1.
+ */
+ if (optopt == (int)'-')
+ return (-1);
+ if (!*place)
+ ++optind;
+ if (opterr && *ostr != ':')
+ (void)printf("illegal option -- %c\n", optopt);
+ return (BADCH);
+ }
+ if (*++oli != ':') { /* don't need argument */
+ optarg = NULL;
+ if (!*place)
+ ++optind;
+ }
+ else { /* need an argument */
+ if (*place) /* no white space */
+ optarg = place;
+ else if (nargc <= ++optind) { /* no arg */
+ place = EMSG;
+ if (*ostr == ':')
+ return (BADARG);
+ if (opterr)
+ (void)printf("option requires an argument -- %c\n", optopt);
+ return (BADCH);
+ }
+ else /* white space */
+ optarg = nargv[optind];
+ place = EMSG;
+ ++optind;
+ }
+ return (optopt); /* dump back option letter */
+}
+#endif //defined (_WIN32)
+
--- libgd-2.2.5/src/gd.h.orig 2017-10-02 13:50:31.857516500 +0300
+++ libgd-2.2.5/src/gd.h 2017-10-02 14:03:15.317333300 +0300
@@ -46,34 +46,31 @@
/* http://gcc.gnu.org/wiki/Visibility */
#if defined(_WIN32) || defined(CYGWIN) || defined(_WIN32_WCE)
-# ifdef BGDWIN32
-# ifdef NONDLL
-# define BGD_EXPORT_DATA_PROT
-# else
-# ifdef __GNUC__
-# define BGD_EXPORT_DATA_PROT __attribute__ ((__dllexport__))
-# else
-# define BGD_EXPORT_DATA_PROT __declspec(dllexport)
-# endif
-# endif
-# else
-# ifdef __GNUC__
-# define BGD_EXPORT_DATA_PROT __attribute__ ((__dllimport__))
-# else
-# define BGD_EXPORT_DATA_PROT __declspec(dllimport)
-# endif
-# endif
-# define BGD_STDCALL __stdcall
-# define BGD_EXPORT_DATA_IMPL
+ #ifdef NONDLL // static build
+ #define BGD_EXPORT_DATA_PROT
+ #define BGD_STDCALL
+ #else
+ #ifdef BGDWIN32 // defined if we are building the GD DLL (instead of using it)
+ #define BGD_EXPORT_DATA_PROT __attribute__ ((dllexport))
+ #else
+ #define BGD_EXPORT_DATA_PROT __attribute__ ((dllimport))
+ #endif
+ #ifdef __MINGW32__
+ #define BGD_STDCALL
+ #else
+ #define BGD_STDCALL __stdcall
+ #endif
+ #endif
+ #define BGD_EXPORT_DATA_IMPL
#else
-# if defined(__GNUC__) || defined(__clang__)
-# define BGD_EXPORT_DATA_PROT __attribute__ ((__visibility__ ("default")))
-# define BGD_EXPORT_DATA_IMPL __attribute__ ((__visibility__ ("hidden")))
-# else
-# define BGD_EXPORT_DATA_PROT
-# define BGD_EXPORT_DATA_IMPL
-# endif
-# define BGD_STDCALL
+ #if defined(__GNUC__) || defined(__clang__)
+ #define BGD_EXPORT_DATA_PROT __attribute__ ((visibility ("default")))
+ #define BGD_EXPORT_DATA_IMPL __attribute__ ((visibility ("hidden")))
+ #else
+ #define BGD_EXPORT_DATA_PROT
+ #define BGD_EXPORT_DATA_IMPL
+ #endif
+ #define BGD_STDCALL
#endif
#define BGD_DECLARE(rt) BGD_EXPORT_DATA_PROT rt BGD_STDCALL

View File

@@ -1,43 +1,6 @@
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -132,18 +132,18 @@
if (PNG_FOUND)
set(GD_PROGRAMS ${GD_PROGRAMS} gdtopng pngtogd)
- if (NOT WIN32)
+ if (NOT MSVC)
set(GD_PROGRAMS ${GD_PROGRAMS} webpng)
- endif (NOT WIN32)
+ endif (NOT MSVC)
if (ZLIB_FOUND)
set(GD_PROGRAMS ${GD_PROGRAMS} gdparttopng gd2topng pngtogd2)
endif()
endif()
if (FREETYPE_FOUND AND JPEG_FOUND)
- if (NOT WIN32)
+ if (NOT MSVC)
set(GD_PROGRAMS ${GD_PROGRAMS} annotate)
- endif (NOT WIN32)
+ endif (NOT MSVC)
endif()
if (ZLIB_FOUND)
@@ -152,11 +152,6 @@
foreach(program ${GD_PROGRAMS})
add_executable(${program} ${program}.c)
- if (WIN32)
- list(REMOVE_ITEM program webpng.c annotate.c)
- list(REMOVE_ITEM GD_PROGRAMS webpng)
- list(REMOVE_ITEM GD_PROGRAMS annotate)
- endif (WIN32)
if (BUILD_SHARED_LIBS)
target_link_libraries(${program} ${GD_LIB})
--- a/src/annotate.c
+++ b/src/annotate.c
@@ -13,6 +13,60 @@
--- libgd-2.3.0/src/annotate.c.orig 2020-03-24 14:40:28.948198600 +0300
+++ libgd-2.3.0/src/annotate.c 2020-03-24 14:40:39.318399700 +0300
@@ -15,6 +15,60 @@
*/
enum { left, center, right };