Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[giflib] Update to 5.2.1 #18836

Merged
merged 9 commits into from
Jul 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions ports/giflib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,36 @@ cmake_minimum_required(VERSION 3.4)

project(giflib C)

set(GIFLIB_EXPORTS "NOTFOUND" CACHE FILEPATH "The path of the DEF file listing the DLL exports.")

set(GIFLIB_HEADERS
lib/gif_lib.h
gif_lib.h
)

set(GIFLIB_SOURCES
lib/dgif_lib.c
lib/egif_lib.c
lib/gif_err.c
lib/gif_font.c
lib/gif_hash.c
lib/gifalloc.c
lib/openbsd-reallocarray.c
lib/quantize.c
dgif_lib.c
egif_lib.c
gifalloc.c
gif_err.c
gif_font.c
gif_hash.c
openbsd-reallocarray.c
)

add_definitions(-D_CRT_SECURE_NO_WARNINGS)

include(CheckSymbolExists)
check_symbol_exists(reallocarray "stdlib.h" HAVE_REALLOCARRAY)
if(HAVE_REALLOCARRAY)
add_definitions(-DHAVE_REALLOCARRAY)
endif()

add_library(gif ${GIFLIB_SOURCES})
if(BUILD_SHARED_LIBS AND WIN32)
target_sources(gif PRIVATE "${GIFLIB_EXPORTS}")
else()
set(UNUSED "${GIFLIB_EXPORTS}")
endif()

if (NOT GIFLIB_SKIP_HEADERS)
install(FILES ${GIFLIB_HEADERS} DESTINATION include)
Expand Down
4 changes: 0 additions & 4 deletions ports/giflib/CONTROL

This file was deleted.

36 changes: 36 additions & 0 deletions ports/giflib/disable-GifDrawBoxedText8x8-win32.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
diff --git a/gif_font.c b/gif_font.c
index d90783c..b682c7a 100644
--- a/gif_font.c
+++ b/gif_font.c
@@ -204,6 +204,7 @@ GifDrawRectangle(SavedImage *Image,
memset(bp + (i * Image->ImageDesc.Width), color, (size_t)w);
}

+#if !defined(_WIN32)
void
GifDrawBoxedText8x8(SavedImage *Image,
const int x, const int y,
@@ -257,5 +258,6 @@ GifDrawBoxedText8x8(SavedImage *Image,
border + LineCount * GIF_FONT_HEIGHT + border, fg);
}
}
+#endif

/* end */
diff --git a/gif_lib.h b/gif_lib.h
index ebdbd3c..41bf7a2 100644
--- a/gif_lib.h
+++ b/gif_lib.h
@@ -290,10 +290,12 @@ extern void GifDrawRectangle(SavedImage *Image,
const int x, const int y,
const int w, const int d, const int color);

+#if !defined(_WIN32)
extern void GifDrawBoxedText8x8(SavedImage *Image,
const int x, const int y,
const char *legend,
const int border, const int bg, const int fg);
+#endif

#ifdef __cplusplus
}
55 changes: 55 additions & 0 deletions ports/giflib/exports.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
EXPORTS
vicroms marked this conversation as resolved.
Show resolved Hide resolved
DGifCloseFile @1
DGifExtensionToGCB @2
DGifGetCode @3
DGifGetCodeNext @4
DGifGetExtension @5
DGifGetExtensionNext @6
DGifGetImageDesc @7
DGifGetLZCodes @8
DGifGetLine @9
DGifGetPixel @10
DGifGetRecordType @11
DGifGetScreenDesc @12
DGifOpen @13
DGifOpenFileHandle @14
DGifOpenFileName @15
DGifSavedExtensionToGCB @16
DGifSlurp @17
EGifCloseFile @18
EGifGCBToExtension @19
EGifGCBToSavedExtension @20
EGifGetGifVersion @21
EGifOpen @22
EGifOpenFileHandle @23
EGifOpenFileName @24
EGifPutCode @25
EGifPutCodeNext @26
EGifPutComment @27
EGifPutExtension @28
EGifPutExtensionBlock @29
EGifPutExtensionLeader @30
EGifPutExtensionTrailer @31
EGifPutImageDesc @32
EGifPutLine @33
EGifPutPixel @34
EGifPutScreenDesc @35
EGifSetGifVersion @36
EGifSpew @37
FreeLastSavedImage @38
GifAddExtensionBlock @39
GifApplyTranslation @40
GifAsciiTable8x8 @41 DATA
GifBitSize @42
GifDrawBox @43
; needs strtok_r: GifDrawBoxedText8x8 @44
GifDrawRectangle @45
GifDrawText8x8 @46
GifErrorString @47
GifFreeExtensions @48
GifFreeMapObject @49
GifFreeSavedImages @50
GifMakeMapObject @51
GifMakeSavedImage @52
GifUnionColorMap @53
openbsd_reallocarray @54
31 changes: 15 additions & 16 deletions ports/giflib/fix-compile-error.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/lib/dgif_lib.c b/lib/dgif_lib.c
index fddc0d2..7a6ab9c 100644
--- a/lib/dgif_lib.c
+++ b/lib/dgif_lib.c
@@ -54,7 +54,7 @@ DGifOpenFileName(const char *FileName, int *Error)
diff --git a/dgif_lib.c b/dgif_lib.c
index 82fc097..3bb302b 100644
--- a/dgif_lib.c
+++ b/dgif_lib.c
@@ -58,7 +58,7 @@ DGifOpenFileName(const char *FileName, int *Error)
int FileHandle;
GifFileType *GifFile;

