Fixed RSS text positionning (close #3115).
[vlc/solaris.git] / toolbox
blob32519a19ad478d1be46ae1de055b460bd1507a1c
1 #! /bin/sh
4 ## toolbox for the VLC media player
5 ## $Id$
6 ##
7 ## Copyright (C) 2002-2006 the VideoLAN team
8 ##
9 ## Authors: Samuel Hocevar <sam@zoy.org>
10 ## RĂ©mi Denis-Courmont <rem # videolan.org>
12 ###
13 ### Get a sane environment, just in case
14 ###
15 LC_ALL=C
16 export LC_ALL
17 LANG=C
18 export LANG
19 CYGWIN=binmode
20 export CYGWIN
23 ## Give help
25 help()
27 cat << EOF
28 recognized flags are:
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
35 EOF
36 exit 1
40 ## Extract stuff from Makefile.am
42 getfiles()
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" | \
45 tr '\\ ' '\n\n' | \
46 sed -ne 's/[^-$()_a-zA-Z0-9][^-$()_a-zA-Z0-9]*\([a-zA-Z]\)/\1/p' | \
47 sed -e "s,^,${srcdir}/,"
50 ###
51 ### argument check
52 ###
54 if test "$1" = ""
55 then
56 help
59 case "$1" in
60 --changelog|--update-changelog)
61 action=changelog
63 --update-po)
64 action=po
66 --update-includes)
67 action=includes
69 --update-flexml)
70 action=flexml
72 --update-glade2|--update-glade-2|--fix-glade2)
73 action=glade2
75 --distclean)
76 action=distclean
78 --add-include)
79 action=include
81 --dist-contrib)
82 action=contrib
84 --help)
85 help
88 echo "$0: unknown option $1"
89 help
91 esac
92 shift
95 ## Add includes to help doxygen
97 if test "${action}" = "include"
98 then
99 case "$1" in
100 */vlc_common.h|*/include/vlc/*);;
101 */include/*.h) echo "#include <vlc_common.h>" ;;
102 esac
103 cat $1
104 exit 0
108 ## Update the CVS changelog
110 if test "${action}" = "changelog"
111 then
112 YEAR="`date +%Y`"
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"
115 exit 0
119 ## Update the potfiles because no one ever does it
121 if test "${action}" = "po"
122 then
123 # find out the source files
124 echo "WARNING: you should run \"make update-po\" instead!" >&2
125 make update-po
126 exit $?
130 ## Create include files
132 if test "${action}" = "includes"
133 then
134 #set -x
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"
146 rm -f "${file}.tmp"
147 mkdir -p -- "${builddir}/src/modules"
148 cat "${srcdir}/src/modules/builtin.h.in" > "${file}.tmp" || exit 1
149 if test -n "${BUILTINS}"
150 then
151 for i in `echo ${BUILTINS}`
153 echo "int vlc_entry__`echo $i | sed -e 'y@/@_@' -e 's@\..*@@'`( module_t* );" >> "${file}.tmp"
154 done
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}"
161 then
162 for i in `echo ${BUILTINS}`
164 echo " ALLOCATE_BUILTIN(`echo $i | sed -e 'y@/@_@' -e 's@\..*@@'`); \\" >> "${file}.tmp"
165 done
167 echo " } while( 0 );" >> "${file}.tmp"
168 echo "" >> "${file}.tmp" || exit 1
169 if diff >/dev/null 2>&1 "${file}" "${file}.tmp"
170 then
171 rm -f "${file}.tmp"
172 else
173 echo "creating new ${file}"
174 mv -f "${file}.tmp" "${file}"
177 exit 0
181 ## Fix glade2-generated files
183 if test "${action}" = "glade2"
184 then
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"
190 echo "fixing $file"
191 if grep "DO NOT EDIT THIS FILE" "$file" >/dev/null 2>&1
192 then
193 rm -f -- "$file.$$.bak"
194 cat > "$file.$$.bak" << EOF
195 /* This file was created automatically by glade2 and fixed by bootstrap */
197 #ifdef HAVE_CONFIG_H
198 # include "config.h"
199 #endif
201 #include <vlc/vlc.h>
203 sed -e 1,7d \
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"
214 exit 0
218 ## Make distclean
220 if test "${action}" = "distclean"
221 then
222 set -x
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
225 # let's rock!
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"
244 then
245 set -x
246 if test ! -d "${distdir}/extras"
247 then
248 mkdir "${distdir}/extras"
250 if test ! -d "${distdir}/extras/contrib"
251 then
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"
259 then
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"
265 then
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"
270 then
271 mkdir "${distdir}/extras/contrib/src/Distributions"
273 cp ${srcdir}/extras/contrib/src/Distributions/* "${distdir}/extras/contrib/src/Distributions/"