aseprite/shared-libwebp.patch
Eldred Habert 4bf904749f Use brand new PKGBUILD for Aseprite Package (#1)
* Use brand new PKGBUILD instead

Attempting to fix the old one's jank

* Install third-party licenses as well

* Install .desktop file as well

* Add missing build-time dependencies

* Install icons in the icon theme directories instead

Also remove redundant `$srcdir`s in `package()`

* Put font license in the central directory as well

* Bump pkgrel

It was bumped during my work

* Ignore files in subdirectories

* Add missing resource files

* Use underscores for local variable names

https://wiki.archlinux.org/title/Arch_package_guidelines#Package_etiquette
https://github.com/ImperatorStorm/PKGBUILDs/pull/1#discussion_r777122781

* Use HTTPS for upstream URL

* Add myself as co-maintainer

Thanks!

* Remove ICU dependency

We are using a statically-linked version instead, apparently

* Avoid interactive prompts when patching fails

* Clean up $srcdir

Extract Aseprite's sources into a separate directory
Configure Aseprite out-of-tree
Configure Skia in a fresh directory (apparently `gn` does not support out-of-tree)

* Disable Skottie in Skia

This functionality doesn't appear to be used by Aseprite,
and excluding it should reduce build time

* Only pull Skia dependencies that we need

This significantly reduces initial build time (from syncing large repos)
and storage use.
The only remaining dependency that has a chance to be axed is `dng_sdk`,
for which more investigation is needed.

* Avoid printing redundant flags in `gn` args

Brainfart.
"static" flags like `is_debug` were re-printed for each "non-static"
(e.g. `skia_use_*`) variant.
Doing it this way also allows getting rid of weird quote shenanigans.

* Simplify `gn` configure line

`is_official_build=true` sets Skia up to use system libs by default,
so only specify those that we *don't* want

* Pull `gn` version ourselves

That way, we can additionally check its integrity via the SHA256

* Add forgotten `libgl` dependency

What's weird is that the lib seems not to be linked to dynamically,
but I can't see it not being required at run time. Right?

* Maybe use system libwebp? Based on https://patch-diff.githubusercontent.com/raw/aseprite/aseprite/pull/2535.patch

* Fix system `libwebp`, add `pixman` as makedep

* possibly fix shared-libwebp.patch?

* Disable updater

https://github.com/ImperatorStorm/PKGBUILDs/pull/1#issuecomment-1003838784

* Avoid creating symlinks to Skia deps in their dirs

Would occur if they were already symlinked

* Use system HarfBuzz and FreeType

I remember getting build errors, but cannot reproduce them anymore.
So use the system libs more where possible!

* Find all WebP libs

* Mark libwebp as runtime dep

* Remove CMake variables used by libwebp build

They do nothing now that we are using shared libwebp

* Remove build-time dep on Pixman

It doesn't wind up being used at all in the end

* Trim off a bunch of dependencies from Skia

Only libpng is required to render some of the images, it seems,
so this reduces build time and the amount of sources, which is good!

Co-authored-by: ImperatorStorm <30777770+ImperatorStorm@users.noreply.github.com>
2022-01-05 15:55:41 -08:00

59 lines
2.2 KiB
Diff

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,9 +230,17 @@ 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)
- include_directories(${WEBP_INCLUDE_DIR})
+ 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_DIRS NAMES decode.h PATH_SUFFIXES webp)
+ else()
+ set(WEBP_LIBRARIES webp webpdemux libwebpmux)
+ set(WEBP_INCLUDE_DIR ${LIBWEBP_DIR}/src)
+ include_directories(${WEBP_INCLUDE_DIR})
+ endif()
endif()
# tinyxml
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()