Expand All @@ -11,7 +11,7 @@ index fddc0d2..7a6ab9c 100644
if (Error != NULL)
*Error = D_GIF_ERR_OPEN_FAILED;
return NULL;
@@ -81,7 +81,7 @@ DGifOpenFileHandle(int FileHandle, int *Error)
@@ -85,7 +85,7 @@ DGifOpenFileHandle(int FileHandle, int *Error)
if (GifFile == NULL) {
if (Error != NULL)
*Error = D_GIF_ERR_NOT_ENOUGH_MEM;
Expand All @@ -20,7 +20,7 @@ index fddc0d2..7a6ab9c 100644
return NULL;
}

@@ -95,7 +95,7 @@ DGifOpenFileHandle(int FileHandle, int *Error)
@@ -99,7 +99,7 @@ DGifOpenFileHandle(int FileHandle, int *Error)
if (Private == NULL) {
if (Error != NULL)
*Error = D_GIF_ERR_NOT_ENOUGH_MEM;
Expand All @@ -29,7 +29,7 @@ index fddc0d2..7a6ab9c 100644
free((char *)GifFile);
return NULL;
}
@@ -106,7 +106,7 @@ DGifOpenFileHandle(int FileHandle, int *Error)
@@ -110,7 +110,7 @@ DGifOpenFileHandle(int FileHandle, int *Error)
_setmode(FileHandle, O_BINARY); /* Make sure it is in binary mode. */
#endif /* _WIN32 */

Expand All @@ -38,11 +38,11 @@ index fddc0d2..7a6ab9c 100644

/*@-mustfreeonly@*/
GifFile->Private = (void *)Private;
diff --git a/lib/egif_lib.c b/lib/egif_lib.c
index f30b61b..18dc4a2 100644
--- a/lib/egif_lib.c
+++ b/lib/egif_lib.c
@@ -60,10 +60,10 @@ EGifOpenFileName(const char *FileName, const bool TestExistence, int *Error)
diff --git a/egif_lib.c b/egif_lib.c
index 6219af0..8ddda1b 100644
--- a/egif_lib.c
+++ b/egif_lib.c
@@ -67,10 +67,10 @@ EGifOpenFileName(const char *FileName, const bool TestExistence, int *Error)
GifFileType *GifFile;

if (TestExistence)
Expand All @@ -55,7 +55,7 @@ index f30b61b..18dc4a2 100644
S_IREAD | S_IWRITE);

if (FileHandle == -1) {
@@ -73,7 +73,7 @@ EGifOpenFileName(const char *FileName, const bool TestExistence, int *Error)
@@ -80,7 +80,7 @@ EGifOpenFileName(const char *FileName, const bool TestExistence, int *Error)
}
GifFile = EGifOpenFileHandle(FileHandle, Error);
if (GifFile == (GifFileType *) NULL)
Expand All @@ -64,7 +64,7 @@ index f30b61b..18dc4a2 100644
return GifFile;
}

@@ -118,7 +118,7 @@ EGifOpenFileHandle(const int FileHandle, int *Error)
@@ -125,7 +125,7 @@ EGifOpenFileHandle(const int FileHandle, int *Error)
_setmode(FileHandle, O_BINARY); /* Make sure it is in binary mode. */
#endif /* _WIN32 */

Expand All @@ -73,4 +73,3 @@ index f30b61b..18dc4a2 100644

GifFile->Private = (void *)Private;
Private->FileHandle = FileHandle;

