Skip to content

Commit

Permalink
OSX post-build fixup: check if bin file is Mach-O
Browse files Browse the repository at this point in the history
Before attempting to fix up a binary file with install_name_tool,
check if it is a file of Mach-O type using command 'file'.
  • Loading branch information
sfgraves committed Apr 17, 2015
1 parent 03897fd commit 9c0eb2d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
11 changes: 4 additions & 7 deletions macos_fixup_gfortranlibs.sh
Expand Up @@ -33,15 +33,12 @@ for i in $(find $STARLINK_DIR/lib -name '*.dylib' -type f); do
install_name_tool -change "$libpath" "$newpath" "$i";
done

for i in $(find $STARLINK_DIR/bin -type f -perm +111 -not -name '*.csh' \
-not -name '*.sh' -not -name '*_link_adam' -not -name '*.icl' \
-not -name '*.py' -not -name '*.pl' -not -name '*.tcl' \
-not -name '*.tab' -not -name '*.cfg' -not -name '*.ids' \
-not -name '*.def' -not -name '*.class'); do
install_name_tool -change "$libpath" "$newpath" "$i";
for i in $(find $STARLINK_DIR/bin -type f -perm +111); do
if file $i | grep -q Mach-O; then
install_name_tool -change "$libpath" "$newpath" "$i";
fi
done


for i in $(find $STARLINK_DIR/Perl -name '*.bundle' -type f); do
install_name_tool -change "$libpath" "$newpath" "$i";
done
Expand Down
14 changes: 6 additions & 8 deletions macos_postbuild_library_fixup.sh
Expand Up @@ -159,15 +159,13 @@ done
echo "Fixing up binaries under $STARLINK_DIR/bin"
echo
echo
for i in $(find $STARLINK_DIR/bin -type f -perm +111 -not -name '*.csh' \
-not -name '*.sh' -not -name '*_link_adam' -not -name '*.icl' \
-not -name '*.py' -not -name '*.pl' -not -name '*.tcl' \
-not -name '*.tab' -not -name '*.cfg' -not -name '*.ids' \
-not -name '*.def' -not -name '*.class'); do
for i in $(find $STARLINK_DIR/bin -type f -perm +111); do

# echo $i
fixup_starlink_dylib_links $i
add_rpath_starlink $i
# Check if a Mach-O type file.
if file $i | grep -q Mach-O; then
fixup_starlink_dylib_links $i
add_rpath_starlink $i
fi

done

Expand Down

0 comments on commit 9c0eb2d

Please sign in to comment.