~ubuntu-branches/debian/sid/pgadmin3/sid

« back to all changes in this revision

Viewing changes to pgadmin/pgscript/parser.sh

  • Committer: Bazaar Package Importer
  • Author(s): Gerfried Fuchs
  • Date: 2009-07-30 12:27:16 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20090730122716-fddbh42on721bbs2
Tags: 1.10.0-1
* New upstream release.
* Adjusted watch file to match release candidates.
* Updated to Standards-Version 3.8.2:
  - Moved to Section: database.
  - Add DEB_BUILD_OPTIONS support for parallel building.
  - Move from findstring to filter suggestion for DEB_BUILD_OPTIONS parsing.
* pgagent got split into its own separate source package by upstream.
* Exclude Docs.vcproj from installation.
* Move doc-base.enus from pgadmin3 to pgadmin3-data package, the files are
  in there too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
#######################################################################
 
4
#
 
5
# pgAdmin III - PostgreSQL Tools
 
6
# Copyright (C) 2002 - 2009, The pgAdmin Development Team
 
7
# This software is released under the BSD Licence
 
8
#
 
9
# parser.sh - Runs Flex and Bison and processes the generated files
 
10
#
 
11
#######################################################################
 
12
 
 
13
# Directory containing pgScript includes (relative to the src directory)
 
14
INCLUDEDIR="include/pgscript"
 
15
# Directory containing pgScript sources (relative to the src directory)
 
16
SOURCEDIR="pgscript"
 
17
# Headers generated by Bison that need to be moved to ${INCLUDEDIR}
 
18
FILESTOMOVE=( "location.hh" "parser.tab.hh" "position.hh" "stack.hh" )
 
19
 
 
20
# Flex destination
 
21
LEXER="pgscript/lex.pgs.cc"
 
22
# A temporary file
 
23
AUX="pgscript/auxfile"
 
24
# Bison destination
 
25
PARSER="pgscript/parser.tab.cc"
 
26
 
 
27
#######################################################################
 
28
 
 
29
# Find the current directory
 
30
THISDIR=`dirname $0`
 
31
PREVDIR="$PWD"
 
32
 
 
33
# Go to the directory on top of the script directory
 
34
echo -n "cd ${THISDIR}/.. ... "
 
35
cd "${THISDIR}/.."
 
36
echo "done"
 
37
pwd
 
38
echo ""
 
39
 
 
40
# Generate Bison file
 
41
echo -n "+ Generating Bison output... "
 
42
bison -o"${PARSER}" "${SOURCEDIR}/pgsParser.yy"
 
43
echo "done"
 
44
 
 
45
# Generate Flex file
 
46
echo -n "+ Generating Flex output... "
 
47
flex -o"${LEXER}" "${SOURCEDIR}/pgsScanner.ll"
 
48
echo "done"
 
49
 
 
50
# Add pgAdmin3.h include at the beginning and change <FlexLexer.h> to
 
51
# "pgscript/FlexLexer.h" for the Flex output
 
52
echo -n "+ Processing Flex output... "
 
53
cat "${LEXER}" | awk 'BEGIN {print "#include \"pgAdmin3.h\"\n\n"}{print $0}' \
 
54
        | sed -e 's/<FlexLexer\.h>/"pgscript\/FlexLexer\.h"/g' > "${AUX}"
 
55
mv -f "${AUX}" "${LEXER}"
 
56
echo "done"
 
57
 
 
58
# Add pgAdmin3.h include at the beginning and a pragma and change
 
59
# "parser.tab.hh" to "pgscript/parser.tab.hh" to the Bison output
 
60
echo -n "+ Processing Bison output... "
 
61
cat "${PARSER}" | awk 'BEGIN {print "#include \"pgAdmin3.h\"\n#if _MSC_VER > 1000\n#pragma warning(disable: 4800)\n#endif\n"}{print $0}' | \
 
62
        sed -e 's/"parser.tab.hh"/"pgscript\/parser\.tab\.hh"/g' > "${AUX}"
 
63
sleep 1
 
64
mv -f "${AUX}" "${PARSER}"
 
65
echo "done"
 
66
 
 
67
# Move Bison include files to the include directory
 
68
echo + "Moving Bison header files... "
 
69
for file in ${FILESTOMOVE[@]}
 
70
do
 
71
        echo "    + mv ${SOURCEDIR}/${file} ${INCLUDEDIR}/${file}"
 
72
        mv "${SOURCEDIR}/${file}" "${INCLUDEDIR}/${file}"
 
73
done
 
74
echo "... done"
 
75
 
 
76
# Go back to the previous directory
 
77
echo ""
 
78
echo -n "cd $PREVDIR ... "
 
79
cd "$PREVDIR"
 
80
echo "done"