48 changes: 5 additions & 43 deletions ports/giflib/msvc-guard-unistd-h.patch
Original file line number Diff line number Diff line change
@@ -1,46 +1,8 @@
diff -Naur a/lib/dgif_lib.c b/lib/dgif_lib.c
--- a/lib/dgif_lib.c 2016-04-02 21:34:00.000000000 +0600
+++ b/lib/dgif_lib.c 2017-04-21 07:06:48.781271400 +0700
@@ -12,7 +12,9 @@
#include <limits.h>
#include <stdint.h>
#include <fcntl.h>
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#include <stdio.h>
#include <string.h>

diff -Naur a/lib/egif_lib.c b/lib/egif_lib.c
--- a/lib/egif_lib.c 2016-01-22 16:36:36.000000000 +0600
+++ b/lib/egif_lib.c 2017-04-21 07:07:08.728159900 +0700
@@ -8,7 +8,9 @@

*****************************************************************************/

+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
diff -Naur a/lib/gif_hash.c b/lib/gif_hash.c
--- a/lib/gif_hash.c 2014-05-16 17:46:53.000000000 +0700
+++ b/lib/gif_hash.c 2017-04-21 07:07:17.718719500 +0700
@@ -11,7 +11,9 @@

*****************************************************************************/

+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#include <stdint.h>
#include <stdlib.h>
#include <fcntl.h>
diff -Naur a/lib/gif_hash.h b/lib/gif_hash.h
--- a/lib/gif_hash.h 2014-05-16 17:46:53.000000000 +0700
+++ b/lib/gif_hash.h 2017-04-21 07:07:32.316346800 +0700
@@ -7,7 +7,9 @@
diff --git a/gif_hash.h b/gif_hash.h
index 6a1b585..e6712e8 100644
--- a/gif_hash.h
+++ b/gif_hash.h
@@ -9,7 +9,9 @@ SPDX-License-Identifier: MIT
#ifndef _GIF_HASH_H_
#define _GIF_HASH_H_

Expand Down
27 changes: 14 additions & 13 deletions ports/giflib/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

set(GIFLIB_VERSION 5.1.4)
set(GIFLIB_VERSION 5.2.1)

set(EXTRA_PATCHES "")
if (VCPKG_TARGET_IS_WINDOWS)
set(ADDITIONAL_PATCH "fix-compile-error.patch")
list(APPEND EXTRA_PATCHES fix-compile-error.patch)
endif()

vcpkg_from_sourceforge(
OUT_SOURCE_PATH SOURCE_PATH
REPO "giflib"
FILENAME "giflib-${GIFLIB_VERSION}.tar.bz2"
SHA512 32b5e342056c210e6478e9cb3b6ceec9594dcfaf34feea1eb4dad633a081ed4465bceee578c19165907cb47cb83912ac359ceea666a8e07dbbb5420f9928f96d
FILENAME "giflib-${GIFLIB_VERSION}.tar.gz"
SHA512 4550e53c21cb1191a4581e363fc9d0610da53f7898ca8320f0d3ef6711e76bdda2609c2df15dc94c45e28bff8de441f1227ec2da7ea827cb3c0405af4faa4736
PATCHES
msvc-guard-unistd-h.patch
${ADDITIONAL_PATCH}
disable-GifDrawBoxedText8x8-win32.patch # MSVC doesn't have strtok_r
${EXTRA_PATCHES}
)

file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
"-DGIFLIB_EXPORTS=${CMAKE_CURRENT_LIST_DIR}/exports.def"
OPTIONS_DEBUG
-DGIFLIB_SKIP_HEADERS=ON
)

vcpkg_install_cmake()
vcpkg_cmake_install()
vcpkg_copy_pdbs()

file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/giflib RENAME copyright)
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
12 changes: 12 additions & 0 deletions ports/giflib/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "giflib",
"version": "5.2.1",
"description": "A library for reading and writing gif images.",
"homepage": "https://sourceforge.net/projects/giflib/",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
}
]
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2265,7 +2265,7 @@
"port-version": 0
},
"giflib": {
"baseline": "5.1.4-6",
"baseline": "5.2.1",
"port-version": 0
},
"ginkgo": {
Expand Down
5 changes: 5 additions & 0 deletions versions/g-/giflib.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "7cfc37d67d8662dd5fa5bf698a61ebbd657060cc",
"version": "5.2.1",
"port-version": 0
},
{
"git-tree": "053e7dd7e20392f9168d982e026a7fd71afbefe3",
"version-string": "5.1.4-6",
Expand Down