You are not logged in.

#1 2019-07-05 00:19:15

oinkl
Member
Registered: 2010-01-13
Posts: 47

[SOLVED] PKGBUILD review request

I adopted aseprite-git from the AUR and wrote my first PKGBUILD. Any comments appreciated!

I also have a question regarding python2: ninja requires python to refer to python2. I followed what the previous maintainer did and linked python to python2 and prefixed it in PATH, but it feels abit hackish. Is this the best solution?

# Maintainer: Justin Wong <jusw85 at hotmail dot com>
# Contributor: Benoit Favre <benoit.favre@gmail.com>
# Contributor: Alexander Rødseth <rodseth@gmail.com>
# Contributor: Kamil Biduś <kamil.bidus@gmail.com>

pkgname=aseprite-git
_pkgname=aseprite
pkgver=v1.2.13.r0.gaf4fd54c2
pkgrel=1
pkgdesc='Create animated sprites and pixel art'
arch=('x86_64' 'i686')
url='http://www.aseprite.org/'
license=('BSD' 'custom')
depends=('cmark' 'curl' 'libjpeg-turbo' 'giflib' 'tinyxml' 'pixman' 'libxcursor' 'fontconfig')
makedepends=('git' 'ninja' 'python2' 'clang')
conflicts=("${_pkgname}" "${_pkgname}-gpl"  )
source=("skia::git+https://github.com/${_pkgname}/skia.git#branch=aseprite-m71"
        "${_pkgname}::git+https://github.com/${_pkgname}/${_pkgname}.git"
        'desktop.patch')
sha256sums=('SKIP'
            'SKIP'
            'bcb6229e42cef16a8a0273c2fce67ce81d243a085c90bd52ac15183e757ff875')

pkgver() {
    cd "${srcdir}/${_pkgname}"
    git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
    cd "${srcdir}/${_pkgname}"

    less EULA.txt
    echo "Do you accept the EULA? yes/NO"
    read reply
    [ "$reply" == "yes" ] || exit 1

    git submodule update --init --recursive
    patch --strip=1 --input="${srcdir}/desktop.patch"
    mkdir -p build

    cd "${srcdir}/skia"
    python2 tools/git-sync-deps

    mkdir -p "${srcdir}/.pkgbuild-bin"
    ln -sf /usr/bin/python2 "${srcdir}/.pkgbuild-bin/python"
}

build() {
    cd "${srcdir}/skia"
    bin/gn gen out/Clang --args='is_debug=false is_official_build=true cc="clang" cxx="clang++" skia_use_system_expat=false skia_use_system_icu=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false'
    ninja -C out/Clang skia

    cd "${srcdir}/${_pkgname}/build"
    cmake \
        -DCMAKE_BUILD_TYPE=RelWithDebInfo \
        -DLAF_OS_BACKEND=skia \
        -DSKIA_DIR="$srcdir/skia" \
        -DSKIA_OUT_DIR="$srcdir/skia/out/Clang" \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DUSE_SHARED_CMARK=ON \
        -DUSE_SHARED_CURL=ON \
        -DUSE_SHARED_JPEGLIB=ON \
        -DUSE_SHARED_GIFLIB=ON \
        -DUSE_SHARED_ZLIB=ON \
        -DUSE_SHARED_LIBPNG=ON \
        -DUSE_SHARED_TINYXML=ON \
        -DUSE_SHARED_PIXMAN=ON \
        -DUSE_SHARED_FREETYPE=ON \
        -DUSE_SHARED_HARFBUZZ=ON \
        -G Ninja \
        ..
    export PATH="${srcdir}/.pkgbuild-bin":$PATH
    ninja ${_pkgname}
}

package() {
    cd "${srcdir}/${_pkgname}/build"
    DESTDIR="${pkgdir}" ninja install

    # Remove extraneous files
    # https://github.com/aseprite/aseprite/issues/1574
    # https://github.com/aseprite/aseprite/issues/1602
    rm -f "${pkgdir}"/usr/bin/bsd*
    rm -f "${pkgdir}"/usr/lib/pkgconfig/libarchive.pc
    rm -f "${pkgdir}"/usr/share/man/man1/bsd*

    rm -f "${pkgdir}"/usr/bin/img2webp
    rm -fr "${pkgdir}"/usr/include/webp/
    rm -f "${pkgdir}"/usr/lib/libwebp*
    rm -fr "${pkgdir}"/usr/share/WebP/
    rm -f "${pkgdir}"/usr/share/man/man1/img2webp.1

    rm -f "${pkgdir}"/usr/include/json11.hpp
    rm -f "${pkgdir}"/usr/lib/libjson11.a
    rm -f "${pkgdir}"/usr/lib/pkgconfig/json11.pc

    find "${pkgdir}" -type d -empty -delete

    cd "${srcdir}/${_pkgname}"

    install -Dm644 "src/desktop/linux/${_pkgname}.desktop" "${pkgdir}/usr/share/applications/${_pkgname}.desktop"
    install -Dm644 "src/desktop/linux/mime/${_pkgname}.xml" "${pkgdir}/usr/share/mime/packages/${_pkgname}.xml"
    for i in {16,32,48,64,128,256}; do
        install -Dm644 "data/icons/ase${i}.png" "${pkgdir}/usr/share/icons/hicolor/${i}x${i}/apps/${_pkgname}.png"
        install -Dm644 "data/icons/doc${i}.png" "${pkgdir}/usr/share/icons/hicolor/${i}x${i}/mimetypes/image-x-${_pkgname}.png"
    done
    install -Dm644 "EULA.txt" "${pkgdir}/usr/share/licenses/${pkgname}/EULA"
    install -Dm644 "$srcdir/skia/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

Last edited by oinkl (2019-07-08 12:56:26)

Offline

#2 2019-07-05 00:24:45

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,520
Website

Re: [SOLVED] PKGBUILD review request

oinkl wrote:

ninja requires python to refer to python2. I followed what the previous maintainer did and linked python to python2 and prefixed it in PATH, but it feels abit hackish. Is this the best solution?

That sounds like the worst solution to me.  If it is the only possible solution, then I suppose it could also be the best - but I doubt that's the case.  I'm downloading now to do some tinkering, but I'd prefer to fix what is broken rather than breaking something else as a coping strategy.  (edit: this isn't as bad as I first thought.  I thought this was like another active thread where the user created a python wrapper script in /usr/local/bin/.  The present hackery as ugly as it is is at least restricted to within the build environment.)

