make update-po
[vlc.git] / toolbox
blob15260fe5e440aa60f77c504d6e3157342a823c57
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-vc update Microsoft Visual Studio files
30 --update-vc7 update Microsoft Visual .NET files
31 --update-po update translation files
32 --update-includes generate various include files
33 --update-version generate src/misc/version.c
34 --update-glade2 generate and fix Glade 2 code
35 --update-flexml generate and fix flexml and flex code
36 --distclean "make distclean" on steroids
37 --dist-contrib add the contrib dir to MAKE_DIST
38 EOF
39 exit 1
43 ## Extract stuff from Makefile.am
45 getfiles()
47 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" | \
48 tr '\\ ' '\n\n' | \
49 sed -ne 's/[^-$()_a-zA-Z0-9][^-$()_a-zA-Z0-9]*\([a-zA-Z]\)/\1/p' | \
50 sed -e "s,^,${srcdir}/,"
53 ###
54 ### argument check
55 ###
57 if test "$1" = ""
58 then
59 help
62 case "$1" in
63 --changelog|--update-changelog)
64 action=changelog
66 --update-vc)
67 action=vc
69 --update-vc7)
70 action=vc7
72 --update-po)
73 action=po
75 --update-includes)
76 action=includes
78 --update-version)
79 action=version
81 --update-flexml)
82 action=flexml
84 --update-glade2|--update-glade-2|--fix-glade2)
85 action=glade2
87 --distclean)
88 action=distclean
90 --add-include)
91 action=include
93 --dist-contrib)
94 action=contrib
96 --help)
97 help
100 echo "$0: unknown option $1"
101 help
103 esac
104 shift
107 ## Add includes to help doxygen
109 if test "${action}" = "include"
110 then
111 case "$1" in
112 */vlc_common.h|*/include/vlc/*);;
113 */include/*.h) echo "#include <vlc_common.h>" ;;
114 esac
115 cat $1
116 exit 0
120 ## Update the CVS changelog
122 if test "${action}" = "changelog"
123 then
124 YEAR="`date +%Y`"
125 echo "toolbox --changelog no longer required. use this instead:"
126 echo " LANG=C svn log -v -r '{$YEAR-12-31}:{$YEAR-01-01}' > ChangeLog"
127 exit 0
131 ## Update the MSVC project files
133 if test "${action}" = "vc"
134 then
135 echo "generating Visual Studio files"
137 if test -z "${srcdir}"; then
138 srcdir="`sed -ne 's/^srcdir *= *//p' < Makefile`"
141 # The evil ^M. printf '\r' does not work in Cygwin.
142 M=' '
144 # Variables we get from configure.ac
145 LIBVLC_VERSION=`sed -ne '/AC_INIT/s/.*,\(.*\))/\1/p' < configure.ac`
146 LIBVLC_CODENAME=`sed -ne '/CODENAME=/s/.*"\(.*\)"/\1/p' < configure.ac`
147 LIBVLC_SYMBOL=`echo $LIBVLC_VERSION | sed -e 'y/.-/__/'`
149 # Sources that get built under Win32 - FIXME: anyone wanna deuglify this? :)
150 LIBVLC_SOURCES=`getfiles SOURCES_libvlc_common; getfiles SOURCES_libvlc_win32; getfiles SOURCES_libvlc_dirent; getfiles SOURCES_libvlc_getopt; getfiles SOURCES_libvlc_libc`
152 LIBVLC_HEADERS=`getfiles HEADERS_include; getfiles HEADERS_include_built`
154 LIBVLC_PKG_HEADERS=`getfiles dist_pkginclude_HEADERS`
156 # Clean up
157 rm -f evc/*.vcp msvc/*.dsp msvc/*.vcproj msvc/*.sln msvc/*.ncb
159 # config files
160 for target in evc/config.h msvc/config.h
162 printf "."
163 rm -f ${target}
164 sed -e "s/@CODENAME@/${LIBVLC_CODENAME}/" \
165 -e "s/@VERSION@/${LIBVLC_VERSION}/" \
166 -e "s/@SYMBOL@/${LIBVLC_SYMBOL}/" < ${target}.in > ${target}
167 done
169 # libvlc files
170 for target in evc/libvlc.vcp msvc/libvlc.dsp
172 printf "."
173 # Top of the project file
174 perl -pe 'if(/ZSOURCESZ/){last;}' < ${target}.in > ${target}
175 # The source files
176 for file in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep -v "/.*/"`
178 cat >> ${target} << EOF
179 # Begin Source File${M}
180 SOURCE="..\\`echo ${file} | sed -e 's%/%\\\\%g'`"${M}
181 # ADD CPP /D "__LIBVLC__" /D PLUGIN_PATH=\\".\\" /D DATA_PATH=\\"share\\"${M}
182 # End Source File${M}
184 done
185 for subdir in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep "/.*/" | cut -f2 -d/ | sort | uniq`
187 cat >> ${target} << EOF
188 # Begin Group "${subdir}"${M}
190 for file in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep "/${subdir}/"`
192 subdir="`echo ${file} | sed -e 's%/[^/]*$%/%' | sed -e 's%/%\\\\%g'`"
193 if test "${target}" = "evc/libvlc.vcp"
194 then
195 cat >> ${target} << EOF
196 # Begin Source File${M}
197 SOURCE="..\\`echo ${file} | sed -e 's%/%\\\\%g'`"${M}
198 # ADD CPP /D "__LIBVLC__" /D PLUGIN_PATH=\\".\\" /D DATA_PATH=\\"share\\"${M}
199 !IF "\$(CFG)" == "libvlc - Win32 (WCE MIPS) Release"${M}
200 # PROP Output_Dir "MIPSRel\\${subdir}"${M}
201 # PROP Intermediate_Dir "MIPSRel\\${subdir}"${M}
202 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE MIPS) Debug"${M}
203 # PROP Output_Dir "MIPSDbg\\${subdir}"${M}
204 # PROP Intermediate_Dir "MIPSDbg\\${subdir}"${M}
205 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE SH4) Release"${M}
206 # PROP Output_Dir "SH4Rel\\${subdir}"${M}
207 # PROP Intermediate_Dir "SH4Rel\\${subdir}"${M}
208 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE SH4) Debug"${M}
209 # PROP Output_Dir "SH4Dbg\\${subdir}"${M}
210 # PROP Intermediate_Dir "SH4Dbg\\${subdir}"${M}
211 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE SH3) Release"${M}
212 # PROP Output_Dir "SH3Rel\\${subdir}"${M}
213 # PROP Intermediate_Dir "SH3Rel\\${subdir}"${M}
214 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE SH3) Debug"${M}
215 # PROP Output_Dir "SH3Dbg\\${subdir}"${M}
216 # PROP Intermediate_Dir "SH3Dbg\\${subdir}"${M}
217 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE ARM) Release"${M}
218 # PROP Output_Dir "ARMRel\\${subdir}"${M}
219 # PROP Intermediate_Dir "ARMRel\\${subdir}"${M}
220 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE ARM) Debug"${M}
221 # PROP Output_Dir "ARMDbg\\${subdir}"${M}
222 # PROP Intermediate_Dir "ARMDbg\\${subdir}"${M}
223 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE ARMV4) Release"${M}
224 # PROP Output_Dir "ARMV4Rel\\${subdir}"${M}
225 # PROP Intermediate_Dir "ARMV4Rel\\${subdir}"${M}
226 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE ARMV4) Debug"${M}
227 # PROP Output_Dir "ARMV4Dbg\\${subdir}"${M}
228 # PROP Intermediate_Dir "ARMV4Dbg\\${subdir}"${M}
229 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE x86em) Release"${M}
230 # PROP Output_Dir "X86EMRel\\${subdir}"${M}
231 # PROP Intermediate_Dir "X86EMRel\\${subdir}"${M}
232 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE x86em) Debug"${M}
233 # PROP Output_Dir "X86EMDbg\\${subdir}"${M}
234 # PROP Intermediate_Dir "X86EMDbg\\${subdir}"${M}
235 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE emulator) Debug"${M}
236 # PROP Output_Dir "emulatorDbg\\${subdir}"${M}
237 # PROP Intermediate_Dir "emulatorDbg\\${subdir}"${M}
238 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE emulator) Release"${M}
239 # PROP Output_Dir "emulatorRel\\${subdir}"${M}
240 # PROP Intermediate_Dir "emulatorRel\\${subdir}"${M}
241 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE x86) Debug"${M}
242 # PROP Output_Dir "X86Dbg\\${subdir}"${M}
243 # PROP Intermediate_Dir "X86Dbg\\${subdir}"${M}
244 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE x86) Release"${M}
245 # PROP Output_Dir "X86Rel\\${subdir}"${M}
246 # PROP Intermediate_Dir "X86Rel\\${subdir}"${M}
247 !ENDIF${M}
248 # End Source File${M}
250 else
251 cat >> ${target} << EOF
252 # Begin Source File${M}
253 SOURCE="..\\`echo ${file} | sed -e 's%/%\\\\%g'`"${M}
254 # ADD CPP /D "__LIBVLC__" /D PLUGIN_PATH=\\".\\" /D DATA_PATH=\\"share\\"${M}
255 !IF "\$(CFG)" == "libvlc - Win32 Release"${M}
256 # PROP Output_Dir "Release\\${subdir}"${M}
257 # PROP Intermediate_Dir "Release\\${subdir}"${M}
258 !ELSEIF "\$(CFG)" == "libvlc - Win32 Debug"${M}
259 # PROP Output_Dir "Debug\\${subdir}"${M}
260 # PROP Intermediate_Dir "Debug\\${subdir}"${M}
261 !ENDIF${M}
262 # End Source File${M}
265 done
266 cat >> ${target} << EOF
267 # End Group${M}
269 done
270 # The headers
271 perl -e 'while(<>){if(/ZSOURCESZ/){last;}}while(<>){if(/ZHEADERSZ/){last;}print $_}' < ${target}.in >> ${target}
272 for file in ${LIBVLC_HEADERS}
274 cat >> ${target} << EOF
275 # Begin Source File${M}
276 SOURCE="..\\`echo ${file} | sed -e 's%/%\\\\%g'`"${M}
277 # End Source File${M}
279 done
280 cat >> ${target} << EOF
281 # Begin Group "vlc"${M}
283 for file in ${LIBVLC_PKG_HEADERS}
285 cat >> ${target} << EOF
286 # Begin Source File${M}
287 SOURCE="..\\`echo ${file} | sed -e 's%/%\\\\%g'`"${M}
288 # End Source File${M}
290 done
291 cat >> ${target} << EOF
292 # End Group${M}
294 perl -e 'while(<>){if(/ZHEADERSZ/){last;}}while(<>){print $_}' < ${target}.in >> ${target}
295 done
297 # plugins files
298 for dir in `sed -ne 's,modules/\(.*\)/Makefile,\1,p' ${srcdir}/configure.ac`
300 mf="${srcdir}/modules/${dir}/Modules.am"
301 for mod in `sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf}`
303 # this is an attempt at getting a list of plugin sources... we take the
304 # production and remove everything that does not contain "module", which
305 # means you miss $(NULL), but other variables too.
306 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 '\.'`
307 hfiles=`for i in ${allfiles} ; do echo "$i" ; done | grep '\.h$'`
308 cfiles=`for i in ${allfiles} ; do echo "$i" ; done | grep -v '\.h$'`
309 for msdir in evc msvc
311 test "${msdir}" = "evc" && suf="vcp" || suf="dsp"
312 source="${msdir}/plugins.${suf}.in"
313 target="${msdir}/plugin_${mod}.${suf}"
314 printf "."
315 perl -pe 'if(/ZSOURCESZ/){last;} s/ZPLUGINZ/'${mod}'/g' < ${source} > ${target}
316 for cfile in ${cfiles}
318 cat >> ${target} << EOF
319 # Begin Source File${M}
320 SOURCE="..\\modules\\`echo ${dir}/${cfile} | sed 's,/,\\\\,g'`"${M}
321 # ADD CPP /D "__LIBVLC__" /D "__PLUGIN__" /D "MODULE_NAME=${mod}" /D "MODULE_NAME_IS_${mod}" ${M}
322 !IF "\$(CFG)" == "plugin_${mod} - Win32 Release"${M}
323 # PROP Output_Dir "Release\\modules\\`echo ${dir} | sed 's,/,\\\\,g'`"${M}
324 # PROP Intermediate_Dir "Release\\modules\\`echo ${dir} | sed 's,/,\\\\,g'`"${M}
325 !ELSEIF "\$(CFG)" == "plugin_${mod} - Win32 Debug"${M}
326 # PROP Output_Dir "Debug\\modules\\`echo ${dir} | sed 's,/,\\\\,g'`"${M}
327 # PROP Intermediate_Dir "Debug\\modules\\`echo ${dir} | sed 's,/,\\\\,g'`"${M}
328 # End Source File${M}
330 done
331 # sed is really nicer for this... unfortunately it's broken under cygwin
332 # sed -ne '1,/ZSOURCESZ/d; /ZHEADERSZ/,$d; p' < ${source} >> ${target}
333 perl -e 'while(<>){if(/ZSOURCESZ/){last;}}while(<>){if(/ZHEADERSZ/){last;}print $_}' < ${source} >> ${target}
334 for hfile in ${hfiles}
336 cat >> ${target} << EOF
337 # Begin Source File${M}
338 SOURCE="..\\modules\\`echo ${dir}/${hfile} | sed 's,/,\\\\,g'`"${M}
339 # End Source File${M}
341 done
342 # sed -ne '1,/ZHEADERSZ/d; p' < ${source} >> ${target}
343 perl -e 'while(<>){if(/ZHEADERSZ/){last;}}while(<>){print $_}' < ${source} >> ${target}
344 done
345 done
346 done
348 # vlc files
349 for target in evc/vlc.vcp msvc/vlc.dsp
351 printf "."
352 # Top of the project file
353 perl -pe 'if(/ZSOURCESZ/){last;}' < ${target}.in > ${target}
354 # The source files
355 cat >> ${target} << EOF
356 # Begin Source File${M}
357 SOURCE="..\\src\\vlc.c"${M}
358 # End Source File${M}
360 # Bottom of the project file - handles resource files too
361 perl -e 'while(<>){if(/ZSOURCESZ/){last;}}while(<>){print $_}' < ${target}.in >> ${target}
362 done
364 echo " done."
365 exit 0
369 ## Update the MSVC (.NET) project files
371 if test "${action}" = "vc7"
372 then
373 echo "generating Visual .NET files"
375 srcdir=.
377 # The evil ^M. printf '\r' does not work in Cygwin.
381 # Variables we get from configure.ac
382 LIBVLC_VERSION=`sed -ne '/AC_INIT/s/.*,\(.*\))/\1/p' < configure.ac`
383 LIBVLC_CODENAME=`sed -ne '/CODENAME=/s/.*"\(.*\)"/\1/p' < configure.ac`
384 LIBVLC_SYMBOL=`echo $LIBVLC_VERSION | sed -e 'y/.-/__/'`
386 # Sources that get built under Win32 - FIXME: anyone wanna deuglify this? :)
387 LIBVLC_SOURCES=`getfiles SOURCES_libvlc_common; getfiles SOURCES_libvlc_win32; getfiles SOURCES_libvlc_dirent; getfiles SOURCES_libvlc_getopt; getfiles SOURCES_libvlc_libc`
389 LIBVLC_HEADERS=`getfiles HEADERS_include; getfiles HEADERS_include_built`
391 LIBVLC_PKG_HEADERS=`getfiles dist_pkginclude_HEADERS`
393 # Clean up
394 rm -f msvc/*.vcproj
396 # config files
397 for target in msvc/config.h
399 printf "."
400 rm -f ${target}
401 sed -e "s/@CODENAME@/${LIBVLC_CODENAME}/" \
402 -e "s/@VERSION@/${LIBVLC_VERSION}/" \
403 -e "s/@SYMBOL@/${LIBVLC_SYMBOL}/" < ${target}.in > ${target}
404 done
406 # vlc files
407 target="msvc/vlc.vcproj"
408 printf "."
409 # Top of the project file
410 guid=`perl -e 'sub r {return sprintf("%X", int rand(65536))} print r.r."-".r."-".r."-".r."-".r.r.r'`
411 perl -pe 'if(/ZSOURCESZ/){last;} s/ZGUIDZ/'${guid}'/g' < ${target}.in > ${target}
412 # The source files
413 cat >> ${target} << EOF
414 <File RelativePath="..\\src\\vlc.c"></File>${M}
416 # Bottom of the project file - handles resource files too
417 perl -e 'while(<>){if(/ZSOURCESZ/){last;}}while(<>){print $_}' < ${target}.in >> ${target}
419 # libvlc files
420 target=msvc/libvlc.vcproj
421 printf "."
422 # Top of the project file
423 guid=`perl -e 'sub r {return sprintf("%X", int rand(65536))} print r.r."-".r."-".r."-".r."-".r.r.r'`
424 perl -pe 'if(/ZSOURCESZ/){last;} s/ZGUIDZ/'${guid}'/g' < ${target}.in > ${target}
425 # The source files
426 for file in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep -v "/.*/"`
428 cat >> ${target} << EOF
429 <File RelativePath="..\\`echo ${dir}/${file} | sed 's,/,\\\\,g'`"></File>${M}
431 done
432 for subdir in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep "/.*/" | cut -f2 -d/ | sort | uniq`
434 cat >> ${target} << EOF
435 <Filter Name="`echo ${subdir} | sed s,/,_,g`" Filter="c;cpp">${M}
437 for file in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep "/${subdir}/"`
439 cat >> ${target} << EOF
440 <File RelativePath="..\\`echo ${file} | sed 's,/,\\\\,g'`">${M}
442 if echo ${file} | grep -q '.c$'
443 then
444 cat >> ${target} << EOF
445 <FileConfiguration Name="Debug|Win32">${M}
446 <Tool Name="VCCLCompilerTool" ObjectFile="\$(IntDir)/\$(ProjectName)/`echo ${file} | sed -e s/\.c$/.obj/`"/>${M}
447 </FileConfiguration>${M}
450 cat >> ${target} << EOF
451 </File>${M}
453 done
454 cat >> ${target} << EOF
455 </Filter>${M}
457 done
458 # The headers
459 perl -e 'while(<>){if(/ZSOURCESZ/){last;}}while(<>){if(/ZHEADERSZ/){last;}print $_}' < ${target}.in >> ${target}
460 for file in ${LIBVLC_HEADERS}
462 cat >> ${target} << EOF
463 <File RelativePath="..\\`echo ${file} | sed 's,/,\\\\,g'`"></File>${M}
465 done
466 cat >> ${target} << EOF
467 <Filter Name="vlc" Filter="h;hpp">${M}
469 for file in ${LIBVLC_PKG_HEADERS}
471 cat >> ${target} << EOF
472 <File RelativePath="..\\`echo ${file} | sed 's,/,\\\\,g'`"></File>${M}
474 done
475 cat >> ${target} << EOF
476 </Filter>${M}
478 perl -e 'while(<>){if(/ZHEADERSZ/){last;}}while(<>){print $_}' < ${target}.in >> ${target}
480 # plugins files
481 for dir in `sed -ne 's,modules/\(.*\)/Makefile,\1,p' ${srcdir}/configure.ac`
483 mf="${srcdir}/modules/${dir}/Modules.am"
484 for mod in `sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf}`
486 # this is an attempt at getting a list of plugin sources... we take the
487 # production and remove everything that does not contain "module", which
488 # means you miss $(NULL), but other variables too.
489 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 '\.'`
490 hfiles=`for i in ${allfiles} ; do echo "$i" ; done | grep '\.h$'`
491 cfiles=`for i in ${allfiles} ; do echo "$i" ; done | grep -v '\.h$'`
492 for msdir in msvc
494 source="${msdir}/plugins.vcproj.in"
495 target="${msdir}/plugin_${mod}.vcproj"
496 printf "."
497 guid=`perl -e 'sub r {return sprintf("%X", int rand(65536))} print r.r."-".r."-".r."-".r."-".r.r.r'`
498 perl -pe 'if(/ZSOURCESZ/){last;} s/ZPLUGINZ/'${mod}'/g' < ${source} | sed 's,ZGUIDZ,'${guid}',' > ${target}
499 for cfile in ${cfiles}
501 cat >> ${target} << EOF
502 <File RelativePath="..\\modules\\`echo ${dir}/${cfile} | sed 's,/,\\\\,g'`"></File>${M}
504 done
505 # sed is really nicer for this... unfortunately it's broken under cygwin
506 # sed -ne '1,/ZSOURCESZ/d; /ZHEADERSZ/,$d; p' < ${source} >> ${target}
507 perl -e 'while(<>){if(/ZSOURCESZ/){last;}}while(<>){if(/ZHEADERSZ/){last;}print $_}' < ${source} >> ${target}
508 for hfile in ${hfiles}
510 cat >> ${target} << EOF
511 <File RelativePath="..\\modules\\`echo ${dir}/${hfile} | sed 's,/,\\\\,g'`"></File>${M}
513 done
514 # sed -ne '1,/ZHEADERSZ/d; p' < ${source} >> ${target}
515 perl -e 'while(<>){if(/ZHEADERSZ/){last;}}while(<>){print $_}' < ${source} >> ${target}
516 done
517 done
518 done
520 echo " done."
521 exit 0
525 ## Update the potfiles because no one ever does it
527 if test "${action}" = "po"
528 then
529 # find out the source files
530 echo "WARNING: you should run \"make update-po\" instead!" >&2
531 make update-po
532 exit $?
536 ## Create include files
538 if test "${action}" = "includes"
539 then
540 #set -x
542 if test -z "${srcdir}"; then
543 srcdir="`sed -ne 's/^srcdir *= *//p' < Makefile`"
545 if test -z "${builddir}"; then
546 builddir="`sed -ne 's/^top_builddir *= *//p' < Makefile`"
548 BUILTINS=`sed -ne 's/.*builtins *= *" *\([^"]*\)".*/\1/p' ${builddir}/vlc-config`
550 file="${builddir}/src/misc/modules_builtin.h"
552 rm -f "${file}.tmp"
553 mkdir -p -- "${builddir}/src/misc"
554 cat "${srcdir}/src/misc/modules_builtin.h.in" > "${file}.tmp" || exit 1
555 if test -n "${BUILTINS}"
556 then
557 for i in `echo ${BUILTINS}`
559 echo "int vlc_entry__`echo $i | sed -e 'y@/@_@' -e 's@\..*@@'`( module_t* );" >> "${file}.tmp"
560 done
561 echo "" >> "${file}.tmp"
563 echo "#define ALLOCATE_ALL_BUILTINS() \\" >> ${file}.tmp
564 echo " do \\" >> "${file}.tmp"
565 echo " { \\" >> "${file}.tmp"
566 if test -n "${BUILTINS}"
567 then
568 for i in `echo ${BUILTINS}`
570 echo " ALLOCATE_BUILTIN(`echo $i | sed -e 'y@/@_@' -e 's@\..*@@'`); \\" >> "${file}.tmp"
571 done
573 echo " } while( 0 );" >> "${file}.tmp"
574 echo "" >> "${file}.tmp" || exit 1
575 if diff >/dev/null 2>&1 "${file}" "${file}.tmp"
576 then
577 rm -f "${file}.tmp"
578 else
579 echo "creating new ${file}"
580 mv -f "${file}.tmp" "${file}"
583 exit 0
587 ## Create version file
589 if test "${action}" = "version"
590 then
591 if test -z "${srcdir}"; then
592 srcdir="`sed -ne 's/^srcdir *= *//p' < Makefile`"
594 if test -z "${builddir}"; then
595 builddir="`sed -ne 's/^top_builddir *= *//p' < Makefile`"
597 if test -z "${CC}"; then
598 CC="`sed -ne 's/^CC *= *//p' < Makefile`"
601 file="${builddir}/src/misc/version.c"
602 if which svnversion 2>&1 >/dev/null; then
603 VLC_CHANGESET=`svnversion $srcdir`
604 else
605 VLC_CHANGESET='exported'
608 rm -f ${file}.tmp
609 mkdir -p -- "${builddir}/src/misc"
610 cat > ${file}.tmp << EOF
611 /* DO NOT EDIT THIS FILE - IT IS REGENERATED AT EVERY COMPILE -
612 * IT GIVES BETTER TRACKING OF VLC STABLE AND DEVELOPMENT VERSIONS
613 * WHETHER THEY ARE BUILT BY OTHERS OR DURING DEVELOPMENT OR FOR THE
614 * OFFICIAL VLC STABLE RELEASES.
616 const char psz_vlc_changeset[] = "${VLC_CHANGESET}";
619 if diff >/dev/null 2>&1 ${file} ${file}.tmp
620 then
621 rm -f ${file}.tmp
622 else
623 echo "creating new ${file}"
624 mv -f ${file}.tmp ${file}
627 exit 0
631 ## Fix glade2-generated files
633 if test "${action}" = "glade2"
634 then
635 file="modules/gui/pda/pda.glade"
636 echo "generating code from $file"
637 glade-2 -w "$file" || exit 1
639 file="modules/gui/pda/pda_interface.c"
640 echo "fixing $file"
641 if grep "DO NOT EDIT THIS FILE" "$file" >/dev/null 2>&1
642 then
643 rm -f -- "$file.$$.bak"
644 cat > "$file.$$.bak" << EOF
645 /* This file was created automatically by glade2 and fixed by bootstrap */
647 #include <vlc/vlc.h>
649 sed -e 1,7d \
650 -e 's#_(\(".:..:.."\))#\1#' \
651 -e 's#_(\("[a-z0-9]*://[^"]*"\))#\1#' \
652 -e 's#_("---")#"---"#' \
653 -e 's#_("--")#"--"#' \
654 -e 's#_(\("/dev/[^"]*"\))#\1#' \
655 -e 's#_(\("./."\))#\1#' \
656 < "$file" >> "$file.$$.bak"
657 mv -f "$file.$$.bak" "$file"
660 exit 0
664 ## Make distclean
666 if test "${action}" = "distclean"
667 then
668 set -x
669 # a naive sanity check to make sure we are in a VLC tree
670 test -f vlc.mandriva.spec -a -f vlc.win32.nsi.in || exit 1
671 # let's rock!
672 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 '{}' ';'
673 (cd autotools && find . -maxdepth 1 -name '[a-z]*' -exec rm -f '{}' ';')
674 find msvc -type f -name '*.dsp' -exec rm -f '{}' ';'
675 find evc -type f -name '*.vcp' -exec rm -f '{}' ';'
676 find . -type d -name '.deps' -exec rm -Rf '{}' ';'
677 find . -type d -name '.libs' -exec rm -Rf '{}' ';'
678 # there's some more cruft all around
679 rm -f config.h config.log config.status
680 rm -f vlc vlc-config Makefile Modules.am
681 rm -Rf autom4te.cache
682 rm -f mozilla/vlcintf.h mozilla/vlcintf.xpt
683 echo "\`toolbox --distclean\' is known to be broken."
684 echo "Don't complain if it does not work, or better yet, don't use it."
685 echo "You were warned."
686 # FIXME: a lot of Makefiles are still there
690 ## Add the extras/contrib dir to the distribution
692 if test "${action}" = "contrib"
693 then
694 set -x
695 if test ! -d "${distdir}/extras"
696 then
697 mkdir "${distdir}/extras"
699 if test ! -d "${distdir}/extras/contrib"
700 then
701 mkdir "${distdir}/extras/contrib"
703 cp "${srcdir}/extras/contrib/Makefile" "${distdir}/extras/contrib/Makefile"
704 cp "${srcdir}/extras/contrib/README" "${distdir}/extras/contrib/README"
705 cp "${srcdir}/extras/contrib/bootstrap" "${distdir}/extras/contrib/bootstrap"
706 cp "${srcdir}/extras/contrib/change_prefix.sh" "${distdir}/extras/contrib/change_prefix.sh"
707 if test ! -d "${distdir}/extras/contrib/src"
708 then
709 mkdir "${distdir}/extras/contrib/src"
711 cp "${srcdir}/extras/contrib/src/Makefile" "${distdir}/extras/contrib/src/Makefile"
712 cp "${srcdir}/extras/contrib/src/packages.mak" "${distdir}/extras/contrib/src/packages.mak"
713 if test ! -d "${distdir}/extras/contrib/src/Patches"
714 then
715 mkdir "${distdir}/extras/contrib/src/Patches"
717 cp ${srcdir}/extras/contrib/src/Patches/* "${distdir}/extras/contrib/src/Patches/"