]> git.sesse.net Git - vlc/blob - toolbox
Remove invert selection and select all (I simply can't figure how to do that)
[vlc] / toolbox
1 #! /bin/sh
2
3 ##  toolbox for the VLC media player
4 ##  $Id$
5 ##
6 ##  Authors: Samuel Hocevar <sam@zoy.org>
7
8 ###
9 ###  Get a sane environment, just in case
10 ###
11 LC_ALL=C
12 export LC_ALL
13 LANG=C
14 export LANG
15 CYGWIN=binmode
16 export CYGWIN
17
18 ##
19 ##  Give help
20 ##
21 help()
22 {
23   cat << EOF
24 recognized flags are:
25   --update-vc             update Microsoft Visual Studio files
26   --update-po             update translation files
27   --update-includes       generate various include files
28   --update-glade          generate and fix Glade code
29   --update-glade2         generate and fix Glade 2 code
30   --update-flexml         generate and fix flexml and flex code
31   --distclean             "make distclean" on steroids
32   --dist-contrib          add the contrib dir to MAKE_DIST
33   --make-woody <dir>      change distdir <dir> to a woody distdir
34 EOF
35   exit 1
36 }
37
38 ##
39 ##  Extract stuff from Makefile.am
40 ##
41 getfiles()
42 {
43   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" | \
44     tr '\\ ' '\n\n' | \
45     sed -ne 's/[^-$()_a-zA-Z0-9][^-$()_a-zA-Z0-9]*\([a-zA-Z]\)/\1/p' | \
46     sed -e "s,^,${srcdir}/,"
47 }
48
49 ###
50 ###  argument check
51 ###
52
53 if test "$1" = ""
54 then
55   help
56 fi
57
58 case "$1" in
59   --changelog|--update-changelog)
60     action=changelog
61     ;;
62   --update-vc)
63     action=vc
64     ;;
65   --update-po)
66     action=po
67     ;;
68   --update-includes)
69     action=includes
70     ;;
71   --update-flexml)
72     action=flexml
73     ;;
74   --update-glade|--fix-glade)
75     action=glade
76     ;;
77   --update-glade2|--update-glade-2|--fix-glade2)
78     action=glade2
79     ;;
80   --distclean)
81     action=distclean
82     ;;
83   --make-woody)
84     action=woody
85     ;;
86   --add-include)
87     action=include
88     ;;
89   --dist-contrib)
90     action=contrib
91     ;;
92   --help)
93     help
94     ;;
95   *)
96     echo "$0: unknown option $1"
97     help
98     ;;
99 esac
100 shift
101
102 ##
103 ##  Add includes to help doxygen
104 ##
105 if test "${action}" = "include"
106 then
107   case "$1" in
108     */vlc_common.h|*/include/vlc/*);;
109     */include/*.h) echo "#include <vlc_common.h>" ;;
110   esac
111   cat $1
112   exit 0
113 fi
114
115 ##
116 ##  Update the CVS changelog
117 ##
118 if test "${action}" = "changelog"
119 then
120   YEAR="`date +%Y`"
121   echo "toolbox --changelog no longer required. use this instead:"
122   echo " svn log -v -r '{$YEAR-12-31}:{$YEAR-01-01}' > ChangeLog"
123   exit 0
124 fi
125
126 ##
127 ##  Update the MSVC project files
128 ##
129 if test "${action}" = "vc"
130 then
131   echo "generating Visual Studio files"
132
133   if test -z "${srcdir}"; then
134     srcdir="`sed -ne 's/^srcdir *= *//p' < Makefile`"
135   fi
136
137   #  The evil ^M. printf '\r' does not work in Cygwin.
138   M='\r'
139
140   #  Variables we get from configure.ac
141   LIBVLC_VERSION=`sed -ne '/AC_INIT/s/.*,\(.*\))/\1/p' < configure.ac`
142   LIBVLC_CODENAME=`sed -ne '/CODENAME=/s/.*"\(.*\)"/\1/p' < configure.ac`
143   LIBVLC_SYMBOL=`echo $LIBVLC_VERSION | sed -e 'y/.-/__/'`
144
145   #  Sources that get built under Win32 - FIXME: anyone wanna deuglify this? :)
146   LIBVLC_SOURCES=`getfiles SOURCES_libvlc_common; getfiles SOURCES_libvlc_win32; getfiles SOURCES_libvlc_dirent; getfiles SOURCES_libvlc_getopt; getfiles SOURCES_libvlc_libc`
147
148   LIBVLC_HEADERS=`getfiles HEADERS_include; getfiles HEADERS_include_built`
149
150   LIBVLC_PKG_HEADERS=`getfiles dist_pkginclude_HEADERS`
151
152   # Clean up
153   rm -f evc/*.vcp msvc/*.dsp msvc/*.vcproj msvc/*.sln msvc/*.ncb
154
155   # config files
156   for target in evc/config.h msvc/config.h
157   do
158     printf "."
159     rm -f ${target}
160     sed -e "s/@CODENAME@/${LIBVLC_CODENAME}/" \
161         -e "s/@VERSION@/${LIBVLC_VERSION}/" \
162         -e "s/@SYMBOL@/${LIBVLC_SYMBOL}/" < ${target}.in > ${target}
163   done
164
165   # libvlc files
166   for target in evc/libvlc.vcp msvc/libvlc.dsp
167   do
168     printf "."
169     #  Top of the project file
170     perl -pe 'if(/§SOURCES§/){last;}' < ${target}.in > ${target}
171     #  The source files
172     for file in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep -v "/.*/"`
173     do
174       cat >> ${target} << EOF
175 # Begin Source File${M}
176 SOURCE="..\\`echo ${file} | sed -e 's%/%\\\\%g'`"${M}
177 # ADD CPP /D "__VLC__" /D PLUGIN_PATH=\\".\\" /D DATA_PATH=\\"share\\"${M}
178 # End Source File${M}
179 EOF
180     done
181     for subdir in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep "/.*/" | cut -f2 -d/ | sort | uniq`
182     do
183       cat >> ${target} << EOF
184 # Begin Group "${subdir}"${M}
185 EOF
186       for file in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep "/${subdir}/"`
187       do
188       subdir="`echo ${file} | sed -e 's%/[^/]*$%/%' | sed -e 's%/%\\\\%g'`"
189       if test "${target}" = "evc/libvlc.vcp"
190       then
191         cat >> ${target} << EOF
192 # Begin Source File${M}
193 SOURCE="..\\`echo ${file} | sed -e 's%/%\\\\%g'`"${M}
194 # ADD CPP /D "__VLC__" /D PLUGIN_PATH=\\".\\" /D DATA_PATH=\\"share\\"${M}
195 !IF "\$(CFG)" == "libvlc - Win32 (WCE MIPS) Release"${M}
196 # PROP Output_Dir "MIPSRel\\${subdir}"${M}
197 # PROP Intermediate_Dir "MIPSRel\\${subdir}"${M}
198 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE MIPS) Debug"${M}
199 # PROP Output_Dir "MIPSDbg\\${subdir}"${M}
200 # PROP Intermediate_Dir "MIPSDbg\\${subdir}"${M}
201 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE SH4) Release"${M}
202 # PROP Output_Dir "SH4Rel\\${subdir}"${M}
203 # PROP Intermediate_Dir "SH4Rel\\${subdir}"${M}
204 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE SH4) Debug"${M}
205 # PROP Output_Dir "SH4Dbg\\${subdir}"${M}
206 # PROP Intermediate_Dir "SH4Dbg\\${subdir}"${M}
207 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE SH3) Release"${M}
208 # PROP Output_Dir "SH3Rel\\${subdir}"${M}
209 # PROP Intermediate_Dir "SH3Rel\\${subdir}"${M}
210 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE SH3) Debug"${M}
211 # PROP Output_Dir "SH3Dbg\\${subdir}"${M}
212 # PROP Intermediate_Dir "SH3Dbg\\${subdir}"${M}
213 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE ARM) Release"${M}
214 # PROP Output_Dir "ARMRel\\${subdir}"${M}
215 # PROP Intermediate_Dir "ARMRel\\${subdir}"${M}
216 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE ARM) Debug"${M}
217 # PROP Output_Dir "ARMDbg\\${subdir}"${M}
218 # PROP Intermediate_Dir "ARMDbg\\${subdir}"${M}
219 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE ARMV4) Release"${M}
220 # PROP Output_Dir "ARMV4Rel\\${subdir}"${M}
221 # PROP Intermediate_Dir "ARMV4Rel\\${subdir}"${M}
222 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE ARMV4) Debug"${M}
223 # PROP Output_Dir "ARMV4Dbg\\${subdir}"${M}
224 # PROP Intermediate_Dir "ARMV4Dbg\\${subdir}"${M}
225 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE x86em) Release"${M}
226 # PROP Output_Dir "X86EMRel\\${subdir}"${M}
227 # PROP Intermediate_Dir "X86EMRel\\${subdir}"${M}
228 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE x86em) Debug"${M}
229 # PROP Output_Dir "X86EMDbg\\${subdir}"${M}
230 # PROP Intermediate_Dir "X86EMDbg\\${subdir}"${M}
231 !ELSEIF  "\$(CFG)" == "libvlc - Win32 (WCE emulator) Debug"${M}
232 # PROP Output_Dir "emulatorDbg\\${subdir}"${M}
233 # PROP Intermediate_Dir "emulatorDbg\\${subdir}"${M}
234 !ELSEIF  "\$(CFG)" == "libvlc - Win32 (WCE emulator) Release"${M}
235 # PROP Output_Dir "emulatorRel\\${subdir}"${M}
236 # PROP Intermediate_Dir "emulatorRel\\${subdir}"${M}
237 !ELSEIF  "\$(CFG)" == "libvlc - Win32 (WCE x86) Debug"${M}
238 # PROP Output_Dir "X86Dbg\\${subdir}"${M}
239 # PROP Intermediate_Dir "X86Dbg\\${subdir}"${M}
240 !ELSEIF  "\$(CFG)" == "libvlc - Win32 (WCE x86) Release"${M}
241 # PROP Output_Dir "X86Rel\\${subdir}"${M}
242 # PROP Intermediate_Dir "X86Rel\\${subdir}"${M}
243 !ENDIF${M}
244 # End Source File${M}
245 EOF
246         else
247           cat >> ${target} << EOF
248 # Begin Source File${M}
249 SOURCE="..\\`echo ${file} | sed -e 's%/%\\\\%g'`"${M}
250 # ADD CPP /D "__VLC__" /D PLUGIN_PATH=\\".\\" /D DATA_PATH=\\"share\\"${M}
251 !IF "\$(CFG)" == "libvlc - Win32 Release"${M}
252 # PROP Output_Dir "Release\\${subdir}"${M}
253 # PROP Intermediate_Dir "Release\\${subdir}"${M}
254 !ELSEIF "\$(CFG)" == "libvlc - Win32 Debug"${M}
255 # PROP Output_Dir "Debug\\${subdir}"${M}
256 # PROP Intermediate_Dir "Debug\\${subdir}"${M}
257 !ENDIF${M}
258 # End Source File${M}
259 EOF
260         fi
261       done
262       cat >> ${target} << EOF
263 # End Group${M}
264 EOF
265     done
266     #  The headers
267     perl -e 'while(<>){if(/§SOURCES§/){last;}}while(<>){if(/§HEADERS§/){last;}print $_}' < ${target}.in >> ${target}
268     for file in ${LIBVLC_HEADERS}
269     do
270       cat >> ${target} << EOF
271 # Begin Source File${M}
272 SOURCE="..\\`echo ${file} | sed -e 's%/%\\\\%g'`"${M}
273 # End Source File${M}
274 EOF
275     done
276     cat >> ${target} << EOF
277 # Begin Group "vlc"${M}
278 EOF
279     for file in ${LIBVLC_PKG_HEADERS}
280     do
281       cat >> ${target} << EOF
282 # Begin Source File${M}
283 SOURCE="..\\`echo ${file} | sed -e 's%/%\\\\%g'`"${M}
284 # End Source File${M}
285 EOF
286     done
287     cat >> ${target} << EOF
288 # End Group${M}
289 EOF
290     perl -e 'while(<>){if(/§HEADERS§/){last;}}while(<>){print $_}' < ${target}.in >> ${target}
291   done
292
293   # plugins files
294   for dir in `sed -ne 's,modules/\(.*\)/Makefile,\1,p' ${srcdir}/configure.ac`
295   do
296     mf="${srcdir}/modules/${dir}/Modules.am"
297     for mod in `sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf}`
298     do
299       # this is an attempt at getting a list of plugin sources... we take the
300       # production and remove everything that does not contain "module", which
301       # means you miss $(NULL), but other variables too.
302       allfiles=`grep -v '[^-_a-zA-Z0-9]*#' ${mf} | awk 'BEGIN{a=0}{if(!a&&$0~/^SOURCES_'${mod}'[^-_a-zA-Z0-9]*=/){a=1;print$0;next;}if(a){if($0~/^[a-zA-Z]/){exit;}print $0}}' | tr '\\ ' '\n\n' | grep '\.'`
303       hfiles=`for i in ${allfiles} ; do echo "$i" ; done | grep '\.h$'`
304       cfiles=`for i in ${allfiles} ; do echo "$i" ; done | grep -v '\.h$'`
305       for msdir in evc msvc
306       do
307         test "${msdir}" = "evc" && suf="vcp" || suf="dsp"
308         source="${msdir}/plugins.${suf}.in"
309         target="${msdir}/plugin_${mod}.${suf}"
310         printf "."
311         perl -pe 'if(/§SOURCES§/){last;} s/§PLUGIN§/'${mod}'/g' < ${source} > ${target}
312         for cfile in ${cfiles}
313         do
314           cat >> ${target} << EOF
315 # Begin Source File${M}
316 SOURCE="..\\modules\\`echo ${dir}/${cfile} | sed 's,/,\\\\,g'`"${M}
317 # ADD CPP /D "__VLC__" /D "__PLUGIN__"  /D "MODULE_NAME=${mod}" /D "MODULE_NAME_IS_${mod}" ${M}
318 !IF "\$(CFG)" == "plugin_${mod} - Win32 Release"${M}
319 # PROP Output_Dir "Release\\modules\\`echo ${dir} | sed 's,/,\\\\,g'`"${M}
320 # PROP Intermediate_Dir "Release\\modules\\`echo ${dir} | sed 's,/,\\\\,g'`"${M}
321 !ELSEIF "\$(CFG)" == "plugin_${mod} - Win32 Debug"${M}
322 # PROP Output_Dir "Debug\\modules\\`echo ${dir} | sed 's,/,\\\\,g'`"${M}
323 # PROP Intermediate_Dir "Debug\\modules\\`echo ${dir} | sed 's,/,\\\\,g'`"${M}
324 # End Source File${M}
325 EOF
326         done
327         # sed is really nicer for this... unfortunately it's broken under cygwin
328         # sed -ne '1,/§SOURCES§/d; /§HEADERS§/,$d; p' < ${source} >> ${target}
329         perl -e 'while(<>){if(/§SOURCES§/){last;}}while(<>){if(/§HEADERS§/){last;}print $_}' < ${source} >> ${target}
330         for hfile in ${hfiles}
331         do
332           cat >> ${target} << EOF
333 # Begin Source File${M}
334 SOURCE="..\\modules\\`echo ${dir}/${hfile} | sed 's,/,\\\\,g'`"${M}
335 # End Source File${M}
336 EOF
337         done
338         # sed -ne '1,/§HEADERS§/d; p' < ${source} >> ${target}
339         perl -e 'while(<>){if(/§HEADERS§/){last;}}while(<>){print $_}' < ${source} >> ${target}
340       done
341     done
342   done
343
344   # vlc files
345   for target in evc/vlc.vcp msvc/vlc.dsp
346   do
347     printf "."
348     #  Top of the project file
349     perl -pe 'if(/§SOURCES§/){last;}' < ${target}.in > ${target}
350     #  The source files
351       cat >> ${target} << EOF
352 # Begin Source File${M}
353 SOURCE="..\\src\\vlc.c"${M}
354 # End Source File${M}
355 EOF
356     #  Bottom of the project file - handles resource files too
357     perl -e 'while(<>){if(/§SOURCES§/){last;}}while(<>){print $_}' < ${target}.in >> ${target}
358   done
359
360   echo " done."
361   exit 0
362 fi
363
364 ##
365 ##  Update the potfiles because no one ever does it
366 ##
367 if test "${action}" = "po"
368 then
369   # find out the source files
370   rm -f po/POTFILES.in
371   echo "# automatically created by toolbox --update-po" > po/POTFILES.in
372   echo "" >> po/POTFILES.in
373   echo "# main sources" >> po/POTFILES.in
374   find include src -name '*.[chm]' -o -name '*.[ch]pp' \
375     | grep -v '\(vlc_symbols\|misc/modules_\)' \
376     | sort >> po/POTFILES.in
377   echo "" >> po/POTFILES.in
378   echo "# modules" >> po/POTFILES.in
379   find modules -name '*.[chm]' -o -name '*.[ch]pp' \
380     | grep -v '\(\.moc\.\|gui/gtk2/\)' \
381     | sort >> po/POTFILES.in
382   # clean old potfiles
383   cd po
384   rm -f vlc.pot
385   # update
386   make vlc.pot || exit 1
387   make update-po || exit 1
388   cd ..
389
390   exit 0
391 fi
392
393 ##
394 ##  Create include files
395 ##
396 if test "${action}" = "includes"
397 then
398   #set -x
399
400   if test -z "${srcdir}"; then
401     srcdir="`sed -ne 's/^srcdir *= *//p' < Makefile`"
402   fi
403   if test -z "${builddir}"; then
404     builddir="`sed -ne 's/^top_builddir *= *//p' < Makefile`"
405   fi
406   mkdir -p "${builddir}/include"
407
408   LIBVLC_HEADERS=`getfiles HEADERS_include`
409   BUILTINS=`sed -ne 's/.*builtins *= *" *\([^"]*\)".*/\1/p' vlc-config`
410
411   file="${builddir}/include/vlc_symbols.h"
412
413   rm -f ${file}.in
414   echo '/* DO NOT EDIT THIS FILE! See Makefile.am */' >> ${file}.in
415   echo 'struct module_symbols_t {' >> ${file}.in
416   cat ${LIBVLC_HEADERS} | grep '^ *VLC_EXPORT.*;' | sed -e 's/VLC_EXPORT( *\([^,]*\), *\([^,]*\), *\(.*\));.*/    \1 (* \2_inner) \3;/' >> ${file}.in
417   echo '};' >> ${file}.in
418   echo '#ifdef __PLUGIN__' >> ${file}.in
419   cat ${LIBVLC_HEADERS} | grep '^ *VLC_EXPORT.*;' | sed -e 's/VLC_EXPORT( *\([^,]*\), *\([^,]*\), *\(.*\));.*/#   define \2 p_symbols->\2_inner/' >> ${file}.in
420   echo '#endif /* __PLUGIN__ */' >> ${file}.in
421   if diff >/dev/null 2>&1 ${file} ${file}.in
422   then
423     rm -f ${file}.in
424   else
425     echo "creating new ${file}"
426     mv -f ${file}.in ${file}
427   fi
428
429   file="${builddir}/src/misc/modules_plugin.h"
430
431   rm -f ${file}.tmp
432   sed -e 's#.*\$[I][d]:.*# * Automatically generated from '${file}'.in by bootstrap#' < ${srcdir}/src/misc/modules_plugin.h.in > ${file}.tmp
433   echo '#define STORE_SYMBOLS( p_symbols ) \' >> ${file}.tmp
434   cat ${LIBVLC_HEADERS} | grep '^ *VLC_EXPORT.*;' | sed -e 's/VLC_EXPORT( *\([^,]*\), *\([^,]*\), *\(.*\));.*/    (p_symbols)->\2_inner = \2; \\/' >> ${file}.tmp
435   echo '' >> ${file}.tmp
436   if diff >/dev/null 2>&1 ${file} ${file}.tmp
437   then
438     rm -f ${file}.tmp
439   else
440     echo "creating new ${file}"
441     mv -f ${file}.tmp ${file}
442   fi
443
444   file="${builddir}/src/misc/modules_builtin.h"
445
446   rm -f ${file}.tmp && cp ${srcdir}/src/misc/modules_builtin.h.in ${file}.tmp
447   if test -n "${BUILTINS}"
448   then
449     for i in `echo ${BUILTINS}`
450     do
451       echo "int vlc_entry__`echo $i | sed -e 'y@/@_@' -e 's@\..*@@'`( module_t* );" >>${file}.tmp
452     done
453     echo "" >> ${file}.tmp
454   fi
455   echo "#define ALLOCATE_ALL_BUILTINS() \\" >> ${file}.tmp
456   echo "    do \\" >> ${file}.tmp
457   echo "    { \\" >> ${file}.tmp
458   if test -n "${BUILTINS}"
459   then
460     for i in `echo ${BUILTINS}`
461     do
462       echo "        ALLOCATE_BUILTIN(`echo $i | sed -e 'y@/@_@' -e 's@\..*@@'`); \\" >> ${file}.tmp
463     done
464   fi
465   echo "    } while( 0 );" >> ${file}.tmp
466   echo "" >> ${file}.tmp
467   if diff >/dev/null 2>&1 ${file} ${file}.tmp
468   then
469     rm -f ${file}.tmp
470   else
471     echo "creating new ${file}"
472     mv -f ${file}.tmp ${file}
473   fi
474
475   exit 0
476 fi
477
478 ##
479 ##  Fix glade-generated files
480 ##
481 if test "${action}" = "glade"
482 then
483   for file in modules/gui/gtk/gnome.glade modules/gui/gtk/gtk.glade modules/gui/familiar/familiar.glade
484   do
485     echo "generating code from $file"
486     glade -w $file || exit 1
487   done
488
489   for file in modules/gui/gtk/gnome_interface.c modules/gui/gtk/gtk_interface.c modules/gui/familiar/interface.c
490   do
491     echo "fixing $file"
492     if grep "DO NOT EDIT THIS FILE" $file >/dev/null 2>&1
493     then
494       rm -f $file.$$.bak
495       cat > $file.$$.bak << EOF
496 /* This file was created automatically by glade and fixed by bootstrap */
497
498 #include <vlc/vlc.h>
499 EOF
500       sed -e 1,7d \
501           -e 's#_(\(".:..:.."\))#\1#' \
502           -e 's#_(\("[a-z0-9]*://[^"]*"\))#\1#' \
503           -e 's#_("---")#"---"#' \
504           -e 's#_("--")#"--"#' \
505           -e 's#_(\("/dev/[^"]*"\))#"\1"#' \
506           -e 's#_(\("./."\))#\1#' \
507           < $file >> $file.$$.bak
508       mv -f $file.$$.bak $file
509     fi
510   done
511
512   for file in modules/gui/gtk/gtk_support.h modules/gui/familiar/support.h
513   do
514     echo "fixing $file"
515     if grep "DO NOT EDIT THIS FILE" $file >/dev/null 2>&1
516     then
517       rm -f $file.$$.bak
518       sed -e 's/DO NOT EDIT.*/Created by glade, fixed by bootstrap/' \
519           -e 's,<config.h>,<vlc/vlc.h>,' \
520           -e 's,#if.*ENABLE_NLS.*,#if 0 /* Disabled by bootstrap */,' \
521           -e 's,#else,/* & */,' \
522           < $file > $file.$$.bak
523       mv -f $file.$$.bak $file
524     fi
525   done
526
527   exit 0
528 fi
529
530 ##
531 ##  Fix glade2-generated files
532 ##
533 if test "${action}" = "glade2"
534 then
535   for file in modules/gui/gtk2/gnome2.glade modules/gui/gtk2/gtk2.glade modules/gui/pda/pda.glade
536   do
537     echo "generating code from $file"
538     glade-2 -w $file || exit 1
539   done
540
541   for file in modules/gui/pda/pda_interface.c
542   do
543     echo "fixing $file"
544     if grep "DO NOT EDIT THIS FILE" $file >/dev/null 2>&1
545     then
546       rm -f $file.$$.bak
547       cat > $file.$$.bak << EOF
548 /* This file was created automatically by glade2 and fixed by bootstrap */
549
550 #include <vlc/vlc.h>
551 EOF
552       sed -e 1,7d \
553           -e 's#_(\(".:..:.."\))#\1#' \
554           -e 's#_(\("[a-z0-9]*://[^"]*"\))#\1#' \
555           -e 's#_("---")#"---"#' \
556           -e 's#_("--")#"--"#' \
557           -e 's#_(\("/dev/[^"]*"\))#\1#' \
558           -e 's#_(\("./."\))#\1#' \
559           < $file >> $file.$$.bak
560       mv -f $file.$$.bak $file
561     fi
562   done
563
564   exit 0
565 fi
566
567 ##
568 ##  Make distclean
569 ##
570 if test "${action}" = "distclean"
571 then
572   set -x
573   # a naive sanity check to make sure we are in a VLC tree
574   test -f vlc.spec.mdk -a -f debian/rules || exit 1
575   # let's rock!
576   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 '{}' ';'
577   (cd autotools && find . -name '[a-z]*' -maxdepth 1 -exec rm -f '{}' ';')
578   (cd debian && find . -type d -name '[a-z]*' -maxdepth 1 -exec rm -Rf '{}' ';')
579   find msvc -type f -name '*.dsp' -exec rm -f '{}' ';'
580   find evc -type f -name '*.vcp' -exec rm -f '{}' ';'
581   #find . -type d -name '.deps' -exec rm -Rf '{}' ';'
582   # there's some more cruft all around
583   rm -f config.h config.log config.status
584   rm -f vlc vlc-config Makefile Modules.am
585   rm -Rf autom4te.cache
586   rm -f mozilla/vlcintf.h mozilla/vlcintf.xpt
587   # FIXME: a lot of Makefiles are still there
588 fi
589
590 ##
591 ## Add the extras/contrib dir to the distribution
592 ##
593 if test "${action}" = "contrib"
594 then
595   set -x
596   if test ! -d "${distdir}/extras"
597   then
598     mkdir "${distdir}/extras"
599   fi
600   if test ! -d "${distdir}/extras/contrib"
601   then
602     mkdir "${distdir}/extras/contrib"
603   fi
604   cp "${srcdir}/extras/contrib/Makefile" "${distdir}/extras/contrib/Makefile"
605   cp "${srcdir}/extras/contrib/README" "${distdir}/extras/contrib/README"
606   cp "${srcdir}/extras/contrib/bootstrap" "${distdir}/extras/contrib/bootstrap"
607   cp "${srcdir}/extras/contrib/change_prefix.sh" "${distdir}/extras/contrib/change_prefix.sh"
608   if test ! -d "${distdir}/extras/contrib/src"
609   then
610     mkdir "${distdir}/extras/contrib/src"
611   fi
612   cp "${srcdir}/extras/contrib/src/Makefile" "${distdir}/extras/contrib/src/Makefile"
613   cp "${srcdir}/extras/contrib/src/packages.mak" "${distdir}/extras/contrib/src/packages.mak"
614   if test ! -d "${distdir}/extras/contrib/src/Patches"
615   then
616     mkdir "${distdir}/extras/contrib/src/Patches"
617   fi
618   cp ${srcdir}/extras/contrib/src/Patches/* "${distdir}/extras/contrib/src/Patches/"
619 fi
620
621 ##
622 ##  Build a woody-friendly package
623 ##
624 if test "${action}" = "woody"
625 then
626   set -ex
627   test -d "$1"
628
629   # changelog: replace (1.2.3-4) with (1.2.3-0woody.4)
630   sed -e 's/^vlc (\([^)]*\)-\([^-)]*\))/vlc-woody (\1-0woody.\2)/' \
631       -e 's/ unstable; / stable; /' \
632       < "$1/debian/changelog" > "$1/debian/changelog.woody"
633   mv "$1/debian/changelog.woody" "$1/debian/changelog"
634
635   # control: replace liba52-*-dev with a52dec-dev (>=0.7.3)
636   #                  libdv*-dev with libdv-dev
637   #                  kdelibs4-dev with kdelibs-dev
638   #                  libqt3-mt-dev libqt3-compat-headers with libqt-dev
639   #                  libarts1-dev with libarts-dev
640   #                  libdvdread3-dev with libdvdread2-dev
641   #                  libdvdplay0-dev (>=1.0.1-2) with libdvdplay0-dev
642   #                  libxosd-dev (>=2.2.4-1.3) with libxosd-dev
643   #                  ttf-freefont with ttf-thryomanes
644   #                  dvb-dev (>= 1.0.1-6) with dvb-dev
645   #          remove libwxgtk2.4-dev
646   #                 libidl0 (workaround for mozilla-dev's bad deps)
647   #                 libglib2.0-0 (workaround for mozilla-dev's bad deps)
648   #                 gcc-3.2 (workaround for an ICE in gcc-3.3)
649   #          change Section: gnome with Section: graphics
650   #                 Section: kde with Section: kde
651   #                 Section: libdevel with Section: devel
652   sed -e 's/liba52-[^-]*-dev/a52dec-dev (>=0.7.3)/' \
653       -e 's/libdv[0-9]*-dev/libdv-dev/' \
654       -e 's/kdelibs[0-9]*-dev/kdelibs-dev/' \
655       -e 's/libqt[0-9]*-mt-dev/libqt-dev/' \
656       -e 's/, libqt[0-9]*-compat-headers[^,]*//' \
657       -e 's/libarts[0-9]*-dev/libarts-dev/' \
658       -e 's/libdvdread[0-9]*-dev/libdvdread2-dev/' \
659       -e 's/, libdvdplay0-dev[^,]*/, libdvdplay0-dev/' \
660       -e 's/, libxosd-dev[^,]*/, libxosd-dev/' \
661       -e 's/, ttf-freefont[^,]*/, ttf-thryomanes/' \
662       -e 's/, dvb-dev[^,]*/, dvb-dev/' \
663       -e 's/, libwx[^,]*//' \
664       -e '/Package: wxvlc/,/^ *$/d' \
665       -e 's/, libidl0[^,]*//' \
666       -e 's/, libglib2.0-0[^,]*//' \
667       -e 's/, gcc-3.2[^,]*//' \
668       -e 's/Section: gnome/Section: graphics/' \
669       -e 's/Section: kde/Section: graphics/' \
670       -e 's/Section: libdevel/Section: devel/' \
671       < "$1/debian/control" > "$1/debian/control.woody"
672   mv "$1/debian/control.woody" "$1/debian/control"
673
674   # rules: remove wxwindows and skins stuff
675   sed -e '/# Package: wxvlc/,/^ *$/d' \
676       -e 's,--enable-wxwindows,--disable-wxwindows,' \
677       -e 's,--enable-skins,--disable-skins,' \
678       < "$1/debian/rules" > "$1/debian/rules.woody"
679   mv "$1/debian/rules.woody" "$1/debian/rules"
680   chmod 0755 "$1/debian/rules"
681
682   # modules/misc/freetype.c: replace the default font
683   sed -e 's,freefont/FreeSerifBold.ttf,thryomanes/thryb___.ttf,' \
684       < "$1/modules/misc/freetype.c" > "$1/modules/misc/freetype.c.woody"
685   mv "$1/modules/misc/freetype.c.woody" "$1/modules/misc/freetype.c"
686 fi
687