I'm also going to check out that EULA - PKGBUILDs should not be interactive.  Does the EULA strictly require someone agree to it before they even build the software?  EDIT: nothing in the EULA requires any such interactive consent, remove all of that and just have the PKGBUILD install the EULA properly.

EDIT: can you provide your desktop.patch here so we can test everything out?

Last edited by Trilby (2019-07-05 00:30:56)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2019-07-05 00:34:55

oinkl
Member
Registered: 2010-01-13
Posts: 47

Re: [SOLVED] PKGBUILD review request

desktop.patch

diff --git a/src/desktop/linux/aseprite.desktop b/src/desktop/linux/aseprite.desktop
index 5381f3e4b..374f7e32f 100644
--- a/src/desktop/linux/aseprite.desktop
+++ b/src/desktop/linux/aseprite.desktop
@@ -6,9 +6,8 @@ GenericName=Sprite Editor
 Comment=Animated sprite editor & pixel art tool
 Icon=aseprite
 Categories=Graphics;2DGraphics;RasterGraphics;
-Exec=aseprite %U
+Exec=aseprite %F
 TryExec=aseprite
 Terminal=false
 StartupNotify=false
-StartupWMClass=allegro
 MimeType=image/bmp;image/gif;image/jpeg;image/png;image/x-pcx;image/x-tga;image/vnd.microsoft.icon;video/x-flic;image/webp;image/x-aseprite;
diff --git a/src/desktop/linux/mime/aseprite.xml b/src/desktop/linux/mime/aseprite.xml
index 52b2adb92..a656cb3b1 100644
--- a/src/desktop/linux/mime/aseprite.xml
+++ b/src/desktop/linux/mime/aseprite.xml
@@ -7,6 +7,6 @@
          </magic>
          <glob pattern="*.ase"/>
          <glob pattern="*.aseprite"/>
-        <icon name="aseprite"/>
+        <icon name="image-x-aseprite"/>
   </mime-type>
 </mime-info>

Will fix the EULA, thanks for the tips.
I took reference from what the previous maintainers did. The aseprite package also follow the same pattern...

Last edited by oinkl (2019-07-05 00:35:23)

Offline

#4 2019-07-05 22:10:15

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: [SOLVED] PKGBUILD review request

I also have a question regarding python2: ninja requires python to refer to python2.

Nope, it's very likely cmake that sets that requirement.

If a program uses python but doesn't specify which version , cmake defaults to python2 . Incase python2 is not present, python3 will be used.

A simple search for python in CMakeLists.txt should bring to light if the software supports a method to tell cmake where to look for python (and if it can work with python3) .
If unsure, put CMakeList.txt somewhere public so people can check it without downloading.

Last edited by Lone_Wolf (2019-07-05 22:10:47)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#5 2019-07-05 23:04:18

oinkl
Member
Registered: 2010-01-13
Posts: 47

Re: [SOLVED] PKGBUILD review request

Lone_Wolf wrote:

I also have a question regarding python2: ninja requires python to refer to python2.

Nope, it's very likely cmake that sets that requirement.

If a program uses python but doesn't specify which version , cmake defaults to python2 . Incase python2 is not present, python3 will be used.

A simple search for python in CMakeLists.txt should bring to light if the software supports a method to tell cmake where to look for python (and if it can work with python3) .
If unsure, put CMakeList.txt somewhere public so people can check it without downloading.

You're right this is absolutely my screw up.

ninja's just the build tool, python2 is required because source files are in python2. But because I switched to clang compilation, turns out I didn't need python2 anymore. I've removed it from the PKGBUILD.

Thanks!

Offline

#6 2019-07-06 13:00:34

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: [SOLVED] PKGBUILD review request

man 7 gitsubmodules wrote:

      A submodule is a repository embedded inside another repository. The submodule has its own history; the repository it is embedded in is
       called a superproject.

git submodule update --init --recursive

Putting that in the PKGBUILD means you're allowing the sourcecode to download things without your knowledge.
Worse, those extra repos can have their own submodules which bring in extra repos that can also have submodules etc.

Where will they be installed ?
Do they conflict with existing libraires ?
are you violating the licenses of those repos by using them this way ?
Just a few of the questions that can't be answered easily.


For  a single user that builds for their own use this command can be risky, but also very handy.

For PKGBUILDs intended for general public use it is a very bad idea.


https://wiki.archlinux.org/index.php/VC … Submodules shows an alternative that let's you control the submodules.

Look in the top git repo folder for a .gitmodules file to see what submodules are needed and where the superproject expects them..

Last edited by Lone_Wolf (2019-07-06 13:01:22)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#7 2019-07-06 17:45:42

oinkl
Member
Registered: 2010-01-13
Posts: 47

Re: [SOLVED] PKGBUILD review request

For comment.

# Maintainer: Justin Wong <jusw85 at hotmail dot com>
# Contributor: Benoit Favre <benoit.favre@gmail.com>
# Contributor: Alexander Rødseth <rodseth@gmail.com>
# Contributor: Kamil Biduś <kamil.bidus@gmail.com>

