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-2010 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.
24 test x
$1 = x
&& echo "Error: version number not given" && exit 1;
28 SITE
=http
://www.claws-mail.org
29 NAME
=claws-mail-themes
35 function getListFromPage
()
37 test -f ${PAGE} && rm -f ${PAGE};
38 wget
-q -a ${WLOG} ${SITE}/${PAGE}
39 test ! -f ${PAGE} && echo "Error: couldn't get ${PAGE}." && exit 1;
41 grep 'download.php?file=' ${PAGE} \
46 function makeRoomForThemes
()
50 && echo "Removing previous destination";
54 function downloadThemes
()
56 for theme
in `cat ${LIST} `;
57 do tarf
=`echo $theme | cut -f2 -d/ `;
59 && tarf
=`echo $theme | cut -f3 -d/ `;
60 echo -n "Downloading... ";
61 wget
-q -a ${WLOG} -O ${DDIR}/$tarf ${SITE}/$theme
62 test ! -f ${DDIR}/$tarf && echo "Error: couldn't get $tarf" && exit 1;
63 pushd ${DDIR} > /dev
/null
65 test ${tarf} = ${tarf/.tar.bz2/} && tarops
="xzf" || tarops
="xjf";
66 echo -n "unpacking... " \
67 && tar $tarops $tarf \
68 && echo -n "deleting tarball... " \
75 function removeWhitespaces
()
80 && test ! "${dir}" = "${dir/ /_}" \
81 && mv "${dir}" "${dir// /_}";
86 function fixPermissions
()
88 find ${DDIR} -type d
-exec chmod 755 '{}' +
89 find ${DDIR} -type f
-exec chmod 644 '{}' +
92 function createProject
()
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 count_png
=`ls -1 *.png 2> /dev/null | wc -l `
107 count_xpm
=`ls -1 *.xpm 2> /dev/null | wc -l `
110 if [ $count_png -gt $count_xpm ];
115 for px
in `ls -1 *.${ext} `;
116 do if [ $i -lt $count ];
117 then echo " $px \\" >> $MA;
118 else echo " $px" >> $MA;
123 count
=`ls * | grep -v "\.${ext}$" | wc -l `;
125 then echo -n 'EXTRA_DIST =' >> $MA;
127 for npx
in `ls -1 * | grep -v "\.${ext}$" `;
128 do if [ $i -lt $count ];
129 then echo " $npx \\" >> $MA;
130 else echo " $npx" >> $MA;
140 function createAutogenSh
()
142 cat<<EOA > ${DDIR}/autogen.sh
146 && automake --add-missing --foreign --copy \
148 && ./configure --enable-maintainer-mode $@
150 chmod +x
${DDIR}/autogen.sh
151 echo "Created autogen.sh"
154 function createMakefileAm
()
159 then echo "EXTRA_DIST = INSTALL "${NAME} > $MA
160 else echo "EXTRA_DIST = "${NAME} > $MA
163 echo -n "SUBDIRS =" >> $MA
165 do test -d "$dir" && echo -n " ${dir}" >> $MA;
168 echo "Created Makefile.am"
171 function createConfigureAc
()
175 echo 'AC_PREREQ(2.59d)' > $CA
176 echo 'AC_INIT('${NAME}')' >> $CA
177 echo 'AM_INIT_AUTOMAKE('${NAME}', '${VERS}')' >> $CA
182 dnl Checks for programs.
188 # the list of Makefiles
191 && echo "${dir}/Makefile" >> $CA \
192 && createThemeMakefileAm
"$dir";
201 find ${DDIR} -name Makefile.am
-delete
204 ${DDIR}/configure.ac \
208 function cleanGenerated
()
210 find ${DDIR} -name Makefile.
in -delete
211 find ${DDIR} -name Makefile
-delete
212 rm -rf ${DDIR}/autom4te.cache
217 ${DDIR}/config.status \
245 echo "Autotoolized.";
249 $0 $VERS --autotoolize
254 echo " $0 vers {--clean[-all]|--download|--autotoolize|--all}"