update bundle script and add install info to README

master
Alison G. Watson 2019-07-08 20:10:25 -04:00
parent 350bb402d2
commit 897bb17346
5 changed files with 145 additions and 123 deletions

11
.gitignore vendored
View File

@ -1,9 +1,10 @@
/target
/out
**/*.rs.bk
Cargo.lock
perf.data*
*.bat
*.user
/tycho/resources/icons/*
.DS_Store
/out
/target
/tycho/resources/icons.qrc
/tycho/resources/icons/*
Cargo.lock
perf.data*

View File

@ -11,11 +11,30 @@ and structures to build applications which work with Marathon's data.
See [the crate documentation](source/lib.rs) for more information.
`maraiah` does not have any special dependencies.
To compile, run `cargo build`.
## `maraiah-leela`
`leela` is a CLI utility that essentially allows for a direct user interface to
the underlying Maraiah library.
`maraiah-leela` is a CLI utility that essentially allows for a direct user
interface to the underlying Maraiah library.
`maraiah-leela` does not have any special dependencies.
To compile, run `cargo build -p maraiah-leela`.
## `maraiah-tycho`
`tycho` is a map editor written in C++ and Rust using Qt.
`maraiah-tycho` is a map editor written in C++ and Rust using Qt.
`maraiah-tycho` requires `librsvg` and `pigz` to compile the icons. `librsvg` is
also required for the bundle script.`fish` is also required for the icon
compilation script and the bundle script. The runtime dependencies are Qt5's
Core, GUI, and Widgets libraries, and a C++ runtime.
To compile, `cd` to `tycho`, run `./gen_icons.fish`, and then compile with
`cargo build -p maraiah-tycho`. If you wish to create a Macintosh Application
Bundle, run `./bundle.fish`. This will also create an installer DMG. If you
don't want to create an installer and just want the app, run `env NO_DMG=1
./bundle.fish`.

117
bundle.fish Executable file
View File

@ -0,0 +1,117 @@
#!/usr/bin/env fish
set err_ok 0
set err_bad_arg 1
set err_bad_run 2
set appdir
set dmg
set tmpdir
function rm_if -a name
if test -d $name
rm -rf "$name"
and echo "removed dir $name"
else if test -f $name
rm -f "$name"
and echo "removed file $name"
end
return 0
end
function perish -a ret
rm_if "$tmpdir"
exit "$ret"
end
function err -a ret
echo "error, dropping build"
rm_if "$appdir"
rm_if "$dmg"
perish $ret
end
function :
echo "$argv"
echo
eval "$argv" || err $err_bad_run
end
set icon_name_Tycho "resources/icons/pfhor-hand_1024@2x.svgz"
set name $argv[1]
set exe $argv[2]
if test ! $name
echo "program name needed (available: Tycho)"
err $err_bad_arg
end
if test ! $exe
echo "full path to executable required (ex. '$_ $name ~/bin/maraiah-tycho')"
err $err_bad_arg
end
set app $name.app
set srcdir $PWD/(string lower "$name")
set exedir (dirname "$exe")
set appdir $exedir/$app
set tmpdir (mktemp -d)
set diskdir $tmpdir/disk
set icondir $tmpdir/$name.iconset
set icon_name "icon_name_$name"
set icon_name $$icon_name
set icon $srcdir/$icon_name
set dmg $exedir/$name.dmg
: rm_if "$appdir"
: mkdir -p "$appdir/Contents/"{Frameworks,MacOS,Resources}
: cp "$exe" "$appdir/Contents/MacOS"
: cp "$srcdir/resources/Info.plist" "$appdir/Contents"
: mkdir -p "$icondir"
: rsvg-convert -w 16 -h 16 "$icon" -o "$icondir/icon_16x16.png"
: rsvg-convert -w 32 -h 32 "$icon" -o "$icondir/icon_32x32.png"
: rsvg-convert -w 64 -h 64 "$icon" -o "$icondir/icon_64x64.png"
: rsvg-convert -w 128 -h 128 "$icon" -o "$icondir/icon_128x128.png"
: rsvg-convert -w 256 -h 256 "$icon" -o "$icondir/icon_256x256.png"
: rsvg-convert -w 512 -h 512 "$icon" -o "$icondir/icon_512x512.png"
: rsvg-convert -w 1024 -h 1024 "$icon" -o "$icondir/icon_512x512@2x.png"
: cp "$icondir/icon_32x32.png" "$icondir/icon_16x16@2x.png"
: cp "$icondir/icon_64x64.png" "$icondir/icon_32x32@2x.png"
: cp "$icondir/icon_256x256.png" "$icondir/icon_128x128@2x.png"
: cp "$icondir/icon_512x512.png" "$icondir/icon_256x256@2x.png"
: iconutil -c icns -o "$appdir/Contents/Resources/$name.icns" "$icondir"
for lnk in (cat "$exedir"/build/maraiah-tycho-*/out/etc/link.txt)
set lnk (dirname "$lnk")
: cp -r "$lnk" "$appdir/Contents/Frameworks"
end
echo "success: bundle written to $appdir"
if test ! "$NO_DMG"
echo "creating the disk image..."
: rm_if "$dmg"
: mkdir -p "$diskdir"
: cp -r "$appdir" "$diskdir"
: cp "$srcdir/resources/Image.DS_Store" "$diskdir/.DS_Store"
: ln -s /Applications "$diskdir"
: hdiutil create -volname "$name" -srcfolder "$diskdir" "$dmg"
echo "success: dmg written to $dmg"
end
perish $err_ok
## EOF

