# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 PortSystem 1.0 PortGroup app 1.0 PortGroup cmake 1.1 PortGroup conflicts_build 1.0 PortGroup github 1.0 PortGroup xcodeversion 1.0 name Aseprite categories graphics platforms {macosx >= 15} maintainers {ryandesign @ryandesign} openmaintainer license Restrictive # We are allowed to redistribute the source code but not binaries. # https://github.com/aseprite/aseprite/blob/master/EULA.txt # "The Licensor grants you the right to install and use copies of the # SOFTWARE PRODUCT on your computer [...]" # "You may not distribute copies of the SOFTWARE PRODUCT to third # parties." # "You may only compile and modify the source code of the SOFTWARE # PRODUCT for your own personal purpose or to propose a contribution to # the SOFTWARE PRODUCT." # https://aseprite.org/faq/#if-aseprite-source-code-is-available-how-is-that-you-are-selling-it # "Now you can still download its source code, compile it, and use it # for your personal purposes. You can make commercial art/assets with it # too. The only restriction in Aseprite EULA is that you cannot # redistribute Aseprite to third parties." # https://github.com/aseprite/aseprite/issues/2266#issuecomment-586600478 # "[...] we considerer that the source code can be distributed (even # modified copies). And only binaries cannot be distributed. We might # modify the EULA soon to clarify these aspects (separation between # Binary vs. Source Code)." # https://community.aseprite.org/t/eula-and-faq-confusion/9377 # "[...] the FAQ is making reference to assets/sprites, so you can # create art for personal or commercial products with any version of # Aseprite (official or compiled). About the EULA is that you cannot # compile Aseprite for commercial purposes (e.g. resell it)." github.setup aseprite aseprite 1.2.37 v revision 4 # Aseprite doesn't specify which commit of depot_tools we should use, so I'm # using the latest commit at the time this version of Aseprite was released. set depot_tools_commit f05fcf7051e12e5b561b8811e299096f332157f7 # Latest commit in skia's aseprite-m102 branch at the time this version of # Aseprite was released (see INSTALL.md). set skia_commit 861e4743af6d9bf6077ae6dda7274e5a136ee4e2 homepage https://aseprite.org github.tarball_from releases distname ${name}-v${version}-Source use_zip yes checksums ${distfiles} \ rmd160 5a290163548d287602631743a47088de99bb06ea \ sha256 74989ac5e57e4cba9cc16212d81f058c3aff70749d929e2e35eb38688c994c9e \ size 61977600 \ skia-${skia_commit}.tar.gz \ rmd160 b7649f5478916cf79567f2bedd70cf1b361fd723 \ sha256 6924ab75b5ea2b7390d22ad1710b8e6586d6068aec79457362350820bf10aaf3 \ size 53948567 set main_distfile [lindex ${distfiles} 0] set skia_distfile skia-${skia_commit}.tar.gz distfiles ${main_distfile}:main \ ${skia_distfile}:skia extract.only ${main_distfile} master_sites [lindex ${master_sites} 0]:main \ https://github.com/aseprite/skia/archive/${skia_commit}:skia description animated sprite editor & pixel art tool long_description ${name} is an image editor for creating animated \ sprites and other pixel art. set python_branch 3.11 set python_version [string map {. {}} ${python_branch}] configure.python ${prefix}/bin/python${python_branch} # TODO: Don't use git to fetch depot_tools or skia's dependencies. if {${os.platform} eq "darwin" && ${os.major} < 14} { set git_dep port:git } else { set git_dep bin:git:git } depends_fetch-append ${git_dep} depends_extract-append ${git_dep} \ port:python${python_version} depends_build-append path:bin/pkg-config:pkgconfig \ port:python${python_version} depends_lib-append port:bzip2 \ port:cmark \ port:curl \ port:expat \ port:freetype \ port:giflib \ path:lib/pkgconfig/harfbuzz.pc:harfbuzz \ path:lib/pkgconfig/harfbuzz-icu.pc:harfbuzz-icu \ path:lib/pkgconfig/icu-uc.pc:icu \ port:libb2 \ port:libdeflate \ path:include/turbojpeg.h:libjpeg-turbo \ path:lib/pkgconfig/pixman-1.pc:libpixman \ port:libpng \ port:libxml2 \ port:lz4 \ port:mesa \ port:tiff \ port:tinyxml \ port:webp \ port:xz \ port:zlib \ port:zstd # TODO: Use MacPorts libarchive # https://github.com/aseprite/aseprite/issues/1681 # TODO: Use MacPorts lua, after updating it to 5.4 # or figure out how to prevent this build from seeing it. conflicts_build lua lua50 # Invoke a procedure on each item in a list. # You'd think this would be in Tcl or MacPorts base already. # http://wiki.tcl.tk/4884 proc map {prefix list} { set result {} foreach item ${list} { lappend result [{*}${prefix} ${item}] } return ${result} } proc quoted_shellescape {arg} { return "\"[shellescape ${arg}]\"" } worksrcdir ${github.project} extract.mkdir yes post-fetch { # depot_tools is hosted on googlesource.com which doesn't generate # deterministic tarballs. https://github.com/google/gitiles/issues/84 file mkdir ${workpath}/depot_tools system -W ${workpath}/depot_tools "\ git -c init.defaultBranch=main init &&\ git remote add origin https://chromium.googlesource.com/chromium/tools/depot_tools &&\ git fetch --depth 1 origin ${depot_tools_commit} &&\ git -c advice.detachedHead=false checkout FETCH_HEAD\ " } post-extract { system -W ${workpath} \ "tar -xzf [shellescape ${distpath}/${skia_distfile}]" foreach submodule {../skia} { delete ${worksrcpath}/${submodule} move {*}[glob ${workpath}/[file tail ${submodule}]-*] ${worksrcpath}/${submodule} } # Various skia gn scripts run "python" but are compatible with python 3. ln -s ${configure.python} ${workpath}/depot_tools/python # depot_tools runs "python3". ln -s ${configure.python} ${workpath}/depot_tools/python3 # Fetch skia's dependencies. # TODO: Fetch these as distfiles instead, maybe using a strategy similar # to the one used by the MoltenVK port. Many of them aren't even needed # since we're using MacPorts deps rather than bundled versions. system -W ${workpath}/skia "${configure.python} tools/git-sync-deps" } patch.dir ${workpath} patchfiles prefix.patch \ USE_SHARED_LIBWEBP.patch post-patch { reinplace -W ${workpath}/skia/third_party "s|@PREFIX@|${prefix}|g" \ freetype2/BUILD.gn harfbuzz/BUILD.gn } compiler.cxx_standard 2017 cmake.build_type Release cmake.generator Ninja supported_archs arm64 x86_64 universal_variant no # The cmake portgroup clears configure.*_archflags at pre-configure time # so we have to save it before then. set archflags [get_canonical_archflags] configure.cppflags-replace -I${prefix}/include -isystem${prefix}/include pre-configure { switch ${build_arch} { x86_64 { set skia_cpu x64 } default { set skia_cpu ${build_arch} } } # Claiming to be an official build and using -frtti because it is # suggested here: # https://github.com/aseprite/skia#skia-on-macos lappend skia_cflags {*}${configure.cflags} \ {*}${archflags} lappend skia_cxxflags {*}${configure.cxxflags} \ -frtti \ {*}${archflags} lappend skia_ldflags {*}${configure.ldflags} \ {*}${archflags} lappend skia_configure_args \ cc="${configure.cc}" \ cxx="${configure.cxx}" \ extra_cflags_c=\[[join [map quoted_shellescape ${skia_cflags}] ,]\] \ extra_cflags_cc=\[[join [map quoted_shellescape ${skia_cxxflags}] ,]\] \ extra_ldflags=\[[join [map quoted_shellescape ${skia_ldflags}] ,]\] \ is_debug=false \ is_official_build=true \ skia_pdf_subset_harfbuzz=true \ skia_use_freetype=true \ skia_use_harfbuzz=true \ target_cpu="${skia_cpu}" if {${configure.ccache}} { lappend skia_configure_args \ cc_wrapper="${prefix}/bin/ccache" } system -W ${workpath}/skia "\ PATH=${workpath}/depot_tools:$env(PATH) &&\ export PATH &&\ gn gen out/Release --args=[shellescape [join ${skia_configure_args}]] &&\ ${prefix}/bin/ninja -vC out/Release skia modules\ " } # Specify the libraries that libskia.a uses to avoid undefined symbols. lappend skia_libraries ${workpath}/skia/out/Release/libskia.a \ ${prefix}/lib/libjpeg.dylib \ ${prefix}/lib/libpng.dylib \ ${prefix}/lib/libwebp.dylib \ ${prefix}/lib/libwebpdemux.dylib \ ${prefix}/lib/libwebpmux.dylib \ ${prefix}/lib/libz.dylib configure.args -DENABLE_BZip2=ON \ -DENABLE_LIBXML2=ON \ -DENABLE_LZMA=ON \ -DENABLE_UPDATER=OFF \ -DENABLE_WEBP=ON \ -DHARFBUZZ_LIBRARY=${prefix}/lib/libharfbuzz.dylib \ -DLAF_BACKEND=skia \ -DLAF_WITH_EXAMPLES=OFF \ -DPNG_SHARED=ON \ -DSKIA_DIR=${workpath}/skia \ -DSKIA_LIBRARY=[join ${skia_libraries} {\;}] \ -DSKIA_LIBRARY_DIR=${workpath}/skia/out/Release \ -DUSE_SHARED_CMARK=YES \ -DUSE_SHARED_CURL=YES \ -DUSE_SHARED_FREETYPE=YES \ -DUSE_SHARED_GIFLIB=YES \ -DUSE_SHARED_HARFBUZZ=YES \ -DUSE_SHARED_JPEGLIB=YES \ -DUSE_SHARED_LIBPNG=YES \ -DUSE_SHARED_LIBWEBP=YES \ -DUSE_SHARED_PIXMAN=YES \ -DUSE_SHARED_TINYXML=YES \ -DUSE_SHARED_ZLIB=YES \ -DWITH_BZip2=ON app.executable ${build.dir}/bin/aseprite app.retina yes app.icon data/icons/ase256.png set document_icon data/icons/doc256.png set extension_icon data/icons/ext256.png # The program is coded to look for its data in a relative path that assumes # an app bundle layout, so we can't use the install target because it doesn't # create an app bundle. https://github.com/aseprite/aseprite/issues/1366 destroot { copy ${worksrcpath}/data ${destroot}${applications_dir}/${app.name}.app/Contents/Resources # Remove unneeded files installed by the bundled copies of libarchive # and json11. https://github.com/aseprite/aseprite/issues/1602 foreach f { bin/bsdcat bin/bsdcpio bin/bsdtar include/json11.hpp lib/libjson11.a lib/pkgconfig/json11.pc lib/pkgconfig/libarchive.pc share/man/man1/bsdcat.1 share/man/man1/bsdcpio.1 share/man/man1/bsdtar.1 } { delete ${destroot}${prefix}/${f} } } post-destroot { # Add extra keys, like document types, to Info.plist. set merge "Merge [shellescape ${filespath}/extra-Info.plist]" system -W ${destroot}${applications_dir}/${app.name}.app/Contents \ "/usr/libexec/PlistBuddy Info.plist -c [shellescape ${merge}]" system -W ${destroot}${applications_dir}/${app.name}.app/Contents/Resources \ "${prefix}/bin/makeicns -in [shellescape ${worksrcpath}/${document_icon}] -out Document.icns" system -W ${destroot}${applications_dir}/${app.name}.app/Contents/Resources \ "${prefix}/bin/makeicns -in [shellescape ${worksrcpath}/${extension_icon}] -out Extension.icns" } # Might be able to improve this later using the MacOSX.sdk port. minimum_xcodeversions {15 8} # https://aseprite.org/faq/#if-aseprite-source-code-is-available-how-is-that-you-are-selling-it notes " ${name} is free for personal and commercial use provided you compile it\ from source, which is what happens when MacPorts installs it. The\ MacPorts project does not distribute binaries of ${name}. To show your support for and appreciation of the developers and to\ avoid the need to compile it from source and instead receive an\ official binary from the developers, please purchase a license: ${homepage}/#buy Please read and agree to the end user license agreement: ${github.raw}/${github.tag_prefix}${github.version}/EULA.txt And check the frequently-asked questions: ${homepage}/faq/ " github.livecheck.regex {([0-9.]+)}