-
Notifications
You must be signed in to change notification settings - Fork 329
411 lines (354 loc) · 14.6 KB
/
libfaust.yml
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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
name: libfaust
env:
FAUST_VERSION: 2.77.3
FAUSTGEN_VERSION: "1.73"
LLVM_PACKAGE_VERSION: "15.0.7"
CMAKE_OSX_DEPLOYMENT_TARGET: "10.15"
LLVM_COMMIT: 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a
# Controls when the action will run.
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
create_release:
type: boolean
description: Create a draft release
default: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build-ubuntu:
strategy:
fail-fast: false
matrix:
include:
- name: ubuntu-x86_64
os: ubuntu-22.04
cmake-options: >-
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_VERBOSE_MAKEFILE=ON
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install dependencies
run: |
sudo apt-get install -y zstd libncurses-dev libxml2-dev
- name: Install dependencies
run: |
sudo apt-get install -y libllvm15 llvm-15 llvm-15-dev
- name: Build libfaust
run: |
find /usr -name llvm-config
export PATH="/usr/lib/llvm-15/bin:$PATH"
export LLVM_ROOT=$(llvm-config --prefix | tr '\n' ' ')
echo "LLVM_ROOT: " $LLVM_ROOT
cd build
cmake -C ./backends/all.cmake . -Bbuild ${{matrix.cmake-options}} -DINCLUDE_DYNAMIC=ON -DINCLUDE_STATIC=ON -DINCLUDE_LLVM=ON -DUSE_LLVM_CONFIG=ON
cmake --build build --config Release
- name: Make distribution
run: |
cd build/lib
rm -f libfaust.so libfaust.so.2
newest=$(ls -1 libfaust.so.* | tail -n1)
mv "$newest" libfaust.so
strip --strip-unneeded libfaust.so
cd ..
zip -r libfaust-${{ matrix.name }}.zip lib
- name: Upload libfaust artifact
uses: actions/upload-artifact@v4
with:
name: libfaust-${{ matrix.name }}.zip
path: build/libfaust-${{ matrix.name }}.zip
if-no-files-found: error
build-ubuntu-aarch64:
strategy:
fail-fast: false
matrix:
include:
- name: ubuntu-aarch64
os: ubuntu-22.04
llvm-url: https://github.com/grame-cncm/faust/releases/download/2.59.5-llvm/llvm-17.0.6-ubuntu-aarch64.zip
cmake-options: >-
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_VERBOSE_MAKEFILE=ON
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Download LLVM
run: |
# Libfaust will need to link against LLVM.
# Since we're using an x86_64 GitHub actions runner, we're unable to build arm64 LLVM on-demand.
# To get around this, we download a compatible LLVM build that we've built in advance.
curl -L ${{ matrix.llvm-url }} -o llvm.zip
unzip -o llvm.zip
rm llvm.zip
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile-aarch64
tags: mylibrary-builder:latest
platforms: linux/arm64
load: true
- name: Create Container from Image
run: docker create --name mylib-container mylibrary-builder:latest
- name: Copy Compiled Library from Container
run: |
docker cp mylib-container:/faust/build/libfaust-${{ matrix.name }}.zip libfaust-${{ matrix.name }}.zip
docker rm mylib-container
- name: Upload libfaust artifact
uses: actions/upload-artifact@v4
with:
name: libfaust-${{ matrix.name }}.zip
path: libfaust-${{ matrix.name }}.zip
if-no-files-found: error
build-macos:
strategy:
fail-fast: false
matrix:
include:
- name: arm64
os: macos-14
llvm-url: https://github.com/grame-cncm/faust/releases/download/2.59.5-llvm/llvm-15.0.7-macos10.15-arm64.zip
ARCHS: "-arch arm64"
CMAKE_OSX_ARCHITECTURES: arm64
HOST: aarch64-apple-darwin
ENABLE_MPEG: OFF
- name: x64
os: macos-13
llvm-url: https://github.com/grame-cncm/faust/releases/download/2.59.5-llvm/llvm-15.0.7-macos10.15-x86_64.zip
ARCHS: "-arch x86_64"
CMAKE_OSX_ARCHITECTURES: x86_64
HOST: x86_64-apple-darwin
ENABLE_MPEG: ON
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Build libmicrohttpd
run: |
curl -L https://mirror.cyberbits.eu/gnu/libmicrohttpd/libmicrohttpd-0.9.76.tar.gz -o libmicrohttpd-0.9.76.tar.gz
tar -xvf libmicrohttpd-0.9.76.tar.gz
mv libmicrohttpd-0.9.76 libmicrohttpd
cd libmicrohttpd
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
export TARGET=${{matrix.HOST}}
export CC=$(xcrun -find -sdk macosx gcc)
export CFLAGS="${{matrix.ARCHS}} -target $TARGET -isysroot $SDKROOT"
export LDFLAGS="${{matrix.ARCHS}} -target $TARGET -isysroot $SDKROOT"
./configure --enable-https=no --host=$TARGET --prefix=$PWD/libmicrohttpd
make && make install
- name: Brew install requirements (arm64)
if: ${{ endsWith( matrix.name, 'arm64') }}
# todo: should we bother with brew update?
run: |
brew update
PACKAGES=(ncurses gtk+ liblo lame flac libogg libtool libvorbis opus mpg123)
DEPS=($(brew deps --union --topological $(echo $PACKAGES) | tr '\n' ' '))
PACKAGES=("${DEPS[@]}" "${PACKAGES[@]}")
export HOMEBREW_NO_INSTALL_CLEANUP=1
export HOMEBREW_NO_INSTALL_UPGRADE=1
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
for PACKAGE in "${PACKAGES[@]}"
do
echo "Fetching bottle: $PACKAGE"
response=$(brew fetch --bottle-tag=arm64_ventura $PACKAGE 2>&1)
package_path=$(echo $response | sed -n 's/.*\:\ \(.*\.tar\.gz\).*/\1/p')
package_path=$(echo "$package_path" | xargs)
echo "Package Path: $package_path"
brew reinstall --verbose --force-bottle "$package_path" || true
done
brew uninstall --ignore-dependencies curl git || true
- name: Brew install requirements (x64)
if: ${{ endsWith( matrix.name, 'x64') }}
run: brew install pkg-config ncurses gtk+ liblo lame flac libogg libtool libvorbis opus mpg123
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: '5.15.2'
host: 'mac'
target: 'desktop'
dir: '${{ github.workspace }}/qt_install'
# tools: 'tools_ifw tools_qtcreator,qt.tools.qtcreator'
- name: Download LLVM
run: |
# Libfaust will need to link against LLVM.
# Since we're using an x86_64 GitHub actions runner, we're unable to build arm64 LLVM on-demand.
# To get around this, we download a compatible LLVM build that we've built in advance.
curl -L ${{ matrix.llvm-url }} -o llvm.zip
unzip -o llvm.zip
- name: Clone Libsndfile
uses: actions/checkout@v4
with:
repository: libsndfile/libsndfile
path: libsndfile
submodules: true
- name: Build libsndfile
# Note that can't use the libsndfile from brew because it lacks libsndfile.a, the static lib.
run: |
brew uninstall --ignore-dependencies libsndfile || true
cd libsndfile
LIBSNDFILE_INSTALL_PREFIX="$PWD/install"
mkdir CMakeBuild && cd CMakeBuild
cmake .. -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$LIBSNDFILE_INSTALL_PREFIX" -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_OSX_ARCHITECTURES=$CMAKE_OSX_ARCHITECTURES -DCMAKE_OSX_DEPLOYMENT_TARGET=$CMAKE_OSX_DEPLOYMENT_TARGET -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF -DENABLE_MPEG=${{ matrix.ENABLE_MPEG }}
make && make install
otool -L $LIBSNDFILE_INSTALL_PREFIX/lib/libsndfile.a
echo "Testing pkg-config for sndfile"
export PKG_CONFIG_PATH="$LIBSNDFILE_INSTALL_PREFIX/lib/pkgconfig"
pkg-config --cflags sndfile
env:
CMAKE_OSX_ARCHITECTURES: ${{matrix.CMAKE_OSX_ARCHITECTURES}}
- name: Clone MAX SDK
uses: actions/checkout@v4
with:
repository: Cycling74/max-sdk-base
path: max-sdk-base
# - name: Clone faustlive
# uses: actions/checkout@v4
# with:
# repository: grame-cncm/faustlive
# path: faustlive
- name: Build everything
# todo: do we need to specify the qt@5 path for PKG_CONFIG_PATH?
run: |
export PKG_CONFIG_PATH="$QT_ROOT_DIR/lib/pkgconfig:$PWD/libsndfile/install/lib/pkgconfig:$PWD/libmicrohttpd/libmicrohttpd/lib/pkgconfig"
export LLVM_DIR=$PWD/llvm/lib/cmake/llvm
export LLVM_LIB_DIR=$PWD/llvm/lib
export LLVM_INCLUDE_DIRS=$PWD/llvm/include
export LLVM_LIBS=$(ls $LLVM_LIB_DIR/lib*.a | sed "s|$LLVM_LIB_DIR/lib\(.*\)\.a|-l\1|g" | tr '\n' ' ')
export LLVM_LIBS="-lm -lcurses -lxml2 $LLVM_LIBS"
export LLVM_LIBS="$(echo "$LLVM_LIBS" | sed 's/[[:space:]]*$//')"
export LLVM_DEFINITIONS="-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
export LLVM_LD_FLAGS="-L$LLVM_LIB_DIR -Wl,-search_paths_first -Wl,-headerpad_max_install_names"
export LLVM="$LLVM_LD_FLAGS $LLVM_LIBS"
export FAUSTLIVE=$PWD/faustlive
export BUILD_HTTP_STATIC=ON
export USE_STATIC_SNDFILE=1
export CMAKEOPT="-DCMAKE_OSX_ARCHITECTURES="$CMAKE_OSX_ARCHITECTURES" -DCMAKE_OSX_DEPLOYMENT_TARGET=$CMAKE_OSX_DEPLOYMENT_TARGET -DCMAKE_BUILD_TYPE=Release"
export INCLUDE_LLVM=ON
export USE_LLVM_CONFIG=off
cd build
make release
cd Release-${{env.FAUST_VERSION}}
cp Faust-${{env.FAUST_VERSION}}.dmg Faust-${{env.FAUST_VERSION}}-${{matrix.name}}.dmg
cp faustgen-${{env.FAUSTGEN_VERSION}}-macosx.dmg faustgen-${{env.FAUSTGEN_VERSION}}-${{matrix.name}}.dmg
env:
CMAKE_OSX_ARCHITECTURES: ${{matrix.CMAKE_OSX_ARCHITECTURES}}
ARCHS: ${{matrix.ARCHS}}
- name: Upload Faust artifact
uses: actions/upload-artifact@v4
with:
name: faust-${{env.FAUST_VERSION}}-${{ matrix.name }}.dmg
path: build/Release-${{env.FAUST_VERSION}}/Faust-${{env.FAUST_VERSION}}-${{matrix.name}}.dmg
if-no-files-found: error
- name: Upload Faust source artifact
if: ${{ endsWith( matrix.name, 'arm64') }}
uses: actions/upload-artifact@v4
with:
name: faust-${{env.FAUST_VERSION}}.tar.gz
path: build/Release-${{env.FAUST_VERSION}}/faust-${{env.FAUST_VERSION}}.tar.gz
if-no-files-found: error
- name: Upload faustgen~ artifact
uses: actions/upload-artifact@v4
with:
name: faustgen-${{env.FAUSTGEN_VERSION}}-${{ matrix.name }}.dmg
path: build/Release-${{env.FAUST_VERSION}}/faustgen-${{env.FAUSTGEN_VERSION}}-${{matrix.name}}.dmg
if-no-files-found: error
build-windows:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: win64
os: windows-2022
llvm-url: https://github.com/grame-cncm/faust/releases/download/2.59.5-llvm/llvm-17.0.6-win11-x86_64.zip
libsndfile-url: https://github.com/libsndfile/libsndfile/releases/download/1.2.0/libsndfile-1.2.0-win64.zip
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ilammy/msvc-dev-cmd@v1
- name: Download LLVM
run: |
# Libfaust will need to link against LLVM.
# We download a Windows x86_64 LLVM build that we've built in advance.
curl -L ${{ matrix.llvm-url }} -o llvm.zip
7z x llvm.zip -y
- name: Download Libsndfile
run: |
curl -L ${{ matrix.libsndfile-url }} -o libsndfile.zip
7z x libsndfile.zip -y
mv libsndfile-1.2.0-win64 libsndfile
# todo: remove windows/libmicrohttpd from repo and use dynamically downloaded version
# - name: Download libmicrohttpd
# run: |
# curl -L https://ftpmirror.gnu.org/libmicrohttpd/libmicrohttpd-latest-w32-bin.zip -o libmicrohttpd.zip
# 7z x libmicrohttpd.zip -y
- name: Clone Max SDK
uses: actions/checkout@v4
with:
repository: Cycling74/max-sdk-base
path: max-sdk-base
- name: Build libfaust
shell: cmd
run: |
cd build
call MakeRelease.bat
env:
LLVM_PACKAGE_VERSION: 17.0.6
- name: Make distribution
shell: cmd
run: |
cd embedded/faustgen/package
7z a -tzip faustgen-${{env.FAUSTGEN_VERSION}}-${{ matrix.name }}.zip faustgen-${{env.FAUSTGEN_VERSION}}-${{ matrix.name }}
- name: Upload Faust installer
uses: actions/upload-artifact@v4
with:
name: Faust-${{env.FAUST_VERSION}}-${{matrix.name}}.exe
path: build/Faust-${{env.FAUST_VERSION}}-${{matrix.name}}.exe
if-no-files-found: error
- name: Upload faustgen~ artifact
uses: actions/upload-artifact@v4
with:
name: faustgen-${{env.FAUSTGEN_VERSION}}-${{ matrix.name }}.zip
path: embedded/faustgen/package/faustgen-${{env.FAUSTGEN_VERSION}}-${{ matrix.name }}.zip
if-no-files-found: error
create-release:
if: ${{ inputs.create_release }}
needs: [build-ubuntu, build-ubuntu-aarch64, build-macos, build-windows]
runs-on: ubuntu-latest
name: "Create Release on GitHub"
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
path: "dist"
- uses: softprops/action-gh-release@v1
with:
draft: true
files: "dist/*/*"