[xml] xml2-config.bat for windows



i have wanted to link against the libxml2.dll lib but the building script reported an error xml2-config was missing.
i could get libxml from here 
http://sourceforge.net/projects/gnuwin32/files/libxml/2.4.12-1/
and a newer version from here ftp://ftp.zlatkovic.com/libxml/
but 
 xml2-config required shell script on windows 
so i rewrote xml2-config to xml2-config.bat

not sure how it fits current build 
it seems like paths in file ware dynamically genetically
but  i have made the prefix path to be calculated to the directory of  xml2-config.bat

@ECHO OFF

setlocal ENABLEDELAYEDEXPANSION
rem http://batcheero.blogspot.co.il/2007/06/how-to-enabledelayedexpansion.html - windows xp

SET SELFDIR=%~dp0
IF %SELFDIR:~-1%==\ SET SELFDIR=%SELFDIR:~0,-1%
set SELFDIR=%SELFDIR:\=/%

set prefix=%SELFDIR%
set exec_prefix=%prefix%
set includedir=%prefix%/include
set libdir=%exec_prefix%/lib

IF "%1"=="" GOTO usage0

rem whats the point of resettingthes flags...
rem set cflags=false
rem set libs=false

:loop

    IF "%1"=="" Exit /B 0

    IF "%1"=="--version" (
echo 2.4.12
Exit /B 0
)

    IF "%1"=="--help" (
          GOTO usage0
)
 
    rem the code below does: if next arg is not any known argument nor empty then the next arg is prefix value otherwise print the prefix
    IF "%1"=="--prefix" ( 
          IF "%2"=="" ( SHIFT
                        echo %prefix%) ELSE (
            IF "%2"=="--cflags" ( SHIFT
                                  echo %prefix% ) ELSE (
              IF "%2"=="--libs" ( SHIFT
                                  echo %prefix%) ELSE (
                IF "%2"=="--prefix" ( SHIFT
                                      echo %prefix%) ELSE (
                 SET /A prefix=%2
                 set exec_prefix=!prefix!
                 set includedir=!prefix!/include
                 set libdir=!exec_prefix!/lib
                 SHIFT
                 SHIFT
                )
              )
            )
          )
)

    IF "%1"=="--cflags" (

        echo -I!includedir!/libxml2/libxml -I!includedir!/libxml2 
SHIFT
)

    IF "%1"=="--libs" (
        echo -L!libdir! -lxml2 -lz  -liconv -lm -Wl,-s -lwsock32 -liberty -lMsup -lMstubs 
SHIFT
)


    GOTO :loop

Exit /B 1


:usage0

echo Usage: xml-config [OPTION]
echo _
echo Known values for OPTION are:
echo _
echo   --prefix=DIR change libxml prefix [default $prefix]
echo   --libs print library linking information
echo   --cflags print pre-processor and compiler flags
echo   --help display this help and exit
echo   --version output version information
Exit /B 0

:usage1

echo Usage: xml-config [OPTION]
echo _
echo Known values for OPTION are:
echo _
echo   --prefix=DIR change libxml prefix [default $prefix]
echo   --libs print library linking information
echo   --cflags print pre-processor and compiler flags
echo   --help display this help and exit
echo   --version output version information
Exit /B 1

Attachment: xml2-config.bat.txt
Description: Text document



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]