summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a1671ce5a5252f06f0bee934b5c841e263977c0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# Maintainer: Justin Wong <jusw85 at hotmail dot com>
# Contributor: Eldred Habert <me@eldred.fr>
# Contributor: Benoit Favre <benoit.favre@gmail.com>
# Contributor: Alexander Rødseth <rodseth@gmail.com>
# Contributor: Kamil Biduś <kamil.bidus@gmail.com>

# Reference: https://bbs.archlinux.org/viewtopic.php?pid=1853334#p1853334

pkgname=aseprite-git
_pkgname=aseprite
pkgver=1.2.33.r0.g845ff1778
pkgrel=1
pkgdesc='Create animated sprites and pixel art'
arch=('x86_64' 'i686')
url='http://www.aseprite.org/'
license=('BSD' 'custom')
depends=('libxcursor' 'fontconfig' 'hicolor-icon-theme' 'libglvnd' 'libc++')
makedepends=('git' 'ninja' 'python' 'clang' 'cmake' 'libxi')
# makedepends=('git' 'ninja' 'python' 'clang' 'cmake' 'libxi' 'lld')
options=('!lto')
provides=("${_pkgname}")
conflicts=("${_pkgname}")
source=("git+https://github.com/${_pkgname}/${_pkgname}.git#branch=main"
        'desktop.patch'

        # Aseprite submodules
        "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}/tga.git"
        "git+https://github.com/${_pkgname}/curl.git"
        "git+https://github.com/${_pkgname}/IXWebSocket"

        # LAF submodules
        # temporarily removed as googletest was updated from laf, but https://github.com/aseprite/googletest was not updated
        # "git+https://github.com/${_pkgname}/googletest"

        # Skia
        "git+https://github.com/${_pkgname}/skia.git#branch=aseprite-m102")
sha256sums=('SKIP'
            '8b14e36939e930de581e95abf0591645aa0fcfd47161cf88b062917dbaaef7f9'
            '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'
            # 'SKIP'
            )

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

prepare() {
    local -A submodule_paths=(
        [third_party/pixman]=pixman
        [third_party/simpleini]=simpleini
        [third_party/gtest]=gtest
        [third_party/libwebp]=libwebp
        [src/flic]=flic
        [third_party/freetype2]=freetype2
        [third_party/zlib]=zlib
        [third_party/libpng]=libpng
        [src/clip]=clip
        [src/observable]=observable
        [src/undo]=undo
        [laf]=laf
        [third_party/cmark]=cmark
        [third_party/harfbuzz]=harfbuzz
        [third_party/libarchive]=libarchive
        [third_party/json11]=json11
        [third_party/benchmark]=benchmark
        [third_party/giflib]=giflib
        [third_party/fmt]=fmt
        [third_party/tinyexpr]=tinyexpr
        [third_party/lua]=lua
        [src/tga]=tga
        [third_party/curl]=curl
        [third_party/IXWebSocket]=IXWebSocket)

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

    git submodule init
    local submodule
    for submodule in "${!submodule_paths[@]}"; do
        git config submodule.${submodule}.url "${srcdir}/${submodule_paths[$submodule]}"
    done
    git -c protocol.file.allow=always submodule update

    cd laf
    git submodule init
    # git config submodule.third_party/googletest.url "${srcdir}/googletest" # not required if LAF_WITH_TESTS=OFF
    git -c protocol.file.allow=always submodule update

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

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

build() {
    cd "${srcdir}/skia"
    bin/gn gen out/Clang --args='cc="clang" cxx="clang++" extra_ldflags=["-stdlib=libc++"] extra_cflags=["-stdlib=libc++"] is_debug=false is_official_build=true 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 skia_use_sfntly=false skia_use_freetype=true skia_use_harfbuzz=true skia_pdf_subset_harfbuzz=true skia_use_system_freetype2=false skia_use_system_harfbuzz=false'    
    # bin/gn gen out/Clang --args='is_debug=false is_official_build=true 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 skia_use_sfntly=false skia_use_freetype=true skia_use_harfbuzz=true skia_pdf_subset_harfbuzz=true skia_use_system_freetype2=false skia_use_system_harfbuzz=false'
    ninja -C out/Clang skia modules

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

    # https://github.com/aseprite/aseprite/issues/2843
    # -DUSE_SHARED_CMARK=ON \
    # -DUSE_SHARED_CURL=ON \
    # -DUSE_SHARED_GIFLIB=ON \
    # -DUSE_SHARED_JPEGLIB=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 \

    cmake \
        -DCMAKE_BUILD_TYPE=RelWithDebInfo \
        -DCMAKE_C_COMPILER="clang" \
        -DCMAKE_CXX_COMPILER="clang++" \
        -DCMAKE_CXX_FLAGS:STRING="-stdlib=libc++" \
        -DCMAKE_EXE_LINKER_FLAGS:STRING="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -stdlib=libc++" \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DLAF_BACKEND=skia \
        -DSKIA_DIR="$srcdir/skia" \
        -DSKIA_LIBRARY_DIR="$srcdir/skia/out/Clang" \
        -DSKIA_LIBRARY="$srcdir/skia/out/Clang/libskia.a" \
        -DLAF_WITH_TESTS=OFF \
        -DLAF_WITH_EXAMPLES=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/lib/pkgconfig/libarchive.pc

    rm -f "${pkgdir}"/usr/lib/libwebp*
    rm -f "${pkgdir}"/usr/lib/pkgconfig/libwebp*
    rm -fr "${pkgdir}"/usr/include/webp/
    rm -fr "${pkgdir}"/usr/share/WebP/

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

    rm -fr "${pkgdir}"/usr/lib/cmake/cmark
    rm -f "${pkgdir}"/usr/lib/pkgconfig/libcmark.pc
    rm -f "${pkgdir}"/usr/lib/libcmark*
    rm -f "${pkgdir}"/usr/include/cmark*
    rm -f "${pkgdir}"/usr/share/man/man1/cmark.1
    rm -f "${pkgdir}"/usr/share/man/man3/cmark.3

    rm -f "${pkgdir}"/usr/lib/libtga-lib.a
    rm -f "${pkgdir}"/usr/include/tga.h

    rm -f "${pkgdir}"/usr/lib/libcurl.a
    rm -f "${pkgdir}"/usr/lib/pkgconfig/*
    rm -f "${pkgdir}"/usr/lib//cmake/CURL/*
    rm -f "${pkgdir}"/usr/include/curl/*
    rm -f "${pkgdir}"/usr/bin/curl-config

    rm -f "${pkgdir}"/usr/include/fmt/*
    rm -f "${pkgdir}"/usr/lib/cmake/fmt/*
    rm -f "${pkgdir}"/usr/lib/libfmt.a

    rm -f "${pkgdir}"/usr/include/tinyxml2.h
    rm -f "${pkgdir}"/usr/lib/cmake/tinyxml2/*

    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"
}