summaryrefslogtreecommitdiff
path: root/configure
blob: 7824e36a86df0f4b4b0529119d50e144ba0427ba (plain)
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
#!/bin/sh
#
# Configures to build the Qtopia Environment
#
# Copyright 1999-2000 Trolltech AS.  All rights reserved.
#

PLATFORM=linux-generic-g++
SHARING=shared
DEBUG=
QCONFIGARG=

touch .test.qpe.
if [ '!' -f ${OPIEDIR}/.test.qpe. ];
then
    rm .test.qpe.
    echo
    echo
    echo '   The environment variable $OPIEDIR is not set correctly. It is currently'
    echo '   set to "'$OPIEDIR'", but it should be set to this directory,'
    echo '   which is "'`pwd`'".'
    echo
    echo '   Please read the INSTALL file for instructions on how to set $OPIEDIR'
    echo '   correctly. If you have set $OPIEDIR in your .profile or .login, you '
    echo '   will need to log out and log in again to make the setting effective.'
    echo
    echo
    exit 1
fi
rm .test.qpe.

mkdir -p include/qpe
( cd include/qpe &&  rm -f *.h; ln -s ../../library/*.h .; ln -s ../../library/backend/*.h .; rm -f *_p.h; )

VERSION_MAJ=$(sed -n -e 's/.*QPE_VERSION "\([0-9]*\)\.[0-9]*\.[0-9]*.*".*/\1/p' <include/qpe/version.h)
VERSION_MIN=$(sed -n -e 's/.*QPE_VERSION "[0-9]*\.\([0-9]\)\.[0-9]*.*".*/\1/p' <include/qpe/version.h)
VERSION_PAT=$(sed -n -e 's/.*QPE_VERSION "[0-9]*\.[0-9]*\.\([0-9]*\).*".*/\1/p' <include/qpe/version.h)

TOMAKE=

if grep -q 'VERSION_STR.*"3' $QTDIR/include/qglobal.h
then
    QT3=yes
else
    QT3=no
fi

# Parse the arguments, setting things to "yes" or "no".

while [ -n "$1" ]; do
   case $1 in
   -platform|-xplatform) # No difference since we don't need to build moc, etc.
        shift; PLATFORM=$1
	;;
   -release)
       DEBUG=
	;;
   -debug)
       DEBUG=-debug
	;;
   -shared)
       SHARING=shared
	;;
   -static)
       SHARING=static
	;;
   -qconfig)
	# optional way to specify the qconfig-qpe.h is to pass -qconfig qpe
	shift; QCONFIGARG=DEFINES+=QCONFIG='\"'$1'\"' # Don't quote me on that.
	;;
   -make)
	shift; TOMAKE="$TOMAKE $1"
	;;
   -qt3)
       QT3=yes
       ;;
    *)
	HELP=yes;;
   esac
   shift
done

TARGET=configs/$PLATFORM-$SHARING$DEBUG

if [ '!' -f $TARGET ]
then
    if [ -f configs/linux-$PLATFORM-g++-$SHARING$DEBUG ]
    then
	TARGET=configs/linux-$PLATFORM-g++-$SHARING$DEBUG
    else
	echo
	echo '    The specified platform/compiler not supported: ' $TARGET
	echo
	exit 2
    fi
fi

# Next, emit a usage message if something failed.

if [ "$HELP" = "yes" ]; then
    cat <<EOF
Usage: $0 [-debug] [-release] [-shared] [-static] [-qt3] [-platform ...]

The defaults (*) are usually acceptable.  Here is a short explanation of
each option:

 *  -release ........... Compile and link Qt with debugging turned off.
    -debug ............. Compile and link Qt with debugging turned on.

 *  -shared ............ Create and use a shared Qt library (libqt.so)
    -static ............ Create and use a static Qt library (libqt.a)

    -qt3 ............... Configure for use with Qt 3.x

    -platform target ... The platform you are building on ($PLATFORM)
EOF
   exit 0;
fi


echo Creating makefiles...

sed -e 's/^\(VERSION.*= \).*/\1'$VERSION_MAJ.$VERSION_MIN.$VERSION_PAT/ <library/library.pro >library/library.pro-v
mv library/library.pro-v library/library.pro

if [ "$QT3" = yes ]
then
    VCONFIG="CONFIG+=qt3"
else
    VCONFIG="CONFIG+=qt2"
fi

if [ -f $TMAKEPATH/tmake.conf ]
then
    # You have tmake. We'll regenerate the file for you...
    echo "Makefiles will be regenerated."
fi

H=`pwd`
if [ -z "$TOMAKE" ]
then
    TOMAKE=`make showcomponents`
fi

