Changeset 885

Show
Ignore:
Timestamp:
07/11/07 09:14:47 (1 year ago)
Author:
ok_computer
Message:

OS X: Adding more flexibility to app creation script.

Location:
trunk/installer/osx
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/installer/osx/create_app

    r862 r885  
    1818# 
    1919# dylibs="space separated list of dylibs" 
     20# frameworks="space separated list of frameworks" 
    2021# theme_dylibs="space separated list of theme dylibs" 
     22# olib_names="space separated list of olib directories to copy e.g. openpluginlib etc 
     23# open*lib_plugins="space separated list of openimagelib, etc plugins" 
     24# python_modules="space separated list of python modules to copy" 
     25# 
     26# For all above an empty string means use the default list. Or "_NONE_" means copy none. 
    2127 
    2228if [ $# -lt 2 ] ; then 
    23    echo "Usage: create_app --prefer-ppc --gpl --py_ver=<python_ver> --jahwidgets_dir=<jahwidgets> --olib_prefix=<olib_prefix> --olib_ver=<olib_ver> --lib_prefix=<lib_prefix> --qt_prefix=<qt_prefix> script --theme=<theme.dylib> --bundle_version=bundle_ver" 
     29   echo "Usage: create_app --prefer-ppc --gpl --py_ver=<python_ver> --jahwidgets_dir=<jahwidgets> --olib_prefix=<olib_prefix> --olib_ver=<olib_ver> --olib_names=<openlibnamelist> --lib_prefix=<lib_prefix> --qt_prefix=<qt_prefix> script --theme=<theme.dylib> --bundle_version=bundle_ver" 
    2430   echo 
    2531   echo "By default create_app will read from a config file, either ca_config in pwd or .ca_config in ~" 
     
    3238script_root=${0%/*} 
    3339 
     40# defaults - all can be overridden in ca_config 
    3441enable_gpl=0 
     42 
     43dylibs="" 
     44frameworks="" 
     45theme_dylibs="" 
     46 
     47# olib lib names to copy e.g. openpluginlib etc 
     48# default is all 
     49olib_names="" 
     50python_modules="" 
     51 
     52# plugins to copy. Default is all 
     53openassetlib_plugins="" 
     54openeffectslib_plugins="" 
     55openimagelib_plugins="" 
     56openmedialib_plugins="" 
     57openobjectlib_plugins="" 
    3558 
    3659# Get config 
     
    6083        ;; 
    6184 
     85    --olib_names*) 
     86        olib_names=${1##*=} 
     87        ;; 
     88 
    6289    --lib_prefix*) 
    6390        lib_prefix=${1##*=} 
     
    158185 
    159186# We have to exclude all our own python modules because py2app can't handle them 
    160 python setup.py py2app $prefer_ppc --excludes openpluginlib,openmedialib,openassetlib,openimagelib,jahwidgets 
     187python setup.py py2app $prefer_ppc --excludes openpluginlib,openmedialib,openassetlib,openimagelib,jahwidgets,$excludes 
    161188 
    162189bundle="$py_script_root/dist/$app_name.app" 
     
    214241 
    215242for dylib in $dylibs ; do 
    216     echo "cp $dylib" 
    217     # Don't use cp -R here because we want to copy the target, not the symlink 
    218     cp "$dylib" "$bundle/Contents/Frameworks" 
     243    if [ -e $dylib ] ; then 
     244        echo "cp $dylib" 
     245        # Don't use cp -R here because we want to copy the target, not the symlink 
     246        cp "$dylib" "$bundle/Contents/Frameworks" 
     247    else 
     248        echo "Unable to find dylib: $dylib" 
     249        exit 1 
     250    fi 
    219251done 
     252 
     253# Frameworks 
     254if [ "$frameworks" == "" ] ; then 
     255    # default set 
     256    frameworks="Cg" 
     257fi 
     258 
     259if [ "$frameworks" != "_NONE_" ] ; then 
     260    for name in $frameworks ; do 
     261        framework="/Library/Frameworks/${name}.framework" 
     262        if [ -d $framework ] ; then 
     263            cp -R $framework "$bundle/Contents/Frameworks/" 
     264            dep_dylibs="$dep_dylibs "`$fixup_install_names_cmd "$bundle/Contents/Frameworks/${name}.framework/$name"` 
     265        else 
     266            echo "Unable to find framework: $name" 
     267            exit 1 
     268        fi 
     269    done 
     270fi 
    220271 
    221272# Olibs - drop the 'openlibraries-X.X.X' prefix in the destination so scripts don't need to worry about it 
    222273echo "cp $olib_src_path" 
    223 cp -R "$olib_src_path"/open* "$bundle/Contents/Frameworks/" 
     274if [ "$olib_names" != "" ] ; then 
     275    # Custom list 
     276    for olib in $olib_names ; do 
     277        cp -R $olib_src_path/$olib "$bundle/Contents/Frameworks/" 
     278    done 
     279else 
     280    # Copy it all 
     281    cp -R "$olib_src_path"/open* "$bundle/Contents/Frameworks/" 
     282fi 
    224283 
    225284# Remove python dylibs, these are copied later into the correct python location 
     
    227286find "$bundle/Contents/Frameworks" -name "*_py.*" -print0 | xargs -0 rm > /dev/null 
    228287 
     288# If any olib plugins have been specified remove existing and re-copy 
     289copy_custom_olib_plugins()  
     290{ 
     291    base=$1 
     292    plugins=$2 
     293 
     294    if [ "$plugins" == "" ] ; then 
     295        return 
     296    fi 
     297 
     298    dest_plugin_dir="$bundle/Contents/Frameworks/$base/plugins" 
     299 
     300    if [ -d $dest_plugin_dir ] ; then 
     301        rm -f $dest_plugin_dir/* 
     302    fi 
     303 
     304    if [ "$plugins" == "_NONE_" ] ; then 
     305        return 
     306    fi 
     307     
     308    echo "Copying $base plugins..." 
     309 
     310    # Else copy new ones 
     311    src_plugin_dir="$olib_src_path/$base/plugins" 
     312    for name in $plugins ; do 
     313        # -R presevers symlinks 
     314        cp -R $src_plugin_dir/lib${base}_${name}*.dylib "$dest_plugin_dir" 
     315        cp $src_plugin_dir/${name}_plugin.opl "$dest_plugin_dir" 
     316    done 
     317} 
     318 
     319copy_custom_olib_plugins "openassetlib" "$openassetlib_plugins" 
     320copy_custom_olib_plugins "openeffectslib" "$openeffectslib_plugins" 
     321copy_custom_olib_plugins "openimagelib" "$openimagelib_plugins" 
     322copy_custom_olib_plugins "openmedialib" "$openmedialib_plugins" 
     323copy_custom_olib_plugins "openobjectlib" "$openobjectlib_plugins" 
     324 
    229325# Fixup install names 
    230326bundle_dylibs=`find "$bundle/Contents/Frameworks" -name "*.dylib"` 
    231327dep_dylibs=`$fixup_install_names_cmd $bundle_dylibs` 
    232  
    233 # Cg Framework 
    234 if [ -e /Library/Frameworks/Cg.framework ] ; then 
    235     cp -R /Library/Frameworks/Cg.framework "$bundle/Contents/Frameworks" 
    236     dep_dylibs="$dep_dylibs "`$fixup_install_names_cmd "$bundle/Contents/Frameworks/Cg.framework/Cg"` 
    237 else 
    238     echo "Error: Unable to find Cg.framework" 
    239     exit -1 
    240 fi 
    241328 
    242329# libthemes must go in Contents/PlugIns/style 
     
    283370fi 
    284371 
    285 modules="$jahwidgets_dir/src/qt3/python/jahwidgets.so \ 
     372if [ "$python_modules" == "" ] ; then 
     373    python_modules="$jahwidgets_dir/src/qt3/python/jahwidgets.so \ 
    286374$olib_sitepackages/openassetlib.so \ 
    287375$olib_sitepackages/openimagelib.so \ 
    288376$olib_sitepackages/openmedialib.so \ 
    289377$olib_sitepackages/openpluginlib.so" 
    290  
    291 for module in $modules ; do 
    292     cp "$module" "$module_dest" 
     378fi 
     379 
     380for module in $python_modules ; do 
     381    if [ -e $module ] ; then 
     382        cp $module "$module_dest" 
     383    else 
     384        echo "Unable to copy module: $module" 
     385        exit 1 
     386    fi 
    293387done 
    294388 
  • trunk/installer/osx/create_dmg

    r701 r885  
    2323fi 
    2424 
    25 hdiutil convert tmp.dmg -format UDZO -imagekey zlib_level=9 -o "$dmg" 
     25# Bzip2 compression only works on 10.4 or later 
     26hdiutil convert tmp.dmg -format UDBZ -o "$dmg" 
     27# Use Gzip compression otherwise 
     28#hdiutil convert tmp.dmg -format UDZO -imagekey zlib_level=9 -o "$dmg" 
     29 
    2630rm tmp.dmg 
    2731 
  • trunk/installer/osx/fixup_install_names

    r714 r885  
    22 
    33if [ $# -eq 0 ] ; then 
    4    echo "Usage: fixup_install_names --check --custom_prefix <prefix1> --custom_prefix <prefix2> <dylib-files>" 
     4   echo "Usage: fixup_install_names --check --custom-prefix <prefix1> --custom-prefix <prefix2> <dylib-files>" 
    55   echo "--check just outputs warning if any old prefix is found" 
    66   exit 
     
    1111/usr/local/lib/ \ 
    1212/usr/local/qt/lib/ \ 
     13/opt/local/qt/lib/ \ 
    1314/Library/Frameworks/ \ 
    1415/opt/local/Library/Frameworks/ \