~ubuntu-branches/ubuntu/precise/postgresql-9.1/precise-security

« back to all changes in this revision

Viewing changes to src/tools/msvc/pgbison.bat

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-11 10:41:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110511104153-psbh2o58553fv1m0
Tags: upstream-9.1~beta1
ImportĀ upstreamĀ versionĀ 9.1~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
@echo off
 
2
REM src/tools/msvc/pgbison.bat
 
3
 
 
4
IF NOT EXIST src\tools\msvc\buildenv.pl goto nobuildenv
 
5
perl -e "require 'src/tools/msvc/buildenv.pl'; while(($k,$v) = each %ENV) { print qq[\@SET $k=$v\n]; }" > bldenv.bat
 
6
CALL bldenv.bat
 
7
del bldenv.bat
 
8
:nobuildenv 
 
9
 
 
10
SET BV=
 
11
for /F "tokens=4 usebackq" %%f in (`bison -V`) do if "!BV!"=="" SET BV=%%f
 
12
if "%BV%"=="" goto novarexp
 
13
if %BV% EQU 1.875 goto bisonok
 
14
if %BV% GEQ 2.2 goto bisonok
 
15
goto nobison
 
16
:bisonok
 
17
 
 
18
if "%1" == "src\backend\parser\gram.y" call :generate %1 src\backend\parser\gram.c src\backend\parser\gram.h
 
19
if "%1" == "src\backend\bootstrap\bootparse.y" call :generate %1 src\backend\bootstrap\bootparse.c
 
20
if "%1" == "src\backend\replication\repl_gram.y" call :generate %1 src\backend\replication\repl_gram.c
 
21
if "%1" == "src\pl\plpgsql\src\gram.y" call :generate %1 src\pl\plpgsql\src\pl_gram.c src\pl\plpgsql\src\pl_gram.h
 
22
if "%1" == "src\interfaces\ecpg\preproc\preproc.y" call :generate %1 src\interfaces\ecpg\preproc\preproc.c src\interfaces\ecpg\preproc\preproc.h
 
23
if "%1" == "contrib\cube\cubeparse.y" call :generate %1 contrib\cube\cubeparse.c
 
24
if "%1" == "contrib\seg\segparse.y" call :generate %1 contrib\seg\segparse.c
 
25
 
 
26
echo Unknown bison input: %1
 
27
exit 1
 
28
 
 
29
:generate
 
30
SET fn=%1
 
31
SET cf=%2
 
32
bison.exe -d %fn% -o %cf%
 
33
if errorlevel 1 exit 1
 
34
SET hf=%cf:~0,-2%.h
 
35
if not "%hf%"=="%3" (
 
36
        copy /y %hf% %3
 
37
        if errorlevel 1 exit 1
 
38
        del %hf%
 
39
)
 
40
exit 0
 
41
 
 
42
 
 
43
:novarexp
 
44
echo pgbison must be called with cmd /V:ON /C pgbison to work!
 
45
exit 1
 
46
 
 
47
:nobison
 
48
echo WARNING! Bison install not found, or unsupported Bison version.
 
49
echo Attempting to build without.
 
50
exit 0