Skip to content

Commit

Permalink
dev-games/aseprite: add 1.3.5
Browse files Browse the repository at this point in the history
Closes: https://bugs.gentoo.org/924692
Signed-off-by: Azamat H. Hackimov <[email protected]>
Signed-off-by: Joonas Niilola <[email protected]>
  • Loading branch information
winterheart authored and juippis committed Apr 16, 2024
1 parent 4b40923 commit ca2ef8c
Show file tree
Hide file tree
Showing 3 changed files with 376 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev-games/aseprite/Manifest
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
DIST Aseprite-v1.2.40-Source.zip 61802371 BLAKE2B f6f586a3ca222de208e6639e3fc94a63f98e487e1975dccd2974ffa71f937384177639e3799fb81f064afaf1c4a048394fab32a30bcda353320ac55c38b17636 SHA512 0a548428a3362f49cb6cecaa061de8371ad3f0bc22d00bc957e21f22316772e854d7ad36ebb7e5b69274eea376bb62fa39abfd4bc02250524c3707f81a628b1f
DIST Aseprite-v1.3.2-Source.zip 64151421 BLAKE2B 9e23bf62b7d8c6377e36149ce830151d35b48e125a5a99aeb44b0fb1f2f653e53df9b8d74b7127598607561cf6dde4b59f00dd6c6abd08581eddab71feda415d SHA512 cbe1acd1f851f049ceaa948eb59ec1cb1e67c99e9204750f1e38cbedb8122fe0ce63230b63ab537e59d87c88d5ebae03b0785d0eb5195c8ef9a206c8ac71b977
DIST Aseprite-v1.3.5-Source.zip 64189695 BLAKE2B f796f688f0ba565ae32fde2e8d84e39b610f451054440ced078ce1fc847a9208460b45aa6efa059a56c9e0603b4fd156cc476a2c40715ec2c37181e39c06a401 SHA512 885386e84c55b84cc85ffbf16f7269ac1640458abe973c3aa2e3eabd807ea3e1e06ee6e6dfaffff9dd7b09d3b37bd9ac41821152838cd80742edd4d53302c0e3
DIST skia-m102-3338e90707323d2cd3a150276acb9f39933deee2.gh.tar.gz 53944562 BLAKE2B 9da3e8386cd7a18a6ee9362743bee4146c41038af8868a6f5e8a2dce468e4dc4669b488861d117da8d1bd8461b2ad47bfc300774a33a84153bca345d63a929a7 SHA512 9ae0032ee3861ce4958af6eb7047273d28b1faa3823576ef568e3c7faed7f49a9976540a72c3fa38234a4ae6319ac381324eff807938f9763781fd33ad67d075
220 changes: 220 additions & 0 deletions dev-games/aseprite/aseprite-1.3.5.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{10..12} )

inherit cmake desktop python-any-r1 toolchain-funcs xdg-utils

SKIA_VER="m102"
# Last commit in ${SKIA_VER} feature branch
# Don't use skia.googlesource.com, it produces non-reproducible tarballs
SKIA_REV="3338e90707323d2cd3a150276acb9f39933deee2"

DESCRIPTION="Animated sprite editor & pixel art tool"
HOMEPAGE="https://www.aseprite.org"
SRC_URI="https://github.com/aseprite/aseprite/releases/download/v${PV}/Aseprite-v${PV}-Source.zip
https://github.com/google/skia/archive/${SKIA_REV}.tar.gz -> skia-${SKIA_VER}-${SKIA_REV}.gh.tar.gz"

# See https://github.com/aseprite/aseprite#license
LICENSE="Aseprite-EULA MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"

IUSE="kde test webp"
RESTRICT="bindist mirror !test? ( test )"

