Skip to content

Commit b8007b5

Browse files
committed
combine ARM and Intel macOS libraries
1 parent 3dff5d0 commit b8007b5

3 files changed

Lines changed: 62 additions & 11 deletions

File tree

.github/workflows/build_library.yaml

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,25 +1187,49 @@ jobs:
11871187
name: Clone
11881188
uses: actions/checkout@v4
11891189

1190+
- id: set_release_prefix
1191+
name: Set prefix
1192+
run: |
1193+
echo "PREFIX=undreamai-${{ github.ref_name }}-llamacpp" >> $GITHUB_ENV
1194+
shell: bash
1195+
11901196
- id: download_artifacts
11911197
name: Download Artifacts
11921198
uses: actions/download-artifact@v4
11931199
with:
11941200
path: artifacts
11951201

1196-
- id: merge_artifacts
1197-
name: Merge artifacts
1202+
- id: unzip_artifacts
1203+
name: Unzip artifacts
11981204
run: |
11991205
cd artifacts
12001206
ls -R
1201-
PREFIX=undreamai-${{ github.ref_name }}-llamacpp
12021207
1203-
for d in `ls | grep $PREFIX`;do
1208+
for d in `ls | grep ${{ env.PREFIX }}`;do
12041209
cd $d; unzip $d; rm $d; cd ..;
1205-
new_name=`echo $d | sed -e "s:$PREFIX-::g" | sed -e 's:.zip::g'`
1210+
new_name=`echo $d | sed -e "s:${{ env.PREFIX }}-::g" | sed -e 's:.zip::g'`
12061211
mv $d $new_name;
12071212
echo $new_name >> bundle
12081213
done
1214+
1215+
- id: combine_macos_libraries
1216+
name: Merge macOS libraries
1217+
run: |
1218+
cd artifacts
1219+
for acc in acc no_acc;do
1220+
mkdir macos-$acc
1221+
lipo -create -output macos-$acc/libundreamai_macos-$acc.dylib macos-x64-$acc/libundreamai_macos-x64-$acc.dylib macos-arm64-$acc/libundreamai_macos-arm64-$acc.dylib
1222+
cp `ls macos-x64-$acc/* | grep -v ".dylib"` macos-$acc
1223+
rm -r macos-x64-$acc macos-arm64-$acc
1224+
sed -i.bak "/macos-x64-$acc/d" bundle
1225+
sed -i.bak "/macos-arm64-$acc/d" bundle
1226+
echo macos-$acc >> bundle
1227+
done
1228+
1229+
- id: merge_artifacts
1230+
name: Merge artifacts
1231+
run: |
1232+
cd artifacts
12091233
12101234
servers=`find . -name undreamai_server*`
12111235
if [ "$servers" != "" ];then

.github/workflows_template/build_library_steps.yaml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,26 +302,50 @@ jobs:
302302
303303
################################ Release ################################
304304

305+
- id: set_release_prefix
306+
name: Set prefix
307+
run: |
308+
echo "PREFIX=undreamai-${{ github.ref_name }}-llamacpp" >> $GITHUB_ENV
309+
shell: bash
310+
305311
- name: Download Artifacts
306312
id: download_artifacts
307313
uses: actions/download-artifact@v4
308314
with:
309315
path: artifacts
310316

311-
- name: Merge artifacts
312-
id: merge_artifacts
317+
- id: unzip_artifacts
318+
name: Unzip artifacts
313319
run: |
314320
cd artifacts
315321
ls -R
316-
PREFIX=undreamai-${{ github.ref_name }}-llamacpp
317-
318-
for d in `ls | grep $PREFIX`;do
322+
323+
for d in `ls | grep ${{ env.PREFIX }}`;do
319324
cd $d; unzip $d; rm $d; cd ..;
320-
new_name=`echo $d | sed -e "s:$PREFIX-::g" | sed -e 's:.zip::g'`
325+
new_name=`echo $d | sed -e "s:${{ env.PREFIX }}-::g" | sed -e 's:.zip::g'`
321326
mv $d $new_name;
322327
echo $new_name >> bundle
323328
done
324329

330+
- id: combine_macos_libraries
331+
name: Merge macOS libraries
332+
run: |
333+
cd artifacts
334+
for acc in acc no_acc;do
335+
mkdir macos-$acc
336+
lipo -create -output macos-$acc/libundreamai_macos-$acc.dylib macos-x64-$acc/libundreamai_macos-x64-$acc.dylib macos-arm64-$acc/libundreamai_macos-arm64-$acc.dylib
337+
cp `ls macos-x64-$acc/* | grep -v ".dylib"` macos-$acc
338+
rm -r macos-x64-$acc macos-arm64-$acc
339+
sed -i.bak "/macos-x64-$acc/d" bundle
340+
sed -i.bak "/macos-arm64-$acc/d" bundle
341+
echo macos-$acc >> bundle
342+
done
343+
344+
- name: Merge artifacts
345+
id: merge_artifacts
346+
run: |
347+
cd artifacts
348+
325349
servers=`find . -name undreamai_server*`
326350
if [ "$servers" != "" ];then
327351
zip -r undreamai-${{ github.ref_name }}-server.zip $servers

.github/workflows_template/build_library_template.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,9 @@ jobs:
346346
- visionos-build
347347
steps:
348348
@@checkout@@
349+
@@set_release_prefix@@
349350
@@download_artifacts@@
351+
@@unzip_artifacts@@
352+
@@combine_macos_libraries@@
350353
@@merge_artifacts@@
351354
@@release@@

0 commit comments

Comments
 (0)