2008-12-29 05:43:17 +01:00
|
|
|
#!/bin/sh
|
2008-12-29 02:13:55 +01:00
|
|
|
|
2012-05-14 15:21:27 +02:00
|
|
|
set -e
|
|
|
|
|
2020-11-08 18:33:37 +01:00
|
|
|
SRC_DIR="${1}"
|
|
|
|
BUILD_DIR="${2}"
|
2021-10-12 09:37:49 +02:00
|
|
|
WX_PREFIX=""
|
2020-11-08 18:33:37 +01:00
|
|
|
FONTCONFIG_CONF_DIR="${4}"
|
|
|
|
DICT_DIR="${5}"
|
|
|
|
MESON_BUILD_OSX_BUNDLE="${6}"
|
|
|
|
|
|
|
|
if [ "${MESON_BUILD_OSX_BUNDLE}" != "TRUE" ]; then
|
|
|
|
echo "Project not built with \`build_osx_bundle\`"
|
|
|
|
echo "Please run \`meson configure -Dbuild_osx_bundle=true\` and rebuild"
|
2012-05-14 15:22:09 +02:00
|
|
|
exit 1
|
2008-12-29 05:41:00 +01:00
|
|
|
fi
|
2008-12-29 02:13:55 +01:00
|
|
|
|
2020-11-08 18:33:37 +01:00
|
|
|
PKG_DIR="${BUILD_DIR}/Aegisub.app"
|
|
|
|
SKEL_DIR="${SRC_DIR}/packages/osx_bundle"
|
|
|
|
|
2009-06-02 02:16:45 +02:00
|
|
|
if test -d "${PKG_DIR}"; then
|
2012-05-14 15:22:04 +02:00
|
|
|
rm -rf "${PKG_DIR}"
|
2020-11-08 18:33:37 +01:00
|
|
|
echo "Removing old Aegisub.app"
|
2008-12-30 07:44:04 +01:00
|
|
|
fi
|
2008-12-29 02:13:55 +01:00
|
|
|
|
2008-12-29 05:41:00 +01:00
|
|
|
echo
|
|
|
|
echo "---- Directory Structure ----"
|
2009-06-02 02:16:45 +02:00
|
|
|
mkdir -v "${PKG_DIR}"
|
|
|
|
mkdir -v "${PKG_DIR}/Contents"
|
|
|
|
mkdir -v "${PKG_DIR}/Contents/MacOS"
|
|
|
|
mkdir -v "${PKG_DIR}/Contents/Resources"
|
|
|
|
mkdir -v "${PKG_DIR}/Contents/SharedSupport"
|
|
|
|
mkdir -v "${PKG_DIR}/Contents/SharedSupport/dictionaries"
|
2008-12-29 02:13:55 +01:00
|
|
|
|
2008-12-29 05:41:00 +01:00
|
|
|
echo
|
|
|
|
echo "---- Copying Skel Files ----"
|
2020-11-08 18:33:37 +01:00
|
|
|
if ! test -f "${BUILD_DIR}/osx-bundle.sed"; then
|
2010-12-11 02:32:59 +01:00
|
|
|
echo
|
2020-11-08 18:33:37 +01:00
|
|
|
echo "NOT FOUND: ${BUILD_DIR}/osx-bundle.sed"
|
2012-05-14 15:22:09 +02:00
|
|
|
exit 1
|
2010-12-11 02:32:59 +01:00
|
|
|
fi
|
|
|
|
|
2014-06-17 03:22:06 +02:00
|
|
|
# used by osx-bundle.sed
|
2020-11-08 18:33:37 +01:00
|
|
|
find "${SRC_DIR}/po" -name *.po | sed 's/.*\/\(.*\)\.po/ <string>\1<\/string>/; s/RS/YU/' > "${BUILD_DIR}/languages"
|
2012-05-24 03:53:56 +02:00
|
|
|
|
2020-11-08 18:33:37 +01:00
|
|
|
#find "${SKEL_DIR}" -type f -not -regex ".*.svn.*"
|
|
|
|
cp -v ${SKEL_DIR}/Contents/Resources/*.icns "${PKG_DIR}/Contents/Resources"
|
|
|
|
cat "${SKEL_DIR}/Contents/Info.plist" | sed -f "${BUILD_DIR}/osx-bundle.sed" > "${PKG_DIR}/Contents/Info.plist"
|
2008-12-29 02:13:55 +01:00
|
|
|
|
2020-11-08 18:33:37 +01:00
|
|
|
rm "${BUILD_DIR}/languages"
|
2009-02-18 07:00:17 +01:00
|
|
|
|
2014-06-17 03:22:06 +02:00
|
|
|
echo
|
|
|
|
echo "---- Installing files ----"
|
2020-11-08 18:33:37 +01:00
|
|
|
CURRENT_DIR=`pwd`
|
|
|
|
cd ${BUILD_DIR}
|
|
|
|
ninja install
|
|
|
|
cd ${CURRENT_DIR}
|
2014-06-17 03:22:06 +02:00
|
|
|
|
2009-02-18 07:00:17 +01:00
|
|
|
echo
|
|
|
|
echo "---- Copying dictionaries ----"
|
2020-11-08 18:33:37 +01:00
|
|
|
if test -f "${DICT_DIR}"; then
|
|
|
|
cp -v "${DICT_DIR}/*" "${PKG_DIR}/Contents/SharedSupport/dictionaries"
|
2009-02-18 07:00:17 +01:00
|
|
|
else
|
2023-09-12 14:57:42 +02:00
|
|
|
mkdir -p "${BUILD_DIR}/dictionaries"
|
|
|
|
if ! test -f "${BUILD_DIR}/dictionaries/en_US.aff"; then
|
|
|
|
echo "Specified dictionary directory ${DICT_DIR} not found. Downloading dictionaries:"
|
|
|
|
curl -L "https://downloads.sourceforge.net/project/openofficeorg.mirror/contrib/dictionaries/en_US.zip" -o "${BUILD_DIR}/dictionaries/en_US.zip"
|
|
|
|
unzip "${BUILD_DIR}/dictionaries/en_US.zip" -d "${BUILD_DIR}/dictionaries"
|
|
|
|
fi
|
2023-03-23 15:42:16 +01:00
|
|
|
cp -v "${BUILD_DIR}/dictionaries/en_US.aff" "${PKG_DIR}/Contents/SharedSupport/dictionaries"
|
|
|
|
cp -v "${BUILD_DIR}/dictionaries/en_US.dic" "${PKG_DIR}/Contents/SharedSupport/dictionaries"
|
2009-02-18 07:00:17 +01:00
|
|
|
fi
|
|
|
|
|
2009-01-04 11:04:32 +01:00
|
|
|
echo
|
2010-01-21 01:37:04 +01:00
|
|
|
echo "---- Copying Aegisub locale files ----"
|
2009-01-04 11:53:54 +01:00
|
|
|
# Let Aqua know that aegisub supports english. English strings are
|
|
|
|
# internal so we don't need an aegisub.mo file.
|
2010-01-21 01:37:04 +01:00
|
|
|
mkdir -vp "${PKG_DIR}/Contents/Resources/en.lproj"
|
2009-01-04 11:53:54 +01:00
|
|
|
|
2020-11-08 18:33:37 +01:00
|
|
|
# FIXME
|
2014-06-17 03:22:06 +02:00
|
|
|
# 10.8 wants sr_YU rather than sr_RS
|
2020-11-08 18:33:37 +01:00
|
|
|
#mv "${PKG_DIR}/Contents/Resources/sr_RS.lproj" "${PKG_DIR}/Contents/Resources/sr_YU.lproj"
|
|
|
|
#mv "${PKG_DIR}/Contents/Resources/sr_RS@latin.lproj" "${PKG_DIR}/Contents/Resources/sr_YU@latin.lproj"
|
2010-01-21 01:37:04 +01:00
|
|
|
|
2021-10-12 09:37:49 +02:00
|
|
|
## TODO: rm those lines
|
|
|
|
## xref: [Update and review translations · Issue #132 · TypesettingTools/Aegisub](https://github.com/TypesettingTools/Aegisub/issues/132)
|
|
|
|
# echo
|
|
|
|
# echo "---- Copying WX locale files ----"
|
|
|
|
#
|
|
|
|
# for i in `ls -1 ${SRC_DIR}/po/*.mo|sed "s|po/\(.*\).mo|\1|"`; do
|
|
|
|
# WX_MO="${WX_PREFIX}/share/locale/${i}/LC_MESSAGES/wxstd.mo"
|
|
|
|
#
|
|
|
|
# if ! test -f "${WX_MO}"; then
|
|
|
|
# WX_MO="${HOME_DIR}/wxstd/${i}.mo"
|
|
|
|
# fi
|
|
|
|
#
|
|
|
|
# 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
|
2010-01-21 01:37:04 +01:00
|
|
|
|
2008-12-29 05:41:00 +01:00
|
|
|
echo
|
2020-11-08 18:33:37 +01:00
|
|
|
echo "---- Fixing libraries ----"
|
2021-10-12 09:37:49 +02:00
|
|
|
sudo python3 "${SRC_DIR}/tools/osx-fix-libs.py" "${PKG_DIR}/Contents/MacOS/aegisub" || exit $?
|
2008-12-29 05:41:00 +01:00
|
|
|
|
|
|
|
echo
|
2020-11-08 18:33:37 +01:00
|
|
|
echo "Done creating \"${PKG_DIR}\""
|