CDEPEND="
app-arch/libarchive:=
app-text/cmark:=
dev-libs/libfmt:=
dev-libs/tinyxml
media-libs/freetype
media-libs/giflib:=
media-libs/harfbuzz:=[truetype]
media-libs/libjpeg-turbo:=
media-libs/libpng:=
net-misc/curl
sys-libs/zlib:=
virtual/opengl
x11-libs/libX11
x11-libs/libXcursor
x11-libs/libXi
x11-libs/libxcb:=
kde? (
dev-qt/qtcore:5
dev-qt/qtgui:5
kde-frameworks/kio:5
)
webp? ( media-libs/libwebp:= )"
RDEPEND="
${CDEPEND}
gnome-extra/zenity
"
DEPEND="
${CDEPEND}
x11-base/xorg-proto"
BDEPEND="
${PYTHON_DEPS}
test? ( dev-cpp/gtest )
app-arch/unzip
dev-build/gn
virtual/pkgconfig"

DOCS=(
docs/ase-file-specs.md
docs/gpl-palette-extension.md
README.md
)

S="${WORKDIR}"

PATCHES=(
"${FILESDIR}/skia-${SKIA_VER}_remove_angle2.patch"
"${FILESDIR}/${PN}-1.2.40_shared_libarchive.patch"
"${FILESDIR}/${PN}-1.3.2_shared_json11.patch"
"${FILESDIR}/${PN}-1.3.2_shared_webp.patch"
"${FILESDIR}/${PN}-1.2.35_laf_fixes.patch"
"${FILESDIR}/${PN}-1.3.2_shared_fmt.patch"
"${FILESDIR}/${PN}-1.3.2_strict-aliasing.patch"
"${FILESDIR}/${PN}-1.3.5_laf-strict-aliasing.patch"
)

src_prepare() {
cmake_src_prepare
# Skia: remove custom optimizations
sed -i -e 's:"\/\/gn\/skia\:optimize",::g' \
"skia-${SKIA_REV}/gn/BUILDCONFIG.gn" || die
# Aseprite: don't install tga bundled library
sed -i -e '/install/d' src/tga/CMakeLists.txt || die
# Aseprite: don't use bundled gtest
sed -i -e '/add_subdirectory(googletest)/d' \
laf/third_party/CMakeLists.txt || die
# Fix shebang in thumbnailer
sed -i -e 's:#!/usr/bin/sh:#!/bin/sh:' \
src/desktop/linux/aseprite-thumbnailer || die
}

src_configure() {
einfo "Skia configuration"
cd "${WORKDIR}/skia-${SKIA_REV}" || die

tc-export AR CC CXX

passflags() {
local _f _x
_f=( ${1} )
_x="[$(printf '"%s", ' "${_f[@]}")]"
myconf_gn+=( ${2}="${_x}" )
}

local myconf_gn=(
ar=\"${AR}\"
cc=\"${CC}\"
cxx=\"${CXX}\"

is_official_build=true
is_component_build=false
is_debug=false

skia_use_egl=false
skia_use_dawn=false
skia_use_dng_sdk=false
skia_use_metal=false
skia_use_sfntly=false
skia_use_wuffs=false

skia_enable_pdf=false
skia_enable_svg=false
skia_use_expat=false
skia_use_ffmpeg=false
skia_use_fontconfig=false
skia_use_freetype=true
skia_use_gl=true
skia_use_harfbuzz=true
skia_use_icu=false
skia_use_libjpeg_turbo_decode=true
skia_use_libjpeg_turbo_encode=true
skia_use_libpng_decode=true
skia_use_libpng_encode=true
skia_use_libwebp_decode=$(usex webp true false)
skia_use_libwebp_encode=$(usex webp true false)
skia_use_lua=false
skia_use_vulkan=false
skia_use_x11=false
skia_use_xps=false
skia_use_zlib=true
)

passflags "${CFLAGS}" extra_cflags_c
passflags "${CXXFLAGS}" extra_cflags_cc
passflags "${LDFLAGS}" extra_ldflags
myconf_gn="${myconf_gn[@]}"
set -- gn gen --args="${myconf_gn% }" out/Static
echo "$@"
"$@" || die

einfo "Aseprite configuration"
cd "${WORKDIR}" || die

local mycmakeargs=(
-DENABLE_CCACHE=OFF
-DENABLE_DESKTOP_INTEGRATION=ON
-DENABLE_STEAM=OFF
-DENABLE_TESTS="$(usex test)"
-DENABLE_QT_THUMBNAILER="$(usex kde)"
-DENABLE_UPDATER=OFF
-DENABLE_UI=ON
-DENABLE_WEBP="$(usex webp)"
-DLAF_WITH_EXAMPLES=OFF
-DLAF_WITH_TESTS="$(usex test)"
-DFULLSCREEN_PLATFORM=ON
-DSKIA_DIR="${WORKDIR}/skia-${SKIA_REV}/"
-DSKIA_LIBRARY_DIR="${WORKDIR}/skia-${SKIA_REV}/out/Static/"
-DSKIA_LIBRARY="${WORKDIR}/skia-${SKIA_REV}/out/Static/libskia.a"
-DSKSHAPER_LIBRARY="${WORKDIR}/skia-${SKIA_REV}/out/Static/libskshaper.a"
-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_JPEGLIB=ON
-DUSE_SHARED_JSON11=OFF # Custom methods added to bundled version
-DUSE_SHARED_LIBARCHIVE=ON
-DUSE_SHARED_LIBPNG=ON
-DUSE_SHARED_PIXMAN=ON
-DUSE_SHARED_TINYXML=ON
-DUSE_SHARED_WEBP=ON
-DUSE_SHARED_ZLIB=ON
)
cmake_src_configure
}

