4 ## toolbox for the VLC media player
7 ## Copyright (C) 2002-2006 the VideoLAN team
9 ## Authors: Samuel Hocevar <sam@zoy.org>
10 ## RĂ©mi Denis-Courmont <rem # videolan.org>
13 ### Get a sane environment, just in case
29 --update-po update translation files
30 --update-includes generate various include files
31 --update-glade2 generate and fix Glade 2 code
32 --update-flexml generate and fix flexml and flex code
33 --distclean "make distclean" on steroids
34 --dist-contrib add the contrib dir to MAKE_DIST
40 ## Extract stuff from Makefile.am
44 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" | \
46 sed -ne 's/[^-$()_a-zA-Z0-9][^-$()_a-zA-Z0-9]*\([a-zA-Z]\)/\1/p' | \
47 sed -e "s,^,${srcdir}/,"
60 --changelog|--update-changelog)
72 --update-glade2|--update-glade-2|--fix-glade2)
88 echo "$0: unknown option $1"
95 ## Add includes to help doxygen
97 if test "${action}" = "include"
100 */vlc_common.h|*/include/vlc/*);;
101 */include/*.h) echo "#include <vlc_common.h>" ;;
108 ## Update the CVS changelog
110 if test "${action}" = "changelog"
113 echo "toolbox --changelog no longer required. use this instead:"
114 echo " LANG=C svn log -v -r '{$YEAR-12-31}:{$YEAR-01-01}' > ChangeLog"
119 ## Update the potfiles because no one ever does it
121 if test "${action}" = "po"
123 # find out the source files
124 echo "WARNING: you should run \"make update-po\" instead!" >&2
130 ## Create include files
132 if test "${action}" = "includes"
136 if test -z "${srcdir}"; then
137 srcdir="`sed -ne 's/^srcdir *= *//p' < Makefile`"
139 if test -z "${builddir}"; then
140 builddir="`sed -ne 's/^top_builddir *= *//p' < Makefile`"
142 BUILTINS=`sed -ne 's/.*builtins *= *" *\([^"]*\)".*/\1/p' ${builddir}/vlc-config`
144 file="${builddir}/src/modules/builtin.h"
147 mkdir -p -- "${builddir}/src/modules"
148 cat "${srcdir}/src/modules/builtin.h.in" > "${file}.tmp" || exit 1
149 if test -n "${BUILTINS}"
151 for i in `echo ${BUILTINS}`
153 echo "int vlc_entry__`echo $i | sed -e 'y@/@_@' -e 's@\..*@@'`( module_t* );" >> "${file}.tmp"
155 echo "" >> "${file}.tmp"
157 echo "#define ALLOCATE_ALL_BUILTINS() \\" >> ${file}.tmp
158 echo " do \\" >> "${file}.tmp"
159 echo " { \\" >> "${file}.tmp"
160 if test -n "${BUILTINS}"
162 for i in `echo ${BUILTINS}`
164 echo " ALLOCATE_BUILTIN(`echo $i | sed -e 'y@/@_@' -e 's@\..*@@'`); \\" >> "${file}.tmp"
167 echo " } while( 0 );" >> "${file}.tmp"
168 echo "" >> "${file}.tmp" || exit 1
169 if diff >/dev/null 2>&1 "${file}" "${file}.tmp"
173 echo "creating new ${file}"
174 mv -f "${file}.tmp" "${file}"
181 ## Fix glade2-generated files
183 if test "${action}" = "glade2"
185 file="modules/gui/pda/pda.glade"
186 echo "generating code from $file"
187 glade-2 -w "$file" || exit 1
189 file="modules/gui/pda/pda_interface.c"
191 if grep "DO NOT EDIT THIS FILE" "$file" >/dev/null 2>&1
193 rm -f -- "$file.$$.bak"
194 cat > "$file.$$.bak" << EOF
195 /* This file was created automatically by glade2 and fixed by bootstrap */
204 -e 's#_(\(".:..:.."\))#\1#' \
205 -e 's#_(\("[a-z0-9]*://[^"]*"\))#\1#' \
206 -e 's#_("---")#"---"#' \
207 -e 's#_("--")#"--"#' \
208 -e 's#_(\("/dev/[^"]*"\))#\1#' \
209 -e 's#_(\("./."\))#\1#' \
210 < "$file" >> "$file.$$.bak"
211 mv -f "$file.$$.bak" "$file"
220 if test "${action}" = "distclean"
223 # a naive sanity check to make sure we are in a VLC tree
224 test -f vlc-config.in.in -a -f src/libvlc.c || exit 1
226 find . -false -path './extras/contrib/*' -type f '(' -name '*.[oa]' -o -name '*.l[oa]' -o -name '*.so' -o -name '*.sl' -o -name '*.dylib' -o -name '*.dll' -o -name .dirstamp -o '(' '(' ! -path '\./doc/developer/Makefile\.in' ')' -a -name Makefile.in ')' -o -name 'stamp-h*' -o -name '*~' -o -name '*.bak' -o -name '*.moc.cpp' ')' -exec rm -f '{}' ';'
227 (cd autotools && find . -maxdepth 1 -name '[a-z]*' -not -name 'config.rpath' -exec rm -f '{}' ';')
228 find . -type d -name '.deps' -exec rm -Rf '{}' ';'
229 find . -type d -name '.libs' -exec rm -Rf '{}' ';'
230 # there's some more cruft all around
231 rm -f config.h config.log config.status
232 rm -f vlc vlc-config Makefile Modules.am
233 rm -Rf autom4te.cache
234 echo "\`toolbox --distclean\' is known to be broken."
235 echo "Don't complain if it does not work, or better yet, don't use it."
236 echo "You were warned."
237 # FIXME: a lot of Makefiles are still there
241 ## Add the extras/contrib dir to the distribution
243 if test "${action}" = "contrib"
246 if test ! -d "${distdir}/extras"
248 mkdir "${distdir}/extras"
250 if test ! -d "${distdir}/extras/contrib"
252 mkdir "${distdir}/extras/contrib"
254 cp "${srcdir}/extras/contrib/Makefile" "${distdir}/extras/contrib/Makefile"
255 cp "${srcdir}/extras/contrib/README" "${distdir}/extras/contrib/README"
256 cp "${srcdir}/extras/contrib/bootstrap" "${distdir}/extras/contrib/bootstrap"
257 cp "${srcdir}/extras/contrib/change_prefix.sh" "${distdir}/extras/contrib/change_prefix.sh"
258 if test ! -d "${distdir}/extras/contrib/src"
260 mkdir "${distdir}/extras/contrib/src"
262 cp "${srcdir}/extras/contrib/src/Makefile" "${distdir}/extras/contrib/src/Makefile"
263 cp "${srcdir}/extras/contrib/src/packages.mak" "${distdir}/extras/contrib/src/packages.mak"
264 if test ! -d "${distdir}/extras/contrib/src/Patches"
266 mkdir "${distdir}/extras/contrib/src/Patches"
268 cp ${srcdir}/extras/contrib/src/Patches/* "${distdir}/extras/contrib/src/Patches/"
269 if test ! -d "${distdir}/extras/contrib/src/Distributions"
271 mkdir "${distdir}/extras/contrib/src/Distributions"
273 cp ${srcdir}/extras/contrib/src/Distributions/* "${distdir}/extras/contrib/src/Distributions/"