Merge pull request #993 from trazme/add-giflib

giflib port
This commit is contained in:
Alexander Karatarakis 2017-05-01 02:04:14 -07:00 committed by GitHub
commit 50433c2a7c
4 changed files with 114 additions and 0 deletions

View File

@ -0,0 +1,33 @@
cmake_minimum_required(VERSION 3.4)
project(giflib)
set(GIFLIB_HEADERS
lib/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
)
add_library(gif ${GIFLIB_SOURCES})
if (BUILD_SHARED_LIBS)
set_property(TARGET gif PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif ()
if (NOT GIFLIB_SKIP_HEADERS)
install(FILES ${GIFLIB_HEADERS} DESTINATION include)
endif ()
install(TARGETS gif
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)

3
ports/giflib/CONTROL Normal file
View File

@ -0,0 +1,3 @@
Source: giflib
Version: 5.1.4
Description: A library for reading and writing gif images.

View File

@ -0,0 +1,52 @@
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 @@
#ifndef _GIF_HASH_H_
#define _GIF_HASH_H_
+#ifndef _MSC_VER
#include <unistd.h>
+#endif
#include <stdint.h>
#define HT_SIZE 8192 /* 12bits = 4096 or twice as big! */

View File

@ -0,0 +1,26 @@
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/giflib-5.1.4)
vcpkg_download_distfile(ARCHIVE
URLS "http://downloads.sourceforge.net/sourceforge/giflib/giflib-5.1.4.tar.bz2"
FILENAME "giflib-5.1.4.tar.bz2"
SHA512 32b5e342056c210e6478e9cb3b6ceec9594dcfaf34feea1eb4dad633a081ed4465bceee578c19165907cb47cb83912ac359ceea666a8e07dbbb5420f9928f96d
)
vcpkg_extract_source_archive(${ARCHIVE})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES
${CMAKE_CURRENT_LIST_DIR}/msvc-guard-unistd-h.patch
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS_DEBUG
-DGIFLIB_SKIP_HEADERS=ON
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/giflib RENAME copyright)