3 # Generate the source directory for claws-mail-themes package
4 # from the theme tarballs in http://claws-mail.org/themes.php
6 # Copyright (c) 2006-2007 Ricardo Mones <ricardo@mones.org>
7 # Paul Mangan <paul@claws-mail.org>
9 # This program is free software; you can redistribute it and/or modify
10 # it 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 program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 echo " $0 version {--clean[-all]|--download|--autotoolize|--all}"
30 test x$1 = x && echo "Error: version number not given" && printHelp && exit 1;
34 SITE=http://claws-mail.org
35 NAME=claws-mail-themes
42 function getListFromPage()
44 test -f ${PAGE} && rm -f ${PAGE};
45 wget -q -a ${WLOG} ${SITE}/${PAGE}
46 test ! -f ${PAGE} && echo "Error: couldn't get ${PAGE}." && exit 1;
48 grep 'download.php?file=' ${PAGE} \
53 function makeRoomForThemes()
57 && echo "Removing previous destination";
61 function downloadThemes()
63 for theme in `cat ${LIST} `;
64 do tarf=`echo $theme | cut -f2 -d/ `;
65 echo -n "Downloading... ";
66 wget -q -a ${WLOG} -P ${DDIR} ${SITE}/$theme
67 test ! -f ${DDIR}/$tarf && echo "Error: couldn't get $tarf" && exit 1;
68 pushd ${DDIR} > /dev/null
70 test ${tarf} = ${tarf/.tar.bz2/} && tarops="xzf" || tarops="xjf";
71 echo -n "unpacking... " \
72 && tar $tarops $tarf \
73 && echo -n "deleting tarball... " \
80 function removeWhitespaces()
85 && test ! "${dir}" = "${dir/ /_}" \
86 && mv "${dir}" "${dir// /_}";
91 function createProject()
93 touch ${DDIR}/${NAME} ${DDIR}/${NOTES}
94 find ${DDIR} -type f -exec chmod -x '{}' +
97 function createThemeMakefileAm()
100 MA="/tmp/tmp.makefile.am";
103 echo 'themedir = $(prefix)/share/claws-mail/themes/'${dir} > $MA
105 echo -n 'dist_theme_DATA =' >> $MA
106 test -f .claws_themeinfo \
107 && echo " .claws_themeinfo \\" >> $MA;
108 count=`ls *.xpm | wc -l `;
110 for px in `ls -1 *.xpm `;
111 do if [ $i -lt $count ];
112 then echo " $px \\" >> $MA;
113 else echo " $px" >> $MA;
118 count=`ls * | grep -v '\.xpm$' | wc -l `;
120 then echo -n 'EXTRA_DIST =' >> $MA;
122 for npx in `ls -1 * | grep -v '\.xpm$' `;
123 do if [ $i -lt $count ];
124 then echo " $npx \\" >> $MA;
125 else echo " $npx" >> $MA;
135 function createAutogenSh()
137 cat<<EOA > ${DDIR}/autogen.sh
141 && automake --add-missing --foreign --copy \
143 && ./configure --enable-maintainer-mode $@
145 chmod +x ${DDIR}/autogen.sh
146 echo "Created autogen.sh"
149 function createMakefileAm()
153 echo "AUTOMAKE_OPTIONS = dist-bzip2" > $MA
155 echo "EXTRA_DIST = INSTALL "${NOTES} ${NAME} >> $MA
157 echo -n "SUBDIRS =" >> $MA
159 do test -d "$dir" && echo -n " ${dir}" >> $MA;
163 echo "Created Makefile.am"
166 function createConfigureAc()
170 echo 'AC_PREREQ(2.59d)' > $CA
171 echo 'AC_INIT('${NAME}')' >> $CA
172 echo 'AM_INIT_AUTOMAKE('${NAME}', '${VERS}')' >> $CA
177 dnl Checks for programs.
183 # the list of Makefiles
186 && echo "${dir}/Makefile" >> $CA \
187 && createThemeMakefileAm "$dir";
196 find ${DDIR} -name Makefile.am -delete
199 ${DDIR}/configure.ac \
203 function cleanGenerated()
205 find ${DDIR} -name Makefile.in -delete
206 find ${DDIR} -name Makefile -delete
207 rm -rf ${DDIR}/autom4te.cache
212 ${DDIR}/config.status \
239 echo "Autotoolized.";
243 $0 $VERS --autotoolize