comparison dist/package-mingw64.sh @ 92:cccbea0d0ff1

misc: create dist folder
author David Demelier <markand@malikania.fr>
date Thu, 26 Mar 2020 10:25:33 +0100
parents package-mingw64.sh@c33c8e9a89f6
children
comparison
equal deleted inserted replaced
91:8bfb90e85b28 92:cccbea0d0ff1
1 #!/bin/sh
2 #
3 # package-mingw64.sh -- create fakeroot directory for MinGW-w64
4 #
5 # Copyright (c) 2020 David Demelier <markand@malikania.fr>
6 #
7 # Permission to use, copy, modify, and/or distribute this software for any
8 # purpose with or without fee is hereby granted, provided that the above
9 # copyright notice and this permission notice appear in all copies.
10 #
11 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 #
19
20 verbose=0
21
22 die()
23 {
24 echo "$1" 1>&2
25 exit 1
26 }
27
28 info()
29 {
30 if [ $verbose -eq 1 ]; then
31 echo $1
32 fi
33 }
34
35 depends()
36 {
37 ldd molko.exe | grep -E "/mingw" | awk '{ print $3 }'
38 }
39
40 usage()
41 {
42 echo "Create a directory suitable for packaging." 1>&2
43 echo "" 1>&2
44 echo "usage: $(basename $0) [-v] output-directory" 1>&2
45 exit 1
46 }
47
48 if [ ! -f Makefile ]; then
49 die "abort: must be ran from top directory"
50 fi
51
52 if [ ! -f molko.exe ]; then
53 die "abort: no molko.exe binary found, did you build?"
54 fi
55
56 while getopts "v" opt; do
57 case $opt in
58 v)
59 verbose=1
60 ;;
61 *)
62 usage
63 ;;
64 esac
65 done
66
67 shift $((OPTIND - 1))
68
69 if [ $# -eq 0 ] || [ -z $1 ]; then
70 usage
71 fi
72
73 output=${1:-package}
74
75 info "Creating package in $output"
76
77 rm -rf "$output"
78 mkdir -p "$output"
79
80 info "Copying molko.exe"
81 cp molko.exe "$output"
82
83 info "Copying assets"
84 cp -R assets "$output"
85
86 depends | while read -r file; do
87 info "Copying dependency $file"
88 cp -f "$file" "$output"
89 done
90
91 info "Molko's Adventure is ready in $output"