Working on our architecture. Adding a bunch of HID and Futaba classes.
4 # The name of the executable. It is assumed
5 # that it is in the current working directory.
6 EXE_NAME=hidapi-testgui
7 # Path to the executable directory inside the bundle.
8 # This must be an absolute path, so use $PWD.
9 EXEPATH=$PWD/TestGUI.app/Contents/MacOS
10 # Libraries to explicitly bundle, even though they
11 # may not be in /opt/local. One per line. These
12 # are used with grep, so only a portion of the name
13 # is required. eg: libFOX, libz, etc.
19 # echo "Copying deps for $file...."
20 local BASE_OF_EXE=`basename $file`
22 # A will contain the dependencies of this library
23 local A=`otool -LX $file |cut -f 1 -d " "`
26 local BASE=`basename $i`
28 # See if it's a lib we specifically want to bundle
29 local bundle_this_lib=0
31 for j in $LIBS_TO_BUNDLE; do
35 echo "bundling $i because it's in the list."
40 # See if it's in /opt/local. Bundle all in /opt/local
42 echo $i |grep -q /opt/local
45 echo "bundling $i because it's in /opt/local."
49 if [ $isOptLocal -ne 0 ] || [ $bundle_this_lib -ne 0 ]; then
51 # Copy the file into the bundle if it exists.
52 if [ -f $EXEPATH/$BASE ]; then
56 chmod 755 $EXEPATH/$BASE
60 # echo "$BASE_OF_EXE depends on $BASE"
62 # Fix the paths using install_name_tool and then
63 # call this function recursively for each dependency
65 if [ $BASE_OF_EXE != $BASE ]; then
68 install_name_tool -id @executable_path/$BASE $EXEPATH/$BASE
69 install_name_tool -change $i @executable_path/$BASE $EXEPATH/$BASE_OF_EXE
71 # Call this function (recursive) on
72 # on each dependency of this library.
73 copydeps $EXEPATH/$BASE
81 # Copy the binary into the bundle. Use ../libtool to do this if it's
82 # available beacuse if $EXE_NAME was built with autotools, it will be
83 # necessary. If ../libtool not available, just use cp to do the copy, but
84 # only if $EXE_NAME is a binary.
85 if [ -x ../libtool ]; then
86 ../libtool --mode=install cp $EXE_NAME $EXEPATH
88 file -bI $EXE_NAME |grep binary
90 echo "There is no ../libtool and $EXE_NAME is not a binary."
91 echo "I'm not sure what to do."
97 copydeps $EXEPATH/$EXE_NAME