Use shared libfmt

This commit is contained in:
ISSOtm 2022-01-13 20:12:08 +01:00
parent acea23a10b
commit f6cc220db5
5 changed files with 83 additions and 8 deletions

View File

@ -22,6 +22,7 @@ pkgbase = aseprite
depends = tinyxml
depends = libfreetype.so
depends = libarchive.so
depends = libfmt.so
depends = libwebp.so
depends = libwebpmux.so
depends = libwebpdemux.so
@ -35,6 +36,7 @@ pkgbase = aseprite
source = https://github.com/aseprite/aseprite/releases/download/v1.2.31/Aseprite-v1.2.31-Source.zip
source = git+https://github.com/aseprite/skia.git#branch=aseprite-m96
source = desktop.patch
source = shared-fmt.patch
source = shared-libarchive.patch
source = shared-libwebp.patch
source = shared-skia-deps.patch
@ -42,7 +44,8 @@ pkgbase = aseprite
sha256sums = 966bd940e1072ed24b70e211ca2bb1eb9aa6432ca12972a8e1df5f1e0150213d
sha256sums = SKIP
sha256sums = 8b14e36939e930de581e95abf0591645aa0fcfd47161cf88b062917dbaaef7f9
sha256sums = e42675504bfbc17655aef1dca957041095026cd3dd4e6981fb6df0a363948aa7
sha256sums = 821f1354dbbc0bb3fa700e63037ed3c89b0d32bd2ab253450f91eeacd7d47c06
sha256sums = d7f2f8c43d24382453273ed17b1c0e05928980a36ad0b7c988da3aa0fe32de53
sha256sums = 2d6b5f33f23adc4f9912511ac35311a776ce34519ef40e9db3659e4c5457f055
sha256sums = eb9f544e68b41b5cb1a9ab7a6648db51587e67e94f1a452cb5a84f3d224bf5d0
sha256sums = c2d14f9738a96a9db3695c00ac3d14b1312b6a595b151bd56e19422c86517654

1
.gitignore vendored
View File

@ -3,6 +3,7 @@
!/.SRCINFO
!/PKGBUILD
!/desktop.patch
!/shared-fmt.patch
!/shared-libarchive.patch
!/shared-libwebp.patch
!/shared-skia-deps.patch

View File

