3 # Generate the source directory for claws-mail-themes package
4 # from the theme tarballs in http://www.claws-mail.org/themes.php
6 # Copyright (c) 2006-2008 Ricardo Mones <ricardo@mones.org>
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 test x$1 = x && echo "Error: version number not given" && exit 1;
27 SITE=http://www.claws-mail.org
28 NAME=claws-mail-themes
34 function getListFromPage()
36 test -f ${PAGE} && rm -f ${PAGE};
37 wget -q -a ${WLOG} ${SITE}/${PAGE}
38 test ! -f ${PAGE} && echo "Error: couldn't get ${PAGE}." && exit 1;
40 grep 'download.php?file=' ${PAGE} \
45 function makeRoomForThemes()
49 && echo "Removing previous destination";
53 function downloadThemes()
55 for theme in `cat ${LIST} `;
56 do tarf=`echo $theme | cut -f2 -d/ `;
58 && tarf=`echo $theme | cut -f3 -d/ `;
59 echo -n "Downloading... ";
60 wget -q -a ${WLOG} -P ${DDIR} ${SITE}/$theme
61 test ! -f ${DDIR}/$tarf && echo "Error: couldn't get $tarf" && exit 1;
62 pushd ${DDIR} > /dev/null
64 test ${tarf} = ${tarf/.tar.bz2/} && tarops="xzf" || tarops="xjf";
65 echo -n "unpacking... " \
66 && tar $tarops $tarf \
67 && echo -n "deleting tarball... " \
74 function removeWhitespaces()
79 && test ! "${dir}" = "${dir/ /_}" \
80 && mv "${dir}" "${dir// /_}";
85 function fixPermissions()
87 find ${DDIR} -type d -exec chmod 755 '{}' +
88 find ${DDIR} -type f -exec chmod 644 '{}' +
91 function createProject()
96 function createThemeMakefileAm()
99 MA="/tmp/tmp.makefile.am";
102 echo 'themedir = $(prefix)/share/claws-mail/themes/'${dir} > $MA
104 echo -n 'dist_theme_DATA =' >> $MA
105 count_png=`ls -1 *.png 2> /dev/null | wc -l `
106 count_xpm=`ls -1 *.xpm 2> /dev/null | wc -l `
109 if [ $count_png -gt $count_xpm ];
114 for px in `ls -1 *.${ext} `;
115 do if [ $i -lt $count ];
116 then echo " $px \\" >> $MA;
117 else echo " $px" >> $MA;
122 count=`ls * | grep -v "\.${ext}$" | wc -l `;
124 then echo -n 'EXTRA_DIST =' >> $MA;
126 for npx in `ls -1 * | grep -v "\.${ext}$" `;
127 do if [ $i -lt $count ];
128 then echo " $npx \\" >> $MA;
129 else echo " $npx" >> $MA;
139 function createAutogenSh()
141 cat<<EOA > ${DDIR}/autogen.sh
145 && automake --add-missing --foreign --copy \
147 && ./configure --enable-maintainer-mode $@
149 chmod +x ${DDIR}/autogen.sh
150 echo "Created autogen.sh"
153 function createMakefileAm()
158 then echo "EXTRA_DIST = INSTALL "${NAME} > $MA
159 else echo "EXTRA_DIST = "${NAME} > $MA
162 echo -n "SUBDIRS =" >> $MA
164 do test -d "$dir" && echo -n " ${dir}" >> $MA;
167 echo "Created Makefile.am"
170 function createConfigureAc()
174 echo 'AC_PREREQ(2.59d)' > $CA
175 echo 'AC_INIT('${NAME}')' >> $CA
176 echo 'AM_INIT_AUTOMAKE('${NAME}', '${VERS}')' >> $CA
181 dnl Checks for programs.
187 # the list of Makefiles
190 && echo "${dir}/Makefile" >> $CA \
191 && createThemeMakefileAm "$dir";
200 find ${DDIR} -name Makefile.am -delete
203 ${DDIR}/configure.ac \
207 function cleanGenerated()
209 find ${DDIR} -name Makefile.in -delete
210 find ${DDIR} -name Makefile -delete
211 rm -rf ${DDIR}/autom4te.cache
216 ${DDIR}/config.status \
244 echo "Autotoolized.";
248 $0 $VERS --autotoolize
253 echo " $0 vers {--clean[-all]|--download|--autotoolize|--all}"