initial commit
This commit is contained in:
@@ -0,0 +1,202 @@
|
||||
{
|
||||
clangStdenv,
|
||||
cmake,
|
||||
cmark,
|
||||
curl,
|
||||
fetchFromGitHub,
|
||||
fmt,
|
||||
fontconfig,
|
||||
freetype,
|
||||
giflib,
|
||||
glib,
|
||||
harfbuzzFull,
|
||||
libicns,
|
||||
lib,
|
||||
libGL,
|
||||
libjpeg,
|
||||
libpng,
|
||||
libwebp,
|
||||
libx11,
|
||||
libxcursor,
|
||||
libxext,
|
||||
libxi,
|
||||
libxxf86vm,
|
||||
libxcb,
|
||||
libxrandr,
|
||||
ninja,
|
||||
pcre2,
|
||||
pixman,
|
||||
pkg-config,
|
||||
skia-aseprite,
|
||||
tinyxml-2,
|
||||
zlib,
|
||||
}:
|
||||
|
||||
let
|
||||
asepriteStrings = fetchFromGitHub {
|
||||
owner = "aseprite";
|
||||
repo = "strings";
|
||||
rev = "417074f649f359f98511fc87a707c276d87f5739";
|
||||
hash = "sha256-5bB7yK4eJHhkUwGYtIFYdFXpRrBt69VBbTh7EmPFI08=";
|
||||
};
|
||||
in
|
||||
clangStdenv.mkDerivation (finalAttrs: {
|
||||
pname = "aseprite";
|
||||
version = "44cd42d29dbc047ec9d341f05c0a8ff584ede151";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "aseprite";
|
||||
repo = "aseprite";
|
||||
rev = "${finalAttrs.version}";
|
||||
hash = "sha256-swXk8wwFgao2rpF4ntCjOMnV+yk0gi+wbWoWl/wv7e8=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
# Translation files are copied without overwriting existing ones to preserve the
|
||||
# potentially more up-to-date English file from the main source.
|
||||
postUnpack = ''
|
||||
cp --no-clobber ${asepriteStrings}/* "$sourceRoot/data/strings"
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
ninja
|
||||
pkg-config
|
||||
]
|
||||
++ lib.optionals clangStdenv.hostPlatform.isDarwin [
|
||||
libicns
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
cmark
|
||||
curl
|
||||
fmt
|
||||
fontconfig
|
||||
freetype
|
||||
giflib
|
||||
glib
|
||||
harfbuzzFull
|
||||
libGL
|
||||
libjpeg
|
||||
libpng
|
||||
libwebp
|
||||
libx11
|
||||
libxcursor
|
||||
libxext
|
||||
libxi
|
||||
libxxf86vm
|
||||
libxcb
|
||||
libxrandr
|
||||
pcre2
|
||||
pixman
|
||||
skia-aseprite
|
||||
tinyxml-2
|
||||
zlib
|
||||
];
|
||||
|
||||
patches = [
|
||||
./patches/shared-fmt.patch
|
||||
./patches/shared-libwebp.patch
|
||||
./patches/shared-skia-deps.patch
|
||||
./patches/shared-libjpeg-turbo.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace src/ver/CMakeLists.txt \
|
||||
--replace-fail '"1.x-dev"' '"${finalAttrs.version}"'
|
||||
|
||||
# Fix build on Darwin with `-Werror=format-security`.
|
||||
# (NSLog requires a string-literal format).
|
||||
substituteInPlace laf/os/osx/logger.mm \
|
||||
--replace-fail 'NSLog([NSString stringWithUTF8String:error]);' 'NSLog(@"%@", [NSString stringWithUTF8String:error]);'
|
||||
'';
|
||||
|
||||
cmakeFlags = [
|
||||
"-DENABLE_DESKTOP_INTEGRATION=ON"
|
||||
"-DENABLE_UPDATER=OFF"
|
||||
"-DUSE_SHARED_CMARK=ON"
|
||||
"-DUSE_SHARED_CURL=ON"
|
||||
"-DUSE_SHARED_FMT=ON"
|
||||
"-DUSE_SHARED_FREETYPE=ON"
|
||||
"-DUSE_SHARED_GIFLIB=ON"
|
||||
"-DUSE_SHARED_HARFBUZZ=ON"
|
||||
"-DUSE_SHARED_LIBPNG=ON"
|
||||
"-DUSE_SHARED_PIXMAN=ON"
|
||||
"-DUSE_SHARED_TINYXML=OFF"
|
||||
"-DUSE_SHARED_WEBP=ON"
|
||||
"-DUSE_SHARED_ZLIB=ON"
|
||||
# Disable libarchive programs.
|
||||
"-DENABLE_CAT=OFF"
|
||||
"-DENABLE_CPIO=OFF"
|
||||
"-DENABLE_TAR=OFF"
|
||||
# UI backend.
|
||||
"-DLAF_BACKEND=skia"
|
||||
"-DLAF_WITH_EXAMPLES=OFF"
|
||||
"-DSKIA_DIR=${skia-aseprite}"
|
||||
"-DSKIA_LIBRARY_DIR=${skia-aseprite}/lib"
|
||||
];
|
||||
|
||||
# `libskia.a` is static, so its deps must be linked explicitly on Darwin
|
||||
# (otherwise we hit undefined `_jpeg_*`/`_WebP*` symbols, e.g. in the thumbnailer).
|
||||
env.NIX_LDFLAGS = lib.optionalString clangStdenv.hostPlatform.isDarwin "-ljpeg -lwebp -lwebpdemux -lwebpmux";
|
||||
|
||||
postInstall = ''
|
||||
# Install desktop icons.
|
||||
src="$out/share/aseprite/data/icons"
|
||||
for size in 16 32 48 64 128 256; do
|
||||
dst="$out"/share/icons/hicolor/"$size"x"$size"
|
||||
install -Dm644 "$src"/ase"$size".png "$dst"/apps/aseprite.png
|
||||
install -Dm644 "$src"/doc"$size".png "$dst"/mimetypes/image-x-aseprite.png
|
||||
done
|
||||
# Delete unneeded artifacts of bundled libraries.
|
||||
rm -rf "$out"/{include,lib,man}
|
||||
''
|
||||
+ lib.optionalString clangStdenv.hostPlatform.isDarwin ''
|
||||
install -d "$out/Applications"
|
||||
if [ -d "$out/bin/aseprite.app" ]; then
|
||||
rm -rf "$out/Applications/Aseprite.app"
|
||||
mv "$out/bin/aseprite.app" "$out/Applications/Aseprite.app"
|
||||
fi
|
||||
# Generate the `.icns` files referenced by Info.plist from the shipped PNGs.
|
||||
res="$out/Applications/Aseprite.app/Contents/Resources"
|
||||
icons="$res/data/icons"
|
||||
if [ -d "$icons" ] && command -v png2icns >/dev/null; then
|
||||
for spec in "Aseprite ase" "Document doc" "Extension ext"; do
|
||||
set -- $spec
|
||||
name="$1"
|
||||
prefix="$2"
|
||||
png2icns "$res/$name.icns" \
|
||||
"$icons/''${prefix}16.png" \
|
||||
"$icons/''${prefix}32.png" \
|
||||
"$icons/''${prefix}128.png" \
|
||||
"$icons/''${prefix}256.png"
|
||||
done
|
||||
fi
|
||||
# Keep $out/bin clean on Darwin; the bundle lives under $out/Applications.
|
||||
rmdir "$out/bin" 2>/dev/null || true
|
||||
'';
|
||||
|
||||
meta = {
|
||||
homepage = "https://www.aseprite.org/";
|
||||
description = "Animated sprite editor & pixel art tool";
|
||||
license = lib.licenses.unfree;
|
||||
|
||||
longDescription = ''
|
||||
Aseprite is a program to create animated sprites. Its main features are:
|
||||
- Sprites are composed by layers & frames (as separated concepts).
|
||||
- Supported color modes: RGBA, Indexed (palettes up to 256 colors), and Grayscale.
|
||||
- Load/save sequence of PNG files and GIF animations (and FLC, FLI, JPG, BMP, PCX, TGA).
|
||||
- Export/import animations to/from Sprite Sheets.
|
||||
- Tiled drawing mode, useful to draw patterns and textures.
|
||||
- Undo/Redo for every operation.
|
||||
- Real-time animation preview.
|
||||
- Multiple editors support.
|
||||
- Pixel-art specific tools like filled Contour, Polygon, Shading mode, etc.
|
||||
- Onion skinning.
|
||||
'';
|
||||
|
||||
maintainers = [ lib.maintainers.iamanaws ];
|
||||
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
||||
mainProgram = "aseprite";
|
||||
};
|
||||
})
|
||||
@@ -0,0 +1,79 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index b1bd0189b..3fb7abffb 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -66,6 +66,7 @@ enable_testing()
|
||||
|
||||
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)
|
||||
@@ -185,6 +186,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_PROFILE "${CMAKE_BINARY_DIR}/bin")
|
||||
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)
|
||||
@@ -225,6 +227,16 @@ if(NOT USE_SHARED_CURL)
|
||||
set(CURL_STATICLIB ON BOOL)
|
||||
endif()
|
||||
|
||||
+# fmt
|
||||
+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)
|
||||
diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt
|
||||
index 9c67c0268..b19a3e412 100644
|
||||
--- a/src/app/CMakeLists.txt
|
||||
+++ b/src/app/CMakeLists.txt
|
||||
@@ -754,7 +754,7 @@ target_link_libraries(app-lib
|
||||
${ZLIB_LIBRARIES}
|
||||
json11
|
||||
archive_static
|
||||
- fmt
|
||||
+ ${FMT_LIBRARIES}
|
||||
tinyexpr
|
||||
qoi)
|
||||
|
||||
diff --git a/src/dio/CMakeLists.txt b/src/dio/CMakeLists.txt
|
||||
index 55cb24de5..b253dca0b 100644
|
||||
--- a/src/dio/CMakeLists.txt
|
||||
+++ b/src/dio/CMakeLists.txt
|
||||
@@ -16,7 +16,7 @@ endif()
|
||||
|
||||
target_link_libraries(dio-lib
|
||||
${ZLIB_LIBRARIES}
|
||||
- fmt
|
||||
+ ${FMT_LIBRARIES}
|
||||
flic-lib
|
||||
laf-base
|
||||
fixmath-lib
|
||||
diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
|
||||
index 9d09a98c8..1973b134b 100644
|
||||
--- a/third_party/CMakeLists.txt
|
||||
+++ b/third_party/CMakeLists.txt
|
||||
@@ -117,7 +117,10 @@ if(NOT USE_SHARED_HARFBUZZ AND NOT LAF_BACKEND STREQUAL "skia")
|
||||
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)
|
||||
@@ -0,0 +1,21 @@
|
||||
diff --git a/cmake/FindJpegTurbo.cmake b/cmake/FindJpegTurbo.cmake
|
||||
index 33b5204..0407a6a 100644
|
||||
--- a/cmake/FindJpegTurbo.cmake
|
||||
+++ b/cmake/FindJpegTurbo.cmake
|
||||
@@ -9,14 +9,11 @@
|
||||
|
||||
if(LAF_BACKEND STREQUAL "skia")
|
||||
|
||||
- find_library(LIBJPEG_TURBO_LIBRARY NAMES libjpeg jpeg
|
||||
- HINTS "${SKIA_LIBRARY_DIR}" NO_DEFAULT_PATH)
|
||||
- set(LIBJPEG_TURBO_INCLUDE_DIRS "${SKIA_DIR}/third_party/externals/libjpeg-turbo")
|
||||
+ find_library(LIBJPEG_TURBO_LIBRARY NAMES libjpeg jpeg)
|
||||
|
||||
add_library(libjpeg-turbo STATIC IMPORTED)
|
||||
set_target_properties(libjpeg-turbo PROPERTIES
|
||||
- IMPORTED_LOCATION "${LIBJPEG_TURBO_LIBRARY}"
|
||||
- INTERFACE_INCLUDE_DIRECTORIES ${LIBJPEG_TURBO_INCLUDE_DIRS})
|
||||
+ IMPORTED_LOCATION "${LIBJPEG_TURBO_LIBRARY}")
|
||||
|
||||
else()
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 87aed2f28f9c..498472ec2a60 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -76,6 +76,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)
|
||||
@@ -380,7 +381,20 @@ add_subdirectory(laf)
|
||||
# libwebp
|
||||
if(ENABLE_WEBP)
|
||||
# Use libwebp from Skia
|
||||
- if(LAF_BACKEND STREQUAL "skia")
|
||||
+ 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)
|
||||
+ find_path(WEBP_INCLUDE_DIRS NAMES decode.h PATH_SUFFIXES webp)
|
||||
+ find_path(WEBP_INCLUDE_DIRS NAMES decode.h PATH_SUFFIXES webp)
|
||||
+ if(WEBP_LIBRARIES)
|
||||
+ set(WEBP_FOUND ON)
|
||||
+ else()
|
||||
+ set(WEBP_FOUND OFF)
|
||||
+ endif()
|
||||
+ elseif(LAF_BACKEND STREQUAL "skia")
|
||||
find_library(WEBP_LIBRARIES webp
|
||||
NAMES libwebp # required for Windows
|
||||
PATHS "${SKIA_LIBRARY_DIR}" NO_DEFAULT_PATH)
|
||||
diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
|
||||
index 1973b134b9f8..f15dba5a7968 100644
|
||||
--- a/third_party/CMakeLists.txt
|
||||
+++ b/third_party/CMakeLists.txt
|
||||
@@ -33,7 +33,7 @@ if(NOT USE_SHARED_GIFLIB)
|
||||
add_subdirectory(giflib)
|
||||
endif()
|
||||
|
||||
-if(ENABLE_WEBP AND NOT LAF_BACKEND STREQUAL "skia")
|
||||
+if(ENABLE_WEBP AND NOT LAF_BACKEND STREQUAL "skia" AND NOT USE_SHARED_WEBP)
|
||||
set(WEBP_BUILD_EXTRAS OFF CACHE BOOL "Build extras.")
|
||||
set(WEBP_BUILD_ANIM_UTILS OFF CACHE BOOL "Build animation utilities.")
|
||||
set(WEBP_BUILD_CWEBP OFF CACHE BOOL "Build the cwebp command line tool.")
|
||||
@@ -0,0 +1,21 @@
|
||||
--- src/laf/cmake/FindSkia.cmake.orig 2022-01-08 02:15:13.417619266 +0100
|
||||
+++ src/laf/cmake/FindSkia.cmake 2022-01-08 02:15:43.603960491 +0100
|
||||
@@ -32,14 +32,18 @@
|
||||
# SkShaper module + freetype + harfbuzz
|
||||
find_library(SKSHAPER_LIBRARY skshaper PATH "${SKIA_LIBRARY_DIR}")
|
||||
|
||||
+if(NOT USE_SHARED_FREETYPE)
|
||||
set(FREETYPE_FOUND ON)
|
||||
find_library(FREETYPE_LIBRARY freetype2 PATH "${SKIA_LIBRARY_DIR}" NO_DEFAULT_PATH)
|
||||
set(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY})
|
||||
set(FREETYPE_INCLUDE_DIRS "${SKIA_DIR}/third_party/externals/freetype/include")
|
||||
+endif()
|
||||
|
||||
+if(NOT USE_SHARED_HARFBUZZ)
|
||||
find_library(HARFBUZZ_LIBRARY harfbuzz PATH "${SKIA_LIBRARY_DIR}" NO_DEFAULT_PATH)
|
||||
set(HARFBUZZ_LIBRARIES ${HARFBUZZ_LIBRARY})
|
||||
set(HARFBUZZ_INCLUDE_DIRS "${SKIA_DIR}/third_party/externals/harfbuzz/src")
|
||||
+endif()
|
||||
|
||||
set(SKIA_LIBRARIES
|
||||
${SKIA_LIBRARY}
|
||||
Reference in New Issue
Block a user