Skip to content
  • Halla Rempt's avatar
    Set rpaths for OSX · 0d3288ca
    Halla Rempt authored
    To quote the cmake manual:
    
    "Policy CMP0042 was introduced to change the default value of
    MACOSX_RPATH to ON. This is because use of @rpath is a more flexible
    and powerful alternative to @executable_path and @loader_path."
    
    And whenever something is flexible and powerful, you can bet there
    are too many ways of doing things and that it'll take days or weeks
    to get things working again.
    
    This change explicitly sets the rpaths both for running krita on OSX
    after doing a make install and for running krita from a bundle. There
    may be some redundancy here and it is still not enough. Macdeployqt
    doesn't pick up the location of the libraries and start looking in
    /Libraries/Frameworks for the Qt frameworks. So either we can add
    a #{CMAKE_INSTALL_PREFIX}/lib to the properties here, or fix that in
    the deploy script. For now, I'm doing the latter and running
    macdeployqt like this:
    
    rm -rf ~/kf5/krita.app/
    rm -rf ~/kf5/krita.dmg
    cp -r ~/kf5/i/bin/krita.app ~/kf5
    cp -r ~/kf5/i/share ~/kf5/krita.app/Contents/
    mkdir -p ~/kf5/krita.app/Contents/PlugIns/krita
    install_name_tool -add_rpath /Users/boudewijnrempt/kf5/i/lib ~/kf5/krita.app/Contents/MacOS/krita
    macdeployqt ~/kf5/krita.app \
        -verbose=0 \
        -executable=/Users/boudewijnrempt/kf5/krita.app/Contents/MacOS/krita \
        -extra-plugins=/Users/boudewijnrempt/kf5/i/lib/krita/ \
        -extra-plugins=/Users/boudewijnrempt/kf5/i/lib/plugins/ \
        -extra-plugins=/Users/boudewijnrempt/kf5/i/plugins/
    mv ~/kf5/krita.app/Contents/PlugIns/*so ~/kf5/krita.app/Contents/PlugIns/krita
    install_name_tool -delete_rpath  @loader_path/../../../../lib ~/kf5/krita.app/Contents/MacOS/krita
    install_name_tool -delete_rpath  /Users/boudewijnrempt/kf5/i/lib ~/kf5/krita.app/Contents/MacOS/krita
    0d3288ca