for a in $TOMAKE ; do
    N=$a/Makefile
    M=$a/Makefile.in
    O=$a/Makefile.add
    f=`basename $a`

    if [ -f $TMAKEPATH/tmake.conf -a -f $a/$f.pro ]
    then
	(   cd $a;
	    TMAKEPATH=$QTDIR/tmake:$TMAKEPATH \
		tmake $QCONFIGARG CONFIG+=embedded $VCONFIG \
		    -t $H/qt/tmake/propagate.t $f.pro |
		    sed -e "s|$QTDIR|\$(QTDIR)|g" -e "s|$OPIEDIR|\$(OPIEDIR)|g" >Makefile.in;
	)
	echo -n "."
	appname=`grep '^TARGET' $a/$f.pro | sed 's/^TARGET.*=//' | sed 's/ //g'`
	translation=`grep '^TRANSLATION' $a/$f.pro | sed 's,^TRANSL.*=.*i18n\/.*\/,,' | sed 's/ //g' | sed 's,\.ts.*,,' | sed 's,^lib,,' `
	if [ -n "$translation" -a -n "$appname" ]
	then
	    if [ $appname != $translation ]
	    then 
		echo
		echo "Warning: translation and appname disagree in $a/$f.pro"
	    fi
	fi
	
    fi

    cat > $N <<EOF
#############################################################################
# Automatically generated from $M
# Build options from $1
#############################################################################

EOF

    SED=
    PLATFORM_CFLAGS=

    if [ "$f" = "embeddedkonsole" ]
    then
	case $PLATFORM in
	    *x86*|*generic*|*ipaq*)
		SED="$SED /^LIBS.*=/s/\$/ -lutil/;"
		PLATFORM_CFLAGS="-DHAVE_OPENPTY"
	    ;; *)
		SED=
	esac
    elif [ "$f" = "libmpeg3" ]
    then
	# Patch our Makefile.in file with the platform specifics for the libmpeg3 library
	# Use the C++ compiler to compile the .c files (because the fixed-point classes are C++ code)
	SED='s/\$(CC)/\$(CXX)/;'
	case $PLATFORM
	in
	    # For x86 turn on using floating point, compile mmx and css code
	    *x86*)
		# "-funroll-loops -fomit-frame-pointer -malign-loops=2 -malign-jumps=2 -malign-functions=2 -march=i486"
		PLATFORM_CFLAGS="-DHAVE_MMX -DHAVE_CSS"
		SED="$SED /SOURCES.*=/s/=/= video\\/mmxidct.S video\\/reconmmx.s\ /;"
	    # For generic turn on using floating point
	    ;; *generic*)
		PLATFORM_CFLAGS=""
	    # For the ipaq use fixed point maths, don't compile the mmx or css code
	    ;; *ipaq*)
		PLATFORM_CFLAGS="-DUSE_FIXED_POINT"
	    ;; *)
		# For 'other platforms', turn off optimizations and use fixed point
		PLATFORM_CFLAGS="-O -DUSE_FIXED_POINT"
	esac
    elif [ "$f" = "libmad" ]
    then
	# Patch our Makefile.in file with the platform specifics for the libmad library
	case $PLATFORM
	in
	    # For x86 use intel optimizations
	    *x86*)
		PLATFORM_CFLAGS="-DFPM_INTEL"
	    # For the ipaq use ARM asm optimizations
	    ;; *ipaq*)
		PLATFORM_CFLAGS="-DFPM_ARM"
		SED="$SED /SOURCES.*=/s/=/= idmt_arm.S /;"
	    # For generic platforms use the C 64-bit implementation
	    ;; *generic*)
		PLATFORM_CFLAGS="-DFPM_64BIT"
	    # For 'other platforms' use the ARM code
	    ;; *)
		PLATFORM_CFLAGS="-DFPM_ARM"
		SED="$SED /SOURCES.*=/s/=/= idmt_arm.S /;"
	esac
    fi
    if [ -n "$PLATFORM_CFLAGS" ]
    then
	# Append the addition c-flags we have defined
	SED="$SED /CFLAGS.*=.*/s/\$/ $PLATFORM_CFLAGS/;"
	SED="$SED /CXXFLAGS.*=.*/s/\$/ $PLATFORM_CFLAGS/;"
    fi
    cat $TARGET >> $N
    if [ -n "$SED" ]
    then
	sed -e "$SED" $M >> $N
    else
	cat $M >> $N
    fi

    cat >> $N <<EOF

lupdate:
	lupdate $f.pro

lrelease:
	lrelease $f.pro

EOF
    if [ -f "$O" ]
    then
	cat >> $N $O
    fi

done

MAKE=make
echo
echo "QPE is now configured for building. Just run $MAKE (or $MAKE single)."
echo "To reconfigure, run $MAKE clean and configure."
echo