summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: bf25d047e1c653740b407484cc3043083683ea02 (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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# Maintainer: SpotlightKid <aur -at- chrisarndt -dot de>
# Maintainer: redtide <redtid3@gmail.com>
# Contributor: Jean Pierre Cimalando <jp-dev@inbox.ru>

# Based on official PKGBUILD by dvzrv at
# https://gitlab.archlinux.org/archlinux/packaging/packages/sfizz/

_pkgname=sfizz
_gitname=$_pkgname-ui
pkgbase=$_pkgname-git
pkgname=(
  sfizz-git
  sfizz-{lib,lv2,standalone,vst3}-git
  pd-sfizz-git
)
pkgver=1.2.3.r1.g2a45d4b
pkgrel=1
pkgdesc="SFZ based sampler (git version)"
url="https://sfz.tools/sfizz"
arch=(x86_64)
license=(BSD)
makedepends=(
  abseil-cpp
  cairo
  cmake
  cxxopts
  gcc-libs
  ghc-filesystem
  git
  glibc
  jack
  freetype2
  libx11
  libxkbcommon
  libxkbcommon-x11
  lv2
  pango
  pugixml
  simde
# vst3sdk FIXME: READ COMMENT BELOW
  xcb-util
  xcb-util-cursor
  xcb-util-keysyms
)
checkdepends=(
  lv2lint
# catch2 FIXME: This is too recent for current tests
)
source=(
  $_gitname::git+https://github.com/sfztools/sfizz-ui
  library::git+https://github.com/sfztools/sfizz
  git+https://github.com/steinbergmedia/vst3_base
  git+https://github.com/steinbergmedia/vst3_pluginterfaces
  git+https://github.com/steinbergmedia/vst3_public_sdk
  git+https://github.com/sfztools/vstgui
  git+https://github.com/mackron/dr_libs
  git+https://github.com/sfztools/libaiff
  git+https://github.com/sfztools/stb_vorbis
  wavpack::git+https://github.com/dbry/WavPack.git
)
sha512sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP')
b2sums=('SKIP'
        'SKIP'
        'SKIP'
        'SKIP'
        'SKIP'
        'SKIP'
        'SKIP'
        'SKIP'
        'SKIP'
        'SKIP')

_pick() {
  local p="$1" f d; shift
  for f; do
    d="$srcdir/$p/${f#$pkgdir/}"
    mkdir -p "$(dirname "$d")"
    mv "$f" "$d"
    rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
  done
}

pkgver() {
  cd $_gitname
  ( set -o pipefail
    git describe --long --tags 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
  )
}

prepare() {
  cd $_gitname
  git submodule init

  git config submodule.library.url "$srcdir"/library
  git -c protocol.file.allow=always submodule update ./library
  # Please, don't sync with latest library: sometimes can happen that it has features
  # not yet/differently implemented in the UI due separated works/timings;
  # we try to keep them in sync upstream anyway, expecially when tagging releases:
  #
  # git -c protocol.file.allow=always submodule update --remote --merge ./library

  # VST3SDK FIXME:
  # currently incompatible VSTGUI API and we need also a patched version to make it work also with Ardour,
  # so please don't use the system version.
  for module in base pluginterfaces public.sdk; do
    vst3_name=vst3_${module/./_}
    git config submodule.plugins.vst.external.VST_SDK.VST3_SDK.$module.url "$srcdir"/$vst3_name
    git -c protocol.file.allow=always submodule update ./plugins/vst/external/VST_SDK/VST3_SDK/$module
  done
  git config submodule.plugins.editor.external.vstgui4.url "$srcdir"/vstgui
  git -c protocol.file.allow=always submodule update ./plugins/editor/external/vstgui4

  cd library
  git submodule init
  for module in dr_libs libaiff stb_vorbis wavpack; do
    git config submodule.external.st_audiofile.thirdparty.$module.url "$srcdir"/$module
    git -c protocol.file.allow=always submodule update ./external/st_audiofile/thirdparty/$module
  done
  cd ../../

  # symlink tests data to top-level location so that tests can get to them (we build out of tree)
  ln -svf "$srcdir"/library/tests "$srcdir"
}

build() {
  local cmake_options=(
    -B build
    -D CMAKE_INSTALL_PREFIX=/usr
    -D CMAKE_BUILD_TYPE=None
    -D CMAKE_CXX_STANDARD=17
    -D PLUGIN_PUREDATA=ON
    -D SFIZZ_GIT_SUBMODULE_CHECK=OFF
    -D SFIZZ_TESTS=ON
    -D SFIZZ_USE_SYSTEM_ABSEIL=ON
    -D SFIZZ_USE_SYSTEM_CATCH=OFF   # TODO
    -D SFIZZ_USE_SYSTEM_CXXOPTS=ON
    -D SFIZZ_USE_SYSTEM_GHC_FS=ON
    -D SFIZZ_USE_SYSTEM_LV2=ON
    -D SFIZZ_USE_SYSTEM_PUGIXML=ON
    -D SFIZZ_USE_SYSTEM_SIMDE=ON
    -D SFIZZ_USE_SYSTEM_VST3SDK=OFF # TODO
    -S $_gitname
    -W no-dev
  )
  cmake "${cmake_options[@]}"
  cmake --build build --verbose
}

check() {
  ctest --test-dir build/library --output-on-failure
  lv2lint -Mpack -I build/$_pkgname.lv2 "http://sfztools.github.io/sfizz"
}

package_sfizz-git() {
  depends=(
    $_pkgname-{lib,lv2,standalone,vst3}-git
    pd-$_pkgname-git
  )
  provides=($_pkgname)
  conflicts=($_pkgname)

  DESTDIR="$pkgdir" cmake --install build

  (
    cd "$pkgdir"

    _pick $_pkgname-lib-git usr/include
    _pick $_pkgname-lib-git usr/lib/lib$_pkgname.so*
    _pick $_pkgname-lib-git usr/lib/pkgconfig/$_pkgname.pc

    _pick $_pkgname-lv2-git usr/lib/lv2

    _pick $_pkgname-standalone-git usr/bin
    _pick $_pkgname-standalone-git usr/share/man/man1

    _pick $_pkgname-vst3-git usr/lib/vst3

    _pick pd-$_pkgname-git usr/lib/pd
  )
}

package_pd-sfizz-git() {
  pkgdesc+=" - pd external"
  groups=(
    pd-externals
    pro-audio
  )
  depends=(
    abseil-cpp
    gcc-libs
    glibc
    pd
    pugixml
  )
  provides=(pd-$_pkgname)
  conflicts=(pd-$_pkgname)

  mv -v $pkgname/* "$pkgdir"
  install -vDm 644 $_gitname/LICENSE \
    -t "$pkgdir"/usr/share/licenses/$pkgname
  install -vDm 644 $_gitname/{AUTHORS,CONTRIBUTING,GOVERNANCE,README}.md \
    -t "$pkgdir"/usr/share/doc/$pkgname
}

package_sfizz-lib-git() {
  pkgdesc+=" - library"
  depends=(
    abseil-cpp
    gcc-libs
    glibc
    pugixml
  )
  provides=($_pkgname-lib lib$_pkgname.so)
  conflicts=($_pkgname-lib)

  mv -v $pkgname/* "$pkgdir"
  install -vDm 644 $_gitname/LICENSE \
    -t "$pkgdir"/usr/share/licenses/$pkgname
  install -vDm 644 $_gitname/{AUTHORS,CONTRIBUTING,GOVERNANCE,README}.md \
    -t "$pkgdir"/usr/share/doc/$pkgname
}

package_sfizz-lv2-git() {
  pkgdesc+=" - LV2 plugin"
  groups=(
    lv2-plugins
    pro-audio
  )
  depends=(
    abseil-cpp
    cairo
    fontconfig
    gcc-libs
    glib2
    glibc
    libxcb
    libxkbcommon
    libxkbcommon-x11
    lv2-host
    pango
    pugixml
    ttf-roboto
    xcb-util
    xcb-util-cursor
    zenity
  )
  provides=($_pkgname-lv2)
  conflicts=($_pkgname-lv2)

  mv -v $pkgname/* "$pkgdir"
  # devendor ttf-roboto
  ln -svf /usr/share/fonts/TTF/Roboto-Regular.ttf \
    "$pkgdir"/usr/lib/lv2/$_pkgname.lv2/Contents/Resources/Fonts
  install -vDm 644 $_gitname/LICENSE \
    -t "$pkgdir"/usr/share/licenses/$pkgname
  install -vDm 644 $_gitname/{AUTHORS,CONTRIBUTING,GOVERNANCE,README}.md \
    -t "$pkgdir"/usr/share/doc/$pkgname
}

package_sfizz-standalone-git() {
  pkgdesc+=" - standalone"
  groups=(
    pro-audio
  )
  depends=(
    abseil-cpp
    gcc-libs
    glibc
    pugixml
  )
  optdepends=(
    'jack: for sfizz_jack'
  )
  provides=($_pkgname-standalone)
  conflicts=($_pkgname-standalone)

  mv -v $pkgname/* "$pkgdir"
  install -vDm 644 $_gitname/LICENSE \
    -t "$pkgdir"/usr/share/licenses/$pkgname
  install -vDm 644 $_gitname/{AUTHORS,CONTRIBUTING,GOVERNANCE,README}.md \
    -t "$pkgdir"/usr/share/doc/$pkgname
}

package_sfizz-vst3-git() {
  pkgdesc+=" - VST3 plugin"
  groups=(
    pro-audio
    vst3-plugins
  )
  depends=(
    abseil-cpp
    cairo
    fontconfig
    gcc-libs
    glib2
    glibc
    libxcb
    libxkbcommon
    libxkbcommon-x11
    pango
    pugixml
    ttf-roboto
    vst3-host
    xcb-util
    xcb-util-cursor
    zenity
  )
  provides=($_pkgname-vst3)
  conflicts=($_pkgname-vst3)

  mv -v $pkgname/* "$pkgdir"
  # devendor ttf-roboto
  ln -svf /usr/share/fonts/TTF/Roboto-Regular.ttf \
    "$pkgdir"/usr/lib/vst3/$_pkgname.vst3/Contents/Resources/Fonts/
  install -vDm 644 $_gitname/LICENSE \
    -t "$pkgdir"/usr/share/licenses/$pkgname
  install -vDm 644 $_gitname/{AUTHORS,CONTRIBUTING,GOVERNANCE,README}.md \
    -t "$pkgdir"/usr/share/doc/$pkgname/
}