merge r4011,r4012 (Switch from Mac::Finder::DSStore to using AppleScript)

Originally committed to SVN as r4025.
This commit is contained in:
Amar Takhar 2010-01-21 00:37:04 +00:00
parent e247dec1f3
commit 4a42ab1403
6 changed files with 80 additions and 49 deletions

Binary file not shown.

View file

@ -11,13 +11,13 @@ disk image in which Inkscape is bundled on MacOS X
tell application "Finder"
tell disk "@PKG_NAME_VOLUME@"
tell disk "@PKG_DMG_STRING@"
open
tell container window
set current view to icon view
set toolbar visible to false
set statusbar visible to false
set the bounds to {250, 250, 700, 600}
set the bounds to {308, 397, 725, 731}
end tell
close
set opts to the icon view options of container window
@ -26,12 +26,12 @@ tell application "Finder"
set arrangement to not arranged
end tell
set background picture of opts to file ".background:background.png"
set position of application file "@PKG_DIR@" to {133, 55}
set position of alias file "Applications" to {133, 250}
set position of application file "@PKG_BUNDLE_STRING@" to {133, 55}
set position of alias file "Applications" to {133, 241}
update without registering applications
tell container window
set the bounds to {250, 250, 700, 600}
set the bounds to {249, 250, 700, 600}
set the bounds to {308, 397, 725, 731}
set the bounds to {307, 397, 725, 731}
end tell
update without registering applications
end tell

View file

@ -2,3 +2,5 @@ s/@PLIST_VERSION@/@VERSION@/g
s/@PLIST_SVN_REVISION@/@SVN_REVISION@/g
s/@PLIST_BUILD_DATE@/@BUILD_DATE@/g
s/@FONTCONFIG_VERSION_DATA@/@AEGISUB_VERSION_DATA@/g
s/@PKG_DMG_STRING@/@DMG_STRING@/
s/@PKG_BUNDLE_STRING@/@BUNDLE_STRING@/

View file

@ -6,6 +6,8 @@ AEGISUB_VERSION_DATA="${2}"
AEGISUB_BIN="aegisub-${AEGISUB_VERSION_DATA}"
SRCDIR=`pwd`
HOME_DIR=`echo ~`
WX_CONFIG="wx-config"
WX_PREFIX=`${WX_CONFIG} --prefix`
if test -z "${CC}"; then
CC="cc"
@ -38,9 +40,9 @@ echo "---- Copying Skel Files ----"
find ${SKEL_DIR} -type f -not -regex ".*.svn.*"
cp ${SKEL_DIR}/Contents/Resources/*.icns "${PKG_DIR}/Contents/Resources"
cp ${SKEL_DIR}/Contents/Resources/etc/fonts/fonts.dtd "${PKG_DIR}/Contents/Resources/etc/fonts"
cat ${SKEL_DIR}/Contents/Resources/etc/fonts/fonts.conf |sed -f tools/osx-bundle.sed > "${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}\""

View file

@ -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 ])
);

View file

@ -1,14 +1,17 @@
#!/bin/sh
# USAGE
# osx-dmg.sh [Bundle Directory] "[Package Name]"
# USAGE: osx-dmg.sh [Bundle Directory] "[Package Name]"
#
# Amar Takhar <verm@aegisub.org>
#
# -------------------------------------------------------------------------------------
# This script is based on osx-dmg.sh from the Inkscape Project http://www.inkscape.org/
#
# Jean-Olivier Irisson <jo.irisson@gmail.com>
# Michael Wybrow <mjwybrow@users.sourceforge.net>
#
# 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 $?