Skip to content

Commit f929b6e

Browse files
committed
update pypi publish
1 parent 6d7af5b commit f929b6e

2 files changed

Lines changed: 57 additions & 13 deletions

File tree

.github/workflows/pypi_publish.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
# Install build dependencies (patchelf on Linux fixes ggml NEEDED entries)
6565
CIBW_BEFORE_BUILD: >
6666
pip install pybind11 numpy cmake &&
67-
(command -v yum >/dev/null 2>&1 && yum install -y patchelf || true)
67+
(command -v yum >/dev/null 2>&1 && yum install -y patchelf zip unzip || true)
6868
6969
# Skip legacy Python versions and PyPy
7070
CIBW_SKIP: cp36-* cp37-* pp*
@@ -85,6 +85,29 @@ jobs:
8585
rm -rf $tmpdir &&
8686
auditwheel repair -w {dest_dir} {wheel}
8787
88+
# Fix install_name entries before delocate-wheel repair on macOS.
89+
# cmake embeds build-tree paths in dylib install_names and their
90+
# NEEDED references (e.g. /build/path/libggml-base.dylib),
91+
# which delocate-wheel cannot resolve. Rewrite them to @rpath-relative.
92+
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
93+
tmpdir=$(mktemp -d) &&
94+
unzip -q {wheel} -d $tmpdir &&
95+
pkg_dir=$tmpdir/rapidspeech &&
96+
for f in $(find $pkg_dir -name '*.dylib' -o -name '*.so'); do
97+
for lib in libggml-base libggml-cpu libggml-metal libggml-blas libggml librapidspeech-core; do
98+
install_name_tool -change "$lib.dylib" "@rpath/$lib.dylib" "$f" 2>/dev/null || true;
99+
install_name_tool -change "ggml/src/$lib.dylib" "@rpath/$lib.dylib" "$f" 2>/dev/null || true;
100+
done;
101+
id=$(otool -D "$f" | tail -1) &&
102+
basename_id=$(basename "$id") &&
103+
if [ "$id" != "$basename_id" ] && [ -n "$basename_id" ]; then
104+
install_name_tool -id "@rpath/$basename_id" "$f" 2>/dev/null || true;
105+
fi;
106+
done &&
107+
(cd $tmpdir && zip -qr {wheel} .) &&
108+
rm -rf $tmpdir &&
109+
delocate-wheel --require-archs {plat} -w {dest_dir} {wheel}
110+
88111
- uses: actions/upload-artifact@v4
89112
with:
90113
name: wheels-${{ matrix.backend }}-${{ matrix.os }}

CMakeLists.txt

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,26 @@ if (RS_ENABLE_PYTHON)
9393
set(_ggml_targets ggml ggml-base ggml-cpu ggml-metal ggml-blas ggml-vulkan)
9494
foreach(_t IN LISTS _ggml_targets)
9595
if (TARGET ${_t})
96-
set_target_properties(${_t} PROPERTIES
97-
SOVERSION ""
98-
VERSION ""
99-
NO_SONAME ON
100-
INSTALL_RPATH "${RS_RPATH}"
101-
BUILD_WITH_INSTALL_RPATH ON
102-
)
96+
if (APPLE)
97+
# On macOS, NO_SONAME ON causes install_name to be the build-tree
98+
# path, which delocate-wheel cannot resolve. Use INSTALL_NAME_DIR
99+
# instead so install_name becomes @rpath/libname.dylib.
100+
set_target_properties(${_t} PROPERTIES
101+
SOVERSION ""
102+
VERSION ""
103+
INSTALL_NAME_DIR "@rpath"
104+
INSTALL_RPATH "${RS_RPATH}"
105+
BUILD_WITH_INSTALL_RPATH ON
106+
)
107+
else()
108+
set_target_properties(${_t} PROPERTIES
109+
SOVERSION ""
110+
VERSION ""
111+
NO_SONAME ON
112+
INSTALL_RPATH "${RS_RPATH}"
113+
BUILD_WITH_INSTALL_RPATH ON
114+
)
115+
endif()
103116
endif()
104117
endforeach()
105118
endif()
@@ -164,11 +177,19 @@ if (NOT RS_ENABLE_PYTHON)
164177
SOVERSION 1
165178
)
166179
else()
167-
set_target_properties(rapidspeech-core PROPERTIES
168-
NO_SONAME ON
169-
INSTALL_RPATH "${RS_RPATH}"
170-
BUILD_WITH_INSTALL_RPATH ON
171-
)
180+
if (APPLE)
181+
set_target_properties(rapidspeech-core PROPERTIES
182+
INSTALL_NAME_DIR "@rpath"
183+
INSTALL_RPATH "${RS_RPATH}"
184+
BUILD_WITH_INSTALL_RPATH ON
185+
)
186+
else()
187+
set_target_properties(rapidspeech-core PROPERTIES
188+
NO_SONAME ON
189+
INSTALL_RPATH "${RS_RPATH}"
190+
BUILD_WITH_INSTALL_RPATH ON
191+
)
192+
endif()
172193
endif()
173194
set_target_properties(rapidspeech-core PROPERTIES
174195
CXX_VISIBILITY_PRESET hidden

0 commit comments

Comments
 (0)