From 4a42ab14036010c201d0e2580a17d509a87cd97b Mon Sep 17 00:00:00 2001 From: Amar Takhar Date: Thu, 21 Jan 2010 00:37:04 +0000 Subject: [PATCH] merge r4011,r4012 (Switch from Mac::Finder::DSStore to using AppleScript) Originally committed to SVN as r4025. --- aegisub/packages/osx_dmg/DS_Store | Bin 0 -> 12292 bytes .../osx_dmg/dmg_set_style.applescript | 12 ++-- aegisub/tools/osx-bundle.sed.in | 2 + aegisub/tools/osx-bundle.sh | 37 ++++++++--- aegisub/tools/osx-dmg-dsstore.pl | 19 ------ aegisub/tools/osx-dmg.sh | 59 +++++++++++++----- 6 files changed, 80 insertions(+), 49 deletions(-) create mode 100644 aegisub/packages/osx_dmg/DS_Store delete mode 100755 aegisub/tools/osx-dmg-dsstore.pl diff --git a/aegisub/packages/osx_dmg/DS_Store b/aegisub/packages/osx_dmg/DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a6cfb307bc03238ecdbba001afe7c334578c3c5a GIT binary patch literal 12292 zcmeHL+iDX*82+cN*qSyyB!z-dwt~>2?6y^~j^7 zB7>$+k#bpk%77WU0u->P*hO#jvDYZ|=<)zFzzi@0%m6dM4E!4m;LMg~_!sBCmU7Ds zFa!T319E?`P$d=(wl%7)1C6=@0EaNF3i=bW1GEel4YoBxf+DmjP@4*K#Sq#Y9fFJp9ddY<{2+jhP*)GfElzG>+UQ z!Nc+X$7#qXO@9)7y&>i>|HZ!3FLZe+oH|q!&(bVq$)z%Rv`ZCAkijNJV9usGutMW> zlcs5v0`x;lA$7^3WyqIMSJ0owctj0oRB3^x=&I8d&^Z^7ay08~#?@vmNS(gZrM!3} z89)m@Mz-Q+VwK8iAji&@qkZue86kRq@HT6FZ6|xSU;BfMd^mWHj9l}BR^t2VuFlAa zbv7bhF6#wivT^kK+ZSkbvN46eJdQ9Q)K@fq`7@1e9pX7|ojgY2X&NMHp%o;xLK0L1 zJXygwEu4P_ot?AXZzD&0VBV*i%1)j}XiH@+K`u(jWQt5o(SnNO$T*IPf~tsIkmBE;+>O8eM- z@3NDxss&#Xiw4^oF@nP9zoLN~X5hjY7}SwxpG59S5F# "${PKG_DIR}/Contents/Resources/etc/fonts/fonts.conf" +cat ${SKEL_DIR}/Contents/Resources/etc/fonts/fonts.conf |sed -f scripts/osx-bundle.sed > "${PKG_DIR}/Contents/Resources/etc/fonts/fonts.conf" cp ${SKEL_DIR}/Contents/Resources/etc/fonts/conf.d/*.conf "${PKG_DIR}/Contents/Resources/etc/fonts/conf.d" -cat ${SKEL_DIR}/Contents/Info.plist |sed -f tools/osx-bundle.sed > "${PKG_DIR}/Contents/Info.plist" +cat ${SKEL_DIR}/Contents/Info.plist |sed -f scripts/osx-bundle.sed > "${PKG_DIR}/Contents/Info.plist" echo @@ -50,7 +52,7 @@ if test -z "${DICT_DIR}"; then fi if test -d "${DICT_DIR}"; then - cp -v "${DICT_DIR}/*" "${PKG_DIR}/Contents/SharedSupport/dictionaries" + cp -v ${DICT_DIR}/* "${PKG_DIR}/Contents/SharedSupport/dictionaries" else echo "WARNING: Dictionaries not found, please set $$DICT_DIR to a directiory" echo " where the *.aff and *.dic files can be found" @@ -67,21 +69,37 @@ cd "${SRCDIR}" echo -echo "---- Copying locale files ----" +echo "---- Copying Aegisub locale files ----" # Let Aqua know that aegisub supports english. English strings are # internal so we don't need an aegisub.mo file. -mkdir -v "${PKG_DIR}/Contents/Resources/en.lproj" +mkdir -vp "${PKG_DIR}/Contents/Resources/en.lproj" for i in `cat po/LINGUAS`; do if test -f "po/${i}.gmo"; then - mkdir -v "${PKG_DIR}/Contents/Resources/${i}.lproj"; + mkdir -p "${PKG_DIR}/Contents/Resources/${i}.lproj"; cp -v po/${i}.gmo "${PKG_DIR}/Contents/Resources/${i}.lproj/aegisub.mo"; else echo "${i}.gmo not found!" exit 1 - fi + fi; done + +echo +echo "---- Copying WX locale files ----" + +for i in `cat po/LINGUAS`; do +# WX_MO="${WX_PREFIX}/share/locale/${i}/LC_MESSAGES/wxstd.mo" + WX_MO="${HOME_DIR}/wxstd/${i}.mo" + + if test -f "${WX_MO}"; then + cp -v "${WX_MO}" "${PKG_DIR}/Contents/Resources/${i}.lproj/"; + else + echo "WARNING: \"$i\" locale in aegisub but no WX catalog found!"; + fi; +done + + echo echo "---- Binaries ----" @@ -98,11 +116,12 @@ else cp -v src/.libs/${AEGISUB_BIN} "${PKG_DIR}/Contents/MacOS/aegisub" || exit $? fi -cp -v tools/osx-bundle-restart-helper "${PKG_DIR}/Contents/MacOS/restart-helper" || exit $? +echo cc -o "${PKG_DIR}/Contents/MacOS/restart-helper scripts/osx-bundle-restart-helper.c" +${CC} -o "${PKG_DIR}/Contents/MacOS/restart-helper" scripts/osx-bundle-restart-helper.c || exit $? echo echo "---- Libraries ----" -python tools/osx-fix-libs.py "${PKG_DIR}/Contents/MacOS/aegisub" || exit $? +python scripts/osx-fix-libs.py "${PKG_DIR}/Contents/MacOS/aegisub" || exit $? echo echo "Done Creating \"${PKG_DIR}\"" diff --git a/aegisub/tools/osx-dmg-dsstore.pl b/aegisub/tools/osx-dmg-dsstore.pl deleted file mode 100755 index fab245010..000000000 --- a/aegisub/tools/osx-dmg-dsstore.pl +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/perl -w - -use Mac::Finder::DSStore qw( writeDSDBEntries makeEntries ); -use Mac::Memory qw( ); -use Mac::Files qw( NewAliasMinimal ); - -&writeDSDBEntries("$ARGV[0]", - &makeEntries(".", - BKGD_alias => NewAliasMinimal("$ARGV[2]"), - ICVO => 1, - fwi0_flds => [ 308, 397, 658, 848, "icnv", 0, 0 ], - fwvh => 350, - icgo => "\0\0\0\0\0\0\0\0", - icvo => pack('A4 n A4 A4 n*', "icv4", 90, "none", "botm", 0, 0, 0, 0, 0, 1, 0, 100, 1), - icvt => 12 - ), - &makeEntries("Applications", Iloc_xy => [ 133, 250 ]), - &makeEntries("$ARGV[1]", Iloc_xy => [ 133, 55 ]) -); diff --git a/aegisub/tools/osx-dmg.sh b/aegisub/tools/osx-dmg.sh index 2a17d0e2e..f74a0111a 100755 --- a/aegisub/tools/osx-dmg.sh +++ b/aegisub/tools/osx-dmg.sh @@ -1,14 +1,17 @@ #!/bin/sh -# USAGE -# osx-dmg.sh [Bundle Directory] "[Package Name]" +# USAGE: osx-dmg.sh [Bundle Directory] "[Package Name]" # +# Amar Takhar +# +# ------------------------------------------------------------------------------------- # This script is based on osx-dmg.sh from the Inkscape Project http://www.inkscape.org/ # # Jean-Olivier Irisson # Michael Wybrow # -# Copyright (C) 2006-2007 -# Released under GNU GPL, read the file 'COPYING' for more information +# Copyright (C) 2006-2010 +# Released under GNU GPL, read the file 'COPYING' from the Inkscape project for more +# information. TMP_DMG="temp_dmg" PKG_DIR="${1}.app" @@ -21,13 +24,6 @@ if ! test -d "${PKG_DIR}"; then exit 1; fi -if ! /usr/bin/perl -e 'require Mac::Finder::DSStore' > /dev/null 2>&1; then - echo - echo "Perl Mac::Finder::DSStore is required to build a dmg." - echo "Please get it from http://freehg.org/u/wiml/dsstore/" - exit 1; -fi - rm -rf "${TMP_DMG}" "${PKG_NAME}.dmg" mkdir -v "${TMP_DMG}" echo @@ -41,10 +37,6 @@ mkdir -v "${TMP_DMG}/.background" cp -v packages/osx_dmg/dmg_background.png "${TMP_DMG}/.background/background.png" cp -v packages/osx_bundle/Contents/Resources/Aegisub.icns "${TMP_DMG}/.VolumeIcon.icns" -echo -echo "--- Generating /Volumes/${PKG_NAME_VOLUME}/.DS_Store ----" -#/usr/bin/perl tools/osx-dmg-dsstore.pl "${TMP_DMG}/.DS_Store" "${PKG_DIR}" "${TMP_DMG}/.background/background.png" || exit $? - echo echo "---- Creating image ----" /usr/bin/hdiutil create -srcfolder "${TMP_DMG}" -volname "${PKG_NAME}" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW "${PKG_NAME_RW}" || exit $? @@ -62,6 +54,43 @@ echo echo "---- Setting root icon using SetFile ----" SetFile -a C "/Volumes/${PKG_NAME_VOLUME}" || exit $? +echo +if test -n "${SET_STYLE}"; then + echo "---- Running AppleScript to set style ----" + SCRIPT_TMP=`mktemp /tmp/aegisub_dmg_as.XXX` + + sed -f scripts/osx-bundle.sed packages/osx_dmg/dmg_set_style.applescript > ${SCRIPT_TMP} + + /usr/bin/osacompile -o ${SCRIPT_TMP}.scpt ${SCRIPT_TMP} + + /usr/bin/osascript ${SCRIPT_TMP}.scpt + open "/Volumes/${PKG_NAME_VOLUME}" + + echo "********************************************************" + echo "Please move the window to the center of the screen then" + echo "close it." + echo "********************************************************" + echo + echo "PRESS ENTER WHEN DONE" + open "/Volumes/${PKG_NAME_VOLUME}" + read -e DUMB + + hdiutil detach "${DEV_NAME}" + + DEV_NAME=`/usr/bin/hdiutil attach -readwrite -noverify -noautoopen "${PKG_NAME_RW}" |awk '/Apple_partition_scheme/ {print $1}'` || exit $? + echo "Device name: ${DEV_NAME}" + + cp -v "/Volumes/${PKG_NAME_VOLUME}/.DS_Store" packages/osx_dmg/DS_Store + SetFile -a v packages/osx_dmg/DS_Store + hdiutil detach "${DEV_NAME}" + + rm -rf "${TMP_DMG}" "${PKG_NAME_RW}" ${SCRIPT_TMP}.scpt ${SCRIPT_TMP} + exit 0 +else + echo "---- Installing DS_Store ----" + cp -v packages/osx_dmg/DS_Store "/Volumes/${PKG_NAME_VOLUME}/.DS_Store" +fi + echo echo "---- Detaching ----" /usr/bin/hdiutil detach "${DEV_NAME}" -force || exit $?