src_compile() {
einfo "Skia compilation"
cd "${WORKDIR}/skia-${SKIA_REV}" || die
eninja -C out/Static

einfo "Aseprite compilation"
cd "${WORKDIR}" || die
cmake_src_compile
}

src_install() {
newicon -s 64 "${S}/data/icons/ase64.png" "${PN}.png"
cmake_src_install
}

pkg_postinst() {
xdg_desktop_database_update
xdg_icon_cache_update
xdg_mimeinfo_database_update
}

pkg_postrm() {
xdg_desktop_database_update
xdg_icon_cache_update
xdg_mimeinfo_database_update
}
155 changes: 155 additions & 0 deletions dev-games/aseprite/files/aseprite-1.3.5_laf-strict-aliasing.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
https://github.com/aseprite/laf/pull/84
From: "Azamat H. Hackimov" <[email protected]>
Date: Sun, 14 Apr 2024 21:47:02 +0300
Subject: [PATCH] Fix strict-alias warnings

reinterpret_cast on pointers break strict-aliasing rule (-Wstrict-aliasing). Implemented internal function copy_reinterpret_cast that memcpy pointer into type, that can be converted to desired type.
--- a/laf/base/cfile.cpp
+++ b/laf/base/cfile.cpp
@@ -7,6 +7,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
+#include "base/mem_utils.h"

#include <cstdio>

@@ -114,7 +115,7 @@ float fgetf(FILE* file)

// Little endian.
int v = ((b4 << 24) | (b3 << 16) | (b2 << 8) | b1);
- return *reinterpret_cast<float*>(&v);
+ return *copy_reinterpret_cast<float*>(&v);
}

// Reads a 64-bit double-precision floating point number using
@@ -156,7 +157,7 @@ double fgetd(FILE* file)
((long long)b3 << 16) |
((long long)b2 << 8) |
(long long)b1);
- return *reinterpret_cast<double*>(&v);
+ return *copy_reinterpret_cast<double*>(&v);
}

