spek

Acoustic spectrum analyser https://github.com/alexkay/spek spek.cc
git clone http://git.hanabi.in/repos/spek.git
Log | Files | Refs | README

bundle.sh (2862B)


      1 #!/bin/sh
      2 
      3 LANGUAGES="ca cs da de el eo es fi fr gl it ja lv nb nl pl pt_BR ru sk sr@latin sv tr uk vi zh_CN zh_TW"
      4 
      5 cd $(dirname $0)/../..
      6 
      7 rm -f src/spek
      8 
      9 ./autogen.sh && make -j8 || exit 1
     10 
     11 cd dist/osx
     12 rm -fr Spek.app
     13 mkdir -p Spek.app/Contents/MacOS
     14 mkdir -p Spek.app/Contents/Frameworks
     15 mkdir -p Spek.app/Contents/Resources
     16 mv ../../src/spek Spek.app/Contents/MacOS/Spek
     17 cp Info.plist Spek.app/Contents/
     18 cp Spek.icns Spek.app/Contents/Resources/
     19 cp *.png Spek.app/Contents/Resources/
     20 cp ../../LICENCE.md Spek.app/Contents/Resources/
     21 cp ../../README.md Spek.app/Contents/Resources/
     22 mkdir Spek.app/Contents/Resources/lic
     23 cp ../../lic/* Spek.app/Contents/Resources/lic/
     24 
     25 for lang in $LANGUAGES; do
     26     mkdir -p Spek.app/Contents/Resources/"$lang".lproj
     27     cp -v ../../po/"$lang".gmo Spek.app/Contents/Resources/"$lang".lproj/spek.mo
     28     cp -v /usr/local/share/locale/"$lang"/LC_MESSAGES/wxstd.mo Spek.app/Contents/Resources/"$lang".lproj/
     29 done
     30 mkdir -p Spek.app/Contents/Resources/en.lproj
     31 
     32 BINS="Spek.app/Contents/MacOS/Spek"
     33 while [ ! -z "$BINS" ]; do
     34     NEWBINS=""
     35     for bin in $BINS; do
     36         echo "Updating dependendies for $bin."
     37         LIBS=$(otool -L $bin | grep /usr/local | tr -d '\t' | awk '{print $1}')
     38         for lib in $LIBS; do
     39             reallib=$(realpath $lib)
     40             libname=$(basename $reallib)
     41             install_name_tool -change $lib @executable_path/../Frameworks/$libname $bin
     42             if [ ! -f Spek.app/Contents/Frameworks/$libname ]; then
     43                 echo "\tBundling $reallib."
     44                 cp $reallib Spek.app/Contents/Frameworks/
     45                 chmod +w Spek.app/Contents/Frameworks/$libname
     46                 install_name_tool -id @executable_path/../Frameworks/$libname Spek.app/Contents/Frameworks/$libname
     47                 NEWBINS="$NEWBINS Spek.app/Contents/Frameworks/$libname"
     48             fi
     49         done
     50     done
     51     BINS="$NEWBINS"
     52 done
     53 
     54 # Make DMG image
     55 VOLUME_NAME=Spek
     56 DMG_APP=Spek.app
     57 DMG_FILE=$VOLUME_NAME.dmg
     58 MOUNT_POINT=$VOLUME_NAME.mounted
     59 
     60 rm -f $DMG_FILE
     61 rm -f $DMG_FILE.master
     62 
     63 # Compute an approximated image size in MB, and bloat by 1MB
     64 image_size=$(du -ck $DMG_APP | tail -n1 | cut -f1)
     65 image_size=$((($image_size + 5000) / 1000))
     66 
     67 echo "Creating disk image (${image_size}MB)..."
     68 hdiutil create $DMG_FILE -megabytes $image_size -volname $VOLUME_NAME -fs HFS+ -quiet || exit $?
     69 
     70 echo "Attaching to disk image..."
     71 hdiutil attach $DMG_FILE -readwrite -noautoopen -mountpoint $MOUNT_POINT -quiet
     72 
     73 echo "Populating image..."
     74 cp -Rp $DMG_APP $MOUNT_POINT
     75 cd $MOUNT_POINT
     76 ln -s /Applications " "
     77 cd ..
     78 cp DS_Store $MOUNT_POINT/.DS_Store
     79 
     80 echo "Detaching from disk image..."
     81 hdiutil detach $MOUNT_POINT -quiet
     82 mv $DMG_FILE $DMG_FILE.master
     83 
     84 echo "Creating distributable image..."
     85 hdiutil convert -quiet -format UDBZ -o $DMG_FILE $DMG_FILE.master
     86 rm $DMG_FILE.master
     87 
     88 echo "Done."
     89 
     90 cd ../..