summarylogtreecommitdiffstats
path: root/shared-libwebp.patch
diff options
context:
space:
mode:
Diffstat (limited to 'shared-libwebp.patch')
-rw-r--r--shared-libwebp.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/shared-libwebp.patch b/shared-libwebp.patch
new file mode 100644
index 000000000000..a4c3234fd000
--- /dev/null
+++ b/shared-libwebp.patch
@@ -0,0 +1,56 @@
+From ca9e20a87be6dcc8d9b97841535b2320d2eb2f91 Mon Sep 17 00:00:00 2001
+From: Drauthius <albert@diserholt.com>
+Date: Sat, 26 Sep 2020 10:40:13 +0200
+Subject: [PATCH] Shared webp library
+
+Making optional linking with shared system webp library with
+-DUSE_SHARED_WEBP option.
+---
+ CMakeLists.txt | 12 +++++++++---
+ third_party/CMakeLists.txt | 2 +-
+ 2 files changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f16f09660d..40065905d3 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -66,6 +66,7 @@ option(USE_SHARED_TINYXML "Use your installed copy of tinyxml" off)
+ option(USE_SHARED_PIXMAN "Use your installed copy of pixman" off)
+ option(USE_SHARED_FREETYPE "Use shared FreeType library" off)
+ option(USE_SHARED_HARFBUZZ "Use shared HarfBuzz library" off)
++option(USE_SHARED_WEBP "Use your installed copy of webp" off)
+ option(ENABLE_ASEPRITE_EXE "Compile main Aseprite executable" on)
+ option(ENABLE_MEMLEAK "Enable memory-leaks detector (only for developers)" off)
+ option(ENABLE_NEWS "Enable the news in Home tab" on)
+@@ -229,8 +230,16 @@ add_definitions(-DPNG_NO_MMX_CODE) # Do not use MMX optimizations in PNG code
+
+ # libwebp
+ if(WITH_WEBP_SUPPORT)
+- set(WEBP_LIBRARIES webp webpdemux libwebpmux)
+- set(WEBP_INCLUDE_DIR ${LIBWEBP_DIR}/src)
++ if(USE_SHARED_WEBP)
++ find_library(WEBP_LIBRARY NAMES webp)
++ find_library(WEBPDEMUX_LIBRARY NAMES webpdemux)
++ find_library(WEBPMUX_LIBRARY NAMES webpmux)
++ set(WEBP_LIBRARIES ${WEBP_LIBRARY} ${WEBPDEMUX_LIBRARY} ${WEBPMUX_LIBRARY})
++ find_path(WEBP_INCLUDE_DIR NAMES decode.h PATH_SUFFIXES webp)
++ else()
++ set(WEBP_LIBRARIES webp webpdemux libwebpmux)
++ set(WEBP_INCLUDE_DIR ${LIBWEBP_DIR}/src)
++ endif()
+ include_directories(${WEBP_INCLUDE_DIR})
+ endif()
+
+diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
+index 4839d4097c..e8c3e83cbc 100644
+--- a/third_party/CMakeLists.txt
++++ b/third_party/CMakeLists.txt
+@@ -32,7 +32,7 @@ if(NOT USE_SHARED_GIFLIB)
+ add_subdirectory(giflib)
+ endif()
+
+-if(WITH_WEBP_SUPPORT)
++if(WITH_WEBP_SUPPORT AND NOT USE_SHARED_WEBP)
+ set(WEBP_BUILD_EXTRAS OFF CACHE BOOL "Build extras.")
+ add_subdirectory(libwebp)
+ endif()