115
bundle.sh
View File

@ -1,115 +0,0 @@
#!/usr/bin/env bash
err_ok=0
err_bad_arg=1
err_bad_run=2
rm_if() {
if [[ -d $1 ]];
then
rm -rf "$1" && echo "removed dir $1"
elif [[ -f $1 ]]
then
rm -f "$1" && echo "removed file $1"
fi
return 0
}
perish() {
rm_if "${tmpdir}"
exit "$1"
}
err() {
echo "error, dropping build"
rm_if "${appdir}"
rm_if "${dmg}"
perish $1
}
:() {
echo "$@"
echo
eval "$@" || err ${err_bad_run}
}
declare -A icon_names=(
[Tycho]="resources/icons/pfhor-hand_1024.png"
)
name=$1
exe=$2
if [[ ! $name ]]
then
echo "program name needed (available: Tycho)"
err ${err_bad_arg}
fi
if [[ ! $exe ]]
then
echo "full path to executable required (ex. '$0 $name ~/bin/maraiah-tycho')"
err ${err_bad_arg}
fi
app=${name}.app
srcdir=${PWD}/${name,,}
exedir=$(dirname "${exe}")
appdir=${exedir}/${app}
tmpdir=$(mktemp -d)
diskdir=${tmpdir}/disk
icondir=${tmpdir}/${name}.iconset
icon=${srcdir}/${icon_names[${name}]}
dmg=${exedir}/${name}.dmg
: rm_if "${appdir}"
: mkdir -p "${appdir}/Contents/"{Frameworks,MacOS,Resources}
: cp "${exe}" "${appdir}/Contents/MacOS"
: cp "${srcdir}/resources/Info.plist" "${appdir}/Contents"
: mkdir -p "${icondir}"
: sips -z 16 16 "${icon}" --out "${icondir}/icon_16x16.png"
: sips -z 32 32 "${icon}" --out "${icondir}/icon_32x32.png"
: sips -z 64 64 "${icon}" --out "${icondir}/icon_64x64.png"
: sips -z 128 128 "${icon}" --out "${icondir}/icon_128x128.png"
: sips -z 256 256 "${icon}" --out "${icondir}/icon_256x256.png"
: sips -z 512 512 "${icon}" --out "${icondir}/icon_512x512.png"
: sips -z 1024 1024 "${icon}" --out "${icondir}/icon_512x512@2x.png"
: cp "${icondir}/icon_32x32.png" "${icondir}/icon_16x16@2x.png"
: cp "${icondir}/icon_64x64.png" "${icondir}/icon_32x32@2x.png"
: cp "${icondir}/icon_256x256.png" "${icondir}/icon_128x128@2x.png"
: cp "${icondir}/icon_512x512.png" "${icondir}/icon_256x256@2x.png"
: iconutil -c icns -o "${appdir}/Contents/Resources/${name}.icns" "${icondir}"
while IFS= read -r lnk
do
lnk=$(dirname "${lnk}")
: cp -r "${lnk}" "${appdir}/Contents/Frameworks"
done < "${exedir}"/build/maraiah-tycho-*/out/etc/link.txt
echo "success: bundle written to ${appdir}"
if [[ ! "$NO_DMG" ]]
then
echo "creating the disk image..."
: rm_if "${dmg}"
: mkdir -p "${diskdir}"
: cp -r "${appdir}" "${diskdir}"
: cp "${srcdir}/resources/Image.DS_Store" "${diskdir}/.DS_Store"
: ln -s /Applications "${diskdir}"
: hdiutil create -volname "${name}" -srcfolder "${diskdir}" "${dmg}"
echo "success: dmg written to ${dmg}"
fi
perish ${err_ok}
## EOF

0
tycho/gen_images.fish Normal file → Executable file
View File