1#!/bin/sh
2
3set -e
4
5# if you compile first time you must change variable "lazpath" and "lcl"
6# after it execute this script with parameter "all" at awgg dir
7# "./build.sh all" it build awgg
8#                                                 by Segator
9
10
11# You can execute this script with different parameters:
12# default - compiling AWGG only (using by default)
13
14# path to lazbuild
15export lazbuild=$(which lazbuild)
16
17# Set up widgetset: gtk or gtk2 or qt
18# Set up processor architecture: i386 or x86_64
19if [ $2 ]
20  then export lcl=$2
21fi
22if [ $lcl ] && [ $CPU_TARGET ]
23  then export AWGG_ARCH=$(echo "--widgetset=$lcl")" "$(echo "--cpu=$CPU_TARGET")
24elif [ $lcl ]
25  then export AWGG_ARCH=$(echo "--widgetset=$lcl")
26elif [ $CPU_TARGET ]
27  then export AWGG_ARCH=$(echo "--cpu=$CPU_TARGET")
28fi
29
30build_default()
31{
32  $lazbuild src/awgg.lpi $AWGG_ARCH
33
34  strip awgg
35}
36
37build_beta()
38{
39
40  # Build versionitis
41  $lazbuild src/versionitis.lpi
42
43  # Update version
44  src/versionitis -verbose
45
46  # Build AWGG
47  $lazbuild src/awgg.lpi --bm=beta $AWGG_ARCH
48
49  # Build Dwarf LineInfo Extractor
50  $lazbuild tools/extractdwrflnfo.lpi
51
52  # Extract debug line info
53  chmod a+x tools/extractdwrflnfo
54  if [ -f awgg.dSYM/Contents/Resources/DWARF/awgg ]; then
55    mv -f awgg.dSYM/Contents/Resources/DWARF/awgg $(pwd)/awgg.dbg
56  fi
57  tools/extractdwrflnfo awgg.dbg
58
59  # Strip debug info
60  strip awgg
61}
62build_release()
63{
64
65  # Build versionitis
66  $lazbuild src/versionitis.lpi
67
68  # Update version
69  src/versionitis -verbose
70
71  # Build AWGG
72  $lazbuild src/awgg.lpi --bm=release $AWGG_ARCH
73
74  # Build Dwarf LineInfo Extractor
75  $lazbuild tools/extractdwrflnfo.lpi
76
77  # Extract debug line info
78  chmod a+x tools/extractdwrflnfo
79  if [ -f awgg.dSYM/Contents/Resources/DWARF/awgg ]; then
80    mv -f awgg.dSYM/Contents/Resources/DWARF/awgg $(pwd)/awgg.dbg
81  fi
82  tools/extractdwrflnfo awgg.dbg
83
84  # Strip debug info
85  strip awgg
86}
87
88build_all()
89{
90  build_default
91}
92
93
94case $1 in
95        beta)  build_beta;;
96        release) build_release;;
97         all)  build_all;;
98           *)  build_default;;
99esac
100