Import source for “0.9” from upstream tarball.
[debian_comixcursors.git] / install-all
blobb534b76968bd4f49bbf7009ee15b9bf09944c360
1 #! /bin/bash
3 # install-all
4 # Part of ComixCursors, a desktop cursor theme.
6 # Copyright © 2010–2013 Ben Finney <ben+opendesktop@benfinney.id.au>
7 # Copyright © 2006–2013 Jens Luetkens <j.luetkens@limitland.de>
9 # This work is free software: you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
14 # This work is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this work. If not, see <http://www.gnu.org/licenses/>.
22 # Build and install all the ComixCursors themes.
24 themename_stem="ComixCursors"
25 configfile_dir="${themename_stem}Configs"
26 configfile_template_name="Custom"
28 bindir="$(dirname $0)"/bin
30 # Set the ICONSDIR destination to a default (if not already set).
31 ICONSDIR=${ICONSDIR:-~/.icons}
32 export ICONSDIR
34 # We want to use cursors with multiple sizes combined.
35 # The script check wether MULTISIZE is exported at all, so don't export
36 # MULTISIZE if you want distinct cursor sizes, comment it out here or
37 # unset it from the shell.
38 export MULTISIZE=true
40 # argument processing and usage
41 function show_usage_message {
42 cat <<_EOT_
43 Usage: $0 [option]
45 Install the ComixCursors mouse theme.
47 Options:
48 -h: Display this help text, then exit.
49 -u: Uninstall the ComixCursors mouse theme.
50 -v: Be verbose.
52 _EOT_
55 while getopts ":uhv" opt; do
56 case $opt in
58 show_usage_message
59 exit
62 UNINSTALL=true
65 export VERBOSE=true
68 printf "Unexpected option: -%s\n" "$OPTARG" >&2
69 show_usage_message
70 exit 2
72 esac
73 done
75 function build_theme {
76 # Build the cursors for a particular theme.
77 THEMENAME="$1"
78 export THEMENAME
80 if [ $UNINSTALL ]; then
81 make uninstall
82 else
83 if [ ${MULTISIZE} ] ; then
84 printf "\nBuilding \"${THEMENAME}${THEMEOPTIONS}${THEMEINCLUDE}\" (multisize)\n"
85 "${bindir}"/build-cursors
86 if [ $VERBOSE ] ; then
87 make
88 make install
89 else
90 make -s
91 make -s install
93 else
94 # build one theme for each configured size
95 configfile="${configfile_dir}/${THEMENAME}.CONFIG"
96 source "${configfile}"
97 for SIZENAMES in ${SIZES[@]} ; do
98 export SIZENAME="-${SIZENAMES%%=*}"
99 export CURSORSIZE=${SIZENAMES##*=}
100 printf "\nBuilding \"${THEMENAME}${THEMEOPTIONS}${THEMEINCLUDE}${SIZENAME}\"\n"
101 "${bindir}"/build-cursors
102 if [ $VERBOSE ] ; then
103 make
104 make install
105 else
106 make -s
107 make -s install
109 done
114 function build_include_theme {
115 themename="$1"
117 # build the right-handed version
118 export ORIENTATION="RightHanded"
119 export THEMEOPTIONS=""
120 build_theme "$themename"
122 # also build the left-handed version
123 export ORIENTATION="LeftHanded"
124 export THEMEOPTIONS="-LH"
125 build_theme "$themename"
128 for configfile in "${configfile_dir}"/*.CONFIG ; do
129 # Each config file represents a theme to be built.
130 configfile_name=$(basename "$configfile")
131 themename="${configfile_name%.CONFIG}"
132 if [ "$themename" == "$configfile_template_name" ]; then
133 # The template isn't a theme we want to build.
134 continue
137 unset THEMEINCLUDE
138 build_include_theme "$themename"
140 for includefile in "${configfile_dir}"/*.INCLUDE ; do
141 includefile_name=$(basename "$includefile")
142 export THEMEINCLUDE="-${includefile_name%.INCLUDE}"
143 build_include_theme "$themename"
144 done
145 done
147 exit 0