#! /bin/sh
## toolbox for the VLC media player
-## $Id: toolbox,v 1.14 2003/03/12 05:12:05 sam Exp $
+## $Id: toolbox,v 1.21 2003/04/09 16:05:58 sam Exp $
##
## Authors: Samuel Hocevar <sam@zoy.org>
--update-po update translation files
--update-includes [BUILTINS] generate various include files
--update-glade generate and fix Glade code
+ --update-glade2 generate and fix Glade 2 code
+ --update-flexml generate and fix flexml and flex code
+ --distclean "make distclean"
EOF
exit 1
}
{
awk 'BEGIN{a=0}{if(!a&&/^'"$1"'[^-_a-zA-Z0-9]*=/){a=1;print$0;next;}if(a){if(/^[a-zA-Z]/){exit;}print $0}}' < Makefile.am | \
tr '\\ ' '\n\n' | \
- sed -ne 's/[^$-_a-zA-Z0-9][^$-_a-zA-Z0-9]*\([a-zA-Z]\)/\1/p'
+ sed -ne 's/[^-$()_a-zA-Z0-9][^-$()_a-zA-Z0-9]*\([a-zA-Z]\)/\1/p'
}
###
### argument check
###
-do_changelog=no
-do_po=no
-do_vc=no
-do_includes=no
-do_glade=no
if test "$1" = ""
then
case "$1" in
--update-changelog)
- do_changelog=yes
+ action=changelog
;;
--update-vc)
- do_vc=yes
+ action=vc
;;
--update-po)
- do_po=yes
+ action=po
;;
--update-includes)
- do_includes=yes
+ action=includes
+ ;;
+ --update-flexml)
+ action=flexml
;;
--update-glade|--fix-glade)
- do_glade=yes
+ action=glade
+ ;;
+ --update-glade2|--update-glade-2|--fix-glade2)
+ action=glade2
+ ;;
+ --distclean)
+ action=distclean
;;
--help)
help
##
## Update the CVS changelog
##
-if test "$do_changelog" = "yes"
+if test "${action}" = "changelog"
then
cvs2cl --help >/dev/null 2>&1 || exit 1
rm -f ChangeLog
- cvs2cl --hide-filenames --no-wrap -w --stdout | \
+ cvs2cl --utc --hide-filenames --no-wrap -w --stdout | \
sed -e 's/^[^0-9]/ /' -e 's/^ *$//' | \
uniq > ChangeLog
exit 0
##
## Update the MSVC project files
##
-if test "$do_vc" = "yes"
+if test "${action}" = "vc"
then
echo "generating Visual Studio files..."
##
## Update the potfiles because no one ever does it
##
-if test "$do_po" = "yes"
+if test "${action}" = "po"
then
# create a fake file containing win32 strings
rm -f modules/gui/win32/strings.cpp
##
## Create include files
##
-if test "$do_includes" = "yes"
+if test "${action}" = "includes"
then
set -x
##
## Fix glade-generated files
##
-if test "$do_glade" = "yes"
+if test "${action}" = "glade"
then
for file in modules/gui/gtk/gnome.glade modules/gui/gtk/gtk.glade modules/gui/familiar/familiar.glade
do
exit 0
fi
+##
+## Fix glade2-generated files
+##
+if test "${action}" = "glade2"
+then
+ for file in modules/gui/gtk2/gnome2.glade modules/gui/gtk2/gtk2.glade
+ do
+ echo "generating code from $file"
+ glade-2 -w $file || exit 1
+ done
+
+ exit 0
+fi
+
+##
+## Fix flexml-generated files
+##
+if test "${action}" = "flexml"
+then
+ cd modules/gui/skins/parser
+ flexml -SH -a skin.act skin.dtd
+ # comment the dummy main function
+ file=skin.c
+ sed 's@int main@//int main@' < $file > $file.$$.bak
+ mv -f $file.$$.bak $file
+ flex -oflex.c -BLs skin.l
+fi
+
+##
+## Make distclean
+##
+if test "${action}" = "distclean"
+then
+ set -x
+ # a naive sanity check to make sure we are in a VLC tree
+ test -f vlc.spec -a -f debian/rules || exit 1
+ # let's rock!
+ find . -type f '(' -name '*.[oa]' -o -name '*.so' -o -name '*.sl' -o -name '*.dylib' -o -name '*.dll' -o -name .dirstamp -o -name Makefile.in -o -name 'stamp-h*' -o -name '*~' -o -name '*.bak' -o -name '*.moc.cpp' ')' -exec rm -f '{}' ';'
+ (cd autotools && find . -name '[a-z]*' -exec rm -f '{}' ';')
+ (cd debian && find . -type d -name '[a-z]*' -maxdepth 1 -exec rm -Rf '{}' ';')
+ find msvc -type f -name '*.dsp' -exec rm -f '{}' ';'
+ find evc -type f -name '*.vcp' -exec rm -f '{}' ';'
+ #find . -type d -name '.deps' -exec rm -Rf '{}' ';'
+ # there's some more cruft all around
+ rm -f configure.ac config.h config.log config.status
+ rm -f vlc vlc-config Makefile Modules.am
+ rm -Rf autom4te.cache
+ rm -f mozilla/vlcintf.h mozilla/vlcintf.xpt
+ # FIXME: a lot of Makefiles are still there
+fi
+