@ -18,7 +18,7 @@ license=('custom')
depends=(# ~ Aseprite's direct dependencies ~
# pixman is not linked to because we use Skia instead
# harfbuzz is linked statically because Aseprite expects an older version
cmark libcurl.so libgif.so libjpeg.so zlib libpng tinyxml libfreetype.so libarchive.so
cmark libcurl.so libgif.so libjpeg.so zlib libpng tinyxml libfreetype.so libarchive.so libfmt.so
libwebp.so libwebpmux.so libwebpdemux.so
hicolor-icon-theme # For installing Aseprite's icons
# ~ Skia deps ~
@ -37,6 +37,7 @@ source=("https://github.com/aseprite/aseprite/releases/download/v$pkgver/Aseprit
# Which branch a given build of Aseprite requires is noted in its `INSTALL.md`
"git+https://github.com/aseprite/skia.git#branch=aseprite-m96"
desktop.patch
shared-fmt.patch
# Based on https://patch-diff.githubusercontent.com/raw/aseprite/aseprite/pull/2535.patch
shared-libarchive.patch
# Based on https://patch-diff.githubusercontent.com/raw/aseprite/aseprite/pull/2523.patch
@ -47,7 +48,8 @@ noextract=("${source[0]##*/}") # Don't extract Aseprite sources at the root
sha256sums=('966bd940e1072ed24b70e211ca2bb1eb9aa6432ca12972a8e1df5f1e0150213d'
'SKIP'
'8b14e36939e930de581e95abf0591645aa0fcfd47161cf88b062917dbaaef7f9'
'e42675504bfbc17655aef1dca957041095026cd3dd4e6981fb6df0a363948aa7'
'821f1354dbbc0bb3fa700e63037ed3c89b0d32bd2ab253450f91eeacd7d47c06'
'd7f2f8c43d24382453273ed17b1c0e05928980a36ad0b7c988da3aa0fe32de53'
'2d6b5f33f23adc4f9912511ac35311a776ce34519ef40e9db3659e4c5457f055'
'eb9f544e68b41b5cb1a9ab7a6648db51587e67e94f1a452cb5a84f3d224bf5d0'
'c2d14f9738a96a9db3695c00ac3d14b1312b6a595b151bd56e19422c86517654')
@ -59,11 +61,10 @@ prepare() {
# Fix up Aseprite's desktop integration
env -C aseprite patch -tp1 <desktop.patch
# Allow using shared libarchive (the bundled version prevents using the `None` build type...)
# Allow using more shared libs
env -C aseprite patch -tp1 <shared-fmt.patch
env -C aseprite patch -tp1 <shared-libarchive.patch
# Allow using shared libwebp (breaks builds otherwise...)
env -C aseprite patch -tp1 <shared-libwebp.patch
# Skip the build-time dependency on Pixman since it doesn't get used in the end
env -C aseprite patch -tp1 <optional-pixman.patch
# Their "FindSkia" module forcefully tries to use Skia's FreeType and HarfBuzz,
# but we don't clone those because we use the shared ones. Avoid overwriting the settings instead.
@ -86,7 +87,7 @@ skia_use_{expat,xps,zlib,libgifcodec,sfntly}=false`"
cmake -S aseprite -B build -G Ninja -Wno-dev -DCMAKE_INSTALL_MESSAGE=NEVER -DCMAKE_BUILD_TYPE=None \
-DENABLE_{UPDATER,SCRIPTING,WEBSOCKET}=NO -DLAF_WITH_EXAMPLES=OFF -DLAF_WITH_TESTS=OFF -DLAF_BACKEND=skia \
-DSKIA_DIR="$PWD/skia" -DSKIA_LIBRARY_DIR="$_skiadir" -DSKIA_LIBRARY="$_skiadir/libskia.a" \
-DUSE_SHARED_{CMARK,CURL,GIFLIB,JPEGLIB,ZLIB,LIBPNG,TINYXML,PIXMAN,FREETYPE,HARFBUZZ,LIBARCHIVE,WEBP}=YES
-DUSE_SHARED_{CMARK,CURL,FMT,GIFLIB,JPEGLIB,ZLIB,LIBPNG,TINYXML,PIXMAN,FREETYPE,HARFBUZZ,LIBARCHIVE,WEBP}=YES
ninja -C build
}

70
shared-fmt.patch Normal file
View File

@ -0,0 +1,70 @@
--- a/CMakeLists.txt 2022-01-08 00:37:08.165330523 +0100
+++ b/CMakeLists.txt 2022-01-08 00:52:41.163585173 +0100
@@ -54,6 +54,7 @@
option(USE_SHARED_CMARK "Use your installed copy of cmark" off)
option(USE_SHARED_CURL "Use your installed copy of curl" off)
+option(USE_SHARED_FMT "Use your installed copy of fmt" off)
option(USE_SHARED_GIFLIB "Use your installed copy of giflib" off)
option(USE_SHARED_JPEGLIB "Use your installed copy of jpeglib" off)
option(USE_SHARED_ZLIB "Use your installed copy of zlib" off)
@@ -165,6 +165,7 @@
set(SOURCE_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data)
set(CMARK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/cmark)
set(CURL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/curl)
+set(FMT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/fmt)
set(GIFLIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/giflib)
set(LIBJPEG_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/jpeg)
set(LIBPNG_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/libpng)
@@ -204,6 +205,15 @@
set(CURL_STATICLIB ON BOOL)
endif()
+if(USE_SHARED_FMT)
+ find_package(FMT REQUIRED)
+ set(FMT_LIBRARIES fmt::fmt)
+else()
+ set(FMT_FOUND)
+ set(FMT_LIBRARIES fmt)
+ # No need to include extra directories, actually
+endif()
+
# zlib
if(USE_SHARED_ZLIB)
find_package(ZLIB REQUIRED)
--- a/src/app/CMakeLists.txt 2022-01-08 00:37:07.378671200 +0100
+++ b/src/app/CMakeLists.txt 2022-01-08 00:53:13.669969512 +0100
@@ -698,7 +698,7 @@
${HARFBUZZ_LIBRARIES}
json11
archive_static
- fmt
+ ${FMT_LIBRARIES}
tinyexpr)
if(ENABLE_PSD)
--- a/src/dio/CMakeLists.txt 2022-01-08 00:41:50.712726972 +0100
+++ b/src/dio/CMakeLists.txt 2022-01-08 00:53:39.936408022 +0100
@@ -10,7 +10,7 @@
target_link_libraries(dio-lib
${ZLIB_LIBRARIES}
- fmt
+ ${FMT_LIBRARIES}
flic-lib
laf-base
fixmath-lib
--- a/third_party/CMakeLists.txt 2022-01-08 00:37:08.165330523 +0100
+++ b/third_party/CMakeLists.txt 2022-01-08 00:54:30.455969136 +0100
@@ -106,7 +106,10 @@
endif()
add_subdirectory(simpleini)
-add_subdirectory(fmt)
+
+if(NOT USE_SHARED_FMT)
+ add_subdirectory(fmt)
+endif()
# Add cmark without tests
if(NOT USE_SHARED_CMARK)

View File

@ -49,7 +49,7 @@ index e1e3bc1ae3..4a37838e95 100644
+ ${LibArchive_LIBRARIES}
json11
- archive_static
fmt
${FMT_LIBRARIES}
tinyexpr)
diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt