- #! /bin/sh
- ## toolbox for the VLC media player
- ## $Id: toolbox 9292 2004-11-12 10:44:50Z gbazin $
- ##
- ## Authors: Samuel Hocevar <sam@zoy.org>
- ###
- ### Get a sane environment, just in case
- ###
- LC_ALL=C
- export LC_ALL
- LANG=C
- export LANG
- CYGWIN=binmode
- export CYGWIN
- ##
- ## Give help
- ##
- help()
- {
- cat << EOF
- recognized flags are:
- --update-vc update Microsoft Visual Studio files
- --update-po update translation files
- --update-includes 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" on steroids
- --make-woody <dir> change distdir <dir> to a woody distdir
- EOF
- exit 1
- }
- ##
- ## Extract stuff from Makefile.am
- ##
- getfiles()
- {
- awk 'BEGIN{a=0}{if(!a&&$0~/^'"$1"'[^-_a-zA-Z0-9]*=/){a=1;print$0;next;}if(a){if($0~/^[a-zA-Z]/){exit;}print $0}}' < "${srcdir}/Makefile.am" |
- tr '\ ' 'nn' |
- sed -ne 's/[^-$()_a-zA-Z0-9][^-$()_a-zA-Z0-9]*([a-zA-Z])/1/p' |
- sed -e "s,^,${srcdir}/,"
- }
- ###
- ### argument check
- ###
- if test "$1" = ""
- then
- help
- fi
- case "$1" in
- --changelog|--update-changelog)
- action=changelog
- ;;
- --update-vc)
- action=vc
- ;;
- --update-po)
- action=po
- ;;
- --update-includes)
- action=includes
- ;;
- --update-flexml)
- action=flexml
- ;;
- --update-glade|--fix-glade)
- action=glade
- ;;
- --update-glade2|--update-glade-2|--fix-glade2)
- action=glade2
- ;;
- --distclean)
- action=distclean
- ;;
- --make-woody)
- action=woody
- ;;
- --add-include)
- action=include
- ;;
- --help)
- help
- ;;
- *)
- echo "$0: unknown option $1"
- help
- ;;
- esac
- shift
- ##
- ## Add includes to help doxygen
- ##
- if test "${action}" = "include"
- then
- case "$1" in
- */vlc_common.h|*/include/vlc/*);;
- */include/*.h) echo "#include <vlc_common.h>" ;;
- esac
- cat $1
- exit 0
- fi
- ##
- ## Update the CVS changelog
- ##
- if test "${action}" = "changelog"
- then
- YEAR="`date +%Y`"
- echo "toolbox --changelog no longer required. use this instead:"
- echo " svn log -v -r '{$YEAR-12-31}:{$YEAR-01-01}' > ChangeLog"
- exit 0
- fi
- ##
- ## Update the MSVC project files
- ##
- if test "${action}" = "vc"
- then
- echo "generating Visual Studio files"
- if test -z "${srcdir}"; then
- srcdir="`sed -ne 's/^srcdir *= *//p' < Makefile`"
- fi
- # The evil ^M. printf 'r' does not work in Cygwin.
- M=' '
- # Variables we get from configure.ac
- LIBVLC_VERSION=`sed -ne '/AC_INIT/s/.*,(.*))/1/p' < configure.ac`
- LIBVLC_CODENAME=`sed -ne '/CODENAME=/s/.*"(.*)"/1/p' < configure.ac`
- LIBVLC_SYMBOL=`echo $LIBVLC_VERSION | sed -e 'y/.-/__/'`
- # Sources that get built under Win32 - FIXME: anyone wanna deuglify this? :)
- LIBVLC_SOURCES=`getfiles SOURCES_libvlc_common; getfiles SOURCES_libvlc_win32; getfiles SOURCES_libvlc_dirent; getfiles SOURCES_libvlc_getopt; getfiles SOURCES_libvlc_libc`
- LIBVLC_HEADERS=`getfiles HEADERS_include; getfiles HEADERS_include_built`
- LIBVLC_PKG_HEADERS=`getfiles dist_pkginclude_HEADERS`
- # Clean up
- rm -f evc/*.vcp msvc/*.dsp msvc/*.vcproj msvc/*.sln msvc/*.ncb
- # config files
- for target in evc/config.h msvc/config.h
- do
- printf "."
- rm -f ${target}
- sed -e "s/@CODENAME@/${LIBVLC_CODENAME}/"
- -e "s/@VERSION@/${LIBVLC_VERSION}/"
- -e "s/@SYMBOL@/${LIBVLC_SYMBOL}/" < ${target}.in > ${target}
- done
- # libvlc files
- for target in evc/libvlc.vcp msvc/libvlc.dsp
- do
- printf "."
- # Top of the project file
- perl -pe 'if(/