File tree Expand file tree Collapse file tree 4 files changed +46
-20
lines changed
Expand file tree Collapse file tree 4 files changed +46
-20
lines changed Original file line number Diff line number Diff line change @@ -62,11 +62,18 @@ if [[ "$SKIP_OPENOCD" != 1 ]]; then
6262 SKIP_OPENOCD=1
6363 fi
6464 echo " OpenOCD Build Complete"
65+ if [[ " $SKIP_OPENOCD " != 1 ]]; then
66+ ../packages/macos/get-dylibs.sh " openocd-install-$( uname -m) "
67+ echo " OpenOCD dylibs copied"
68+ fi
6569fi
6670if [[ " $SKIP_RISCV " != 1 ]]; then
6771 # Takes ages to build
6872 ../packages/macos/riscv/build-riscv-gcc.sh
6973 echo " RISC-V Build Complete"
74+
75+ ../packages/macos/get-dylibs.sh " riscv-install-$( uname -m) "
76+ echo " RISC-V dylibs copied"
7077fi
7178if [[ " $SKIP_PICOTOOL " != 1 ]]; then
7279 arch -x86_64 ../packages/macos/picotool/build-picotool.sh
@@ -75,6 +82,12 @@ if [[ "$SKIP_PICOTOOL" != 1 ]]; then
7582 fi
7683 echo " Picotool Build Complete"
7784
85+ ../packages/macos/get-dylibs.sh " picotool-install-x86_64"
86+ if [[ $( uname -m) == ' arm64' ]]; then
87+ ../packages/macos/get-dylibs.sh " picotool-install-arm64"
88+ fi
89+ echo " Picotool dylibs copied"
90+
7891 ../packages/macos/make-universal.sh " pico-sdk-tools" " pioasm" " pioasm"
7992 echo " Pioasm Universal Merge Complete"
8093 ../packages/macos/make-universal.sh " picotool-install" " picotool" " picotool"
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ INSTALLDIR=$1
4+
5+ EXES=$( find $INSTALLDIR -type f -perm -u+x)
6+ LIBS=$( otool -L $EXES | grep -E " /opt/homebrew|/usr/local/opt" | grep -v python | sort | uniq | grep -o -E " /.*\.dylib" )
7+
8+ if [ ! $LIBS ]; then
9+ exit 1;
10+ fi
11+
12+ while IFS= read -r lib; do
13+ echo
14+ echo $lib
15+ libname=$( echo $lib | grep -o -E " [^/]*\.dylib" )
16+ echo $libname
17+ echo
18+ while IFS= read -r exe; do
19+ if file $exe | grep " Mach-O 64-bit executable" > /dev/null; then
20+ if otool -L $exe | grep -o $lib > /dev/null; then
21+ echo " $exe $( otool -L $exe | grep -o $lib ) "
22+ exedir=$( echo $exe | grep -o -E " .*/" )
23+ install_name_tool -change $lib @loader_path/$libname $exe
24+ if ! otool -l $exe | grep " LC_RPATH" -A2 | grep " @loader_path" > /dev/null; then
25+ install_name_tool -add_rpath @loader_path/ $exe
26+ fi
27+ if [ ! -f $exedir$libname ]; then
28+ cp $lib $exedir$libname
29+ fi
30+ fi
31+ fi
32+ done <<< " $EXES"
33+ done <<< " $LIBS"
Original file line number Diff line number Diff line change 1313INSTALLDIR=" $PWD /../openocd-install-$( uname -m) /usr/local/bin"
1414rm -rf " $PWD /../openocd-install-$( uname -m) "
1515DESTDIR=" $PWD /../openocd-install-$( uname -m) " make install
16-
17- libusbpath=($( otool -L $INSTALLDIR /openocd | grep libusb) )
18- echo ${libusbpath[0]}
19- cp " ${libusbpath[0]} " $INSTALLDIR /libusb-1.0.dylib
20- install_name_tool -change " ${libusbpath[0]} " @loader_path/libusb-1.0.dylib $INSTALLDIR /openocd
21- libhidpath=($( otool -L $INSTALLDIR /openocd | grep libhidapi) )
22- echo ${libhidpath[0]}
23- cp " ${libhidpath[0]} " $INSTALLDIR /libhidapi.dylib
24- install_name_tool -change " ${libhidpath[0]} " @loader_path/libhidapi.dylib $INSTALLDIR /openocd
25- libjimpath=($( otool -L $INSTALLDIR /openocd | grep libjim) )
26- echo ${libjimpath[0]}
27- cp " ${libjimpath[0]} " $INSTALLDIR /libjim0.83.dylib
28- install_name_tool -change " ${libjimpath[0]} " @loader_path/libjim0.83.dylib $INSTALLDIR /openocd
29- install_name_tool -add_rpath @loader_path/ $INSTALLDIR /openocd
Original file line number Diff line number Diff line change @@ -35,9 +35,3 @@ rm -rf $INSTALLDIR
3535mkdir -p $INSTALLDIR
3636cmake --install picotool/build/ --prefix $INSTALLDIR
3737touch $INSTALLDIR /.keep
38-
39- libpath=($( otool -L $INSTALLDIR /picotool/picotool | grep libusb) )
40- echo ${libpath[0]}
41- cp " ${libpath[0]} " $INSTALLDIR /picotool/libusb-1.0.dylib
42- install_name_tool -change " ${libpath[0]} " @loader_path/libusb-1.0.dylib $INSTALLDIR /picotool/picotool
43- install_name_tool -add_rpath @loader_path/ $INSTALLDIR /picotool/picotool
You can’t perform that action at this time.
0 commit comments