]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - tools/make-functions
Merge remote-tracking branch 'origin/next' into thirteen
[people/pmueller/ipfire-2.x.git] / tools / make-functions
CommitLineData
15679d9f 1#!/bin/bash
70df8302
MT
2###############################################################################
3# #
4# IPFire.org - A linux based firewall #
33e7a260 5# Copyright (C) 2007-2011 IPFire Team <info@ipfire.org> #
70df8302
MT
6# #
7# This program is free software: you can redistribute it and/or modify #
8# it under the terms of the GNU General Public License as published by #
9# the Free Software Foundation, either version 3 of the License, or #
10# (at your option) any later version. #
11# #
12# This program is distributed in the hope that it will be useful, #
13# but WITHOUT ANY WARRANTY; without even the implied warranty of #
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15# GNU General Public License for more details. #
16# #
17# You should have received a copy of the GNU General Public License #
18# along with this program. If not, see <http://www.gnu.org/licenses/>. #
19# #
20###############################################################################
21###############################################################################
15679d9f
MT
22#
23# Beautifying variables & presentation & input output interface
24#
70df8302 25###############################################################################
15679d9f
MT
26
27## Screen Dimentions
28# Find current screen size
29if [ -z "${COLUMNS}" ]; then
30 COLUMNS=$(stty size)
31 COLUMNS=${COLUMNS##* }
32fi
33
34# When using remote connections, such as a serial port, stty size returns 0
35if [ "${COLUMNS}" = "0" ]; then
36 COLUMNS=80
37fi
38
39## Measurements for positioning result messages
40RESULT_WIDTH=4
41TIME_WIDTH=8
42OPT_WIDTH=6
43VER_WIDTH=10
44RESULT_COL=$((${COLUMNS} - $RESULT_WIDTH - 4))
45TIME_COL=$((${RESULT_COL} - $TIME_WIDTH - 5))
46OPT_COL=$((${TIME_COL} - $OPT_WIDTH - 5))
47VER_COL=$((${OPT_COL} - $VER_WIDTH - 5))
48
49## Set Cursur Position Commands, used via echo -e
50SET_RESULT_COL="\\033[${RESULT_COL}G"
51SET_TIME_COL="\\033[${TIME_COL}G"
52SET_OPT_COL="\\033[${OPT_COL}G"
53SET_VER_COL="\\033[${VER_COL}G"
54
55# Define color for messages
56BOLD="\\033[1;39m"
57DONE="\\033[1;32m"
58SKIP="\\033[1;34m"
59WARN="\\033[1;35m"
60FAIL="\\033[1;31m"
61NORMAL="\\033[0;39m"
62
63evaluate() {
64 if [ "$?" -eq "0" ]; then
65 beautify message DONE
66 else
67 EXITCODE=$1
68 shift 1
69 beautify message FAIL
70 $*
71 if [ $EXITCODE -ne "0" ]; then
72 exit $EXITCODE
73 fi
74 fi
75}
76
77position_cursor()
78{
79 # ARG1=starting position on screen
80 # ARG2=string to be printed
81 # ARG3=offset, negative for left movement, positive for right movement, relative to ARG1
82 # For example if your starting position is column 50 and you want to print Hello three columns to the right
83 # of your starting position, your call will look like this:
84 # position_cursor 50 "Hello" 3 (you'll get the string Hello at position 53 (= 50 + 3)
85 # If on the other hand you want your string "Hello" to end three columns to the left of position 50,
86 # your call will look like this:
87 # position_cursor 50 "Hello" -3 (you'll get the string Hello at position 42 (= 50 - 5 -3)
88 # If you want to start printing at the exact starting location, use offset 0
89
90 START=$1
91 STRING=$2
92 OFFSET=$3
93
94 STRING_LENGTH=${#STRING}
95
96 if [ ${OFFSET} -lt 0 ]; then
97 COL=$((${START} + ${OFFSET} - ${STRING_LENGTH}))
98 else
99 COL=$((${START} + ${OFFSET}))
100 fi
101
102 SET_COL="\\033[${COL}G"
103
104 echo $SET_COL
105} # End of position_cursor()
106
107
108beautify()
109{
110 # Commands: build_stage, make_pkg, message, result
111 case "$1" in
112 message)
113 case "$2" in
114 DONE)
115 echo -ne "${SET_RESULT_COL}[${DONE} DONE ${NORMAL}]\n"
116 ;;
117 WARN)
118 echo -ne "${WARN}${3}${NORMAL}${SET_RESULT_COL}[${WARN} WARN ${NORMAL}]\n"
119 ;;
120 FAIL)
121 echo -ne "${SET_RESULT_COL}[${FAIL} FAIL ${NORMAL}]\n"
122 ;;
123 SKIP)
124 echo -ne "${SET_RESULT_COL}[${SKIP} SKIP ${NORMAL}]\n"
125 ;;
126 esac
127 ;;
0b59f25c 128 build_stage)
15679d9f 129 MESSAGE=$2
0b59f25c
MT
130 if [ "$STAGE_TIME_START" ]; then
131 LAST_STAGE_TIME=$[ `date +%s` - $STAGE_TIME_START ]
132 fi
7ab7a9b4 133 STAGE_TIME_START=`date +%s`
0b59f25c
MT
134 echo -ne "${BOLD}*** ${MESSAGE}${NORMAL}"
135 if [ "$LAST_STAGE_TIME" ]; then
136 echo -ne "${DONE} (Last stage took $LAST_STAGE_TIME secs)${NORMAL}"
137 fi
138 echo -ne "${BOLD}${SET_VER_COL} version${SET_OPT_COL} options${SET_TIME_COL} time (sec)${SET_RESULT_COL} status${NORMAL}\n"
7ab7a9b4
MT
139 ;;
140 build_start)
141 BUILD_TIME_START=`date +%s`
142 ;;
143 build_end)
144 BUILD_TIME_END=`date +%s`
070fb401
CS
145 seconds=$[ $BUILD_TIME_END - $BUILD_TIME_START ]
146 hours=$((seconds / 3600))
147 seconds=$((seconds % 3600))
148 minutes=$((seconds / 60))
149 seconds=$((seconds % 60))
150
151 echo -ne "${DONE}***Build is finished now and took $hours hour(s) $minutes minute(s) $seconds second(s)!${NORMAL}\n"
7ab7a9b4 152 ;;
15679d9f
MT
153 make_pkg)
154 echo "$2" | while read PKG_VER PROGRAM OPTIONS
155 do
156 SET_VER_COL_REAL=`position_cursor $OPT_COL $PKG_VER -3`
157
158 if [ "$OPTIONS" == "" ]; then
159 echo -ne "${PROGRAM}${SET_VER_COL}[ ${BOLD}${SET_VER_COL_REAL}${PKG_VER}"
160 echo -ne "${NORMAL} ]${SET_RESULT_COL}"
161 else
162 echo -ne "${PROGRAM}${SET_VER_COL}[ ${BOLD}${SET_VER_COL_REAL}${PKG_VER}"
163 echo -ne "${NORMAL} ]${SET_OPT_COL}[ ${BOLD}${OPTIONS}"
164 echo -ne "${NORMAL} ]${SET_RESULT_COL}"
165 fi
166 done
167 ;;
168 result)
169 RESULT=$2
170
171 if [ ! $3 ]; then
172 PKG_TIME=0
173 else
174 PKG_TIME=$3
175 fi
176
177 SET_TIME_COL_REAL=`position_cursor $RESULT_COL $PKG_TIME -3`
178 case "$RESULT" in
179 DONE)
180 echo -ne "${SET_TIME_COL}[ ${BOLD}${SET_TIME_COL_REAL}$PKG_TIME${NORMAL} ]"
181 echo -ne "${SET_RESULT_COL}[${DONE} DONE ${NORMAL}]\n"
182 ;;
183 FAIL)
184 echo -ne "${SET_TIME_COL}[ ${BOLD}${SET_TIME_COL_REAL}$PKG_TIME${NORMAL} ]"
185 echo -ne "${SET_RESULT_COL}[${FAIL} FAIL ${NORMAL}]\n"
186 ;;
187 SKIP)
15679d9f
MT
188 echo -ne "${SET_RESULT_COL}[${SKIP} SKIP ${NORMAL}]\n"
189 ;;
190 esac
191 ;;
192 esac
193} # End of beautify()
194
195
196get_pkg_ver()
197{
33e7a260 198 PKG_VER=`grep -E "^VER |^VER=|^VER " $1 | awk '{print $3}'`
15679d9f
MT
199
200 if [ -z $PKG_VER ]; then
201 PKG_VER=`grep "Exp " $1 | awk '{print $4}'`
202 fi
33e7a260
AF
203 if [ -z $PKG_VER ]; then
204 PKG_VER="?"
205 fi
15679d9f
MT
206 if [ ${#PKG_VER} -gt $VER_WIDTH ]; then
207 # If a package version number is greater than $VER_WIDTH, we keep the first 4 characters
208 # and replace enough characters to fit the resulting string on the screen. We'll replace
209 # the extra character with .. (two dots). That's why the "+ 2" in the formula below.
210 # Example: if we have a 21-long version number that we want to fit into a 10-long space,
211 # we have to remove 11 characters. But if we replace 11 characters with 2 characters, we'll
212 # end up with a 12-character long string. That's why we replace 12 characters with ..
213 REMOVE=`expr substr "$PKG_VER" 4 $[ ${#PKG_VER} - $VER_WIDTH + 2 ]`
214 PKG_VER=`echo ${PKG_VER/$REMOVE/..}`
215 fi
216
217 echo "$PKG_VER"
218} # End of get_pkg_ver()
219
220if [ 'x86_64' = $MACHINE -o 'i686' = $MACHINE -o 'i586' = $MACHINE ]; then
221 echo "`date -u '+%b %e %T'`: Machine is iX86 (or equivalent)" >> $LOGFILE
222 MACHINE=i586
c1b57e25 223 CROSSTARGET=${MACHINE}-cross-linux-gnu
15679d9f 224 BUILDTARGET=i586-pc-linux-gnu
9b0ff0a0 225 CFLAGS="-O2 -march=i586 -pipe -fomit-frame-pointer"
b4b6bcdb 226 CXXFLAGS="-O2 -march=i586 -pipe -fomit-frame-pointer"
15679d9f
MT
227 C2FLAGS="-O2 -march=i586 -mtune=i586 -pipe -fomit-frame-pointer"
228 CXX2FLAGS="-O2 -march=i586 -mtune=i586 -pipe -fomit-frame-pointer"
d30f0e5a 229elif [ 'armv5tejl' = $MACHINE -o 'armv5tel' = $MACHINE -o 'armv6l' = $MACHINE -o 'armv7l' = $MACHINE ]; then
51f9e7ac 230 echo "`date -u '+%b %e %T'`: Machine is ARM (or equivalent)" >> $LOGFILE
df94e866
MT
231 MACHINE=armv5tel
232 MACHINE_TYPE=arm
c1b57e25 233 CROSSTARGET=${MACHINE}-cross-linux-gnueabi
df94e866 234 BUILDTARGET=${MACHINE}-unknown-linux-gnueabi
8bd492fd 235 CFLAGS="-O2 -march=armv5te -mfloat-abi=soft -fomit-frame-pointer -pipe"
51f9e7ac
MT
236 CXXFLAGS="$CFLAGS"
237 C2FLAGS="$CFLAGS"
238 CXX2FLAGS="$CXXFLAGS"
15679d9f 239else
5e3aa607 240 echo "`date -u '+%b %e %T'`: Can't determine your architecture - $MACHINE"
15679d9f
MT
241 exit 1
242fi
243
244# Define immediately
245stdumount() {
b4b6bcdb
MT
246 umount $BASEDIR/build/sys 2>/dev/null;
247 umount $BASEDIR/build/dev/shm 2>/dev/null;
15679d9f 248 umount $BASEDIR/build/dev/pts 2>/dev/null;
b4b6bcdb 249 umount $BASEDIR/build/dev 2>/dev/null;
15679d9f
MT
250 umount $BASEDIR/build/proc 2>/dev/null;
251 umount $BASEDIR/build/install/mnt 2>/dev/null;
252 umount $BASEDIR/build/usr/src/cache 2>/dev/null;
253 umount $BASEDIR/build/usr/src/ccache 2>/dev/null;
254 umount $BASEDIR/build/usr/src/config 2>/dev/null;
255 umount $BASEDIR/build/usr/src/doc 2>/dev/null;
256 umount $BASEDIR/build/usr/src/html 2>/dev/null;
257 umount $BASEDIR/build/usr/src/langs 2>/dev/null;
258 umount $BASEDIR/build/usr/src/lfs 2>/dev/null;
259 umount $BASEDIR/build/usr/src/log 2>/dev/null;
260 umount $BASEDIR/build/usr/src/src 2>/dev/null;
261}
262
263exiterror() {
264 stdumount
265 for i in `seq 0 7`; do
266 if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
267 losetup -d /dev/loop${i} 2>/dev/null
268 fi;
269 done
270 echo -e "\nERROR: $*"
271 echo " Check $LOGFILE for errors if applicable"
272 exit 1
273}
274
b848d53c
MT
275fake_environ() {
276 [ -e "${BASEDIR}/build/tools/lib/libpakfire_preload.so" ] || return
277
278 local env="LD_PRELOAD=/tools/lib/libpakfire_preload.so"
279
280 # Fake kernel version, because some of the packages do not compile
281 # with kernel 3.0 and later.
282 env="${env} UTS_RELEASE=${KVER}"
283
284 # Fake machine version.
285 env="${env} UTS_MACHINE=${MACHINE}"
286
287 echo "${env}"
288}
289
15679d9f
MT
290entershell() {
291 if [ ! -e $BASEDIR/build/usr/src/lfs/ ]; then
292 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/"
293 fi
b848d53c 294
15679d9f 295 echo "Entering to a shell inside LFS chroot, go out with exit"
bb0ab381 296 chroot $LFS /tools/bin/env -i HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
e4783340 297 PATH=/tools/ccache/bin:/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
15679d9f
MT
298 VERSION=$VERSION CONFIG_ROOT=$CONFIG_ROOT \
299 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
300 CFLAGS="$CF2LAGS" CXXFLAGS="$CXX2FLAGS" \
301 CCACHE_DIR=/usr/src/ccache \
36d351ff 302 CCACHE_COMPRESS=1 \
ad92a4b8 303 CCACHE_COMPILERCHECK="none" \
15679d9f 304 KVER=$KVER \
df94e866 305 BUILDTARGET="$BUILDTARGET" \
c1b57e25 306 CROSSTARGET="${CROSSTARGET}" \
df94e866
MT
307 MACHINE="$MACHINE" \
308 MACHINE_TYPE="$MACHINE_TYPE" \
15679d9f 309 KGCC="ccache /usr/bin/gcc" \
b848d53c 310 $(fake_environ) \
15679d9f
MT
311 /tools/bin/bash
312 if [ $? -ne 0 ]; then
313 beautify message FAIL
314 exiterror "chroot error"
315 else
316 stdumount
317 fi
318}
319
320############################################################################
321# #
322# Necessary shell functions #
323# #
324############################################################################
325#
326# Common checking before entering the chroot and compilling
327#
328# Return:0 caller can continue
329# :1 skip (nothing to do)
330# or fail if no script file found
331#
332lfsmakecommoncheck()
333{
15679d9f
MT
334 # Script present?
335 if [ ! -f $BASEDIR/lfs/$1 ]; then
336 exiterror "No such file or directory: $BASEDIR/$1"
337 fi
338
339 local PKG_VER=`get_pkg_ver $BASEDIR/lfs/$1`
340 beautify make_pkg "$PKG_VER $*"
341
846e756e
MT
342 # Check if this package is supported by our architecture.
343 # If no SUP_ARCH is found, we assume the package can be built for all.
344 if grep "^SUP_ARCH" ${BASEDIR}/lfs/${1} >/dev/null; then
345 # Check if package supports ${MACHINE} or all architectures.
346 if ! grep -E "^SUP_ARCH.*${MACHINE}|^SUP_ARCH.*all" ${BASEDIR}/lfs/${1} >/dev/null; then
347 beautify result SKIP
348 return 1
349 fi
350 fi
351
15679d9f
MT
352 # Script slipped?
353 local i
354 for i in $SKIP_PACKAGE_LIST
355 do
a50d04ab 356 if [ "$i" == "$1" ]; then
15679d9f
MT
357 beautify result SKIP
358 return 1;
359 fi
360 done
361
362 echo -ne "`date -u '+%b %e %T'`: Building $* " >> $LOGFILE
363
51f9e7ac 364 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MACHINE=$MACHINE \
df94e866 365 MACHINE_TYPE="$MACHINE_TYPE" \
51f9e7ac 366 MESSAGE="$1\t " download >> $LOGFILE 2>&1
15679d9f
MT
367 if [ $? -ne 0 ]; then
368 exiterror "Download error in $1"
369 fi
370
51f9e7ac 371 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MACHINE=$MACHINE \
df94e866 372 MACHINE_TYPE="$MACHINE_TYPE" \
51f9e7ac 373 MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1
15679d9f
MT
374 if [ $? -ne 0 ]; then
375 exiterror "md5sum error in $1, check file in cache or signature"
376 fi
377
378 return 0 # pass all!
379} # End of lfsmakecommoncheck()
380
381lfsmake1() {
382 lfsmakecommoncheck $*
383 [ $? == 1 ] && return 0
384
385 local PKG_TIME_START=`date +%s`
386
387 cd $BASEDIR/lfs && make -f $* BUILDTARGET=$BUILDTARGET \
c1b57e25 388 CROSSTARGET="${CROSSTARGET}" \
15679d9f 389 MACHINE=$MACHINE \
df94e866 390 MACHINE_TYPE=$MACHINE_TYPE \
15679d9f
MT
391 LFS_BASEDIR=$BASEDIR \
392 ROOT=$LFS \
393 KVER=$KVER \
394 MAKETUNING=$MAKETUNING \
395 install >> $LOGFILE 2>&1
396 local COMPILE_SUCCESS=$?
397 local PKG_TIME_END=`date +%s`
398
399 if [ $COMPILE_SUCCESS -ne 0 ]; then
400 beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
401 exiterror "Building $*";
402 else
403 beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
404 fi
405
406 return 0
407}
408
409lfsmake2() {
410 lfsmakecommoncheck $*
411 [ $? == 1 ] && return 0
412
413 local PKG_TIME_START=`date +%s`
bb0ab381 414 chroot $LFS /tools/bin/env -i HOME=/root \
15679d9f 415 TERM=$TERM PS1='\u:\w\$ ' \
e4783340 416 PATH=/tools/ccache/bin:/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
15679d9f
MT
417 VERSION=$VERSION \
418 CONFIG_ROOT=$CONFIG_ROOT \
419 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
420 CFLAGS="$C2FLAGS" CXXFLAGS="$CXX2FLAGS" \
ad92a4b8
MT
421 CCACHE_DIR=/usr/src/ccache CCACHE_COMPRESS=1 \
422 CCACHE_COMPILERCHECK="none" \
15679d9f 423 KVER=$KVER MAKETUNING=$MAKETUNING \
c1b57e25
MT
424 BUILDTARGET="$BUILDTARGET" \
425 CROSSTARGET="${CROSSTARGET}" \
426 MACHINE="$MACHINE" \
df94e866 427 MACHINE_TYPE="$MACHINE_TYPE" \
b848d53c 428 $(fake_environ) \
15679d9f
MT
429 /tools/bin/bash -x -c "cd /usr/src/lfs && \
430 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
431 local COMPILE_SUCCESS=$?
432 local PKG_TIME_END=`date +%s`
433
434 if [ $COMPILE_SUCCESS -ne 0 ]; then
435 beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
436 exiterror "Building $*";
437 else
438 beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
439 fi
440
441 return 0
442}
443
444ipfiremake() {
445 lfsmakecommoncheck $*
446 [ $? == 1 ] && return 0
447
448 local PKG_TIME_START=`date +%s`
bb0ab381 449 chroot $LFS /tools/bin/env -i HOME=/root \
15679d9f 450 TERM=$TERM PS1='\u:\w\$ ' \
e4783340 451 PATH=/tools/ccache/bin:/bin:/usr/bin:/sbin:/usr/sbin \
15679d9f 452 VERSION=$VERSION \
a01fc474 453 CORE=$CORE \
15679d9f
MT
454 CONFIG_ROOT=$CONFIG_ROOT \
455 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
456 CFLAGS="$C2FLAGS" CXXFLAGS="$CXX2FLAGS" \
ad92a4b8
MT
457 CCACHE_DIR=/usr/src/ccache CCACHE_COMPRESS=1 \
458 CCACHE_COMPILERCHECK="none" \
15679d9f 459 KVER=$KVER MAKETUNING=$MAKETUNING \
c1b57e25
MT
460 BUILDTARGET="$BUILDTARGET" \
461 CROSSTARGET="${CROSSTARGET}" \
462 MACHINE="$MACHINE" \
df94e866 463 MACHINE_TYPE="$MACHINE_TYPE" \
b848d53c 464 $(fake_environ) \
15679d9f
MT
465 /bin/bash -x -c "cd /usr/src/lfs && \
466 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
467
468 local COMPILE_SUCCESS=$?
469 local PKG_TIME_END=`date +%s`
470
471 if [ $COMPILE_SUCCESS -ne 0 ]; then
472 beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
473 exiterror "Building $*";
474 else
475 beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
476 fi
477 return 0
478}
479
480ipfiredist() {
0d909a4a
MT
481 lfsmakecommoncheck $*
482 [ $? == 1 ] && return 0
483
484 local PKG_TIME_START=`date +%s`
485 chroot $LFS /tools/bin/env -i HOME=/root \
486 TERM=$TERM PS1='\u:\w\$ ' \
e4783340 487 PATH=/tools/ccache/bin:/bin:/usr/bin:/sbin:/usr/sbin \
0d909a4a
MT
488 VERSION=$VERSION \
489 CONFIG_ROOT=$CONFIG_ROOT \
490 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
491 CFLAGS="$C2FLAGS" CXXFLAGS="$CXX2FLAGS" \
ad92a4b8
MT
492 CCACHE_DIR=/usr/src/ccache CCACHE_COMPRESS=1 \
493 CCACHE_COMPILERCHECK="none" \
3c937429 494 KVER=$KVER \
c1b57e25
MT
495 BUILDTARGET="$BUILDTARGET" \
496 CROSSTARGET="${CROSSTARGET}" \
497 MACHINE="$MACHINE" \
df94e866 498 MACHINE_TYPE="$MACHINE_TYPE" \
b848d53c 499 $(fake_environ) \
0d909a4a
MT
500 /bin/bash -x -c "cd /usr/src/lfs && \
501 make -f $1 LFS_BASEDIR=/usr/src dist" >>$LOGFILE 2>&1
502
503 local COMPILE_SUCCESS=$?
504 local PKG_TIME_END=`date +%s`
505
506 if [ $COMPILE_SUCCESS -ne 0 ]; then
507 beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
508 exiterror "Packaging $*";
15679d9f 509 else
0d909a4a 510 beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
15679d9f
MT
511 fi
512 return 0
513}
514
515installmake() {
41921bd9
MT
516 lfsmakecommoncheck $*
517 [ $? == 1 ] && return 0
518
519 local PKG_TIME_START=`date +%s`
bb0ab381 520 chroot $LFS /tools/bin/env -i HOME=/root \
15679d9f 521 TERM=$TERM PS1='\u:\w\$ ' \
e4783340 522 PATH=/tools/ccache/bin:/bin:/usr/bin:/sbin:/usr/sbin \
15679d9f
MT
523 VERSION=$VERSION \
524 CONFIG_ROOT=$CONFIG_ROOT \
15679d9f
MT
525 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
526 CFLAGS="-Os" CXXFLAGS="-Os" \
36d351ff 527 CCACHE_DIR=/usr/src/ccache CCACHE_COMPRESS=1 CCACHE_HASHDIR=1 \
3c937429 528 KVER=$KVER \
c1b57e25
MT
529 BUILDTARGET="$BUILDTARGET" \
530 CROSSTARGET="${CROSSTARGET}" \
531 MACHINE="$MACHINE" \
df94e866 532 MACHINE_TYPE="$MACHINE_TYPE" \
bc259fdc
MT
533 LD_LIBRARY_PATH=/tools/lib \
534 /tools/bin/bash -x -c "cd /usr/src/lfs && \
535 /tools/bin/make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
41921bd9
MT
536
537 local COMPILE_SUCCESS=$?
538 local PKG_TIME_END=`date +%s`
539
540 if [ $COMPILE_SUCCESS -ne 0 ]; then
541 beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
542 exiterror "Building $*";
15679d9f 543 else
41921bd9 544 beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
15679d9f
MT
545 fi
546 return 0
547}
548
8a5f0f44
MT
549update_langs() {
550 echo -ne "Checking the translations for missing or obsolete strings..."
1065bfea 551 chmod 755 $BASEDIR/tools/{check_strings.pl,sort_strings.pl,check_langs.sh}
8a5f0f44
MT
552 $BASEDIR/tools/sort_strings.pl en
553 $BASEDIR/tools/sort_strings.pl de
e73e134c
AF
554 $BASEDIR/tools/sort_strings.pl fr
555 $BASEDIR/tools/sort_strings.pl es
196e5f8f 556 $BASEDIR/tools/sort_strings.pl pl
2bb7b134 557 $BASEDIR/tools/sort_strings.pl ru
8a5f0f44
MT
558 $BASEDIR/tools/check_strings.pl en > $BASEDIR/doc/language_issues.en
559 $BASEDIR/tools/check_strings.pl de > $BASEDIR/doc/language_issues.de
e73e134c
AF
560 $BASEDIR/tools/check_strings.pl fr > $BASEDIR/doc/language_issues.fr
561 $BASEDIR/tools/check_strings.pl es > $BASEDIR/doc/language_issues.es
196e5f8f 562 $BASEDIR/tools/check_strings.pl es > $BASEDIR/doc/language_issues.pl
2bb7b134 563 $BASEDIR/tools/check_strings.pl ru > $BASEDIR/doc/language_issues.ru
8a5f0f44
MT
564 $BASEDIR/tools/check_langs.sh > $BASEDIR/doc/language_missings
565 beautify message DONE
566}