@@ -10,18 +10,34 @@ mkdir -p $INSTALLDIR
1010cp -r $INSTALLDIR -arm64/* $INSTALLDIR
1111touch $INSTALLDIR /.keep
1212
13- EXES=$( find $INSTALLDIR -type f -perm -u+x)
14- LIBS=$( find $INSTALLDIR -type f -name " *.dylib" )
15- FILES=" $EXES " $' \n ' " $LIBS "
13+ EXES_arm=$( find $INSTALLDIR -arm64 -type f -perm -u+x)
14+ LIBS_arm=$( find $INSTALLDIR -arm64 -type f -name " *.dylib" )
15+ FILES_arm=$( echo " $EXES_arm " $' \n ' " $LIBS_arm " | sed " s|$INSTALLDIR -arm64|$INSTALLDIR |g" )
16+
17+ EXES_x64=$( find $INSTALLDIR -x86_64 -type f -perm -u+x)
18+ LIBS_x64=$( find $INSTALLDIR -x86_64 -type f -name " *.dylib" )
19+ FILES_x64=$( echo " $EXES_x64 " $' \n ' " $LIBS_x64 " | sed " s|$INSTALLDIR -x86_64|$INSTALLDIR |g" )
20+
21+ FILES=$( echo " $FILES_arm " $' \n ' " $FILES_x64 " | sort | uniq)
22+
1623echo " Files: $FILES "
1724while IFS= read -r file; do
1825 file_arm64=$( sed " s|$INSTALLDIR |$INSTALLDIR -arm64|" <<< $file )
1926 file_x86_64=$( sed " s|$INSTALLDIR |$INSTALLDIR -x86_64|" <<< $file )
20- if file $file | grep " Mach-O 64-bit executable" > /dev/null; then
21- echo " Processing executable: $file $file_x86_64 $file_arm64 "
22- lipo -create -output $file $file_x86_64 $file_arm64
23- elif file $file | grep " Mach-O 64-bit dynamically linked shared library" > /dev/null; then
24- echo " Processing dynamic library: $file $file_x86_64 $file_arm64 "
25- lipo -create -output $file $file_x86_64 $file_arm64
27+ if [ -f $file_x86_64 ]; then
28+ if [ -f $file_arm64 ]; then
29+ if file $file | grep " Mach-O 64-bit executable" > /dev/null; then
30+ echo " Processing executable: $file $file_x86_64 $file_arm64 "
31+ lipo -create -output $file $file_x86_64 $file_arm64
32+ elif file $file | grep " Mach-O 64-bit dynamically linked shared library" > /dev/null; then
33+ echo " Processing dynamic library: $file $file_x86_64 $file_arm64 "
34+ lipo -create -output $file $file_x86_64 $file_arm64
35+ fi
36+ else
37+ echo " Copying $file_x86_64 to $file "
38+ cp $file_x86_64 $file
39+ fi
40+ else
41+ echo " Leaving $file as is"
2642 fi
2743done <<< " $FILES"
0 commit comments