How Do I know This Shell Script Is Working?

Discussion in 'Mac Programming' started by ajm113, Mar 18, 2011.

  1. ajm113, Mar 18, 2011
    Last edited: Mar 18, 2011

    ajm113 macrumors newbie

    Joined:
    Jan 16, 2011
    #1
    Okay, so I'm ready to deploy my beta limited feature edition of my app and I'm having slight problems bundling up non standard Mac frameworks.

    Here is what my project looks like:
    [​IMG]

    As you can tell the framework "FreeImage.framework" is highlighted red, I temporally removed the framework from the Frameworks folder in the system for testing and I have the frameworks in a copy file already and I created a shell script target, but idk if it's even running or not before I build the Unix Executable.

    [​IMG]

    Encase if you cant read the code to well:
    Code:
    function relocateLibraryInCurrentApp() {
      install_name_tool -change $1$2 @executable_path/../Frameworks/$2 $CONFIGURATION_BUILD_DIR/$EXECUTABLE_PATH
    }
    
    relocateLibraryInCurrentApp /usr/local/lib/ libwx_macud_gl-2.8.dylib #note the space
    relocateLibraryInCurrentApp /Library/Frameworks/ FreeImage.framework/Versions/A/Foobar #note the space
    
    exit 0
    
    Anyways, what am I missing? I tried using the otool -L "My Unix Executable" and it keeps showing up the default framework paths instead of the paths located in the bundle and I tried using the install_name_tool -change ... directory through the Terminal and it has NO effect on the executable and it shows no error. :(

    Can someone point out what I'm missing? Cause if I just run the app bundle without the framework in it's default location in the System it just crashes saying it can't find the framework. This is my first Mac deployment, so I'm not exactly sure what I'm missing cause I'm coming from a .dll background and I have my frameworks in the "Frameworks" folder in the app bundle.

    Code:
    MyApp.app/Contents/Frameworks
            |
             -> FreeImage.framework
             -> libwx_macud_gl-2.8.dylib
    
    Thanks, Ajm.
     
  2. Detrius macrumors 68000

    Joined:
    Sep 10, 2008
    Location:
    Asheville, NC
    #2
    You're on the right track. You need to change the install name of the framework itself. Set this when you build the framework (it's a build setting in the GUI). Then, when the app is linked to the framework, it'll already be looking in the right place.
     
  3. ajm113, Mar 18, 2011
    Last edited: Mar 18, 2011

    ajm113 thread starter macrumors newbie

    Joined:
    Jan 16, 2011
    #3
    When you mean "build" the framework, you are referring to actually rebuilding the source code of the framework it's self? Cause I'm not sure how to do that exactly with FreeImage since I pretty much just downloaded the .framework that only includes the header files.

    Sorry I know I seem really lost but, I'm new to Mac development still coming from a rich Windows development background. :(

    Cause it sounds to me: "Recompile an API into a library of something you don't have original source code to."
     
  4. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #4
    Perhaps you can put something like this in your script and then inspect that the files exists and the modification date is the when you last built.

    Code:
    touch /tmp/scripttest
    
    One other thing, dylibs normally go into Contents/MacOS directory next to the executable not the Frameworks directory; them not being frameworks but simple shared libraries (these are the equivalent of DLLs).

    These are fixed up using the install_path_tool to have paths like:

    Code:
    @loader_path/libwx_macud_gl-2.8.dylib
    
     
  5. ajm113 thread starter macrumors newbie

    Joined:
    Jan 16, 2011
    #5
    Hey thanks for your replys!!

    Thank you very much it seemed that touch tool really helped me! :)

    Awesome my app is ready for deployment, I just need to make a free limited features version of it and it's all set for Windows and Mac!

    Thanks again!
     

Share This Page