@@ -44,7 +44,7 @@ sed "${sed_args[@]}" "s|/tools/host|${TOOLS_PATH}/host|g" ${TOOLS_PATH}/host/sha
44
44
# We force linking of external static libraries by removing the shared
45
45
# libraries. This is hacky. But we're building in a temporary container
46
46
# and it gets the job done.
47
- find ${TOOLS_PATH} /deps -name ' *.so*' -exec rm {} \;
47
+ find ${TOOLS_PATH} /deps -name ' *.so*' -a \! \( -name ' libtcl*.so* ' -or -name ' libtk*.so* ' \) - exec rm {} \;
48
48
49
49
tar -xf Python-${PYTHON_VERSION} .tar.xz
50
50
@@ -705,6 +705,8 @@ if [ "${PYBUILD_SHARED}" = "1" ]; then
705
705
${ROOT} /out/python/install/bin/python${PYTHON_MAJMIN_VERSION}
706
706
707
707
# Python's build system doesn't make this file writable.
708
+ # TODO(geofft): @executable_path/ is a weird choice here, who is
709
+ # relying on it? Should probably be @loader_path.
708
710
chmod 755 ${ROOT} /out/python/install/lib/${LIBPYTHON_SHARED_LIBRARY_BASENAME}
709
711
install_name_tool \
710
712
-change /install/lib/${LIBPYTHON_SHARED_LIBRARY_BASENAME} @executable_path/${LIBPYTHON_SHARED_LIBRARY_BASENAME} \
@@ -723,6 +725,13 @@ if [ "${PYBUILD_SHARED}" = "1" ]; then
723
725
-change /install/lib/${LIBPYTHON_SHARED_LIBRARY_BASENAME} @executable_path/../lib/${LIBPYTHON_SHARED_LIBRARY_BASENAME} \
724
726
${ROOT} /out/python/install/bin/python${PYTHON_MAJMIN_VERSION}${PYTHON_BINARY_SUFFIX}
725
727
fi
728
+
729
+ # At the moment, python3 and libpython don't have shared-library
730
+ # dependencies, but at some point we will want to run this for
731
+ # them too.
732
+ for module in ${ROOT} /out/python/install/lib/python* /lib-dynload/* .so; do
733
+ install_name_tool -add_rpath @loader_path/../.. " $module "
734
+ done
726
735
else # (not macos)
727
736
LIBPYTHON_SHARED_LIBRARY_BASENAME=libpython${PYTHON_MAJMIN_VERSION}${PYTHON_BINARY_SUFFIX} .so.1.0
728
737
LIBPYTHON_SHARED_LIBRARY=${ROOT} /out/python/install/lib/${LIBPYTHON_SHARED_LIBRARY_BASENAME}
@@ -1250,6 +1259,14 @@ if [ -d "${TOOLS_PATH}/deps/lib/tcl8" ]; then
1250
1259
for source in ${TOOLS_PATH} /deps/lib/{itcl4.2.4,tcl8,tcl8.6,thread2.8.9,tk8.6}; do
1251
1260
cp -av $source ${ROOT} /out/python/install/lib/
1252
1261
done
1262
+
1263
+ (
1264
+ shopt -s nullglob
1265
+ dylibs=(${TOOLS_PATH} /deps/lib/lib* .dylib ${TOOLS_PATH} /deps/lib/lib* .so)
1266
+ if [ " ${# dylibs[@]} " -gt 0 ]; then
1267
+ cp -av " ${dylibs[@]} " ${ROOT} /out/python/install/lib/
1268
+ fi
1269
+ )
1253
1270
fi
1254
1271
1255
1272
# Copy the terminfo database if present.
0 commit comments