# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
homepage http://mystonline.com/
master_sites http://archives.gametap.com/static/uru-client/mac/
set installer_dmg mac_myst_setup.dmg
set launcher_exe UruLauncher.exe
distfiles ${installer_dmg}
description Myst Online: URU Live Again
long_description ${description} (MO:ULagain) running via the Cider wrapper from GameTap
checksums md5 3b3b5af000b32a4415e6aa7d944083fb \
sha1 253e14987a9375d66f92373b11e2dda43872b2a8 \
rmd160 c156b0edd20a691248269f6e3ab9996fddae74c8
depends_run port:mystonline-bootstrap
set libexec_dir ${prefix}/libexec/${name}
set share_dir ${prefix}/share/${my_name}
set bootstrap_dir ${share_dir}/bootstrap
set assets_dir ${share_dir}/data
set wineprefix ${share_dir}/cider
set app_name "Myst Online (Cider)"
set app_package ${applications_dir}/${app_name}.app
set my_dmg_mount [my_attach_disk_image ${distpath}/${installer_dmg}]
copy "${my_dmg_mount}/Myst Online.app" ${worksrcpath}/app
my_detach_disk_image ${my_dmg_mount}
xinstall -m 644 -W ${filespath} MOUL.sh chown-data.c ${worksrcpath}
reinplace "s|@BOOTSTRAP_LAUNCHER@|${bootstrap_dir}/${launcher_exe}|g" ${worksrcpath}/MOUL.sh
reinplace "s|@LAUNCHER@|${assets_dir}/${launcher_exe}|g" ${worksrcpath}/MOUL.sh
reinplace "s|@LIBEXEC@|${libexec_dir}|g" ${worksrcpath}/MOUL.sh
reinplace -W ${worksrcpath} "s|@WINEPREFIX@|${wineprefix}|g" MOUL.sh chown-data.c
reinplace -W ${worksrcpath} "s|@ASSETS@|${assets_dir}|g" MOUL.sh chown-data.c
reinplace "s|@APP_PACKAGE@|${app_package}|g" ${worksrcpath}/chown-data.c
# Delete the main app executable (which does nothing but launch the child app)
# and replace it with our script (which does that and more)
delete "${worksrcpath}/app/Contents/MacOS/Uru Live"
xinstall -W ${worksrcpath} MOUL.sh "${worksrcpath}/app/Contents/MacOS/Uru Live"