Skip to content

Commit 56e48eb

Browse files
Add workflow and license for SpeexDSP natives (#13)
* Create speexdsp workflow based on the koana workflow Just linux for now * 😑 * Add debug outputs * Try a subfolder in the artifact path * Try arm64 * I meant musl but whatever, install autoconf * Install automake * Add libtool * Replace the archaic SpeexDSP build stuff Co-authored-by: Livia-Valeriya Silvercrown <akiraveliara@outlook.com> * Try using CMake #1 * Add debug directory listing * Actually clone the natives repo * Adjust natives repo path * Fix cmake parameter syntax * Add musl-dev * Set C standard to C11 * Fix typo, add debugging * Do not use NEON for now * Try building on windows * Update CMakeLists.txt Co-authored-by: Livia-Valeriya Silvercrown <akiraveliara@outlook.com> * Forgot to clone the natves repo on windows * Use correct slashes on windows * Try building on mac * How many more times am i gonna forget smh * Try building without SSE on mac x64 * Add license for speexdsp * Add speexdsp library information --------- Co-authored-by: Livia-Valeriya Silvercrown <akiraveliara@outlook.com>
1 parent ddf69a4 commit 56e48eb

File tree

4 files changed

+467
-0
lines changed

4 files changed

+467
-0
lines changed

.github/workflows/speexdsp.yml

Lines changed: 372 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,372 @@
1+
name: Build speexdsp
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- '.github/workflows/speexdsp.yml'
9+
- 'build/SpeexDSP_CMakeLists.txt'
10+
11+
jobs:
12+
version:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
version: ${{ steps.print-version.outputs.version }}
16+
steps:
17+
- name: Clone speexdsp repo
18+
uses: actions/checkout@v4
19+
with:
20+
repository: xiph/speexdsp
21+
22+
- name: Print version
23+
id: print-version
24+
shell: bash
25+
run: |
26+
git fetch --tags
27+
LATEST_TAG=$(git tag | grep -E ^SpeexDSP-[0-9]+.[0-9]+.[0-9]+$ | tail -1)
28+
git checkout "$LATEST_TAG"
29+
echo "version=$LATEST_TAG" >> $GITHUB_OUTPUT
30+
31+
build-windows-x64:
32+
runs-on: windows-latest
33+
needs: version
34+
steps:
35+
- name: Clone speexdsp repo
36+
uses: actions/checkout@v4
37+
with:
38+
repository: xiph/speexdsp
39+
ref: ${{needs.version.outputs.version}}
40+
41+
- name: Clone Natives repo
42+
uses: actions/checkout@v4
43+
with:
44+
path: natives
45+
46+
- name: Setup VS build tools
47+
uses: seanmiddleditch/gha-setup-vsdevenv@v5
48+
with:
49+
host_arch: amd64
50+
arch: amd64
51+
52+
- name: Build speexdsp
53+
shell: pwsh
54+
run: |
55+
cp natives/build/SpeexDSP_CMakeLists.txt CMakeLists.txt
56+
cmake -B build -A x64 -DSPEEX_USE_SSE=ON
57+
cmake --build build --config Release --parallel
58+
59+
- name: Rename native
60+
shell: bash
61+
run: mv build/Release/speexdsp.dll build/Release/speexdsp-win-x64.dll
62+
63+
- name: Publish Artifacts
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: speexdsp-windows-x64
67+
path: build\Release\speexdsp-win-x64.dll
68+
69+
build-windows-arm64:
70+
runs-on: windows-11-arm
71+
needs: version
72+
steps:
73+
- name: Clone speexdsp repo
74+
uses: actions/checkout@v4
75+
with:
76+
repository: xiph/speexdsp
77+
ref: ${{needs.version.outputs.version}}
78+
79+
- name: Clone Natives repo
80+
uses: actions/checkout@v4
81+
with:
82+
path: natives
83+
84+
- name: Setup VS build tools
85+
uses: seanmiddleditch/gha-setup-vsdevenv@v5
86+
with:
87+
host_arch: arm64
88+
arch: arm64
89+
90+
- name: Build speexdsp
91+
shell: pwsh
92+
run: |
93+
cp natives/build/SpeexDSP_CMakeLists.txt CMakeLists.txt
94+
cmake -B build -A ARM64
95+
cmake --build build --config Release --parallel
96+
97+
- name: Rename native
98+
shell: bash
99+
run: mv build/Release/speexdsp.dll build/Release/speexdsp-win-arm64.dll
100+
101+
- name: Publish Artifacts
102+
uses: actions/upload-artifact@v4
103+
with:
104+
name: speexdsp-windows-arm64
105+
path: build\Release\speexdsp-win-arm64.dll
106+
107+
build-linux-x64:
108+
runs-on: ubuntu-latest
109+
needs: version
110+
steps:
111+
- name: Clone speexdsp repo
112+
uses: actions/checkout@v4
113+
with:
114+
repository: xiph/speexdsp
115+
ref: ${{needs.version.outputs.version}}
116+
117+
- name: Clone Natives repo
118+
uses: actions/checkout@v4
119+
with:
120+
path: natives
121+
122+
- name: Build speexdsp
123+
shell: bash
124+
run: |
125+
cp natives/build/SpeexDSP_CMakeLists.txt CMakeLists.txt
126+
cmake -B build -DSPEEX_USE_SSE=ON
127+
cmake --build build --config Release --parallel
128+
129+
- name: Rename native
130+
shell: bash
131+
run: mv build/libspeexdsp.so build/libspeexdsp-linux-x64.so
132+
133+
- name: Publish Artifacts
134+
uses: actions/upload-artifact@v4
135+
with:
136+
name: speexdsp-linux-x64
137+
path: build/libspeexdsp-linux-x64.so
138+
139+
build-linux-arm64:
140+
runs-on: ubuntu-24.04-arm
141+
needs: version
142+
steps:
143+
- name: Clone speexdsp repo
144+
uses: actions/checkout@v4
145+
with:
146+
repository: xiph/speexdsp
147+
ref: ${{needs.version.outputs.version}}
148+
149+
- name: Clone Natives repo
150+
uses: actions/checkout@v4
151+
with:
152+
path: natives
153+
154+
- name: Build speexdsp
155+
shell: bash
156+
run: |
157+
cp natives/build/SpeexDSP_CMakeLists.txt CMakeLists.txt
158+
cmake -B build
159+
cmake --build build --config Release --parallel
160+
161+
- name: Rename native
162+
shell: bash
163+
run: mv build/libspeexdsp.so build/libspeexdsp-linux-arm64.so
164+
165+
- name: Publish Artifacts
166+
uses: actions/upload-artifact@v4
167+
with:
168+
name: speexdsp-linux-arm64
169+
path: build/libspeexdsp-linux-arm64.so
170+
171+
build-macos-x64:
172+
runs-on: macos-latest
173+
needs: version
174+
steps:
175+
- name: Clone speexdsp repo
176+
uses: actions/checkout@v4
177+
with:
178+
repository: xiph/speexdsp
179+
ref: ${{needs.version.outputs.version}}
180+
181+
- name: Clone Natives repo
182+
uses: actions/checkout@v4
183+
with:
184+
path: natives
185+
186+
- name: Build speexdsp
187+
shell: bash
188+
run: |
189+
cp natives/build/SpeexDSP_CMakeLists.txt CMakeLists.txt
190+
cmake -B build
191+
cmake --build build --config Release --parallel
192+
193+
- name: Rename native
194+
shell: bash
195+
run: mv build/libspeexdsp.dylib build/libspeexdsp-osx-x64.dylib
196+
197+
- name: Publish Artifacts
198+
uses: actions/upload-artifact@v4
199+
with:
200+
name: speexdsp-macos-x64
201+
path: build/libspeexdsp-osx-x64.dylib
202+
203+
build-macos-arm64:
204+
runs-on: macos-latest
205+
needs: version
206+
steps:
207+
- name: Clone speexdsp repo
208+
uses: actions/checkout@v4
209+
with:
210+
repository: xiph/speexdsp
211+
ref: ${{needs.version.outputs.version}}
212+
213+
- name: Clone Natives repo
214+
uses: actions/checkout@v4
215+
with:
216+
path: natives
217+
218+
- name: Build speexdsp
219+
shell: bash
220+
run: |
221+
cp natives/build/SpeexDSP_CMakeLists.txt CMakeLists.txt
222+
cmake -B build
223+
cmake --build build --config Release --parallel
224+
225+
- name: Rename native
226+
shell: bash
227+
run: mv build/libspeexdsp.dylib build/libspeexdsp-osx-arm64.dylib
228+
229+
- name: Publish Artifacts
230+
uses: actions/upload-artifact@v4
231+
with:
232+
name: speexdsp-macos-arm64
233+
path: build/libspeexdsp-osx-arm64.dylib
234+
235+
build-musl-x64:
236+
runs-on: ubuntu-latest
237+
needs: version
238+
steps:
239+
- name: Clone speexdsp repo
240+
uses: actions/checkout@v4
241+
with:
242+
repository: xiph/speexdsp
243+
ref: ${{needs.version.outputs.version}}
244+
245+
- name: Clone Natives repo
246+
uses: actions/checkout@v4
247+
with:
248+
path: natives
249+
250+
- name: Setup Alpine Linux
251+
uses: jirutka/setup-alpine@v1
252+
with:
253+
packages: >
254+
build-base
255+
cmake
256+
git
257+
make
258+
gcc
259+
g++
260+
nasm
261+
linux-headers
262+
263+
- name: Build speexdsp
264+
shell: alpine.sh {0}
265+
run: |
266+
cp natives/build/SpeexDSP_CMakeLists.txt CMakeLists.txt
267+
cmake -B build -DSPEEX_USE_SSE=ON
268+
cmake --build build --config Release --parallel
269+
270+
- name: Rename native
271+
shell: bash
272+
run: mv build/libspeexdsp.so build/libspeexdsp-musl-x64.so
273+
274+
- name: Publish Artifacts
275+
uses: actions/upload-artifact@v4
276+
with:
277+
name: speexdsp-musl-x64
278+
path: build/libspeexdsp-musl-x64.so
279+
280+
build-musl-arm64:
281+
runs-on: ubuntu-latest
282+
needs: version
283+
steps:
284+
- name: Clone speexdsp repo
285+
uses: actions/checkout@v4
286+
with:
287+
repository: xiph/speexdsp
288+
ref: ${{needs.version.outputs.version}}
289+
290+
- name: Clone Natives repo
291+
uses: actions/checkout@v4
292+
with:
293+
path: natives
294+
295+
- name: Setup Alpine Linux
296+
uses: jirutka/setup-alpine@v1
297+
with:
298+
arch: aarch64
299+
packages: >
300+
build-base
301+
cmake
302+
git
303+
make
304+
gcc
305+
g++
306+
nasm
307+
linux-headers
308+
309+
- name: Build speexdsp
310+
shell: alpine.sh {0}
311+
run: |
312+
cp natives/build/SpeexDSP_CMakeLists.txt CMakeLists.txt
313+
cmake -B build
314+
cmake --build build --config Release --parallel
315+
316+
- name: Rename native
317+
shell: bash
318+
run: mv build/libspeexdsp.so build/libspeexdsp-musl-arm64.so
319+
320+
- name: Publish Artifacts
321+
uses: actions/upload-artifact@v4
322+
with:
323+
name: speexdsp-musl-arm64
324+
path: build/libspeexdsp-musl-arm64.so
325+
326+
# publish-nuget:
327+
# runs-on: ubuntu-latest
328+
# needs: [version, build-windows-x64, build-windows-arm64, build-linux-x64, build-linux-arm64, build-macos-x64, build-macos-arm64, build-musl-x64, build-musl-arm64]
329+
# steps:
330+
# - name: Checkout CSPROJ files
331+
# uses: actions/checkout@v4.2.2
332+
333+
# - name: Setup .NET
334+
# uses: actions/setup-dotnet@v4
335+
# with:
336+
# dotnet-version: 9
337+
338+
# - name: Download Artifacts
339+
# uses: actions/download-artifact@v4
340+
# with:
341+
# path: temp
342+
# pattern: koana-*
343+
# merge-multiple: true
344+
345+
# - name: Move Artifacts
346+
# run: |
347+
# mkdir -p lib/koana/win-x64/native
348+
# mkdir -p lib/koana/linux-x64/native
349+
# mkdir -p lib/koana/win-arm64/native
350+
# mkdir -p lib/koana/linux-arm64/native
351+
# mkdir -p lib/koana/osx-x64/native
352+
# mkdir -p lib/koana/osx-arm64/native
353+
# mkdir -p lib/koana/linux-musl-x64/native
354+
# mkdir -p lib/koana/linux-musl-arm64/native
355+
# cp temp/koana-win-x64.dll lib/koana/win-x64/native/koana.dll
356+
# cp temp/libkoana-linux-x64.so lib/koana/linux-x64/native/libkoana.so
357+
# cp temp/koana-win-arm64.dll lib/koana/win-arm64/native/koana.dll
358+
# cp temp/libkoana-linux-arm64.so lib/koana/linux-arm64/native/libkoana.so
359+
# cp temp/libkoana-osx-x64.dylib lib/koana/osx-x64/native/libkoana.dylib
360+
# cp temp/libkoana-osx-arm64.dylib lib/koana/osx-arm64/native/libkoana.dylib
361+
# cp temp/libkoana-musl-x64.so lib/koana/linux-musl-x64/native/libkoana.so
362+
# cp temp/libkoana-musl-arm64.so lib/koana/linux-musl-arm64/native/libkoana.so
363+
364+
# - name: Pack DSharpPlus.Natives.Koana
365+
# shell: bash
366+
# env:
367+
# NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
368+
# VERSION: ${{ needs.version.outputs.version }}
369+
# run: |
370+
# VERSION="${VERSION:1}"
371+
# dotnet pack ./build/DSharpPlus.Natives.Koana.csproj -c Release -p:Version="$VERSION.${{ github.run_number }}"
372+
# dotnet nuget push "artifacts/**" --skip-duplicate -k "$NUGET_API_KEY" -s https://api.nuget.org/v3/index.json

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ This repository contains packaging code for native libraries used by DSharpPlus.
1414
- Koana (forked from [dpp](https://github.com/brainboxdotcc/dpp))
1515
- buildscript: .github/workflows/koana.yml
1616
- license: licenses/koana-license.txt
17+
- SpeexDSP
18+
- buildscript: .github/workflows/speexdsp.yml
19+
- license: licenses/speexdsp-license.txt

0 commit comments

Comments
 (0)