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}
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.
40 # argument processing and usage
41 function show_usage_message
{
45 Install the ComixCursors mouse theme.
48 -h: Display this help text, then exit.
49 -u: Uninstall the ComixCursors mouse theme.
55 while getopts ":uhv" opt
; do
68 printf "Unexpected option: -%s\n" "$OPTARG" >&2
75 function build_theme
{
76 # Build the cursors for a particular theme.
80 if [ $UNINSTALL ]; then
83 if [ ${MULTISIZE} ] ; then
84 printf "\nBuilding \"${THEMENAME}${THEMEOPTIONS}${THEMEINCLUDE}\" (multisize)\n"
85 "${bindir}"/build-cursors
86 if [ $VERBOSE ] ; then
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
114 function build_include_theme
{
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.
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"