pkgname=aseprite-git
_pkgname=aseprite
pkgver=1.2.13.r0.gaf4fd54c2
pkgrel=3
pkgdesc='Create animated sprites and pixel art'
arch=('x86_64' 'i686')
url='http://www.aseprite.org/'
license=('BSD' 'custom')
depends=('cmark' 'curl' 'libjpeg-turbo' 'giflib' 'tinyxml' 'pixman' 'libxcursor' 'fontconfig')
makedepends=('git' 'ninja' 'python2' 'clang')
conflicts=("${_pkgname}" "${_pkgname}-gpl"  )
source=("git+https://github.com/${_pkgname}/pixman.git"
        "git+https://github.com/${_pkgname}/simpleini.git"
        "git+https://github.com/${_pkgname}/gtest.git"
        "git+https://github.com/${_pkgname}/libwebp.git"
        "git+https://github.com/${_pkgname}/flic.git"
        "git+https://github.com/${_pkgname}/freetype2.git"
        "git+https://github.com/${_pkgname}/zlib.git"
        "git+https://github.com/${_pkgname}/libpng.git"
        "git+https://github.com/${_pkgname}/clip.git"
        "git+https://github.com/${_pkgname}/observable.git"
        "git+https://github.com/${_pkgname}/undo.git"
        "git+https://github.com/${_pkgname}/laf.git"
        "git+https://github.com/${_pkgname}/cmark.git"
        "git+https://github.com/${_pkgname}/harfbuzz.git"
        "git+https://github.com/${_pkgname}/libarchive.git"
        "git+https://github.com/${_pkgname}/json11.git"
        "git+https://github.com/${_pkgname}/benchmark.git"
        "git+https://github.com/${_pkgname}/giflib.git"
        "git+https://github.com/${_pkgname}/fmt.git"
        "git+https://github.com/${_pkgname}/tinyexpr.git"
        "git+https://github.com/${_pkgname}/lua"
        "git+https://github.com/${_pkgname}/stringencoders"
        "git+https://github.com/${_pkgname}/googletest"
        "git+https://github.com/${_pkgname}/skia.git#branch=aseprite-m71"
        "git+https://github.com/${_pkgname}/${_pkgname}.git"
        'desktop.patch')
sha256sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'bcb6229e42cef16a8a0273c2fce67ce81d243a085c90bd52ac15183e757ff875')
_submodules=(
    'pixman'
    'simpleini'
    'gtest'
    'libwebp'
    'flic'
    'freetype2'
    'zlib'
    'libpng'
    'clip'
    'observable'
    'undo'
    'laf'
    'cmark'
    'harfbuzz'
    'libarchive'
    'json11'
    'benchmark'
    'giflib'
    'fmt'
    'tinyexpr'
    'lua')
_submodules_path=(
    "third_party/pixman"
    "third_party/simpleini"
    "third_party/gtest"
    "third_party/libwebp"
    "src/flic"
    "third_party/freetype2"
    "third_party/zlib"
    "third_party/libpng"
    "src/clip"
    "src/observable"
    "src/undo"
    "laf"
    "third_party/cmark"
    "third_party/harfbuzz"
    "third_party/libarchive"
    "third_party/json11"
    "third_party/benchmark"
    "third_party/giflib"
    "third_party/fmt"
    "third_party/tinyexpr"
    "third_party/lua")

pkgver() {
    cd "${srcdir}/${_pkgname}"
    git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//'
}

