install.patch 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. From d335e5562c3b2d405a1b7c1b116a0f2333cd9389 Mon Sep 17 00:00:00 2001
  2. From: orbea <orbea@riseup.net>
  3. Date: Fri, 28 Aug 2020 09:45:43 -0700
  4. Subject: [PATCH 1/4] Add a desktop file.
  5. ---
  6. yarntown.desktop | 9 +++++++++
  7. 1 file changed, 9 insertions(+)
  8. create mode 100644 yarntown.desktop
  9. diff --git a/yarntown.desktop b/yarntown.desktop
  10. new file mode 100644
  11. index 0000000..c2827d6
  12. --- /dev/null
  13. +++ b/yarntown.desktop
  14. @@ -0,0 +1,9 @@
  15. +[Desktop Entry]
  16. +Name=Yarntown
  17. +GenericName=Yarntown game for the Solarus engine
  18. +Comment=Yarntown (2D hommage to Bloodborne)
  19. +Exec=yarntown
  20. +Terminal=false
  21. +Type=Application
  22. +Icon=yarntown
  23. +Categories=Game;AdventureGame;
  24. --
  25. GitLab
  26. From 959930c05781c13971945a81698a55e341771f06 Mon Sep 17 00:00:00 2001
  27. From: orbea <orbea@riseup.net>
  28. Date: Sat, 29 Aug 2020 13:47:39 -0700
  29. Subject: [PATCH 2/4] Add a .gitignore.
  30. ---
  31. .gitignore | 2 ++
  32. 1 file changed, 2 insertions(+)
  33. create mode 100644 .gitignore
  34. diff --git a/.gitignore b/.gitignore
  35. new file mode 100644
  36. index 0000000..b37f35a
  37. --- /dev/null
  38. +++ b/.gitignore
  39. @@ -0,0 +1,2 @@
  40. +*.solarus
  41. +yarntown
  42. --
  43. GitLab
  44. From ee5635b327b883486051d92be381a5202f0774ac Mon Sep 17 00:00:00 2001
  45. From: orbea <orbea@riseup.net>
  46. Date: Tue, 1 Sep 2020 07:00:47 -0700
  47. Subject: [PATCH 3/4] Add the quest version to quest.dat.
  48. ---
  49. data/quest.dat | 2 +-
  50. 1 file changed, 1 insertion(+), 1 deletion(-)
  51. diff --git a/data/quest.dat b/data/quest.dat
  52. index f97b633..bf7ff4c 100644
  53. --- a/data/quest.dat
  54. +++ b/data/quest.dat
  55. @@ -6,7 +6,7 @@ quest{
  56. long_description = [[
  57. ]],
  58. author = "Max Mraz",
  59. - quest_version = "",
  60. + quest_version = "1.0.6",
  61. release_date = "",
  62. website = "",
  63. normal_quest_size = "416x240",
  64. --
  65. GitLab
  66. From 9bf2149bd137d14940ca451b1976f26f15b650d3 Mon Sep 17 00:00:00 2001
  67. From: orbea <orbea@riseup.net>
  68. Date: Sat, 29 Aug 2020 11:24:27 -0700
  69. Subject: [PATCH 4/4] Add a install.sh posix script.
  70. ---
  71. INSTALL | 68 ++++++++++++++++
  72. install.sh | 225 +++++++++++++++++++++++++++++++++++++++++++++++++++++
  73. 2 files changed, 293 insertions(+)
  74. create mode 100644 INSTALL
  75. create mode 100755 install.sh
  76. diff --git a/INSTALL b/INSTALL
  77. new file mode 100644
  78. index 0000000..cc12b3d
  79. --- /dev/null
  80. +++ b/INSTALL
  81. @@ -0,0 +1,68 @@
  82. +install.sh is a POSIX sh script known to work with the following shells:
  83. +
  84. + ash
  85. + dash
  86. + bash
  87. + ksh
  88. + loksh
  89. + mksh
  90. + pdksh
  91. + posh (0.14.1 or newer)
  92. + oksh
  93. + yash
  94. + zsh
  95. +
  96. +install.sh accepts the following arguments as targets:
  97. +
  98. +build - Generates the solarus.data archive and the executable script.
  99. +clean - Removes the solarus.data archive and the executable script.
  100. +install - Installs the solarus.data archive and executable script.
  101. +install-assets - Installs the docs, icons and desktop file.
  102. +uninstall - Uninstalls all installed files.
  103. +
  104. +The build, clean and install targets can customize the name of the data
  105. +archive.
  106. +
  107. + DATANAME - Name of the solarus data archive (data.solarus)
  108. +
  109. +Additionally the following arguments can be passed to the install
  110. +and uninstall targets to configure the install paths.
  111. +
  112. + PREFIX - Install path prefix (/usr/local)
  113. + BINDIR - Binary install directory (PREFIX/bin)
  114. + DOCDIR - Documentation install directory (PREFIX/share/doc)
  115. + MANDIR - Manpage install directory (PREFIX/share/man)
  116. + DATADIR - Read-only data install directory (DATAROOTDIR)
  117. + DATAROOTDIR - Read-only data root install directory (PREFIX/share)
  118. + SYSCONFDIR - Read-only data install directory (PREFIX/etc)
  119. +
  120. +The configurable install directories can be either absolute or relative
  121. +paths. If they are set as relative paths the value of PREFIX will be
  122. +prepended to the install directory. For example if MANDIR is set to
  123. +'man' man pages will be installed to '/usr/local/man/' instead of
  124. +'/usr/local/share/man/'.
  125. +
  126. +By design install.sh will not use any set environment variables and all
  127. +configuration must be passed explicitly as arguments.
  128. +
  129. +EXAMPLES
  130. +
  131. + ./install.sh install PREFIX=/usr DESTDIR=/tmp
  132. +
  133. + Installs to '/tmp/usr/'.
  134. +
  135. + ./install.sh uninstall PREFIX=/usr DESTDIR=/tmp
  136. +
  137. + Uninstalls from '/tmp/usr/'.
  138. +
  139. + ./install.sh install DOCDIR=/usr/local/doc
  140. +
  141. + Installs documentation to '/usr/local/doc/$PRGNAM-$VERSION'.
  142. +
  143. + ./install.sh install MANDIR=man
  144. +
  145. + Installs man pages to '$PREFIX/man/man1/'.
  146. +
  147. + ./install.sh install SYSCONFDIR=/etc
  148. +
  149. + Installs read-only data to '/etc/'.
  150. diff --git a/install.sh b/install.sh
  151. new file mode 100755
  152. index 0000000..9cc10da
  153. --- /dev/null
  154. +++ b/install.sh
  155. @@ -0,0 +1,225 @@
  156. +#!/bin/sh
  157. +# Install script for yarntown.
  158. +
  159. +# Copyright 2017-2020 orbea
  160. +# All rights reserved.
  161. +#
  162. +# Redistribution and use of this script, with or without modification, is
  163. +# permitted provided that the following conditions are met:
  164. +#
  165. +# 1. Redistributions of this script must retain the above copyright
  166. +# notice, this list of conditions and the following disclaimer.
  167. +#
  168. +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
  169. +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  170. +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  171. +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  172. +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  173. +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  174. +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  175. +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  176. +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  177. +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  178. +
  179. +# IFS is <space><tab><newline>
  180. +IFS='
  181. +'
  182. +\unset -f command printf unalias : 2>/dev/null
  183. +\unalias -a 2>/dev/null
  184. +PATH="$(command -p getconf PATH):$PATH"
  185. +LC_ALL=C; export LC_ALL
  186. +
  187. +set -euf
  188. +
  189. +die () {
  190. + ret="$1"; shift
  191. + case "$ret" in
  192. + : ) printf %s\\n "$@" >&2; return 0 ;;
  193. + 0 ) printf %s\\n "$@" ;;
  194. + * ) printf %s\\n "$@" >&2 ;;
  195. + esac
  196. + exit "$ret"
  197. +}
  198. +
  199. +case "${1:-}" in
  200. + install-assets ) INSTALL=4 ;;
  201. + clean ) INSTALL=3 ;;
  202. + build ) INSTALL=2 ;;
  203. + install ) INSTALL=1 ;;
  204. + uninstall ) INSTALL=0 ;;
  205. + '' ) die 1 'No install target.' ;;
  206. + * ) die 1 "No rule to install target '$1'." ;;
  207. +esac
  208. +
  209. +cmd () {
  210. + print=
  211. + for command do
  212. + case "$command" in
  213. + -- ) : ;;
  214. + */* ) print="${print} '$command'" ;;
  215. + * ) print="${print} $command" ;;
  216. + esac
  217. + done
  218. + printf " %s\\n" "$print"
  219. + command -p "$@"
  220. +}
  221. +
  222. +is_absolute () { case "$1" in /*) return 0 ;; *) return 1 ;; esac; }
  223. +
  224. +PREFIX=; BINDIR=; DATADIR=; DATANAME=; DATAROOTDIR=; DOCDIR=; MANDIR=
  225. +SYSCONFDIR=; DESTDIR=
  226. +
  227. +CWD="$(pwd)"
  228. +
  229. +if [ "$0" != "${0%/*}" ]; then
  230. + SOURCE_DIR="$(cd -- "${0%/*}/" && pwd -P)"
  231. +else
  232. + SOURCE_DIR="$(pwd -P)"
  233. +fi
  234. +
  235. +quest_version="$(grep quest_version "$SOURCE_DIR"/data/quest.dat)"
  236. +quest_version="${quest_version%\"*}"
  237. +
  238. +PRGNAM=yarntown
  239. +VERSION="${quest_version#*\"}"
  240. +
  241. +shift
  242. +
  243. +install_args=
  244. +
  245. +while [ $# -gt 0 ]; do
  246. + arg="$1"; shift
  247. + case "${arg%%=*}" in
  248. + DATANAME|DESTDIR|PREFIX )
  249. + eval "${arg%%=*}=\"\${arg#*=}\""
  250. + ;;
  251. + BINDIR|DATADIR|DATAROOTDIR|DOCDIR|MANDIR|SYSCONFDIR )
  252. + install_args=1
  253. + eval "${arg%%=*}=\"\${arg#*=}\""
  254. + ;;
  255. + * )
  256. + die : "WARNING: Variable '${arg%%=*}' was not used by $PRGNAM."
  257. + ;;
  258. + esac
  259. +done
  260. +
  261. +PREFIX="${PREFIX:-/usr/local}"
  262. +BINDIR="${BINDIR:-${PREFIX}/bin}"
  263. +DOCDIR="${DOCDIR:-${PREFIX}/share/doc}/$PRGNAM-$VERSION"
  264. +MANDIR="${MANDIR:-${PREFIX}/share/man}"
  265. +DATANAME="${DATANAME:-data.solarus}"
  266. +DATAROOTDIR="${DATAROOTDIR:-${PREFIX}/share}"
  267. +DATADIR="${DATADIR:-${DATAROOTDIR}}/solarus/$PRGNAM"
  268. +SYSCONFDIR="${SYSCONFDIR:-${PREFIX}/etc}"
  269. +DESTDIR="${DESTDIR:-}"
  270. +
  271. +is_absolute "$PREFIX" || PREFIX="$CWD/$PREFIX"
  272. +
  273. +if [ -n "$install_args" ]; then
  274. + for i in \$BINDIR \$DATADIR \$DATAROOTDIR \$DOCDIR \$MANDIR \$SYSCONFDIR; do
  275. + eval "dest=\"$i\""
  276. + is_absolute "${dest:?}" || eval "${i#*$}=\"\${PREFIX}/$i\""
  277. + done
  278. +fi
  279. +
  280. +####################
  281. +### Project Code ###
  282. +####################
  283. +
  284. +build_bin () {
  285. + command -p rm -f -- "$CWD/$PRGNAM"
  286. + printf 'Generating %s script...\n' "$PRGNAM"
  287. + printf '#!/bin/sh\nsolarus-run %s "$@"\n' "$DATADIR" > "$CWD/$PRGNAM"
  288. +}
  289. +
  290. +build_data () {
  291. + command -p rm -f -- "$CWD/$DATANAME"
  292. + printf 'Generating %s...\n' "$DATANAME"
  293. + (
  294. + cd -- "${SOURCE_DIR}"/data/
  295. + command -p find . -type f \( \
  296. + -name '*.spc' -o \
  297. + -name '*.ogg' -o \
  298. + -name '*.it' -o \
  299. + -name '*.png' -o \
  300. + -name '*.dat' -o \
  301. + -name '*.lua' -o \
  302. + -name '*.ttf' -o \
  303. + -name '*.ttc' -o \
  304. + -name '*.fon' -o \
  305. + -name '*.glsl' \
  306. + \) -exec zip -9 -q "$CWD/$DATANAME" {} +
  307. + )
  308. +}
  309. +
  310. +icon_sizes='16 32 64 128 256 512 1024'
  311. +
  312. +case $INSTALL in
  313. + # install-assets
  314. + 4 )
  315. + printf 'Installing assets...\n'
  316. + cmd mkdir -p -- "${DESTDIR}${DATAROOTDIR}/applications"
  317. + cmd mkdir -p -- "${DESTDIR}${DATAROOTDIR}/pixmaps"
  318. + cmd mkdir -p -- "${DESTDIR}${DOCDIR}"
  319. + cmd rm -f -- "${DESTDIR}${DOCDIR}/credits.txt"
  320. + cmd cp -- "${SOURCE_DIR}/credits.txt" "${DESTDIR}${DOCDIR}"
  321. + cmd rm -f -- "${DESTDIR}${DOCDIR}/readme.md"
  322. + cmd cp -- "${SOURCE_DIR}/readme.md" "${DESTDIR}${DOCDIR}"
  323. + cmd rm -f -- "${DESTDIR}${DATAROOTDIR}/applications/$PRGNAM.desktop"
  324. + cmd cp -- "${SOURCE_DIR}/$PRGNAM.desktop" \
  325. + "${DESTDIR}${DATAROOTDIR}/applications"
  326. + cmd rm -f -- "${DESTDIR}${DATAROOTDIR}/pixmaps/$PRGNAM.png"
  327. + cmd cp -- "${SOURCE_DIR}/data/logos/logo.png" \
  328. + "${DESTDIR}${DATAROOTDIR}/pixmaps/$PRGNAM.png"
  329. +
  330. + eval "set -- $icon_sizes"
  331. + for icon do
  332. + icon_dir="${DESTDIR}${DATAROOTDIR}/icons/hicolor/${icon}x${icon}/apps"
  333. + cmd mkdir -p -- "$icon_dir"
  334. + cmd rm -f -- "$icon_dir/$PRGNAM.png"
  335. + cmd cp -- "${SOURCE_DIR}/medias/icon/icon_$icon.png" \
  336. + "$icon_dir/$PRGNAM.png"
  337. + done
  338. + ;;
  339. + # clean
  340. + 3 )
  341. + printf 'Removing %s...\n' "$DATANAME"
  342. + cmd rm -f -- "$CWD/$DATANAME"
  343. + cmd rm -f -- "$CWD/$PRGNAM"
  344. + ;;
  345. + # build
  346. + 2 )
  347. + build_data
  348. + build_bin
  349. + ;;
  350. + # install
  351. + 1 )
  352. + [ -f "$CWD/$DATANAME" ] || build_data
  353. + [ -f "$CWD/$PRGNAM" ] || build_bin
  354. + printf 'Installing...\n'
  355. + cmd mkdir -p -- "${DESTDIR}${BINDIR}"
  356. + cmd mkdir -p -- "${DESTDIR}${DATADIR}"
  357. + cmd rm -f -- "${DESTDIR}${BINDIR}/$PRGNAM"
  358. + cmd cp -- "$CWD/$PRGNAM" "${DESTDIR}${BINDIR}"
  359. + cmd rm -f -- "${DESTDIR}${DATADIR}/$DATANAME"
  360. + cmd cp -- "$CWD/$DATANAME" "${DESTDIR}${DATADIR}"
  361. + cmd chmod 0755 -- "${DESTDIR}${BINDIR}/$PRGNAM"
  362. + ;;
  363. + # uninstall
  364. + 0 )
  365. + printf 'Uninstalling...\n'
  366. + cmd rm -rf -- "${DESTDIR}${DOCDIR}"
  367. + cmd rm -rf -- "${DESTDIR}${DATADIR}"
  368. + cmd rm -f -- "${DESTDIR}${BINDIR}/$PRGNAM"
  369. + cmd rm -f -- "${DESTDIR}${DATAROOTDIR}/applications/$PRGNAM.desktop"
  370. + cmd rm -f -- "${DESTDIR}${DATAROOTDIR}/pixmaps/$PRGNAM.png"
  371. +
  372. + eval "set -- $icon_sizes"
  373. + for icon do
  374. + icon_dir="${DESTDIR}${DATAROOTDIR}/icons/hicolor/${icon}x${icon}/apps"
  375. + cmd rm -f -- "$icon_dir/$PRGNAM.png"
  376. + done
  377. + ;;
  378. +esac
  379. +
  380. +exit 0
  381. --
  382. GitLab