# -*- 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 name Aseprite categories graphics platforms {macosx >= 16} 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.3.6 v revision 0 # Aseprite doesn't specify which commit of depot_tools we should use, so I'm # using the most recent commit before this version of Aseprite was tagged. set depot_tools_commit f85dd800c796d44fa1b16f16f74cb1366a0670c8 # 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 7ac3f5e221a27db10e843db73dd16dd188c699c8 \ sha256 5e974aa2786297981cd5ebe81f040a49b722bddfe33d70def207ad06cb0d34fc \ size 64194232 \ 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 ${github.master_sites}:main \ https://github.com/${github.author}/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.12 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: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:libarchive \ port:libb2 \ port:libdeflate \ path:include/turbojpeg.h:libjpeg-turbo \ path:lib/pkgconfig/pixman-1.pc:libpixman \ port:libpng \ port:lz4 \ port:mesa \ port:tiff \ port:tinyxml \ port:webp \ port:zlib \ port:zstd # 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\ " } pre-extract { ui_msg "The extract, configure, and build phases may each take several minutes to complete." } 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 # Avoid fetching unnecessary dependencies. system -W ${workpath} "patch -bp0 < [shellescape ${filespath}/DEPS.patch]" # Avoid fetching unnecessary data for necessary dependencies. system -W ${workpath} "patch -bp0 < [shellescape ${filespath}/git-sync-deps.patch]" # Fetch skia's dependencies. # TODO: Fetch these as distfiles instead, maybe using a strategy similar # to the one formerly 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_LIBARCHIVE.patch \ USE_SHARED_LIBWEBP.patch # Can probably apply this unconditionally but only these older systems need it # and builds for newer systems have already succeeded and I don't want to risk # disturbing them. if {${os.platform} eq "darwin" && ${os.major} < 19} { patchfiles-append no-base_aligned_alloc.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} } } # Using is_official_build=true and -frtti as suggested here: # https://github.com/aseprite/skia#skia-on-macos # is_official_build=true also turns on the use of system libraries. 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_LIBARCHIVE=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 json11. # See https://github.com/aseprite/aseprite/issues/1602 foreach f { include/json11.hpp lib/libjson11.a lib/pkgconfig/json11.pc } { 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" } # 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 and that you do not redistribute the compiled binary. The\ MacPorts project does not distribute binaries of ${name}; instead, it\ compiles ${name} from source on your system, which is why it takes some\ time. To support the developers and to show your appreciation, and to avoid\ the need to compile ${name} from source and instead receive an official\ binary from the developers, please purchase a license: ${homepage}/#buy By using ${name} you agree to be bound by the terms of the end user\ license agreement which you can read here: ${github.raw}/${github.tag_prefix}${github.version}/EULA.txt Documentation is available: ${homepage}/docs/ You may also find it helpful to read the frequently-asked questions: ${homepage}/faq/ " github.livecheck.regex {([0-9.]+)}