prepare() {
    cd "${srcdir}/${_pkgname}"
    git submodule init
    for (( i=0; i<${#_submodules[@]}; i++ )); do
        git config submodule.${_submodules_path[$i]}.url "${srcdir}/${_submodules[$i]}"
    done
    git submodule update

    cd laf
    git submodule init
    git config submodule.third_party/stringencoders.url "${srcdir}/stringencoders"
    git config submodule.third_party/googletest.url "${srcdir}/googletest"
    git submodule update

    cd "${srcdir}/${_pkgname}"
    patch --strip=1 --input="${srcdir}/desktop.patch"
    mkdir -p build

    cd "${srcdir}/skia"
    python2 tools/git-sync-deps
}

build() {
    cd "${srcdir}/skia"
    bin/gn gen out/Clang --args='is_debug=false is_official_build=true cc="clang" cxx="clang++" skia_use_system_expat=false skia_use_system_icu=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false'
    ninja -C out/Clang skia

    cd "${srcdir}/${_pkgname}/build"
    cmake \
        -DCMAKE_BUILD_TYPE=RelWithDebInfo \
        -DLAF_OS_BACKEND=skia \
        -DSKIA_DIR="$srcdir/skia" \
        -DSKIA_OUT_DIR="$srcdir/skia/out/Clang" \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DUSE_SHARED_CMARK=ON \
        -DUSE_SHARED_CURL=ON \
        -DUSE_SHARED_JPEGLIB=ON \
        -DUSE_SHARED_GIFLIB=ON \
        -DUSE_SHARED_ZLIB=ON \
        -DUSE_SHARED_LIBPNG=ON \
        -DUSE_SHARED_TINYXML=ON \
        -DUSE_SHARED_PIXMAN=ON \
        -DUSE_SHARED_FREETYPE=ON \
        -DUSE_SHARED_HARFBUZZ=ON \
        -G Ninja \
        ..
    ninja ${_pkgname}
}

package() {
    cd "${srcdir}/${_pkgname}/build"
    DESTDIR="${pkgdir}" ninja install

    # Remove extraneous files
    # https://github.com/aseprite/aseprite/issues/1574
    # https://github.com/aseprite/aseprite/issues/1602
    rm -f "${pkgdir}"/usr/bin/bsd*
    rm -f "${pkgdir}"/usr/lib/pkgconfig/libarchive.pc
    rm -f "${pkgdir}"/usr/share/man/man1/bsd*

    rm -f "${pkgdir}"/usr/bin/img2webp
    rm -fr "${pkgdir}"/usr/include/webp/
    rm -f "${pkgdir}"/usr/lib/libwebp*
    rm -fr "${pkgdir}"/usr/share/WebP/
    rm -f "${pkgdir}"/usr/share/man/man1/img2webp.1

    rm -f "${pkgdir}"/usr/include/json11.hpp
    rm -f "${pkgdir}"/usr/lib/libjson11.a
    rm -f "${pkgdir}"/usr/lib/pkgconfig/json11.pc

    find "${pkgdir}" -type d -empty -delete

    cd "${srcdir}/${_pkgname}"

    install -Dm644 "src/desktop/linux/${_pkgname}.desktop" "${pkgdir}/usr/share/applications/${_pkgname}.desktop"
    install -Dm644 "src/desktop/linux/mime/${_pkgname}.xml" "${pkgdir}/usr/share/mime/packages/${_pkgname}.xml"
    for i in {16,32,48,64,128,256}; do
        install -Dm644 "data/icons/ase${i}.png" "${pkgdir}/usr/share/icons/hicolor/${i}x${i}/apps/${_pkgname}.png"
        install -Dm644 "data/icons/doc${i}.png" "${pkgdir}/usr/share/icons/hicolor/${i}x${i}/mimetypes/image-x-${_pkgname}.png"
    done
    install -Dm644 "EULA.txt" "${pkgdir}/usr/share/licenses/${pkgname}/EULA"
    install -Dm644 "$srcdir/skia/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

Offline

#8 2019-07-08 09:07:53

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: [SOLVED] PKGBUILD review request

At first I thought the submodule urls were wrong, but upstream appears to have forked everything they depend on.

Worse,  a lot of those submodules are already present in archlinux.
You could try to remove the submodules for things that are already present, but that's a lot of work.
Also upstream may have good reasons for using forks instead of original repos.

I suggest you switch to installing in /opt so aseprite can use it's preferred versions from the submodules without clashing with pacman installed versions.
If you do that, remove packages that will be used from a submodule (like pixman) from depends array.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#9 2019-07-08 12:55:39

oinkl
Member
Registered: 2010-01-13
Posts: 47

Re: [SOLVED] PKGBUILD review request

The executable is statically linked and primary output is /usr/bin/aseprite and /usr/share/aseprite/*
The compilation had the option of linking against shared libraries instead of from source tree and I had them removed from the PKGBUILD where possible.

PKGBUILD:

# Maintainer: Justin Wong <jusw85 at hotmail dot com>
# Contributor: Benoit Favre <benoit.favre@gmail.com>
# Contributor: Alexander Rødseth <rodseth@gmail.com>
# Contributor: Kamil Biduś <kamil.bidus@gmail.com>

pkgname=aseprite-git
_pkgname=aseprite
pkgver=1.2.13.r0.gaf4fd54c2
pkgrel=3
pkgdesc='Create animated sprites and pixel art'
arch=('x86_64' 'i686')
url='http://www.aseprite.org/'
license=('BSD' 'custom')
depends=('cmark' 'curl' 'libjpeg-turbo' 'giflib' 'tinyxml' 'pixman' 'libxcursor' 'fontconfig')
makedepends=('git' 'ninja' 'python2' 'clang')
conflicts=("${_pkgname}" "${_pkgname}-gpl"  )
source=(
        # "git+https://github.com/${_pkgname}/pixman.git"
        "git+https://github.com/${_pkgname}/simpleini.git"
        # "git+https://github.com/${_pkgname}/gtest.git"
        "git+https://github.com/${_pkgname}/libwebp.git"
        "git+https://github.com/${_pkgname}/flic.git"
        # "git+https://github.com/${_pkgname}/freetype2.git"
        # "git+https://github.com/${_pkgname}/zlib.git"
        # "git+https://github.com/${_pkgname}/libpng.git"
        "git+https://github.com/${_pkgname}/clip.git"
        "git+https://github.com/${_pkgname}/observable.git"
        "git+https://github.com/${_pkgname}/undo.git"
        "git+https://github.com/${_pkgname}/laf.git"
        # "git+https://github.com/${_pkgname}/cmark.git"
        # "git+https://github.com/${_pkgname}/harfbuzz.git"
        "git+https://github.com/${_pkgname}/libarchive.git"
        "git+https://github.com/${_pkgname}/json11.git"
        # "git+https://github.com/${_pkgname}/benchmark.git"
        # "git+https://github.com/${_pkgname}/giflib.git"
        "git+https://github.com/${_pkgname}/fmt.git"
        "git+https://github.com/${_pkgname}/tinyexpr.git"
        "git+https://github.com/${_pkgname}/lua"
        "git+https://github.com/${_pkgname}/stringencoders"
        # "git+https://github.com/${_pkgname}/googletest"
        "git+https://github.com/${_pkgname}/skia.git#branch=aseprite-m71"
        "git+https://github.com/${_pkgname}/${_pkgname}.git"
        'desktop.patch')
sha256sums=(
            # 'SKIP'
            # 'SKIP'
            # 'SKIP'
            # 'SKIP'
            # 'SKIP'
            # 'SKIP'
            # 'SKIP'
            # 'SKIP'
            # 'SKIP'
            # 'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'bcb6229e42cef16a8a0273c2fce67ce81d243a085c90bd52ac15183e757ff875')
_submodules=(
    # 'pixman'
    'simpleini'
    # 'gtest'
    'libwebp'
    'flic'
    # 'freetype2'
    # 'zlib'
    # 'libpng'
    'clip'
    'observable'
    'undo'
    'laf'
    # 'cmark'
    # 'harfbuzz'
    'libarchive'
    'json11'
    # 'benchmark'
    # 'giflib'
    'fmt'
    'tinyexpr'
    'lua')
_submodules_path=(
    # "third_party/pixman"
    "third_party/simpleini"
    # "third_party/gtest"
    "third_party/libwebp"
    "src/flic"
    # "third_party/freetype2"
    # "third_party/zlib"
    # "third_party/libpng"
    "src/clip"
    "src/observable"
    "src/undo"
    "laf"
    # "third_party/cmark"
    # "third_party/harfbuzz"
    "third_party/libarchive"
    "third_party/json11"
    # "third_party/benchmark"
    # "third_party/giflib"
    "third_party/fmt"
    "third_party/tinyexpr"
    "third_party/lua")

pkgver() {
    cd "${srcdir}/${_pkgname}"
    git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//'
}

prepare() {
    cd "${srcdir}/${_pkgname}"
    git submodule init
    for (( i=0; i<${#_submodules[@]}; i++ )); do
        git config submodule.${_submodules_path[$i]}.url "${srcdir}/${_submodules[$i]}"
    done
    git submodule update

    cd laf
    git submodule init
    git config submodule.third_party/stringencoders.url "${srcdir}/stringencoders"
    # git config submodule.third_party/googletest.url "${srcdir}/googletest"
    git submodule update

    cd "${srcdir}/${_pkgname}"
    patch --strip=1 --input="${srcdir}/desktop.patch"
    mkdir -p build

    cd "${srcdir}/skia"
    python2 tools/git-sync-deps
}

build() {
    cd "${srcdir}/skia"
    bin/gn gen out/Clang --args='is_debug=false is_official_build=true cc="clang" cxx="clang++" skia_use_system_expat=false skia_use_system_icu=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false'
    ninja -C out/Clang skia

    cd "${srcdir}/${_pkgname}/build"
    cmake \
        -DCMAKE_BUILD_TYPE=RelWithDebInfo \
        -DLAF_OS_BACKEND=skia \
        -DSKIA_DIR="$srcdir/skia" \
        -DSKIA_OUT_DIR="$srcdir/skia/out/Clang" \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DUSE_SHARED_CMARK=ON \
        -DUSE_SHARED_CURL=ON \
        -DUSE_SHARED_JPEGLIB=ON \
        -DUSE_SHARED_GIFLIB=ON \
        -DUSE_SHARED_ZLIB=ON \
        -DUSE_SHARED_LIBPNG=ON \
        -DUSE_SHARED_TINYXML=ON \
        -DUSE_SHARED_PIXMAN=ON \
        -DUSE_SHARED_FREETYPE=ON \
        -DUSE_SHARED_HARFBUZZ=ON \
        -DWITH_WEBP_SUPPORT=ON \
        -DLAF_WITH_TESTS=OFF \
        -DENABLE_TESTS=OFF \
        -DENABLE_BENCHMARKS=OFF \
        -G Ninja \
        ..
    ninja ${_pkgname}
}

package() {
    cd "${srcdir}/${_pkgname}/build"
    DESTDIR="${pkgdir}" ninja install

    # Remove extraneous files
    # https://github.com/aseprite/aseprite/issues/1574
    # https://github.com/aseprite/aseprite/issues/1602
    rm -f "${pkgdir}"/usr/bin/bsd*
    rm -f "${pkgdir}"/usr/lib/pkgconfig/libarchive.pc
    rm -f "${pkgdir}"/usr/share/man/man1/bsd*

    rm -f "${pkgdir}"/usr/bin/img2webp
    rm -fr "${pkgdir}"/usr/include/webp/
    rm -f "${pkgdir}"/usr/lib/libwebp*
    rm -fr "${pkgdir}"/usr/share/WebP/
    rm -f "${pkgdir}"/usr/share/man/man1/img2webp.1

    rm -f "${pkgdir}"/usr/include/json11.hpp
    rm -f "${pkgdir}"/usr/lib/libjson11.a
    rm -f "${pkgdir}"/usr/lib/pkgconfig/json11.pc

    find "${pkgdir}" -type d -empty -delete

    cd "${srcdir}/${_pkgname}"

    install -Dm644 "src/desktop/linux/${_pkgname}.desktop" "${pkgdir}/usr/share/applications/${_pkgname}.desktop"
    install -Dm644 "src/desktop/linux/mime/${_pkgname}.xml" "${pkgdir}/usr/share/mime/packages/${_pkgname}.xml"
    for i in {16,32,48,64,128,256}; do
        install -Dm644 "data/icons/ase${i}.png" "${pkgdir}/usr/share/icons/hicolor/${i}x${i}/apps/${_pkgname}.png"
        install -Dm644 "data/icons/doc${i}.png" "${pkgdir}/usr/share/icons/hicolor/${i}x${i}/mimetypes/image-x-${_pkgname}.png"
    done
    install -Dm644 "EULA.txt" "${pkgdir}/usr/share/licenses/${pkgname}/EULA"
    install -Dm644 "${srcdir}/${_pkgname}/docs/LICENSES.md" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSES"
}

Filelist:

/usr/
/usr/bin/
/usr/bin/aseprite
/usr/share/
/usr/share/applications/
/usr/share/applications/aseprite.desktop
/usr/share/aseprite/
/usr/share/aseprite/data/
/usr/share/aseprite/data/convmatr.def
/usr/share/aseprite/data/extensions/
/usr/share/aseprite/data/extensions/adigunpolack-palettes/
/usr/share/aseprite/data/extensions/adigunpolack-palettes/aap-64.gpl
/usr/share/aseprite/data/extensions/adigunpolack-palettes/aap-micro12.gpl
/usr/share/aseprite/data/extensions/adigunpolack-palettes/aap-radiantxv.gpl
/usr/share/aseprite/data/extensions/adigunpolack-palettes/aap-splendor128.gpl
/usr/share/aseprite/data/extensions/adigunpolack-palettes/package.json
/usr/share/aseprite/data/extensions/adigunpolack-palettes/simplejpc-16.gpl
/usr/share/aseprite/data/extensions/arne-palettes/
/usr/share/aseprite/data/extensions/arne-palettes/a64.gpl
/usr/share/aseprite/data/extensions/arne-palettes/arne16.gpl
/usr/share/aseprite/data/extensions/arne-palettes/arne32.gpl
/usr/share/aseprite/data/extensions/arne-palettes/cg-arne.gpl
/usr/share/aseprite/data/extensions/arne-palettes/copper-tech.gpl
/usr/share/aseprite/data/extensions/arne-palettes/cpc-boy.gpl
/usr/share/aseprite/data/extensions/arne-palettes/eroge-copper.gpl
/usr/share/aseprite/data/extensions/arne-palettes/jmp.gpl
/usr/share/aseprite/data/extensions/arne-palettes/package.json
/usr/share/aseprite/data/extensions/arne-palettes/psygnosia.gpl
/usr/share/aseprite/data/extensions/aseprite-theme/
/usr/share/aseprite/data/extensions/aseprite-theme/LICENSE.txt
/usr/share/aseprite/data/extensions/aseprite-theme/package.json
/usr/share/aseprite/data/extensions/aseprite-theme/sheet.aseprite-data
/usr/share/aseprite/data/extensions/aseprite-theme/sheet.png
/usr/share/aseprite/data/extensions/aseprite-theme/theme.xml
/usr/share/aseprite/data/extensions/bayer-matrices/
/usr/share/aseprite/data/extensions/bayer-matrices/bayer2x2.bmp
/usr/share/aseprite/data/extensions/bayer-matrices/bayer4x4.bmp
/usr/share/aseprite/data/extensions/bayer-matrices/bayer8x8.bmp
/usr/share/aseprite/data/extensions/bayer-matrices/package.json
/usr/share/aseprite/data/extensions/davitmasia-palettes/
/usr/share/aseprite/data/extensions/davitmasia-palettes/matriax8c.gpl
/usr/share/aseprite/data/extensions/davitmasia-palettes/package.json
/usr/share/aseprite/data/extensions/dawnbringer-palettes/
/usr/share/aseprite/data/extensions/dawnbringer-palettes/db16.gpl
/usr/share/aseprite/data/extensions/dawnbringer-palettes/db32.gpl
/usr/share/aseprite/data/extensions/dawnbringer-palettes/package.json
/usr/share/aseprite/data/extensions/endesga-palettes/
/usr/share/aseprite/data/extensions/endesga-palettes/arq16.gpl
/usr/share/aseprite/data/extensions/endesga-palettes/arq4.gpl
/usr/share/aseprite/data/extensions/endesga-palettes/edg16.gpl
/usr/share/aseprite/data/extensions/endesga-palettes/edg32.gpl
/usr/share/aseprite/data/extensions/endesga-palettes/edg8.gpl
/usr/share/aseprite/data/extensions/endesga-palettes/en4.gpl
/usr/share/aseprite/data/extensions/endesga-palettes/enos16.gpl
/usr/share/aseprite/data/extensions/endesga-palettes/package.json
/usr/share/aseprite/data/extensions/hardware-palettes/
/usr/share/aseprite/data/extensions/hardware-palettes/apple-ii.gpl
/usr/share/aseprite/data/extensions/hardware-palettes/atari2600-ntsc.gpl
/usr/share/aseprite/data/extensions/hardware-palettes/atari2600-pal.gpl
/usr/share/aseprite/data/extensions/hardware-palettes/cga.gpl
/usr/share/aseprite/data/extensions/hardware-palettes/cga0.gpl
/usr/share/aseprite/data/extensions/hardware-palettes/cga0hi.gpl
/usr/share/aseprite/data/extensions/hardware-palettes/cga1.gpl
/usr/share/aseprite/data/extensions/hardware-palettes/cga1hi.gpl
/usr/share/aseprite/data/extensions/hardware-palettes/cga3rd.gpl
/usr/share/aseprite/data/extensions/hardware-palettes/cga3rdhi.gpl
/usr/share/aseprite/data/extensions/hardware-palettes/commodore-plus4.gpl
/usr/share/aseprite/data/extensions/hardware-palettes/commodore-vic20.gpl
/usr/share/aseprite/data/extensions/hardware-palettes/commodore64.gpl
/usr/share/aseprite/data/extensions/hardware-palettes/cpc.gpl
/usr/share/aseprite/data/extensions/hardware-palettes/gameboy-color-type1.gpl
/usr/share/aseprite/data/extensions/hardware-palettes/gameboy.gpl
/usr/share/aseprite/data/extensions/hardware-palettes/master-system.gpl
/usr/share/aseprite/data/extensions/hardware-palettes/nes-ntsc.gpl
/usr/share/aseprite/data/extensions/hardware-palettes/nes.gpl
/usr/share/aseprite/data/extensions/hardware-palettes/package.json
/usr/share/aseprite/data/extensions/hardware-palettes/teletext.gpl
/usr/share/aseprite/data/extensions/hardware-palettes/vga-13h.gpl
/usr/share/aseprite/data/extensions/hardware-palettes/virtualboy.gpl
/usr/share/aseprite/data/extensions/hardware-palettes/zx-spectrum.gpl
/usr/share/aseprite/data/extensions/hyohnoo-palettes/
/usr/share/aseprite/data/extensions/hyohnoo-palettes/mail24.gpl
/usr/share/aseprite/data/extensions/hyohnoo-palettes/package.json
/usr/share/aseprite/data/extensions/javierguerrero-palettes/
/usr/share/aseprite/data/extensions/javierguerrero-palettes/nyx8.gpl
/usr/share/aseprite/data/extensions/javierguerrero-palettes/package.json
/usr/share/aseprite/data/extensions/pico8-palette/
/usr/share/aseprite/data/extensions/pico8-palette/package.json
/usr/share/aseprite/data/extensions/pico8-palette/pico-8.gpl
/usr/share/aseprite/data/extensions/pinetreepizza-palettes/
/usr/share/aseprite/data/extensions/pinetreepizza-palettes/bubblegum-16.gpl
/usr/share/aseprite/data/extensions/pinetreepizza-palettes/package.json
/usr/share/aseprite/data/extensions/pinetreepizza-palettes/rosy-42.gpl
/usr/share/aseprite/data/extensions/software-palettes/
/usr/share/aseprite/data/extensions/software-palettes/google-ui.gpl
/usr/share/aseprite/data/extensions/software-palettes/monokai.gpl
/usr/share/aseprite/data/extensions/software-palettes/package.json
/usr/share/aseprite/data/extensions/software-palettes/smile-basic.gpl
/usr/share/aseprite/data/extensions/software-palettes/solarized.gpl
/usr/share/aseprite/data/extensions/software-palettes/web-safe-colors.gpl
/usr/share/aseprite/data/extensions/software-palettes/win16.gpl
/usr/share/aseprite/data/extensions/software-palettes/x11.gpl
/usr/share/aseprite/data/extensions/zughy-palettes/
/usr/share/aseprite/data/extensions/zughy-palettes/package.json
/usr/share/aseprite/data/extensions/zughy-palettes/zughy-32.gpl
/usr/share/aseprite/data/fonts/
/usr/share/aseprite/data/fonts/LICENSE.txt
/usr/share/aseprite/data/fonts/aseprite_font.png
/usr/share/aseprite/data/fonts/aseprite_mini.png
/usr/share/aseprite/data/fonts/fonts.xml
/usr/share/aseprite/data/gui.xml
/usr/share/aseprite/data/icons/
/usr/share/aseprite/data/icons/ase.ico
/usr/share/aseprite/data/icons/ase128.png
/usr/share/aseprite/data/icons/ase16.png
/usr/share/aseprite/data/icons/ase256.png
/usr/share/aseprite/data/icons/ase32.png
/usr/share/aseprite/data/icons/ase48.png
/usr/share/aseprite/data/icons/ase64.png
/usr/share/aseprite/data/icons/doc.ico
/usr/share/aseprite/data/icons/doc128.png
/usr/share/aseprite/data/icons/doc16.png
/usr/share/aseprite/data/icons/doc256.png
/usr/share/aseprite/data/icons/doc32.png
/usr/share/aseprite/data/icons/doc48.png
/usr/share/aseprite/data/icons/doc64.png
/usr/share/aseprite/data/icons/ext.ico
/usr/share/aseprite/data/icons/ext128.png
/usr/share/aseprite/data/icons/ext16.png
/usr/share/aseprite/data/icons/ext256.png
/usr/share/aseprite/data/icons/ext32.png
/usr/share/aseprite/data/icons/ext48.png
/usr/share/aseprite/data/icons/ext64.png
/usr/share/aseprite/data/palettes/
/usr/share/aseprite/data/palettes/tags.gpl
/usr/share/aseprite/data/pref.xml
/usr/share/aseprite/data/strings/
/usr/share/aseprite/data/strings/en.ini
/usr/share/aseprite/data/widgets/
/usr/share/aseprite/data/widgets/about.xml
/usr/share/aseprite/data/widgets/advanced_mode.xml
/usr/share/aseprite/data/widgets/ask_for_color_profile.xml
/usr/share/aseprite/data/widgets/brush_slot_params.xml
/usr/share/aseprite/data/widgets/canvas_size.xml
/usr/share/aseprite/data/widgets/cel_properties.xml
/usr/share/aseprite/data/widgets/color_curve_point.xml
/usr/share/aseprite/data/widgets/color_mode.xml
/usr/share/aseprite/data/widgets/convolution_matrix.xml
/usr/share/aseprite/data/widgets/despeckle.xml
/usr/share/aseprite/data/widgets/duplicate_sprite.xml
/usr/share/aseprite/data/widgets/export_file.xml
/usr/share/aseprite/data/widgets/export_sprite_sheet.xml
/usr/share/aseprite/data/widgets/file_selector.xml
/usr/share/aseprite/data/widgets/font_popup.xml
/usr/share/aseprite/data/widgets/frame_properties.xml
/usr/share/aseprite/data/widgets/frame_tag_properties.xml
/usr/share/aseprite/data/widgets/gif_options.xml
/usr/share/aseprite/data/widgets/goto_frame.xml
/usr/share/aseprite/data/widgets/grid_settings.xml
/usr/share/aseprite/data/widgets/home_view.xml
/usr/share/aseprite/data/widgets/import_sprite_sheet.xml
/usr/share/aseprite/data/widgets/jpeg_options.xml
/usr/share/aseprite/data/widgets/keyboard_shortcuts.xml
/usr/share/aseprite/data/widgets/layer_properties.xml
/usr/share/aseprite/data/widgets/main_window.xml
/usr/share/aseprite/data/widgets/modify_selection.xml
/usr/share/aseprite/data/widgets/new_folder_window.xml
/usr/share/aseprite/data/widgets/new_layer.xml
/usr/share/aseprite/data/widgets/new_sprite.xml
/usr/share/aseprite/data/widgets/open_sequence.xml
/usr/share/aseprite/data/widgets/options.xml
/usr/share/aseprite/data/widgets/outline.xml
/usr/share/aseprite/data/widgets/palette_from_sprite.xml
/usr/share/aseprite/data/widgets/palette_popup.xml
/usr/share/aseprite/data/widgets/palette_size.xml
/usr/share/aseprite/data/widgets/paste_text.xml
/usr/share/aseprite/data/widgets/replace_color.xml
/usr/share/aseprite/data/widgets/script_access.xml
/usr/share/aseprite/data/widgets/select_accelerator.xml
/usr/share/aseprite/data/widgets/send_crash.xml
/usr/share/aseprite/data/widgets/slice_properties.xml
/usr/share/aseprite/data/widgets/sprite_properties.xml
/usr/share/aseprite/data/widgets/sprite_size.xml
/usr/share/aseprite/data/widgets/svg_options.xml
/usr/share/aseprite/data/widgets/timeline_conf.xml
/usr/share/aseprite/data/widgets/undo_history.xml
/usr/share/aseprite/data/widgets/user_data.xml
/usr/share/aseprite/data/widgets/webp_options.xml
/usr/share/icons/
/usr/share/icons/hicolor/
/usr/share/icons/hicolor/128x128/
/usr/share/icons/hicolor/128x128/apps/
/usr/share/icons/hicolor/128x128/apps/aseprite.png
/usr/share/icons/hicolor/128x128/mimetypes/
/usr/share/icons/hicolor/128x128/mimetypes/image-x-aseprite.png
/usr/share/icons/hicolor/16x16/
/usr/share/icons/hicolor/16x16/apps/
/usr/share/icons/hicolor/16x16/apps/aseprite.png
/usr/share/icons/hicolor/16x16/mimetypes/
/usr/share/icons/hicolor/16x16/mimetypes/image-x-aseprite.png
/usr/share/icons/hicolor/256x256/
/usr/share/icons/hicolor/256x256/apps/
/usr/share/icons/hicolor/256x256/apps/aseprite.png
/usr/share/icons/hicolor/256x256/mimetypes/
/usr/share/icons/hicolor/256x256/mimetypes/image-x-aseprite.png
/usr/share/icons/hicolor/32x32/
/usr/share/icons/hicolor/32x32/apps/
/usr/share/icons/hicolor/32x32/apps/aseprite.png
/usr/share/icons/hicolor/32x32/mimetypes/
/usr/share/icons/hicolor/32x32/mimetypes/image-x-aseprite.png
/usr/share/icons/hicolor/48x48/
/usr/share/icons/hicolor/48x48/apps/
/usr/share/icons/hicolor/48x48/apps/aseprite.png
/usr/share/icons/hicolor/48x48/mimetypes/
/usr/share/icons/hicolor/48x48/mimetypes/image-x-aseprite.png
/usr/share/icons/hicolor/64x64/
/usr/share/icons/hicolor/64x64/apps/
/usr/share/icons/hicolor/64x64/apps/aseprite.png
/usr/share/icons/hicolor/64x64/mimetypes/
/usr/share/icons/hicolor/64x64/mimetypes/image-x-aseprite.png
/usr/share/licenses/
/usr/share/licenses/aseprite-git/
/usr/share/licenses/aseprite-git/EULA
/usr/share/licenses/aseprite-git/LICENSES
/usr/share/mime/
/usr/share/mime/packages/
/usr/share/mime/packages/aseprite.xml

Offline

#10 2019-07-09 11:25:18

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: [SOLVED] PKGBUILD review request

PKGBUILD looks better, you  missed a few submodules present in archlinux :

https://www.archlinux.org/packages/core … ibarchive/
https://www.archlinux.org/packages/extra/x86_64/lua/
https://www.archlinux.org/packages/extr … 4/libwebp/


Some other commetns :

    bin/gn gen out/Clang --args='is_debug=false is_official_build=true cc="clang" cxx="clang++" skia_use_system_expat=false skia_use_system_icu=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false'
    ninja -C out/Clang skia

Why does skia need specific setup ?
Could it be replaced by skia-sharp from repos ?



When using git submodules source array gets a lot of entries, putting the sources needed exclusively for this package first helps to clarify what happens.

For this package it could look like :

source=( "git+https://github.com/aseprite/aseprite.git"
                'desktop.patch'
                <all submodules used >
)

N.B. this is a personal preference of mine, NOT a rule.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#11 2019-07-09 11:48:29

oinkl
Member
Registered: 2010-01-13
Posts: 47

Re: [SOLVED] PKGBUILD review request

aseprite compiles with specific cmake flags that tells it whether to look for shared libs or in third_party/*
There is no SHARED option other than those specified.
This has been requested for upstream.

https://github.com/aseprite/aseprite/issues/1699
https://github.com/aseprite/aseprite/issues/1681

cmake flags:

        -DUSE_SHARED_CMARK=ON \
        -DUSE_SHARED_CURL=ON \
        -DUSE_SHARED_JPEGLIB=ON \
        -DUSE_SHARED_GIFLIB=ON \
        -DUSE_SHARED_ZLIB=ON \
        -DUSE_SHARED_LIBPNG=ON \
        -DUSE_SHARED_TINYXML=ON \
        -DUSE_SHARED_PIXMAN=ON \
        -DUSE_SHARED_FREETYPE=ON \
        -DUSE_SHARED_HARFBUZZ=ON \

Some other commetns :

    bin/gn gen out/Clang --args='is_debug=false is_official_build=true cc="clang" cxx="clang++" skia_use_system_expat=false skia_use_system_icu=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false'
    ninja -C out/Clang skia

Why does skia need specific setup ?
Could it be replaced by skia-sharp from repos ?

No because:
1. skia isn't skia-sharp
2. I had gotten skia-git from AUR to work (it doesn't compile atm). It's a current version of skia. But no amount of hackery could make aseprite compile with it. The package uses a forked and branched version of skia that's six months old (aseprite/skia). There are too many backward compatibility breaking changes in the current version, which is probably the reason why it's forked and branched (they've said as much)

https://github.com/aseprite/aseprite/is … -311675780

(and I have to compile Skia several times in several platform, and each time I have to update the Skia version is A LOT of work, even the API is unstable from version to version).

[edit]
3. skia* packages only install lib* and include/* into /usr. But the compilation of aseprite also finds specific files in the src directory of skia, thus requiring a copy of the skia source tree to compile and build against.

Last edited by oinkl (2019-07-09 12:18:06)

Offline

#12 2019-07-09 12:05:04

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: [SOLVED] PKGBUILD review request

Good answers, could you add comments with the issue links and a short description of the issues in the PKGBUILD ?

That would make it easier for people to understand why things are done this way.
(it would also help you to keep track of them).


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

Board footer

Powered by FluxBB