2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2016 IPFire Team <info@ipfire.org> #
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. #
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. #
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/>. #
20 ###############################################################################
21 ###############################################################################
23 # Beautifying variables & presentation & input output interface
25 ###############################################################################
28 # Find current screen size
29 if [ -z "${COLUMNS}" ]; then
31 COLUMNS
=${COLUMNS##* }
34 # When using remote connections, such as a serial port, stty size returns 0
35 if [ "${COLUMNS}" = "0" ]; then
39 ## Measurements for positioning result messages
44 RESULT_COL
=$
((${COLUMNS} - $RESULT_WIDTH - 4))
45 TIME_COL
=$
((${RESULT_COL} - $TIME_WIDTH - 5))
46 OPT_COL
=$
((${TIME_COL} - $OPT_WIDTH - 5))
47 VER_COL
=$
((${OPT_COL} - $VER_WIDTH - 5))
49 ## Set Cursur Position Commands, used via echo -e
50 SET_RESULT_COL
="\\033[${RESULT_COL}G"
51 SET_TIME_COL
="\\033[${TIME_COL}G"
52 SET_OPT_COL
="\\033[${OPT_COL}G"
53 SET_VER_COL
="\\033[${VER_COL}G"
55 # Define color for messages
64 local target_arch
="${1}"
66 if [ "${target_arch}" = "default" ]; then
67 target_arch
="$(configure_target_guess)"
70 case "${target_arch}" in
72 BUILDTARGET
="${target_arch}-unknown-linux-gnu"
73 CROSSTARGET
="${target_arch}-cross-linux-gnu"
74 CFLAGS_ARCH
="-m64 -mtune=generic"
78 BUILDTARGET
="${target_arch}-pc-linux-gnu"
79 CROSSTARGET
="${target_arch}-cross-linux-gnu"
80 CFLAGS_ARCH
="-march=i586 -mtune=generic -fomit-frame-pointer"
84 BUILDTARGET
="${target_arch}-unknown-linux-gnueabi"
85 CROSSTARGET
="${target_arch}-cross-linux-gnueabi"
86 CFLAGS_ARCH
="-march=armv5te -mfloat-abi=soft -fomit-frame-pointer"
91 exiterror
"Cannot build for architure ${target_arch}"
95 # Check if the QEMU helper is available if needed.
96 if qemu_is_required
"${target_arch}"; then
97 local qemu_target_helper
="$(qemu_find_target_helper_name "${target_arch}")"
99 if [ -n "${qemu_target_helper}" ]; then
100 QEMU_TARGET_HELPER
="${qemu_target_helper}"
102 exiterror
"Could not find a binfmt_misc helper entry for ${target_arch}"
106 TARGET_ARCH
="${target_arch}"
109 MACHINE
="${TARGET_ARCH}"
112 HARDENING_CFLAGS
="-Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4"
114 CFLAGS
="-O2 -pipe -Wall -fexceptions -fPIC ${CFLAGS_ARCH}"
118 configure_target_guess
() {
119 case "${BUILD_ARCH}" in
123 aarch64|armv7
*|armv6
*|armv5
*)
127 exiterror
"Cannot guess target architecture"
133 if [ "$?" -eq "0" ]; then
134 beautify message DONE
138 beautify message FAIL
140 if [ $EXITCODE -ne "0" ]; then
148 # ARG1=starting position on screen
149 # ARG2=string to be printed
150 # ARG3=offset, negative for left movement, positive for right movement, relative to ARG1
151 # For example if your starting position is column 50 and you want to print Hello three columns to the right
152 # of your starting position, your call will look like this:
153 # position_cursor 50 "Hello" 3 (you'll get the string Hello at position 53 (= 50 + 3)
154 # If on the other hand you want your string "Hello" to end three columns to the left of position 50,
155 # your call will look like this:
156 # position_cursor 50 "Hello" -3 (you'll get the string Hello at position 42 (= 50 - 5 -3)
157 # If you want to start printing at the exact starting location, use offset 0
163 STRING_LENGTH
=${#STRING}
165 if [ ${OFFSET} -lt 0 ]; then
166 COL
=$
((${START} + ${OFFSET} - ${STRING_LENGTH}))
168 COL
=$
((${START} + ${OFFSET}))
171 SET_COL
="\\033[${COL}G"
174 } # End of position_cursor()
179 # Commands: build_stage, make_pkg, message, result
184 echo -ne "${SET_RESULT_COL}[${DONE} DONE ${NORMAL}]\n"
187 echo -ne "${WARN}${3}${NORMAL}${SET_RESULT_COL}[${WARN} WARN ${NORMAL}]\n"
190 echo -ne "${SET_RESULT_COL}[${FAIL} FAIL ${NORMAL}]\n"
193 echo -ne "${SET_RESULT_COL}[${SKIP} SKIP ${NORMAL}]\n"
199 if [ "$STAGE_TIME_START" ]; then
200 LAST_STAGE_TIME
=$
[ `date +%s` - $STAGE_TIME_START ]
202 STAGE_TIME_START
=`date +%s`
203 echo -ne "${BOLD}*** ${MESSAGE}${NORMAL}"
204 if [ "$LAST_STAGE_TIME" ]; then
205 echo -ne "${DONE} (Last stage took $LAST_STAGE_TIME secs)${NORMAL}"
207 echo -ne "${BOLD}${SET_VER_COL} version${SET_OPT_COL} options${SET_TIME_COL} time (sec)${SET_RESULT_COL} status${NORMAL}\n"
210 BUILD_TIME_START
=`date +%s`
213 BUILD_TIME_END
=`date +%s`
214 seconds
=$
[ $BUILD_TIME_END - $BUILD_TIME_START ]
215 hours
=$
((seconds
/ 3600))
216 seconds
=$
((seconds
% 3600))
217 minutes
=$
((seconds
/ 60))
218 seconds
=$
((seconds
% 60))
220 echo -ne "${DONE}***Build is finished now and took $hours hour(s) $minutes minute(s) $seconds second(s)!${NORMAL}\n"
223 echo "$2" |
while read PKG_VER PROGRAM OPTIONS
225 SET_VER_COL_REAL
=`position_cursor $OPT_COL $PKG_VER -3`
227 if [ "$OPTIONS" == "" ]; then
228 echo -ne "${PROGRAM}${SET_VER_COL}[ ${BOLD}${SET_VER_COL_REAL}${PKG_VER}"
229 echo -ne "${NORMAL} ]${SET_RESULT_COL}"
231 echo -ne "${PROGRAM}${SET_VER_COL}[ ${BOLD}${SET_VER_COL_REAL}${PKG_VER}"
232 echo -ne "${NORMAL} ]${SET_OPT_COL}[ ${BOLD}${OPTIONS}"
233 echo -ne "${NORMAL} ]${SET_RESULT_COL}"
246 SET_TIME_COL_REAL
=`position_cursor $RESULT_COL $PKG_TIME -3`
249 echo -ne "${SET_TIME_COL}[ ${BOLD}${SET_TIME_COL_REAL}$PKG_TIME${NORMAL} ]"
250 echo -ne "${SET_RESULT_COL}[${DONE} DONE ${NORMAL}]\n"
253 echo -ne "${SET_TIME_COL}[ ${BOLD}${SET_TIME_COL_REAL}$PKG_TIME${NORMAL} ]"
254 echo -ne "${SET_RESULT_COL}[${FAIL} FAIL ${NORMAL}]\n"
257 echo -ne "${SET_RESULT_COL}[${SKIP} SKIP ${NORMAL}]\n"
262 } # End of beautify()
267 PKG_VER
=`grep -E "^VER |^VER=|^VER " $1 | awk '{print $3}'`
269 if [ -z $PKG_VER ]; then
270 PKG_VER
=`grep "Exp " $1 | awk '{print $4}'`
272 if [ -z $PKG_VER ]; then
275 if [ ${#PKG_VER} -gt $VER_WIDTH ]; then
276 # If a package version number is greater than $VER_WIDTH, we keep the first 4 characters
277 # and replace enough characters to fit the resulting string on the screen. We'll replace
278 # the extra character with .. (two dots). That's why the "+ 2" in the formula below.
279 # Example: if we have a 21-long version number that we want to fit into a 10-long space,
280 # we have to remove 11 characters. But if we replace 11 characters with 2 characters, we'll
281 # end up with a 12-character long string. That's why we replace 12 characters with ..
282 REMOVE
=`expr substr "$PKG_VER" 4 $[ ${#PKG_VER} - $VER_WIDTH + 2 ]`
283 PKG_VER
=`echo ${PKG_VER/$REMOVE/..}`
287 } # End of get_pkg_ver()
291 umount
$BASEDIR/build
/sys
2>/dev
/null
;
292 umount
$BASEDIR/build
/dev
/shm
2>/dev
/null
;
293 umount
$BASEDIR/build
/dev
/pts
2>/dev
/null
;
294 umount
$BASEDIR/build
/dev
2>/dev
/null
;
295 umount
$BASEDIR/build
/proc
2>/dev
/null
;
296 umount
$BASEDIR/build
/install
/mnt
2>/dev
/null
;
297 umount
$BASEDIR/build
/usr
/src
/cache
2>/dev
/null
;
298 umount
$BASEDIR/build
/usr
/src
/ccache
2>/dev
/null
;
299 umount
$BASEDIR/build
/usr
/src
/config
2>/dev
/null
;
300 umount
$BASEDIR/build
/usr
/src
/doc
2>/dev
/null
;
301 umount
$BASEDIR/build
/usr
/src
/html
2>/dev
/null
;
302 umount
$BASEDIR/build
/usr
/src
/langs
2>/dev
/null
;
303 umount
$BASEDIR/build
/usr
/src
/lfs
2>/dev
/null
;
304 umount
$BASEDIR/build
/usr
/src
/log
2>/dev
/null
;
305 umount
$BASEDIR/build
/usr
/src
/src
2>/dev
/null
;
310 for i
in `seq 0 7`; do
311 if ( losetup
/dev
/loop
${i} 2>/dev
/null |
grep -q "/install/images" ); then
312 losetup
-d /dev
/loop
${i} 2>/dev
/null
316 if [ -n "${LOGFILE}" ]; then
320 while read -r line
; do
322 done <<< "$(tail -n30 ${LOGFILE})"
325 echo -e "\nERROR: $*"
326 echo " Check $LOGFILE for errors if applicable"
331 [ -e "${BASEDIR}/build/tools/lib/libpakfire_preload.so" ] ||
return
333 local env
="LD_PRELOAD=/tools/lib/libpakfire_preload.so"
335 # Fake kernel version, because some of the packages do not compile
336 # with kernel 3.0 and later.
337 env
="${env} UTS_RELEASE=${KVER}"
339 # Fake machine version.
340 env
="${env} UTS_MACHINE=${TARGET_ARCH}"
348 # Don't add anything if qemu is not used.
349 if ! qemu_is_required
; then
353 # Set default qemu options
354 case "${TARGET_ARCH}" in
356 QEMU_CPU
="${QEMU_CPU:-cortex-a9}"
358 env
="${env} QEMU_CPU=${QEMU_CPU}"
363 #env="${env} QEMU_STRACE=1"
369 local target_arch
="${1}"
371 if [ -z "${target_arch}" ]; then
372 target_arch
="${TARGET_ARCH}"
375 case "${BUILD_ARCH},${target_arch}" in
376 x86_64
,arm
*|i?
86,arm
*|i?
86,x86_64
)
385 qemu_install_helper
() {
386 # Do nothing, if qemu is not required
387 if ! qemu_is_required
; then
391 if [ ! -e /proc
/sys
/fs
/binfmt_misc
/status
]; then
392 exiterror
"binfmt_misc not mounted. QEMU_TARGET_HELPER not useable."
395 if [ ! $
(cat /proc
/sys
/fs
/binfmt_misc
/status
) = 'enabled' ]; then
396 exiterror
"binfmt_misc not enabled. QEMU_TARGET_HELPER not useable."
400 if [ -z "${QEMU_TARGET_HELPER}" ]; then
401 exiterror
"QEMU_TARGET_HELPER not set"
404 # Check if the helper is already installed.
405 if [ -x "${LFS}${QEMU_TARGET_HELPER}" ]; then
409 # Try to find a suitable binary that we can install
410 # to the build environment.
412 for file in "${QEMU_TARGET_HELPER}" "${QEMU_TARGET_HELPER}-static"; do
413 # file must exist and be executable.
414 [ -x "${file}" ] ||
continue
417 file_is_static
"${file}" ||
continue
419 local dirname="${LFS}$(dirname "${file}")"
420 mkdir
-p "${dirname}"
422 install -m 755 "${file}" "${LFS}${QEMU_TARGET_HELPER}"
426 exiterror
"Could not find a statically-linked QEMU emulator: ${QEMU_TARGET_HELPER}"
429 qemu_find_target_helper_name
() {
430 local target_arch
="${1}"
433 case "${target_arch}" in
435 magic
="7f454c4601010100000000000000000002002800"
438 magic
="7f454c4602010100000000000000000002003e00"
442 [ -z "${magic}" ] && return 1
445 for file in /proc
/sys
/fs
/binfmt_misc
/*; do
446 # skip write only register entry
447 [ $
(basename "${file}") = "register" ] && continue
448 # Search for the file with the correct magic value.
449 grep -qE "^magic ${magic}$" "${file}" ||
continue
451 local interpreter
="$(grep "^interpreter
" "${file}" | awk '{ print $2 }')"
453 [ -n "${interpreter}" ] ||
continue
454 [ "${interpreter:0:1}" = "/" ] ||
continue
455 [ -x "${interpreter}" ] ||
continue
457 echo "${interpreter}"
467 file ${file} 2>/dev
/null |
grep -q "statically linked"
471 if [ ! -e $BASEDIR/build
/usr
/src
/lfs
/ ]; then
472 exiterror
"No such file or directory: $BASEDIR/build/usr/src/lfs/"
475 # Install QEMU helper, if needed
478 echo "Entering to a shell inside LFS chroot, go out with exit"
479 chroot
$LFS /tools
/bin
/env
-i HOME
=/root TERM
=$TERM PS1
='ipfire build chroot ($(uname -m)) \u:\w\$ ' \
480 PATH
=/tools
/ccache
/bin
:/bin
:/usr
/bin
:/sbin
:/usr
/sbin
:/tools
/bin \
481 VERSION
=$VERSION CONFIG_ROOT
=$CONFIG_ROOT \
482 NAME
="$NAME" SNAME
="$SNAME" SLOGAN
="$SLOGAN" \
483 CFLAGS
="${CFLAGS} ${HARDENING_CFLAGS}" \
484 CXXFLAGS
="${CXXFLAGS} ${HARDENING_CFLAGS}" \
485 CCACHE_DIR
=/usr
/src
/ccache \
486 CCACHE_COMPRESS
="${CCACHE_COMPRESS}" \
487 CCACHE_COMPILERCHECK
="${CCACHE_COMPILERCHECK}" \
489 BUILDTARGET
="$BUILDTARGET" \
490 CROSSTARGET
="${CROSSTARGET}" \
492 MACHINE_TYPE
="$MACHINE_TYPE" \
496 if [ $?
-ne 0 ]; then
497 beautify message FAIL
498 exiterror
"chroot error"
504 ############################################################################
506 # Necessary shell functions #
508 ############################################################################
510 # Common checking before entering the chroot and compilling
512 # Return:0 caller can continue
513 # :1 skip (nothing to do)
514 # or fail if no script file found
519 if [ ! -f $BASEDIR/lfs
/$1 ]; then
520 exiterror
"No such file or directory: $BASEDIR/$1"
523 local PKG_VER
=`get_pkg_ver $BASEDIR/lfs/$1`
524 beautify make_pkg
"$PKG_VER $*"
526 # Check if this package is supported by our architecture.
527 # If no SUP_ARCH is found, we assume the package can be built for all.
528 if grep "^SUP_ARCH" ${BASEDIR}/lfs
/${1} >/dev
/null
; then
529 # Check if package supports ${MACHINE} or all architectures.
530 if ! grep -E "^SUP_ARCH.*${MACHINE}|^SUP_ARCH.*all" ${BASEDIR}/lfs/${1} >/dev/null; then
538 for i in $SKIP_PACKAGE_LIST
540 if [ "$i" == "$1" ]; then
546 echo -ne "`date -u '+%b %e %T'`: Building $
* " >> $LOGFILE
548 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MACHINE=$MACHINE \
549 MACHINE_TYPE="$MACHINE_TYPE" \
550 MESSAGE="$1\t " download >> $LOGFILE 2>&1
551 if [ $? -ne 0 ]; then
552 exiterror "Download error
in $1"
555 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MACHINE=$MACHINE \
556 MACHINE_TYPE="$MACHINE_TYPE" \
557 MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1
558 if [ $? -ne 0 ]; then
559 exiterror "md5sum error
in $1, check
file in cache or signature
"
563 } # End of lfsmakecommoncheck()
566 lfsmakecommoncheck $*
567 [ $? == 1 ] && return 0
569 local PKG_TIME_START=`date +%s`
572 PATH="/tools
/ccache
/bin
:/tools
/bin
:$PATH" \
573 make -f $* TOOLCHAIN=1 BUILDTARGET=$BUILDTARGET \
574 CROSSTARGET="${CROSSTARGET}" \
576 MACHINE_TYPE=$MACHINE_TYPE \
577 LFS_BASEDIR=$BASEDIR \
580 MAKETUNING=$MAKETUNING \
581 install >> $LOGFILE 2>&1
582 local COMPILE_SUCCESS=$?
583 local PKG_TIME_END=`date +%s`
585 if [ $COMPILE_SUCCESS -ne 0 ]; then
586 beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
587 exiterror "Building $
*";
589 beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
596 lfsmakecommoncheck $*
597 [ $? == 1 ] && return 0
599 # Install QEMU helper, if needed
602 local PKG_TIME_START=`date +%s`
603 chroot $LFS /tools/bin/env -i HOME=/root \
604 TERM=$TERM PS1='\u:\w\$ ' \
605 PATH=/tools/ccache/bin:/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
606 VERSION=$VERSION PAKFIRE_CORE="${PAKFIRE_CORE}" \
607 SYSTEM_RELEASE="${SYSTEM_RELEASE}" \
608 CONFIG_ROOT=$CONFIG_ROOT \
609 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
610 CFLAGS="${CFLAGS} ${HARDENING_CFLAGS}" \
611 CXXFLAGS="${CXXFLAGS} ${HARDENING_CFLAGS}" \
612 CCACHE_DIR=/usr/src/ccache \
613 CCACHE_COMPRESS="${CCACHE_COMPRESS}" \
614 CCACHE_COMPILERCHECK="${CCACHE_COMPILERCHECK}" \
615 KVER=$KVER MAKETUNING=$MAKETUNING \
616 BUILDTARGET="$BUILDTARGET" \
617 CROSSTARGET="${CROSSTARGET}" \
619 MACHINE_TYPE="$MACHINE_TYPE" \
622 /tools/bin/bash -x -c "cd /usr
/src
/lfs
&& \
623 make -f $
* LFS_BASEDIR
=/usr
/src
install" >>$LOGFILE 2>&1
624 local COMPILE_SUCCESS=$?
625 local PKG_TIME_END=`date +%s`
627 if [ $COMPILE_SUCCESS -ne 0 ]; then
628 beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
629 exiterror "Building $
*";
631 beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
638 lfsmakecommoncheck $*
639 [ $? == 1 ] && return 0
641 # Install QEMU helper, if needed
644 local PKG_TIME_START=`date +%s`
645 chroot $LFS /tools/bin/env -i HOME=/root \
646 TERM=$TERM PS1='\u:\w\$ ' \
647 PATH=/tools/ccache/bin:/bin:/usr/bin:/sbin:/usr/sbin \
650 CONFIG_ROOT=$CONFIG_ROOT \
651 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
652 SYSTEM_RELEASE="$SYSTEM_RELEASE" \
653 CFLAGS="${CFLAGS} ${HARDENING_CFLAGS}" \
654 CXXFLAGS="${CXXFLAGS} ${HARDENING_CFLAGS}" \
655 CCACHE_DIR=/usr/src/ccache \
656 CCACHE_COMPRESS="${CCACHE_COMPRESS}" \
657 CCACHE_COMPILERCHECK="${CCACHE_COMPILERCHECK}" \
658 KVER=$KVER MAKETUNING=$MAKETUNING \
659 BUILDTARGET="$BUILDTARGET" \
660 CROSSTARGET="${CROSSTARGET}" \
662 MACHINE_TYPE="$MACHINE_TYPE" \
665 /bin/bash -x -c "cd /usr
/src
/lfs
&& \
666 make -f $
* LFS_BASEDIR
=/usr
/src
install" >>$LOGFILE 2>&1
668 local COMPILE_SUCCESS=$?
669 local PKG_TIME_END=`date +%s`
671 if [ $COMPILE_SUCCESS -ne 0 ]; then
672 beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
673 exiterror "Building $
*";
675 beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
681 lfsmakecommoncheck $*
682 [ $? == 1 ] && return 0
684 # Install QEMU helper, if needed
687 local PKG_TIME_START=`date +%s`
688 chroot $LFS /tools/bin/env -i HOME=/root \
689 TERM=$TERM PS1='\u:\w\$ ' \
690 PATH=/tools/ccache/bin:/bin:/usr/bin:/sbin:/usr/sbin \
692 CONFIG_ROOT=$CONFIG_ROOT \
693 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
694 CFLAGS="${CFLAGS} ${HARDENING_CFLAGS}" \
695 CXXFLAGS="${CXXFLAGS} ${HARDENING_CFLAGS}" \
696 CCACHE_DIR=/usr/src/ccache \
697 CCACHE_COMPRESS="${CCACHE_COMPRESS}" \
698 CCACHE_COMPILERCHECK="${CCACHE_COMPILERCHECK}" \
700 BUILDTARGET="$BUILDTARGET" \
701 CROSSTARGET="${CROSSTARGET}" \
703 MACHINE_TYPE="$MACHINE_TYPE" \
706 /bin/bash -x -c "cd /usr
/src
/lfs
&& \
707 make -f $1 LFS_BASEDIR
=/usr
/src dist
" >>$LOGFILE 2>&1
709 local COMPILE_SUCCESS=$?
710 local PKG_TIME_END=`date +%s`
712 if [ $COMPILE_SUCCESS -ne 0 ]; then
713 beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
714 exiterror "Packaging $
*";
716 beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
722 lfsmakecommoncheck $*
723 [ $? == 1 ] && return 0
725 # Install QEMU helper, if needed
728 local PKG_TIME_START=`date +%s`
729 chroot $LFS /tools/bin/env -i HOME=/root \
730 TERM=$TERM PS1='\u:\w\$ ' \
731 PATH=/tools/ccache/bin:/bin:/usr/bin:/sbin:/usr/sbin \
733 SYSTEM_RELEASE="${SYSTEM_RELEASE}" \
734 CONFIG_ROOT=$CONFIG_ROOT \
735 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
736 CFLAGS="${CFLAGS} ${HARDENING_CFLAGS}" \
737 CXXFLAGS="${CXXFLAGS} ${HARDENING_CFLAGS}" \
738 CCACHE_DIR=/usr/src/ccache CCACHE_COMPRESS=1 CCACHE_HASHDIR=1 \
740 BUILDTARGET="$BUILDTARGET" \
741 CROSSTARGET="${CROSSTARGET}" \
743 MACHINE_TYPE="$MACHINE_TYPE" \
744 LD_LIBRARY_PATH=/tools/lib \
745 /tools/bin/bash -x -c "cd /usr
/src
/lfs
&& \
746 /tools
/bin
/make -f $
* LFS_BASEDIR
=/usr
/src
install" >>$LOGFILE 2>&1
748 local COMPILE_SUCCESS=$?
749 local PKG_TIME_END=`date +%s`
751 if [ $COMPILE_SUCCESS -ne 0 ]; then
752 beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ]
753 exiterror "Building $
*";
755 beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ]
761 echo -ne "Checking the translations
for missing or obsolete
strings...
"
762 chmod 755 $BASEDIR/tools/{check_strings.pl,sort_strings.pl,check_langs.sh}
763 $BASEDIR/tools/sort_strings.pl en
764 $BASEDIR/tools/sort_strings.pl de
765 $BASEDIR/tools/sort_strings.pl fr
766 $BASEDIR/tools/sort_strings.pl es
767 $BASEDIR/tools/sort_strings.pl pl
768 $BASEDIR/tools/sort_strings.pl ru
769 $BASEDIR/tools/sort_strings.pl nl
770 $BASEDIR/tools/sort_strings.pl tr
771 $BASEDIR/tools/sort_strings.pl it
772 $BASEDIR/tools/check_strings.pl en > $BASEDIR/doc/language_issues.en
773 $BASEDIR/tools/check_strings.pl de > $BASEDIR/doc/language_issues.de
774 $BASEDIR/tools/check_strings.pl fr > $BASEDIR/doc/language_issues.fr
775 $BASEDIR/tools/check_strings.pl es > $BASEDIR/doc/language_issues.es
776 $BASEDIR/tools/check_strings.pl es > $BASEDIR/doc/language_issues.pl
777 $BASEDIR/tools/check_strings.pl ru > $BASEDIR/doc/language_issues.ru
778 $BASEDIR/tools/check_strings.pl nl > $BASEDIR/doc/language_issues.nl
779 $BASEDIR/tools/check_strings.pl tr > $BASEDIR/doc/language_issues.tr
780 $BASEDIR/tools/check_strings.pl it > $BASEDIR/doc/language_issues.it
781 $BASEDIR/tools/check_langs.sh > $BASEDIR/doc/language_missings
782 beautify message DONE
784 echo -ne "Updating language lists...
"
785 update_language_list ${BASEDIR}/src/installer/po
786 update_language_list ${BASEDIR}/src/setup/po
787 beautify message DONE
790 update_language_list() {
794 for lang in ${path}/*.po; do
795 lang="$
(basename "${lang}")"
797 done | sort -u > "${path}/LINGUAS
"