]> git.sesse.net Git - vlc/blob - toolbox
ActiveX: misc fixes & improvements
[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   LIBVLC_HEADERS=`getfiles HEADERS_include`
404   BUILTINS=`sed -ne 's/.*builtins *= *" *\([^"]*\)".*/\1/p' vlc-config`
405
406   file="${srcdir}/include/vlc_symbols.h"
407
408   rm -f ${file}.in
409   echo '/* DO NOT EDIT THIS FILE! See Makefile.am */' >> ${file}.in
410   echo 'struct module_symbols_t {' >> ${file}.in
411   cat ${LIBVLC_HEADERS} | grep '^ *VLC_EXPORT.*;' | sed -e 's/VLC_EXPORT( *\([^,]*\), *\([^,]*\), *\(.*\));.*/    \1 (* \2_inner) \3;/' >> ${file}.in
412   echo '};' >> ${file}.in
413   echo '#ifdef __PLUGIN__' >> ${file}.in
414   cat ${LIBVLC_HEADERS} | grep '^ *VLC_EXPORT.*;' | sed -e 's/VLC_EXPORT( *\([^,]*\), *\([^,]*\), *\(.*\));.*/#   define \2 p_symbols->\2_inner/' >> ${file}.in
415   echo '#endif /* __PLUGIN__ */' >> ${file}.in
416   if diff >/dev/null 2>&1 ${file} ${file}.in
417   then
418     rm -f ${file}.in
419   else
420     echo "creating new ${file}"
421     mv -f ${file}.in ${file}
422   fi
423
424   file="${srcdir}/src/misc/modules_plugin.h"
425
426   rm -f ${file}.tmp && cp ${file}.in ${file}.tmp
427   sed -e 's#.*\$[I][d]:.*# * Automatically generated from '${file}'.in by bootstrap#' < ${file}.in > ${file}.tmp
428   echo '#define STORE_SYMBOLS( p_symbols ) \' >> ${file}.tmp
429   cat ${LIBVLC_HEADERS} | grep '^ *VLC_EXPORT.*;' | sed -e 's/VLC_EXPORT( *\([^,]*\), *\([^,]*\), *\(.*\));.*/    (p_symbols)->\2_inner = \2; \\/' >> ${file}.tmp
430   echo '' >> ${file}.tmp
431   if diff >/dev/null 2>&1 ${file} ${file}.tmp
432   then
433     rm -f ${file}.tmp
434   else
435     echo "creating new ${file}"
436     mv -f ${file}.tmp ${file}
437   fi
438
439   file="${srcdir}/src/misc/modules_builtin.h"
440
441   rm -f ${file}.tmp && cp ${file}.in ${file}.tmp
442   if test -n "${BUILTINS}"
443   then
444     for i in `echo ${BUILTINS}`
445     do
446       echo "int vlc_entry__`echo $i | sed -e 'y@/@_@' -e 's@\..*@@'`( module_t* );" >>${file}.tmp
447     done
448     echo "" >> ${file}.tmp
449   fi
450   echo "#define ALLOCATE_ALL_BUILTINS() \\" >> ${file}.tmp
451   echo "    do \\" >> ${file}.tmp
452   echo "    { \\" >> ${file}.tmp
453   if test -n "${BUILTINS}"
454   then
455     for i in `echo ${BUILTINS}`
456     do
457       echo "        ALLOCATE_BUILTIN(`echo $i | sed -e 'y@/@_@' -e 's@\..*@@'`); \\" >> ${file}.tmp
458     done
459   fi
460   echo "    } while( 0 );" >> ${file}.tmp
461   echo "" >> ${file}.tmp
462   if diff >/dev/null 2>&1 ${file} ${file}.tmp
463   then
464     rm -f ${file}.tmp
465   else
466     echo "creating new ${file}"
467     mv -f ${file}.tmp ${file}
468   fi
469
470   exit 0
471 fi
472
473 ##
474 ##  Fix glade-generated files
475 ##
476 if test "${action}" = "glade"
477 then
478   for file in modules/gui/gtk/gnome.glade modules/gui/gtk/gtk.glade modules/gui/familiar/familiar.glade
479   do
480     echo "generating code from $file"
481     glade -w $file || exit 1
482   done
483
484   for file in modules/gui/gtk/gnome_interface.c modules/gui/gtk/gtk_interface.c modules/gui/familiar/interface.c
485   do
486     echo "fixing $file"
487     if grep "DO NOT EDIT THIS FILE" $file >/dev/null 2>&1
488     then
489       rm -f $file.$$.bak
490       cat > $file.$$.bak << EOF
491 /* This file was created automatically by glade and fixed by bootstrap */
492
493 #include <vlc/vlc.h>
494 EOF
495       sed -e 1,7d \
496           -e 's#_(\(".:..:.."\))#\1#' \
497           -e 's#_(\("[a-z0-9]*://[^"]*"\))#\1#' \
498           -e 's#_("---")#"---"#' \
499           -e 's#_("--")#"--"#' \
500           -e 's#_(\("/dev/[^"]*"\))#"\1"#' \
501           -e 's#_(\("./."\))#\1#' \
502           < $file >> $file.$$.bak
503       mv -f $file.$$.bak $file
504     fi
505   done
506
507   for file in modules/gui/gtk/gtk_support.h modules/gui/familiar/support.h
508   do
509     echo "fixing $file"
510     if grep "DO NOT EDIT THIS FILE" $file >/dev/null 2>&1
511     then
512       rm -f $file.$$.bak
513       sed -e 's/DO NOT EDIT.*/Created by glade, fixed by bootstrap/' \
514           -e 's,<config.h>,<vlc/vlc.h>,' \
515           -e 's,#if.*ENABLE_NLS.*,#if 0 /* Disabled by bootstrap */,' \
516           -e 's,#else,/* & */,' \
517           < $file > $file.$$.bak
518       mv -f $file.$$.bak $file
519     fi
520   done
521
522   exit 0
523 fi
524
525 ##
526 ##  Fix glade2-generated files
527 ##
528 if test "${action}" = "glade2"
529 then
530   for file in modules/gui/gtk2/gnome2.glade modules/gui/gtk2/gtk2.glade modules/gui/pda/pda.glade
531   do
532     echo "generating code from $file"
533     glade-2 -w $file || exit 1
534   done
535
536   for file in modules/gui/pda/pda_interface.c
537   do
538     echo "fixing $file"
539     if grep "DO NOT EDIT THIS FILE" $file >/dev/null 2>&1
540     then
541       rm -f $file.$$.bak
542       cat > $file.$$.bak << EOF
543 /* This file was created automatically by glade2 and fixed by bootstrap */
544
545 #include <vlc/vlc.h>
546 EOF
547       sed -e 1,7d \
548           -e 's#_(\(".:..:.."\))#\1#' \
549           -e 's#_(\("[a-z0-9]*://[^"]*"\))#\1#' \
550           -e 's#_("---")#"---"#' \
551           -e 's#_("--")#"--"#' \
552           -e 's#_(\("/dev/[^"]*"\))#\1#' \
553           -e 's#_(\("./."\))#\1#' \
554           < $file >> $file.$$.bak
555       mv -f $file.$$.bak $file
556     fi
557   done
558
559   exit 0
560 fi
561
562 ##
563 ##  Make distclean
564 ##
565 if test "${action}" = "distclean"
566 then
567   set -x
568   # a naive sanity check to make sure we are in a VLC tree
569   test -f vlc.spec.mdk -a -f debian/rules || exit 1
570   # let's rock!
571   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 '{}' ';'
572   (cd autotools && find . -name '[a-z]*' -maxdepth 1 -exec rm -f '{}' ';')
573   (cd debian && find . -type d -name '[a-z]*' -maxdepth 1 -exec rm -Rf '{}' ';')
574   find msvc -type f -name '*.dsp' -exec rm -f '{}' ';'
575   find evc -type f -name '*.vcp' -exec rm -f '{}' ';'
576   #find . -type d -name '.deps' -exec rm -Rf '{}' ';'
577   # there's some more cruft all around
578   rm -f config.h config.log config.status
579   rm -f vlc vlc-config Makefile Modules.am
580   rm -Rf autom4te.cache
581   rm -f mozilla/vlcintf.h mozilla/vlcintf.xpt
582   # FIXME: a lot of Makefiles are still there
583 fi
584
585 ##
586 ## Add the extras/contrib dir to the distribution
587 ##
588 if test "${action}" = "contrib"
589 then
590   set -x
591   if test ! -d "${distdir}/extras"
592   then
593     mkdir "${distdir}/extras"
594   fi
595   if test ! -d "${distdir}/extras/contrib"
596   then
597     mkdir "${distdir}/extras/contrib"
598   fi
599   cp "${srcdir}/extras/contrib/Makefile" "${distdir}/extras/contrib/Makefile"
600   cp "${srcdir}/extras/contrib/README" "${distdir}/extras/contrib/README"
601   cp "${srcdir}/extras/contrib/bootstrap" "${distdir}/extras/contrib/bootstrap"
602   cp "${srcdir}/extras/contrib/change_prefix.sh" "${distdir}/extras/contrib/change_prefix.sh"
603   if test ! -d "${distdir}/extras/contrib/src"
604   then
605     mkdir "${distdir}/extras/contrib/src"
606   fi
607   cp "${srcdir}/extras/contrib/src/Makefile" "${distdir}/extras/contrib/src/Makefile"
608   cp "${srcdir}/extras/contrib/src/packages.mak" "${distdir}/extras/contrib/src/packages.mak"
609   if test ! -d "${distdir}/extras/contrib/src/Patches"
610   then
611     mkdir "${distdir}/extras/contrib/src/Patches"
612   fi
613   cp ${srcdir}/extras/contrib/src/Patches/* "${distdir}/extras/contrib/src/Patches/"
614 fi
615
616 ##
617 ##  Build a woody-friendly package
618 ##
619 if test "${action}" = "woody"
620 then
621   set -ex
622   test -d "$1"
623
624   # changelog: replace (1.2.3-4) with (1.2.3-0woody.4)
625   sed -e 's/^vlc (\([^)]*\)-\([^-)]*\))/vlc-woody (\1-0woody.\2)/' \
626       -e 's/ unstable; / stable; /' \
627       < "$1/debian/changelog" > "$1/debian/changelog.woody"
628   mv "$1/debian/changelog.woody" "$1/debian/changelog"
629
630   # control: replace liba52-*-dev with a52dec-dev (>=0.7.3)
631   #                  libdv*-dev with libdv-dev
632   #                  kdelibs4-dev with kdelibs-dev
633   #                  libqt3-mt-dev libqt3-compat-headers with libqt-dev
634   #                  libarts1-dev with libarts-dev
635   #                  libdvdread3-dev with libdvdread2-dev
636   #                  libdvdplay0-dev (>=1.0.1-2) with libdvdplay0-dev
637   #                  libxosd-dev (>=2.2.4-1.3) with libxosd-dev
638   #                  ttf-freefont with ttf-thryomanes
639   #                  dvb-dev (>= 1.0.1-6) with dvb-dev
640   #          remove libwxgtk2.4-dev
641   #                 libidl0 (workaround for mozilla-dev's bad deps)
642   #                 libglib2.0-0 (workaround for mozilla-dev's bad deps)
643   #                 gcc-3.2 (workaround for an ICE in gcc-3.3)
644   #          change Section: gnome with Section: graphics
645   #                 Section: kde with Section: kde
646   #                 Section: libdevel with Section: devel
647   sed -e 's/liba52-[^-]*-dev/a52dec-dev (>=0.7.3)/' \
648       -e 's/libdv[0-9]*-dev/libdv-dev/' \
649       -e 's/kdelibs[0-9]*-dev/kdelibs-dev/' \
650       -e 's/libqt[0-9]*-mt-dev/libqt-dev/' \
651       -e 's/, libqt[0-9]*-compat-headers[^,]*//' \
652       -e 's/libarts[0-9]*-dev/libarts-dev/' \
653       -e 's/libdvdread[0-9]*-dev/libdvdread2-dev/' \
654       -e 's/, libdvdplay0-dev[^,]*/, libdvdplay0-dev/' \
655       -e 's/, libxosd-dev[^,]*/, libxosd-dev/' \
656       -e 's/, ttf-freefont[^,]*/, ttf-thryomanes/' \
657       -e 's/, dvb-dev[^,]*/, dvb-dev/' \
658       -e 's/, libwx[^,]*//' \
659       -e '/Package: wxvlc/,/^ *$/d' \
660       -e 's/, libidl0[^,]*//' \
661       -e 's/, libglib2.0-0[^,]*//' \
662       -e 's/, gcc-3.2[^,]*//' \
663       -e 's/Section: gnome/Section: graphics/' \
664       -e 's/Section: kde/Section: graphics/' \
665       -e 's/Section: libdevel/Section: devel/' \
666       < "$1/debian/control" > "$1/debian/control.woody"
667   mv "$1/debian/control.woody" "$1/debian/control"
668
669   # rules: remove wxwindows and skins stuff
670   sed -e '/# Package: wxvlc/,/^ *$/d' \
671       -e 's,--enable-wxwindows,--disable-wxwindows,' \
672       -e 's,--enable-skins,--disable-skins,' \
673       < "$1/debian/rules" > "$1/debian/rules.woody"
674   mv "$1/debian/rules.woody" "$1/debian/rules"
675   chmod 0755 "$1/debian/rules"
676
677   # modules/misc/freetype.c: replace the default font
678   sed -e 's,freefont/FreeSerifBold.ttf,thryomanes/thryb___.ttf,' \
679       < "$1/modules/misc/freetype.c" > "$1/modules/misc/freetype.c.woody"
680   mv "$1/modules/misc/freetype.c.woody" "$1/modules/misc/freetype.c"
681 fi
682