From 9c33de2d07e3f28ce52ea6520c9d8d23f83a1c8d Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Thu, 9 May 2019 20:45:23 +0200 Subject: [PATCH] [freeimage,freeglut,giflib,libwebp] port patches from #5169 (#6364) * [freeimage] improve compatibility with other ports, using typedefs identical to other headers to avoid errors * [libwebp] fixes for non-win32 systems * [giflib] revert again #5578 * [freeglut] add missing wrapper for linux --- ports/freeglut/portfile.cmake | 6 +- ports/freeglut/vcpkg-cmake-wrapper.cmake | 10 +++ ports/freeimage/portfile.cmake | 35 +++++----- .../use-typedef-as-already-declared.patch | 15 +++++ ports/giflib/portfile.cmake | 8 ++- ports/libwebp/0001-build-fixes.patch | 4 +- .../libwebp/0003-remove-missing-symbol.patch | 13 ++++ .../0004-add-missing-linked-library.patch | 15 +++++ ports/libwebp/CONTROL | 4 +- ports/libwebp/portfile.cmake | 65 ++++++++++++++----- 10 files changed, 136 insertions(+), 39 deletions(-) create mode 100644 ports/freeglut/vcpkg-cmake-wrapper.cmake create mode 100644 ports/freeimage/use-typedef-as-already-declared.patch create mode 100644 ports/libwebp/0003-remove-missing-symbol.patch create mode 100644 ports/libwebp/0004-add-missing-linked-library.patch diff --git a/ports/freeglut/portfile.cmake b/ports/freeglut/portfile.cmake index 1659c002d..86d691593 100644 --- a/ports/freeglut/portfile.cmake +++ b/ports/freeglut/portfile.cmake @@ -15,7 +15,7 @@ vcpkg_extract_source_archive_ex( ) if(VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") - message("Freeglut currently requires the following libraries from the system package manager:\n opengl\n glu\n libx11\n\nThese can be installed on Ubuntu systems via apt-get install libxi-dev libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev\nOn macOS Xquartz is required.") + message("Freeglut currently requires the following libraries from the system package manager:\n opengl\n glu\n libx11\n xrandr\n xi\n xxf86vm\n\nThese can be installed on Ubuntu systems via apt-get install libxi-dev libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev libxrandr-dev libxxf86vm-dev\nOn macOS Xquartz is required.") endif() if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) @@ -62,3 +62,7 @@ file(RENAME ${CURRENT_PACKAGES_DIR}/share/freeglut/COPYING ${CURRENT_PACKAGES_DI vcpkg_copy_pdbs() file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) + +if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux") + file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/glut) +endif() diff --git a/ports/freeglut/vcpkg-cmake-wrapper.cmake b/ports/freeglut/vcpkg-cmake-wrapper.cmake new file mode 100644 index 000000000..5d57ad490 --- /dev/null +++ b/ports/freeglut/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,10 @@ +_find_package(${ARGS}) +if(GLUT_FOUND) + find_library(XRANDR_LIBRARY NAMES xrandr Xrandr) + if(XRANDR_LIBRARY) + list(APPEND GLUT_LIBRARIES ${XRANDR_LIBRARY}) + if(TARGET GLUT::GLUT) + set_property(TARGET GLUT::GLUT APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${XRANDR_LIBRARY}) + endif() + endif() +endif() diff --git a/ports/freeimage/portfile.cmake b/ports/freeimage/portfile.cmake index f3d9279c3..dc57a5691 100644 --- a/ports/freeimage/portfile.cmake +++ b/ports/freeimage/portfile.cmake @@ -2,12 +2,28 @@ include(${CMAKE_TRIPLET_FILE}) include(vcpkg_common_functions) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/FreeImage) vcpkg_download_distfile(ARCHIVE - URLS "https://sourceforge.net/projects/freeimage/files/Source%20Distribution/3.18.0/FreeImage3180.zip/download" + URLS "http://downloads.sourceforge.net/freeimage/FreeImage3180.zip" FILENAME "FreeImage3180.zip" SHA512 9d9cc7e2d57552c3115e277aeb036e0455204d389026b17a3f513da5be1fd595421655488bb1ec2f76faebed66049119ca55e26e2a6d37024b3fb7ef36ad4818 ) -vcpkg_extract_source_archive(${ARCHIVE}) +vcpkg_extract_source_archive_ex( + OUT_SOURCE_PATH SOURCE_PATH + ARCHIVE ${ARCHIVE} + PATCHES + "${CMAKE_CURRENT_LIST_DIR}/disable-plugins-depending-on-internal-third-party-libraries.patch" + "${CMAKE_CURRENT_LIST_DIR}/use-external-jpeg.patch" + "${CMAKE_CURRENT_LIST_DIR}/use-external-jxrlib.patch" + "${CMAKE_CURRENT_LIST_DIR}/use-external-libtiff.patch" + "${CMAKE_CURRENT_LIST_DIR}/use-external-openjpeg.patch" + "${CMAKE_CURRENT_LIST_DIR}/use-external-png-zlib.patch" + "${CMAKE_CURRENT_LIST_DIR}/use-external-rawlib.patch" + "${CMAKE_CURRENT_LIST_DIR}/use-external-webp.patch" + "${CMAKE_CURRENT_LIST_DIR}/use-external-openexr.patch" + "${CMAKE_CURRENT_LIST_DIR}/use-freeimage-config-include.patch" + "${CMAKE_CURRENT_LIST_DIR}/fix-function-overload.patch" + "${CMAKE_CURRENT_LIST_DIR}/use-typedef-as-already-declared.patch" +) file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) file(COPY ${CMAKE_CURRENT_LIST_DIR}/FreeImageConfig-static.h DESTINATION ${SOURCE_PATH}) @@ -25,21 +41,6 @@ file(REMOVE_RECURSE ${SOURCE_PATH}/Source/LibWebP) file(REMOVE_RECURSE ${SOURCE_PATH}/Source/LibRawLite) file(REMOVE_RECURSE ${SOURCE_PATH}/Source/OpenEXR) -vcpkg_apply_patches( - SOURCE_PATH ${SOURCE_PATH} - PATCHES "${CMAKE_CURRENT_LIST_DIR}/disable-plugins-depending-on-internal-third-party-libraries.patch" - "${CMAKE_CURRENT_LIST_DIR}/use-external-jpeg.patch" - "${CMAKE_CURRENT_LIST_DIR}/use-external-jxrlib.patch" - "${CMAKE_CURRENT_LIST_DIR}/use-external-libtiff.patch" - "${CMAKE_CURRENT_LIST_DIR}/use-external-openjpeg.patch" - "${CMAKE_CURRENT_LIST_DIR}/use-external-png-zlib.patch" - "${CMAKE_CURRENT_LIST_DIR}/use-external-rawlib.patch" - "${CMAKE_CURRENT_LIST_DIR}/use-external-webp.patch" - "${CMAKE_CURRENT_LIST_DIR}/use-external-openexr.patch" - "${CMAKE_CURRENT_LIST_DIR}/use-freeimage-config-include.patch" - "${CMAKE_CURRENT_LIST_DIR}/fix-function-overload.patch" -) - vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA diff --git a/ports/freeimage/use-typedef-as-already-declared.patch b/ports/freeimage/use-typedef-as-already-declared.patch new file mode 100644 index 000000000..80d367bcb --- /dev/null +++ b/ports/freeimage/use-typedef-as-already-declared.patch @@ -0,0 +1,15 @@ +diff --git a/Source/FreeImage.h b/Source/FreeImage.h +index 1fd9c2f..59de277 100644 +--- a/Source/FreeImage.h ++++ b/Source/FreeImage.h +@@ -160,8 +160,8 @@ typedef uint8_t BYTE; + typedef uint16_t WORD; + typedef uint32_t DWORD; + typedef int32_t LONG; +-typedef int64_t INT64; +-typedef uint64_t UINT64; ++typedef long long int INT64; ++typedef long long unsigned int UINT64; + #else + // MS is not C99 ISO compliant + typedef long BOOL; diff --git a/ports/giflib/portfile.cmake b/ports/giflib/portfile.cmake index ed68c11b8..7ca1478f7 100644 --- a/ports/giflib/portfile.cmake +++ b/ports/giflib/portfile.cmake @@ -4,18 +4,22 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY) set(GIFLIB_VERSION 5.1.4) vcpkg_download_distfile(ARCHIVE - URLS "https://nchc.dl.sourceforge.net/project/giflib/giflib-${GIFLIB_VERSION}.tar.bz2" + URLS "https://nchc.dl.sourceforge.net/project/giflib/giflib-${GIFLIB_VERSION}.tar.bz2" FILENAME "giflib-${GIFLIB_VERSION}.tar.bz2" SHA512 32b5e342056c210e6478e9cb3b6ceec9594dcfaf34feea1eb4dad633a081ed4465bceee578c19165907cb47cb83912ac359ceea666a8e07dbbb5420f9928f96d ) +if (VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR NOT VCPKG_CMAKE_SYSTEM_NAME) + set(ADDITIONAL_PATCH "fix-compile-error.patch") +endif() + vcpkg_extract_source_archive_ex( OUT_SOURCE_PATH SOURCE_PATH ARCHIVE ${ARCHIVE} REF ${GIFLIB_VERSION} PATCHES msvc-guard-unistd-h.patch - fix-compile-error.patch + ${ADDITIONAL_PATCH} ) file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) diff --git a/ports/libwebp/0001-build-fixes.patch b/ports/libwebp/0001-build-fixes.patch index c25ecbfee..490978727 100644 --- a/ports/libwebp/0001-build-fixes.patch +++ b/ports/libwebp/0001-build-fixes.patch @@ -2,13 +2,15 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt index 499ddce..895fda9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -159,6 +159,10 @@ add_definitions(-DHAVE_CONFIG_H) +@@ -159,6 +159,12 @@ add_definitions(-DHAVE_CONFIG_H) if(MSVC) # avoid security warnings for e.g., fopen() used in the examples. add_definitions(-D_CRT_SECURE_NO_WARNINGS) + add_definitions(-DWEBP_HAVE_JUST_SDL_H) + if(BUILD_SHARED_LIBS) + add_definitions(-DWEBP_EXTERN=__declspec\(dllexport\)) ++ else() ++ add_definitions(-DFREEGLUT_STATIC) + endif() else() add_definitions(-Wall) diff --git a/ports/libwebp/0003-remove-missing-symbol.patch b/ports/libwebp/0003-remove-missing-symbol.patch new file mode 100644 index 000000000..218481bbc --- /dev/null +++ b/ports/libwebp/0003-remove-missing-symbol.patch @@ -0,0 +1,13 @@ +diff --git a/examples/gifdec.c b/examples/gifdec.c +index 4219352..ab0592a 100644 +--- a/examples/gifdec.c ++++ b/examples/gifdec.c +@@ -310,7 +310,7 @@ void GIFDisplayError(const GifFileType* const gif, int gif_error) { + #else + (void)gif; + fprintf(stderr, "GIFLib Error %d: ", gif_error); +- PrintGifError(); ++ //PrintGifError(); + fprintf(stderr, "\n"); + #endif + } diff --git a/ports/libwebp/0004-add-missing-linked-library.patch b/ports/libwebp/0004-add-missing-linked-library.patch new file mode 100644 index 000000000..49a34ef4d --- /dev/null +++ b/ports/libwebp/0004-add-missing-linked-library.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a98540c..a3697cb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -479,6 +479,10 @@ if(WEBP_BUILD_VWEBP) + ${CMAKE_CURRENT_SOURCE_DIR}/src + ${CMAKE_CURRENT_BINARY_DIR}/src + ${OPENGL_INCLUDE_DIR}) ++ if(UNIX AND NOT(ANDROID OR BLACKBERRY OR APPLE)) ++ find_package(X11 REQUIRED) ++ target_link_libraries(vwebp ${X11_LIBRARIES} ${X11_Xxf86vm_LIB}) ++ endif() + install(TARGETS vwebp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + check_c_compiler_flag("-Wno-deprecated-declarations" HAS_NO_DEPRECATED) diff --git a/ports/libwebp/CONTROL b/ports/libwebp/CONTROL index ed3ff55ca..11647702d 100644 --- a/ports/libwebp/CONTROL +++ b/ports/libwebp/CONTROL @@ -1,8 +1,8 @@ Source: libwebp -Version: 1.0.2-2 +Version: 1.0.2-3 Description: Lossy compression of digital photographic images. Build-Depends: opengl Feature: all Description: enable all webp features -Build-Depends: giflib, libjpeg-turbo, zlib, libpng, tiff, freeglut, sdl1 +Build-Depends: giflib, libjpeg-turbo, zlib, libpng, tiff, freeglut (!osx), sdl1 (windows) diff --git a/ports/libwebp/portfile.cmake b/ports/libwebp/portfile.cmake index bae24ddff..f0bd669ee 100644 --- a/ports/libwebp/portfile.cmake +++ b/ports/libwebp/portfile.cmake @@ -9,6 +9,8 @@ vcpkg_from_github( PATCHES 0001-build-fixes.patch 0002-cmake-config-add-backwards-compatibility.patch + 0003-remove-missing-symbol.patch + 0004-add-missing-linked-library.patch ) set(WEBP_BUILD_ANIM_UTILS OFF) @@ -30,6 +32,10 @@ if("all" IN_LIST FEATURES) set(WEBP_BUILD_EXTRAS ON) endif() +if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux") + message("WebP currently requires the following library from the system package manager:\n Xxf86vm\n\nThis can be installed on Ubuntu systems via apt-get install libxxf86vm-dev") +endif() + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA @@ -59,26 +65,53 @@ vcpkg_copy_pdbs() vcpkg_fixup_cmake_targets(CONFIG_PATH "share/WebP/cmake/" TARGET_PATH "share/WebP/") file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +#somehow the native CMAKE_EXECUTABLE_SUFFIX does not work, so here we emulate it +if(CMAKE_HOST_WIN32) +set(EXECUTABLE_SUFFIX ".exe") +else() +set(EXECUTABLE_SUFFIX "") +endif() + if("all" IN_LIST FEATURES) - file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/get_disto.exe) - file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/gif2webp.exe) - file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/img2webp.exe) - file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/vwebp.exe) - file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/vwebp_sdl.exe) - file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/webpinfo.exe) - file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/webpmux.exe) - file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/webp_quality.exe) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/get_disto${EXECUTABLE_SUFFIX}) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/gif2webp${EXECUTABLE_SUFFIX}) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/img2webp${EXECUTABLE_SUFFIX}) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/vwebp${EXECUTABLE_SUFFIX}) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/vwebp_sdl${EXECUTABLE_SUFFIX}) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/webpinfo${EXECUTABLE_SUFFIX}) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/webpmux${EXECUTABLE_SUFFIX}) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/webp_quality${EXECUTABLE_SUFFIX}) file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/libwebp/) - file(RENAME ${CURRENT_PACKAGES_DIR}/bin/get_disto.exe ${CURRENT_PACKAGES_DIR}/tools/libwebp/get_disto.exe) - file(RENAME ${CURRENT_PACKAGES_DIR}/bin/gif2webp.exe ${CURRENT_PACKAGES_DIR}/tools/libwebp/gif2webp.exe) - file(RENAME ${CURRENT_PACKAGES_DIR}/bin/img2webp.exe ${CURRENT_PACKAGES_DIR}/tools/libwebp/img2webp.exe) - file(RENAME ${CURRENT_PACKAGES_DIR}/bin/vwebp.exe ${CURRENT_PACKAGES_DIR}/tools/libwebp/vwebp.exe) - file(RENAME ${CURRENT_PACKAGES_DIR}/bin/vwebp_sdl.exe ${CURRENT_PACKAGES_DIR}/tools/libwebp/vwebp_sdl.exe) - file(RENAME ${CURRENT_PACKAGES_DIR}/bin/webpinfo.exe ${CURRENT_PACKAGES_DIR}/tools/libwebp/webpinfo.exe) - file(RENAME ${CURRENT_PACKAGES_DIR}/bin/webpmux.exe ${CURRENT_PACKAGES_DIR}/tools/libwebp/webpmux.exe) - file(RENAME ${CURRENT_PACKAGES_DIR}/bin/webp_quality.exe ${CURRENT_PACKAGES_DIR}/tools/libwebp/webp_quality.exe) + if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/get_disto${EXECUTABLE_SUFFIX}") + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/get_disto${EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/libwebp/get_disto${EXECUTABLE_SUFFIX}) + endif() + if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/gif2webp${EXECUTABLE_SUFFIX}") + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/gif2webp${EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/libwebp/gif2webp${EXECUTABLE_SUFFIX}) + endif() + if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/img2webp${EXECUTABLE_SUFFIX}") + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/img2webp${EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/libwebp/img2webp${EXECUTABLE_SUFFIX}) + endif() + if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/vwebp${EXECUTABLE_SUFFIX}") + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/vwebp${EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/libwebp/vwebp${EXECUTABLE_SUFFIX}) + endif() + if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/vwebp_sdl${EXECUTABLE_SUFFIX}") + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/vwebp_sdl${EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/libwebp/vwebp_sdl${EXECUTABLE_SUFFIX}) + endif() + if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/webpinfo${EXECUTABLE_SUFFIX}") + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/webpinfo${EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/libwebp/webpinfo${EXECUTABLE_SUFFIX}) + endif() + if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/webpmux${EXECUTABLE_SUFFIX}") + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/webpmux${EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/libwebp/webpmux${EXECUTABLE_SUFFIX}) + endif() + if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/webp_quality${EXECUTABLE_SUFFIX}") + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/webp_quality${EXECUTABLE_SUFFIX} ${CURRENT_PACKAGES_DIR}/tools/libwebp/webp_quality${EXECUTABLE_SUFFIX}) + endif() vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/libwebp) endif() +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() + file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libwebp) file(RENAME ${CURRENT_PACKAGES_DIR}/share/libwebp/COPYING ${CURRENT_PACKAGES_DIR}/share/libwebp/copyright)