// Writes a word using little-endian byte ordering.
@@ -231,7 +232,7 @@ int fputq(long long l, FILE* file)
// Returns 0 in success or -1 in error
int fputf(float l, FILE* file)
{
- int b = *(reinterpret_cast<int*>(&l));
+ int b = *(copy_reinterpret_cast<int*>(&l));
int b1, b2, b3, b4;

// Little endian.
@@ -254,7 +255,7 @@ int fputf(float l, FILE* file)
// Returns 0 in success or -1 in error
int fputd(double l, FILE* file)
{
- long long b = *(reinterpret_cast<long long*>(&l));
+ long long b = *(copy_reinterpret_cast<long long*>(&l));
int b1, b2, b3, b4, b5, b6, b7, b8;

// Little endian.
--- a/laf/base/mem_utils.h
+++ b/laf/base/mem_utils.h
@@ -8,10 +8,18 @@
#define BASE_MEM_UTILS_H_INCLUDED
#pragma once

+#include <cstring>
#include <string>

namespace base {

+ template<typename T>
+ T copy_reinterpret_cast(const void* ptr) {
+ T tmp;
+ std::memcpy(&tmp, ptr, sizeof(T));
+ return tmp;
+ }
+
std::string get_pretty_memory_size(std::size_t memsize);

} // namespace base
--- a/laf/base/serialization.cpp
+++ b/laf/base/serialization.cpp
@@ -8,6 +8,7 @@
#include "config.h"
#endif

+#include "base/mem_utils.h"
#include "base/serialization.h"

#include <iostream>
@@ -57,7 +58,7 @@ std::ostream& little_endian::write64(std::ostream& os, uint64_t qword)

std::ostream& little_endian::write_float(std::ostream& os, float value)
{
- int b = *(reinterpret_cast<int*>(&value));
+ int b = *(copy_reinterpret_cast<int*>(&value));
os.put((int)((b & 0x000000ffl)));
os.put((int)((b & 0x0000ff00l) >> 8));
os.put((int)((b & 0x00ff0000l) >> 16));
@@ -67,7 +68,7 @@ std::ostream& little_endian::write_float(std::ostream& os, float value)

std::ostream& little_endian::write_double(std::ostream& os, double value)
{
- long long b = *(reinterpret_cast<long long*>(&value));
+ long long b = *(copy_reinterpret_cast<long long*>(&value));
os.put((int)((b & 0x00000000000000ffl)));
os.put((int)((b & 0x000000000000ff00l) >> 8));
os.put((int)((b & 0x0000000000ff0000l) >> 16));
@@ -126,7 +127,7 @@ float little_endian::read_float(std::istream& is)
b3 = is.get();
b4 = is.get();
int v = ((b4 << 24) | (b3 << 16) | (b2 << 8) | b1);
- return *reinterpret_cast<float*>(&v);
+ return *copy_reinterpret_cast<float*>(&v);
}

double little_endian::read_double(std::istream& is)
@@ -148,7 +149,7 @@ double little_endian::read_double(std::istream& is)
((long long)b3 << 16) |
((long long)b2 << 8) |
(long long)b1);
- return *reinterpret_cast<double*>(&v);
+ return *copy_reinterpret_cast<double*>(&v);
}

std::ostream& big_endian::write16(std::ostream& os, uint16_t word)
@@ -182,7 +183,7 @@ std::ostream& big_endian::write64(std::ostream& os, uint64_t qword)

std::ostream& big_endian::write_float(std::ostream& os, float value)
{
- int b = *(reinterpret_cast<int*>(&value));
+ int b = *(copy_reinterpret_cast<int*>(&value));
os.put((int)((b & 0xff000000l) >> 24));
os.put((int)((b & 0x00ff0000l) >> 16));
os.put((int)((b & 0x0000ff00l) >> 8));
@@ -192,7 +193,7 @@ std::ostream& big_endian::write_float(std::ostream& os, float value)

std::ostream& big_endian::write_double(std::ostream& os, double value)
{
- long long b = *(reinterpret_cast<long long*>(&value));
+ long long b = *(copy_reinterpret_cast<long long*>(&value));
os.put((int)((b & 0xff00000000000000l) >> 56));
os.put((int)((b & 0x00ff000000000000l) >> 48));
os.put((int)((b & 0x0000ff0000000000l) >> 40));
@@ -251,7 +252,7 @@ float big_endian::read_float(std::istream& is)
b2 = is.get();
b1 = is.get();
int v = ((b4 << 24) | (b3 << 16) | (b2 << 8) | b1);
- return *reinterpret_cast<float*>(&v);
+ return *copy_reinterpret_cast<float*>(&v);
}

double big_endian::read_double(std::istream& is)
@@ -273,7 +274,7 @@ double big_endian::read_double(std::istream& is)
((long long)b3 << 16) |
((long long)b2 << 8) |
(long long)b1);
- return *reinterpret_cast<double*>(&v);
+ return *copy_reinterpret_cast<double*>(&v);
}


0 comments on commit ca2ef8c

Please sign in to comment.