prepare for release 0.5.76
[qtcontacts-tracker:hasselmms-contactsd.git] / configure
1 #!/bin/sh
2 #
3 # Configures to build the project
4 #
5
6 #-------------------------------------------------------------------------------
7 # script initialization
8 #-------------------------------------------------------------------------------
9
10 # Making releases:
11 #   set the new version number:
12 #     odd minor -> development series
13 #     even minor -> stable series
14 #     increment micro for each release within a series
15 #   set nano_version to 0
16 #   update debian/changelog, use dch
17 #   make the release, tag it
18 #   set nano_version to 1
19
20 MAJOR_VERSION=0
21 MINOR_VERSION=5
22 MICRO_VERSION=76
23 NANO_VERSION=0
24
25 if [ $NANO_VERSION -eq "0" ]; then
26     VERSION="$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION"
27 else
28     VERSION="$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION.$NANO_VERSION"
29 fi
30
31 relpath=`dirname $0`
32 relpath=`(cd "$relpath"; /bin/pwd)`
33 outpath=`/bin/pwd`
34
35 PREFIX=/usr
36 LOCALSTATEDIR=/var
37
38 TOP_SOURCEDIR=$relpath
39 TOP_BUILDDIR=$outpath
40
41 while [ "$#" -gt 0 ]; do
42     case "$1" in
43     -h|--help)
44         echo "Usage: ./configure [OPTION]..."
45         echo
46         echo "Configuration:"
47         echo "    -h, --help              display this help and exit"
48         echo
49         echo "Installation directories:"
50         echo "    --prefix PREFIX         install everything relative to PREFIX"
51         echo "                            [/usr]"
52         echo
53         echo "Fine tuning of the installation directories:"
54         echo "    --bindir DIR            user executables [PREFIX/bin]"
55         echo "    --libdir DIR            object code libraries [PREFIX/lib]"
56         echo "    --includedir DIR        C header files [PREFIX/include]"
57         echo "    --localstatedir DIR     modifiable single-machine data [/var]"
58         echo
59         exit
60         ;;
61     --prefix)
62         shift
63         PREFIX=$1
64         ;;
65     --bindir)
66         shift
67         BINDIR=$1
68         ;;
69     --libdir)
70         shift
71         LIBDIR=$1
72         ;;
73     --includedir)
74         shift
75         INCLUDEDIR=$1
76         ;;
77     --localstatedir)
78         shift
79         LOCALSTATEDIR=$1
80         ;;
81     --enable-coverage)
82         ENABLE_COVERAGE=coverage ;;
83     --disable-coverage)
84         ENABLE_COVERAGE=nocoverage ;;
85     *)
86         echo >&2 "configure: error: unrecognized option: '$1'"
87         echo >&2 "Try './configure --help' for more information."
88         exit
89         ;;
90     esac
91     shift
92 done
93
94 [ -z $BINDIR ] && BINDIR=$PREFIX/bin
95 [ -z $LIBDIR ] && LIBDIR=$PREFIX/lib
96 [ -z $INCLUDEDIR ] && INCLUDEDIR=$PREFIX/include
97
98 #coverage options
99
100 if [ -z "$ENABLE_COVERAGE" ]
101 then 
102     echo "Coverage not enabled"
103     ENABLE_COVERAGE=nocoverage
104 fi
105
106 # save configuration into .qmake.cache
107 CACHEFILE="$outpath/.qmake.cache"
108 [ -f "$CACHEFILE" ] && rm -f "$CACHEFILE"
109
110 cat >> "$CACHEFILE" << EOF
111 VERSION = \$\$quote($VERSION)
112 PREFIX = \$\$quote($PREFIX)
113 BINDIR = \$\$quote($BINDIR)
114 LIBDIR = \$\$quote($LIBDIR)
115 INCLUDEDIR = \$\$quote($INCLUDEDIR)
116 LOCALSTATEDIR = \$\$quote($LOCALSTATEDIR)
117 TOP_SOURCEDIR = \$\$quote($TOP_SOURCEDIR)
118 TOP_BUILDDIR = \$\$quote($TOP_BUILDDIR)
119 CONFIG += \$\$quote($ENABLE_COVERAGE)
120 EOF
121
122 infiles="contactsd-1.0.pc
123          tests/mktests.sh"
124 for infile in $infiles; do
125     echo "Generating $infile"
126     # pre-process .in files
127     mkdir -p `dirname $infile`
128     cat $TOP_SOURCEDIR/$infile.in |
129         sed -e "s,@VERSION@,${VERSION},g" \
130             -e "s,@PREFIX@,${PREFIX},g" \
131             -e "s,@BINDIR@,${BINDIR},g" \
132             -e "s,@LIBDIR@,${LIBDIR},g" \
133             -e "s,@INCLUDEDIR@,${INCLUDEDIR},g" \
134             -e "s,@LOCALSTATEDIR@,${LOCALSTATEDIR},g" \
135             -e "s,@TOP_SOURCEDIR@,${TOP_SOURCEDIR},g" \
136             -e "s,@TOP_BUILDDIR@,${TOP_BUILDDIR},g" \
137         > $TOP_BUILDDIR/$infile
138 done
139
140 # run qmake
141 qmake $relpath/contactsd.pro
142
143 echo
144 echo "contactsd is now configured for building. Just run 'make'."
145 echo "Once everything is built, you must run 'make install'."
146 echo "contactsd will be installed into $PREFIX"
147 echo
148 echo "To reconfigure, run 'make confclean' and 'configure'."