| | 377 | ## Update the MSVC (.NET) project files |
|---|
| | 378 | ## |
|---|
| | 379 | if test "${action}" = "vc7" |
|---|
| | 380 | then |
|---|
| | 381 | echo "generating Visual .NET files" |
|---|
| | 382 | |
|---|
| | 383 | srcdir=. |
|---|
| | 384 | |
|---|
| | 385 | # The evil ^M. printf '\r' does not work in Cygwin. |
|---|
| | 386 | M=' |
|---|
| | 387 | ' |
|---|
| | 388 | |
|---|
| | 389 | # Variables we get from configure.ac |
|---|
| | 390 | LIBVLC_VERSION=`sed -ne '/AC_INIT/s/.*,\(.*\))/\1/p' < configure.ac` |
|---|
| | 391 | LIBVLC_CODENAME=`sed -ne '/CODENAME=/s/.*"\(.*\)"/\1/p' < configure.ac` |
|---|
| | 392 | LIBVLC_SYMBOL=`echo $LIBVLC_VERSION | sed -e 'y/.-/__/'` |
|---|
| | 393 | |
|---|
| | 394 | # Sources that get built under Win32 - FIXME: anyone wanna deuglify this? :) |
|---|
| | 395 | LIBVLC_SOURCES=`getfiles SOURCES_libvlc_common; getfiles SOURCES_libvlc_win32; getfiles SOURCES_libvlc_dirent; getfiles SOURCES_libvlc_getopt; getfiles SOURCES_libvlc_libc` |
|---|
| | 396 | |
|---|
| | 397 | LIBVLC_HEADERS=`getfiles HEADERS_include; getfiles HEADERS_include_built` |
|---|
| | 398 | |
|---|
| | 399 | LIBVLC_PKG_HEADERS=`getfiles dist_pkginclude_HEADERS` |
|---|
| | 400 | |
|---|
| | 401 | # Clean up |
|---|
| | 402 | rm -f msvc/*.vcproj |
|---|
| | 403 | |
|---|
| | 404 | # config files |
|---|
| | 405 | for target in msvc/config.h |
|---|
| | 406 | do |
|---|
| | 407 | printf "." |
|---|
| | 408 | rm -f ${target} |
|---|
| | 409 | sed -e "s/@CODENAME@/${LIBVLC_CODENAME}/" \ |
|---|
| | 410 | -e "s/@VERSION@/${LIBVLC_VERSION}/" \ |
|---|
| | 411 | -e "s/@SYMBOL@/${LIBVLC_SYMBOL}/" < ${target}.in > ${target} |
|---|
| | 412 | done |
|---|
| | 413 | |
|---|
| | 414 | # vlc files |
|---|
| | 415 | target="msvc/vlc.vcproj" |
|---|
| | 416 | printf "." |
|---|
| | 417 | # Top of the project file |
|---|
| | 418 | guid=`perl -e 'sub r {return sprintf("%X", int rand(65536))} print r.r."-".r."-".r."-".r."-".r.r.r'` |
|---|
| | 419 | perl -pe 'if(/�SOURCES�/){last;} s/�GUID�/'${guid}'/g' < ${target}.in > ${target} |
|---|
| | 420 | # The source files |
|---|
| | 421 | cat >> ${target} << EOF |
|---|
| | 422 | <File RelativePath="..\\src\\vlc.c"></File>${M} |
|---|
| | 423 | EOF |
|---|
| | 424 | # Bottom of the project file - handles resource files too |
|---|
| | 425 | perl -e 'while(<>){if(/�SOURCES�/){last;}}while(<>){print $_}' < ${target}.in >> ${target} |
|---|
| | 426 | |
|---|
| | 427 | # libvlc files |
|---|
| | 428 | target=msvc/libvlc.vcproj |
|---|
| | 429 | printf "." |
|---|
| | 430 | # Top of the project file |
|---|
| | 431 | guid=`perl -e 'sub r {return sprintf("%X", int rand(65536))} print r.r."-".r."-".r."-".r."-".r.r.r'` |
|---|
| | 432 | perl -pe 'if(/�SOURCES�/){last;} s/�GUID�/'${guid}'/g' < ${target}.in > ${target} |
|---|
| | 433 | # The source files |
|---|
| | 434 | for file in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep -v "/.*/"` |
|---|
| | 435 | do |
|---|
| | 436 | cat >> ${target} << EOF |
|---|
| | 437 | <File RelativePath="..\\`echo ${dir}/${file} | sed 's,/,\\\\,g'`"></File>${M} |
|---|
| | 438 | EOF |
|---|
| | 439 | done |
|---|
| | 440 | for subdir in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep "/.*/" | cut -f2 -d/ | sort | uniq` |
|---|
| | 441 | do |
|---|
| | 442 | cat >> ${target} << EOF |
|---|
| | 443 | <Filter Name="`echo ${subdir} | sed s,/,_,g`" Filter="c;cpp">${M} |
|---|
| | 444 | EOF |
|---|
| | 445 | for file in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep "/${subdir}/"` |
|---|
| | 446 | do |
|---|
| | 447 | cat >> ${target} << EOF |
|---|
| | 448 | <File RelativePath="..\\`echo ${file} | sed 's,/,\\\\,g'`">${M} |
|---|
| | 449 | EOF |
|---|
| | 450 | if echo ${file} | grep -q '.c$' |
|---|
| | 451 | then |
|---|
| | 452 | cat >> ${target} << EOF |
|---|
| | 453 | <FileConfiguration Name="Debug|Win32">${M} |
|---|
| | 454 | <Tool Name="VCCLCompilerTool" ObjectFile="\$(IntDir)/\$(ProjectName)/`echo ${file} | sed -e s/\.c$/.obj/`"/>${M} |
|---|
| | 455 | </FileConfiguration>${M} |
|---|
| | 456 | EOF |
|---|
| | 457 | fi |
|---|
| | 458 | cat >> ${target} << EOF |
|---|
| | 459 | </File>${M} |
|---|
| | 460 | EOF |
|---|
| | 461 | done |
|---|
| | 462 | cat >> ${target} << EOF |
|---|
| | 463 | </Filter>${M} |
|---|
| | 464 | EOF |
|---|
| | 465 | done |
|---|
| | 466 | # The headers |
|---|
| | 467 | perl -e 'while(<>){if(/�SOURCES�/){last;}}while(<>){if(/�HEADERS�/){last;}print $_}' < ${target}.in >> ${target} |
|---|
| | 468 | for file in ${LIBVLC_HEADERS} |
|---|
| | 469 | do |
|---|
| | 470 | cat >> ${target} << EOF |
|---|
| | 471 | <File RelativePath="..\\`echo ${file} | sed 's,/,\\\\,g'`"></File>${M} |
|---|
| | 472 | EOF |
|---|
| | 473 | done |
|---|
| | 474 | cat >> ${target} << EOF |
|---|
| | 475 | <Filter Name="vlc" Filter="h;hpp">${M} |
|---|
| | 476 | EOF |
|---|
| | 477 | for file in ${LIBVLC_PKG_HEADERS} |
|---|
| | 478 | do |
|---|
| | 479 | cat >> ${target} << EOF |
|---|
| | 480 | <File RelativePath="..\\`echo ${file} | sed 's,/,\\\\,g'`"></File>${M} |
|---|
| | 481 | EOF |
|---|
| | 482 | done |
|---|
| | 483 | cat >> ${target} << EOF |
|---|
| | 484 | </Filter>${M} |
|---|
| | 485 | EOF |
|---|
| | 486 | perl -e 'while(<>){if(/�HEADERS�/){last;}}while(<>){print $_}' < ${target}.in >> ${target} |
|---|
| | 487 | |
|---|
| | 488 | # plugins files |
|---|
| | 489 | for dir in `sed -ne 's,modules/\(.*\)/Makefile,\1,p' ${srcdir}/configure.ac` |
|---|
| | 490 | do |
|---|
| | 491 | mf="${srcdir}/modules/${dir}/Modules.am" |
|---|
| | 492 | for mod in `sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf}` |
|---|
| | 493 | do |
|---|
| | 494 | # this is an attempt at getting a list of plugin sources... we take the |
|---|
| | 495 | # production and remove everything that does not contain "module", which |
|---|
| | 496 | # means you miss $(NULL), but other variables too. |
|---|
| | 497 | 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 '\.'` |
|---|
| | 498 | hfiles=`for i in ${allfiles} ; do echo "$i" ; done | grep '\.h$'` |
|---|
| | 499 | cfiles=`for i in ${allfiles} ; do echo "$i" ; done | grep -v '\.h$'` |
|---|
| | 500 | for msdir in msvc |
|---|
| | 501 | do |
|---|
| | 502 | source="${msdir}/plugins.vcproj.in" |
|---|
| | 503 | target="${msdir}/plugin_${mod}.vcproj" |
|---|
| | 504 | printf "." |
|---|
| | 505 | guid=`perl -e 'sub r {return sprintf("%X", int rand(65536))} print r.r."-".r."-".r."-".r."-".r.r.r'` |
|---|
| | 506 | perl -pe 'if(/�SOURCES�/){last;} s/�PLUGIN�/'${mod}'/g' < ${source} | sed 's,�GUID�,'${guid}',' > ${target} |
|---|
| | 507 | for cfile in ${cfiles} |
|---|
| | 508 | do |
|---|
| | 509 | cat >> ${target} << EOF |
|---|
| | 510 | <File RelativePath="..\\modules\\`echo ${dir}/${cfile} | sed 's,/,\\\\,g'`"></File>${M} |
|---|
| | 511 | EOF |
|---|
| | 512 | done |
|---|
| | 513 | # sed is really nicer for this... unfortunately it's broken under cygwin |
|---|
| | 514 | # sed -ne '1,/�SOURCES�/d; /�HEADERS�/,$d; p' < ${source} >> ${target} |
|---|
| | 515 | perl -e 'while(<>){if(/�SOURCES�/){last;}}while(<>){if(/�HEADERS�/){last;}print $_}' < ${source} >> ${target} |
|---|
| | 516 | for hfile in ${hfiles} |
|---|
| | 517 | do |
|---|
| | 518 | cat >> ${target} << EOF |
|---|
| | 519 | <File RelativePath="..\\modules\\`echo ${dir}/${hfile} | sed 's,/,\\\\,g'`"></File>${M} |
|---|
| | 520 | EOF |
|---|
| | 521 | done |
|---|
| | 522 | # sed -ne '1,/�HEADERS�/d; p' < ${source} >> ${target} |
|---|
| | 523 | perl -e 'while(<>){if(/�HEADERS�/){last;}}while(<>){print $_}' < ${source} >> ${target} |
|---|
| | 524 | done |
|---|
| | 525 | done |
|---|
| | 526 | done |
|---|
| | 527 | |
|---|
| | 528 | echo " done." |
|---|
| | 529 | exit 0 |
|---|
| | 530 | fi |
|---|
| | 531 | |
|---|
| | 532 | ## |
|---|