3 ## toolbox for vlc, the VideoLAN Client
4 ## $Id: toolbox,v 1.1 2002/12/25 22:36:14 sam Exp $
6 ## Authors: Samuel Hocevar <sam@zoy.org>
9 ### Get a sane environment, just in case
23 --update-vc update Microsoft Visual Studio files
24 --update-po update translation files
35 while test $# -gt 0; do
46 echo "$0: unknown option $1"
55 ## Give help if needed
57 if test "$do_help" = "yes"
63 ## Update the MSVC project files
65 if test "$do_vc" = "yes"
69 echo "no Makefile found, did you run ./configure?"
73 echo "generating Visual Studio files..."
78 # Sources that get built under Win32 - FIXME: anyone wanna deuglify this? :)
79 LIBVLC_SOURCES=`awk 'BEGIN{a=0}{if(!a&&/^'SOURCES_libvlc_common'[^-_a-zA-Z0-9]*=/){a=1;print$0;next;}if(a){if(/^[a-zA-Z]/){exit;}print $0}}' < Makefile.am | tr '\\ ' '\n\n' | sed -ne 's/[^$-_a-zA-Z0-9][^$-_a-zA-Z0-9]*\([a-zA-Z]\)/\1/p'; awk 'BEGIN{a=0}{if(!a&&/^'SOURCES_libvlc_win32'[^-_a-zA-Z0-9]*=/){a=1;print$0;next;}if(a){if(/^[a-zA-Z]/){exit;}print $0}}' < Makefile.am | tr '\\ ' '\n\n' | sed -ne 's/[^$-_a-zA-Z0-9][^$-_a-zA-Z0-9]*\([a-zA-Z]\)/\1/p'; awk 'BEGIN{a=0}{if(!a&&/^'SOURCES_libvlc_dirent'[^-_a-zA-Z0-9]*=/){a=1;print$0;next;}if(a){if(/^[a-zA-Z]/){exit;}print $0}}' < Makefile.am | tr '\\ ' '\n\n' | sed -ne 's/[^$-_a-zA-Z0-9][^$-_a-zA-Z0-9]*\([a-zA-Z]\)/\1/p'; awk 'BEGIN{a=0}{if(!a&&/^'SOURCES_libvlc_getopt'[^-_a-zA-Z0-9]*=/){a=1;print$0;next;}if(a){if(/^[a-zA-Z]/){exit;}print $0}}' < Makefile.am | tr '\\ ' '\n\n' | sed -ne 's/[^$-_a-zA-Z0-9][^$-_a-zA-Z0-9]*\([a-zA-Z]\)/\1/p'; awk 'BEGIN{a=0}{if(!a&&/^'SOURCES_libvlc_libc'[^-_a-zA-Z0-9]*=/){a=1;print$0;next;}if(a){if(/^[a-zA-Z]/){exit;}print $0}}' < Makefile.am | tr '\\ ' '\n\n' | sed -ne 's/[^$-_a-zA-Z0-9][^$-_a-zA-Z0-9]*\([a-zA-Z]\)/\1/p'`
81 LIBVLC_HEADERS=`awk 'BEGIN{a=0}{if(!a&&/^'HEADERS_include'[^-_a-zA-Z0-9]*=/){a=1;print$0;next;}if(a){if(/^[a-zA-Z]/){exit;}print $0}}' < Makefile.am | tr '\\ ' '\n\n' | sed -ne 's/[^$-_a-zA-Z0-9][^$-_a-zA-Z0-9]*\([a-zA-Z]\)/\1/p'; awk 'BEGIN{a=0}{if(!a&&/^'HEADERS_include_built'[^-_a-zA-Z0-9]*=/){a=1;print$0;next;}if(a){if(/^[a-zA-Z]/){exit;}print $0}}' < Makefile.am | tr '\\ ' '\n\n' | sed -ne 's/[^$-_a-zA-Z0-9][^$-_a-zA-Z0-9]*\([a-zA-Z]\)/\1/p'`
83 LIBVLC_PKG_HEADERS=`awk 'BEGIN{a=0}{if(!a&&/^'dist_pkginclude_HEADERS'[^-_a-zA-Z0-9]*=/){a=1;print$0;next;}if(a){if(/^[a-zA-Z]/){exit;}print $0}}' < Makefile.am | tr '\\ ' '\n\n' | sed -ne 's/[^$-_a-zA-Z0-9][^$-_a-zA-Z0-9]*\([a-zA-Z]\)/\1/p'`
86 rm -f evc/*.vcp msvc/*.dsp
89 for target in evc/libvlc.vcp msvc/libvlc.dsp
92 # Top of the project file
93 perl -pe 'if(/§SOURCES§/){last;}' < ${target}.in > ${target}
95 for file in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep -v "/.*/"`
97 cat >> ${target} << EOF
98 # Begin Source File${M}
99 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
100 # ADD CPP /D "__VLC__" /D PLUGIN_PATH=\\"plugins\\" /D DATA_PATH=\\"share\\"${M}
101 # End Source File${M}
104 for subdir in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep "/.*/" | cut -f2 -d/ | sort | uniq`
106 cat >> ${target} << EOF
107 # Begin Group "${subdir}"${M}
109 for file in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep "/${subdir}/"`
111 if test "${target}" = "evc/libvlc.vcp"
113 cat >> ${target} << EOF
114 # Begin Source File${M}
115 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
116 # ADD CPP /D "__VLC__" /D PLUGIN_PATH=\\"plugins\\" /D DATA_PATH=\\"share\\"${M}
117 !IF "\$(CFG)" == "libvlc - Win32 (WCE MIPS) Release"${M}
118 # PROP Output_Dir "MIPSRel\\${subdir}"${M}
119 # PROP Intermediate_Dir "MIPSRel\\${subdir}"${M}
120 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE MIPS) Debug"${M}
121 # PROP Output_Dir "MIPSDbg\\${subdir}"${M}
122 # PROP Intermediate_Dir "MIPSDbg\\${subdir}"${M}
123 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE SH4) Release"${M}
124 # PROP Output_Dir "SH4Rel\\${subdir}"${M}
125 # PROP Intermediate_Dir "SH4Rel\\${subdir}"${M}
126 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE SH4) Debug"${M}
127 # PROP Output_Dir "SH4Dbg\\${subdir}"${M}
128 # PROP Intermediate_Dir "SH4Dbg\\${subdir}"${M}
129 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE SH3) Release"${M}
130 # PROP Output_Dir "SH3Rel\\${subdir}"${M}
131 # PROP Intermediate_Dir "SH3Rel\\${subdir}"${M}
132 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE SH3) Debug"${M}
133 # PROP Output_Dir "SH3Dbg\\${subdir}"${M}
134 # PROP Intermediate_Dir "SH3Dbg\\${subdir}"${M}
135 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE ARM) Release"${M}
136 # PROP Output_Dir "ARMRel\\${subdir}"${M}
137 # PROP Intermediate_Dir "ARMRel\\${subdir}"${M}
138 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE ARM) Debug"${M}
139 # PROP Output_Dir "ARMDbg\\${subdir}"${M}
140 # PROP Intermediate_Dir "ARMDbg\\${subdir}"${M}
141 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE x86em) Release"${M}
142 # PROP Output_Dir "X86EMRel\\${subdir}"${M}
143 # PROP Intermediate_Dir "X86EMRel\\${subdir}"${M}
144 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE x86em) Debug"${M}
145 # PROP Output_Dir "X86EMDbg\\${subdir}"${M}
146 # PROP Intermediate_Dir "X86EMDbg\\${subdir}"${M}
148 # End Source File${M}
151 cat >> ${target} << EOF
152 # Begin Source File${M}
153 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
154 # ADD CPP /D "__VLC__" /D PLUGIN_PATH=\\"plugins\\" /D DATA_PATH=\\"share\\"${M}
155 !IF "\$(CFG)" == "libvlc - Win32 Release"${M}
156 # PROP Output_Dir "Release\\${subdir}"${M}
157 # PROP Intermediate_Dir "Release\\${subdir}"${M}
158 !ELSEIF "\$(CFG)" == "libvlc - Win32 Debug"${M}
159 # PROP Output_Dir "Debug\\${subdir}"${M}
160 # PROP Intermediate_Dir "Debug\\${subdir}"${M}
162 # End Source File${M}
166 cat >> ${target} << EOF
171 perl -e 'while(<>){if(/§SOURCES§/){last;}}while(<>){if(/§HEADERS§/){last;}print $_}' < ${target}.in >> ${target}
172 for file in ${LIBVLC_HEADERS}
174 cat >> ${target} << EOF
175 # Begin Source File${M}
176 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
177 # End Source File${M}
180 cat >> ${target} << EOF
181 # Begin Group "vlc"${M}
183 for file in ${LIBVLC_PKG_HEADERS}
185 cat >> ${target} << EOF
186 # Begin Source File${M}
187 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
188 # End Source File${M}
191 cat >> ${target} << EOF
194 perl -e 'while(<>){if(/§HEADERS§/){last;}}while(<>){print $_}' < ${target}.in >> ${target}
198 grep '^L_[^ ]*_pic =' Modules.am | while read a b c
200 makefile="`echo $c | sed -e 's@/[^/]*$@/Modules.am@'`"
201 plugin="`echo $a | sed 's/L_\(.*\)_pic/\1/'`"
202 # this is an attempt at getting a list of plugin sources... we take the
203 # production and remove everything that does not contain "module", which
204 # means you miss $(NULL), but other variables too.
205 cfiles=`grep -v '[^-_a-zA-Z0-9]*#' ${makefile} | awk 'BEGIN{a=0}{if(!a&&/^SOURCES_'${plugin}'[^-_a-zA-Z0-9]*=/){a=1;print$0;next;}if(a){if(/^[a-zA-Z]/){exit;}print $0}}' | tr '\\ ' '\n\n' | sed -ne 's,/,\\\\,g; s/.*modules/modules/p'`
206 hfiles=`for i in ${cfiles} ; do echo $i ; done | grep '\.h$'`
207 cfiles=`for i in ${cfiles} ; do echo $i ; done | grep -v '\.h$'`
210 test "${dir}" = "evc" && suf="vcp" || suf="dsp"
211 source="${dir}/plugins.${suf}.in"
212 target="${dir}/plugin_${plugin}.${suf}"
214 perl -pe 'if(/§SOURCES§/){last;} s/§PLUGIN§/'${plugin}'/g' < ${source} > ${target}
215 for cfile in ${cfiles}
217 cat >> ${target} << EOF
218 # Begin Source File${M}
219 SOURCE="..\\${cfile}"${M}
220 # End Source File${M}
223 # sed is really nicer for this... unfortunately it's broken under cygwin
224 # sed -ne '1,/§SOURCES§/d; /§HEADERS§/,$d; p' < ${source} >> ${target}
225 perl -e 'while(<>){if(/§SOURCES§/){last;}}while(<>){if(/§HEADERS§/){last;}print $_}' < ${source} >> ${target}
226 for hfile in ${hfiles}
228 cat >> ${target} << EOF
229 # Begin Source File${M}
230 SOURCE="..\\${hfile}"${M}
231 # End Source File${M}
234 # sed -ne '1,/§HEADERS§/d; p' < ${source} >> ${target}
235 perl -e 'while(<>){if(/§HEADERS§/){last;}}while(<>){print $_}' < ${source} >> ${target}
240 for target in evc/vlc.vcp msvc/vlc.dsp
243 # Top of the project file
244 perl -pe 'if(/§SOURCES§/){last;}' < ${target}.in > ${target}
246 if test "${target}" = "evc/vlc.vcp"
248 cat >> ${target} << EOF
249 # Begin Source File${M}
250 SOURCE="..\\evc\\vlc.c"${M}
251 # End Source File${M}
254 cat >> ${target} << EOF
255 # Begin Source File${M}
256 SOURCE="..\\src\\vlc.c"${M}
257 # End Source File${M}
260 # Bottom of the project file - handles resource files too
261 perl -e 'while(<>){if(/§SOURCES§/){last;}}while(<>){print $_}' < ${target}.in >> ${target}
269 ## Update the potfiles because no one ever does it
271 if test "$do_po" = "yes"