File: configure

package info (click to toggle)
geary 0.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 8,332 kB
  • ctags: 5,261
  • sloc: ansic: 26,847; sql: 174; makefile: 121; xml: 101; python: 18; sh: 17
file content (202 lines) | stat: -rwxr-xr-x 5,788 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#!/usr/bin/env bash
#
# Copyright 2012-2014 Yorba Foundation
#
# This software is licensed under the GNU LGPL (version 2.1 or later).
# See the COPYING file in this distribution. 

srcdir=$(cd $(dirname $0) && pwd)

DEFAULT_PREFIX="/usr/local"

PREFIX=$DEFAULT_PREFIX

configure_help() {
    cat <<- EOT
	Usage:
	  ./configure [OPTIONS]...
	
	Options:
	  -h, --help            Print this help and exit.
	  --prefix=PREFIX       Prepend PREFIX to program installation paths.
	                        [$DEFAULT_PREFIX]
	  --debug               Build for debugging.
	
	  --disable-fatal-warnings
	                        Disable Vala fatal warnings when compiling.
	  --enable-unity
	                        Enable Unity interface changes.
	  --enable-ref-tracking
	                        Enable reference tracking which is dumped to stdout when the program exits.
	  --disable-schemas-compile
	                        Disable compiling the GSettings schema.
	  --disable-desktop-update
	                        Disable desktop database update.
	  --disable-desktop-validate
	                        Disable checking for errors in generated desktop file.
	  --disable-icon-update
	                        Disable icon cache update.
	  --disable-documentation
	                        Disable generating and installing translated help documentation.
	  --disable-contractor
	                        Disable installing Contractor files.
	  --disable-poodle-ssl3
	                        Disable POODLE SSLv3 GnuTLS priority fix. (Not recommended.)

	Some influential environment variables:
	  PKG_CONFIG_PATH       Adds directories to pkg-config's search path.
	  PKG_CONFIG_LIBDIR     Overrides pkg-config's built-in search path.

	  VALAC                 Name of the vala compiler to use, e.g. "valac-0.18".

EOT
}

abort() {
    printf "%s: Invalid argument %s\n" $0 $1
    configure_help
    exit 1
}

while [ $# != 0 ]
do
    if [[ "$1" = *=* ]]
    then
        option=${1%%=*}
        value=${1#*=}
    else
        option=$1
        value=
    fi

    case $option in
        -h | --help)        configure_help
                            exit 0
                            ;;
        
        --prefix)           [ ! $value ] && abort $1
                            CMDLINE="${CMDLINE} -DCMAKE_INSTALL_PREFIX=${value}"
                            ;;
        
# ignored for autotools compatibility
        --bindir | --libdir | --sbindir |--datadir | --localstatedir | --includedir) ;;
        --infodir | --sysconfdir |  --mandir | --libexecdir) ;;
        --build | --host | --target) ;;
        --disable-silent-rules | --disable-static ) ;;
        
        --debug)
                            CMDLINE="${CMDLINE} -DDEBUG=ON"
                            ;;
        
        --disable-fatal-warnings)
                            CMDLINE="${CMDLINE} -DNO_FATAL_WARNINGS=ON"
                            ;;
        
        --enable-ref-tracking)
                            CMDLINE="${CMDLINE} -DREF_TRACKING=ON"
                            ;;
        
        --enable-unity)
                            CMDLINE="${CMDLINE} -DENABLE_UNITY=ON"
                            ;;
        
        --disable-schemas-compile)
                            CMDLINE="${CMDLINE} -DGSETTINGS_COMPILE=OFF"
                            CMDLINE="${CMDLINE} -DGSETTINGS_COMPILE_IN_PLACE=OFF"
                            ;;
        
        --disable-icon-update)
                            CMDLINE="${CMDLINE} -DICON_UPDATE=OFF"
                            ;;
        
        --disable-desktop-update)
                            CMDLINE="${CMDLINE} -DDESKTOP_UPDATE=OFF"
                            ;;

        --disable-desktop-validate)
                            CMDLINE="${CMDLINE} -DDESKTOP_VALIDATE=OFF"
                            ;;

        --disable-documentation)
                            CMDLINE="${CMDLINE} -DTRANSLATE_HELP=OFF"
                            ;;
        
        --disable-contractor)
                            CMDLINE="${CMDLINE} -DDISABLE_CONTRACT=ON"
                            ;;
        
        --disable-poodle-ssl3)
                            CMDLINE="${CMDLINE} -DDISABLE_POODLE=ON"
                            ;;
        
        VALAC)              [ ! $value ] && abort $1
                            VALAC=$value
                            ;;
        
        *)                  abort $option
                            ;;
    esac
    
    shift
done

# Verify use supplied vala executable
if [ -n "$VALAC" ]
then
    VALA_EXECUTABLE=`type -p "$VALAC"`

    if [ -z "$VALA_EXECUTABLE" ]
    then
        printf "$VALAC is not an executable program.\n"
        exit 1
    fi

    CMDLINE="${CMDLINE} -DVALA_EXECUTABLE='$VALA_EXECUTABLE'"
fi

# Verify cmake is installed
# TODO: Check for minimum version number
if ! cmake --version
then
    printf "cmake must be installed to configure and build.\n"
    exit 1
fi

using_srcdir_ne_builddir=false
# Simple check to verify this script is running in the root of the source tree
if [ -e Makefile.in ]
then
    using_srcdir_ne_builddir=true
    # Remove existing Makefile so it's not left around if configure fails
    rm -f Makefile

    # Remove the build folder to force Cmake to update its cache.
    rm -fr build

     if ! mkdir -p build
     then
         printf "Unable to create build directory.\n"
         exit 1
     fi

     cd build
fi

if ! (cmake $CMDLINE ${srcdir})
then
    printf "Unable to prepare build directory.\n"
    exit 1
fi

if ${using_srcdir_ne_builddir}
then
    cd ..

    if ! cp -f ${srcdir}/Makefile.in Makefile
    then
        printf "Unable to prepare Makefile.\n"
        exit 1
    fi
fi

printf "Configured.  Type 'make' to build, 'make install' to install.\n"