]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/bash | |
2 | ############################################################################ | |
3 | # # | |
4 | # This file is part of the IPFire Firewall. # | |
5 | # # | |
6 | # IPFire is free software; you can redistribute it and/or modify # | |
7 | # it under the terms of the GNU General Public License as published by # | |
8 | # the Free Software Foundation; either version 2 of the License, or # | |
9 | # (at your option) any later version. # | |
10 | # # | |
11 | # IPFire is distributed in the hope that it will be useful, # | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | |
14 | # GNU General Public License for more details. # | |
15 | # # | |
16 | # You should have received a copy of the GNU General Public License # | |
17 | # along with IPFire; if not, write to the Free Software # | |
18 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # | |
19 | # # | |
20 | # Copyright (C) 2007-2017 IPFire Team <info@ipfire.org>. # | |
21 | # # | |
22 | ############################################################################ | |
23 | # | |
24 | ||
25 | NAME="IPFire" # Software name | |
26 | SNAME="ipfire" # Short name | |
27 | VERSION="2.19" # Version number | |
28 | CORE="117" # Core Level (Filename) | |
29 | PAKFIRE_CORE="116" # Core Level (PAKFIRE) | |
30 | GIT_BRANCH=`git rev-parse --abbrev-ref HEAD` # Git Branch | |
31 | SLOGAN="www.ipfire.org" # Software slogan | |
32 | CONFIG_ROOT=/var/ipfire # Configuration rootdir | |
33 | NICE=10 # Nice level | |
34 | MAX_RETRIES=1 # prefetch/check loop | |
35 | BUILD_IMAGES=1 # Flash and Xen Downloader | |
36 | KVER=`grep --max-count=1 VER lfs/linux | awk '{ print $3 }'` | |
37 | GIT_TAG=$(git tag | tail -1) # Git Tag | |
38 | GIT_LASTCOMMIT=$(git log | head -n1 | cut -d" " -f2 |head -c8) # Last commit | |
39 | ||
40 | TOOLCHAINVER=20171121 | |
41 | ||
42 | ############################################################################### | |
43 | # | |
44 | # Beautifying variables & presentation & input output interface | |
45 | # | |
46 | ############################################################################### | |
47 | ||
48 | ## Screen Dimentions | |
49 | # Find current screen size | |
50 | if [ -z "${COLUMNS}" ]; then | |
51 | COLUMNS=$(stty size) | |
52 | COLUMNS=${COLUMNS##* } | |
53 | fi | |
54 | ||
55 | # When using remote connections, such as a serial port, stty size returns 0 | |
56 | if [ "${COLUMNS}" = "0" ]; then | |
57 | COLUMNS=80 | |
58 | fi | |
59 | ||
60 | ## Measurements for positioning result messages | |
61 | RESULT_WIDTH=4 | |
62 | TIME_WIDTH=8 | |
63 | OPT_WIDTH=6 | |
64 | VER_WIDTH=10 | |
65 | RESULT_COL=$((${COLUMNS} - $RESULT_WIDTH - 4)) | |
66 | TIME_COL=$((${RESULT_COL} - $TIME_WIDTH - 5)) | |
67 | OPT_COL=$((${TIME_COL} - $OPT_WIDTH - 5)) | |
68 | VER_COL=$((${OPT_COL} - $VER_WIDTH - 5)) | |
69 | ||
70 | ## Set Cursur Position Commands, used via echo -e | |
71 | SET_RESULT_COL="\\033[${RESULT_COL}G" | |
72 | SET_TIME_COL="\\033[${TIME_COL}G" | |
73 | SET_OPT_COL="\\033[${OPT_COL}G" | |
74 | SET_VER_COL="\\033[${VER_COL}G" | |
75 | ||
76 | # Define color for messages | |
77 | BOLD="\\033[1;39m" | |
78 | DONE="\\033[1;32m" | |
79 | SKIP="\\033[1;34m" | |
80 | WARN="\\033[1;35m" | |
81 | FAIL="\\033[1;31m" | |
82 | NORMAL="\\033[0;39m" | |
83 | ||
84 | # New architecture variables | |
85 | HOST_ARCH="$(uname -m)" | |
86 | ||
87 | PWD=$(pwd) | |
88 | BASENAME=$(basename $0) | |
89 | ||
90 | # Debian specific settings | |
91 | if [ ! -e /etc/debian_version ]; then | |
92 | FULLPATH=`which $0` | |
93 | else | |
94 | if [ -x /usr/bin/realpath ]; then | |
95 | FULLPATH=`/usr/bin/realpath $0` | |
96 | else | |
97 | echo "ERROR: Need to do apt-get install realpath" | |
98 | exit 1 | |
99 | fi | |
100 | fi | |
101 | ||
102 | # This is the directory where make.sh is in | |
103 | BASEDIR=$(echo $FULLPATH | sed "s/\/$BASENAME//g") | |
104 | ||
105 | LOGFILE=$BASEDIR/log/_build.preparation.log | |
106 | export BASEDIR LOGFILE | |
107 | DIR_CHK=$BASEDIR/cache/check | |
108 | mkdir $BASEDIR/log/ 2>/dev/null | |
109 | ||
110 | system_processors() { | |
111 | getconf _NPROCESSORS_ONLN 2>/dev/null || echo "1" | |
112 | } | |
113 | ||
114 | system_memory() { | |
115 | local key val unit | |
116 | ||
117 | while read -r key val unit; do | |
118 | case "${key}" in | |
119 | MemTotal:*) | |
120 | # Convert to MB | |
121 | echo "$(( ${val} / 1024 ))" | |
122 | break | |
123 | ;; | |
124 | esac | |
125 | done < /proc/meminfo | |
126 | } | |
127 | ||
128 | configure_build() { | |
129 | local build_arch="${1}" | |
130 | ||
131 | if [ "${build_arch}" = "default" ]; then | |
132 | build_arch="$(configure_build_guess)" | |
133 | fi | |
134 | ||
135 | case "${build_arch}" in | |
136 | x86_64) | |
137 | BUILDTARGET="${build_arch}-unknown-linux-gnu" | |
138 | CROSSTARGET="${build_arch}-cross-linux-gnu" | |
139 | BUILD_PLATFORM="x86" | |
140 | CFLAGS_ARCH="-m64 -mtune=generic" | |
141 | ;; | |
142 | ||
143 | i586) | |
144 | BUILDTARGET="${build_arch}-pc-linux-gnu" | |
145 | CROSSTARGET="${build_arch}-cross-linux-gnu" | |
146 | BUILD_PLATFORM="x86" | |
147 | CFLAGS_ARCH="-march=i586 -mtune=generic -fomit-frame-pointer" | |
148 | ;; | |
149 | ||
150 | aarch64) | |
151 | BUILDTARGET="${build_arch}-unknown-linux-gnu" | |
152 | CROSSTARGET="${build_arch}-cross-linux-gnu" | |
153 | BUILD_PLATFORM="arm" | |
154 | CFLAGS_ARCH="" | |
155 | ;; | |
156 | ||
157 | armv7hl) | |
158 | BUILDTARGET="${build_arch}-unknown-linux-gnueabi" | |
159 | CROSSTARGET="${build_arch}-cross-linux-gnueabi" | |
160 | BUILD_PLATFORM="arm" | |
161 | CFLAGS_ARCH="-march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard" | |
162 | ;; | |
163 | ||
164 | armv5tel) | |
165 | BUILDTARGET="${build_arch}-unknown-linux-gnueabi" | |
166 | CROSSTARGET="${build_arch}-cross-linux-gnueabi" | |
167 | BUILD_PLATFORM="arm" | |
168 | CFLAGS_ARCH="-march=armv5te -mfloat-abi=soft -fomit-frame-pointer" | |
169 | ;; | |
170 | ||
171 | *) | |
172 | exiterror "Cannot build for architure ${build_arch}" | |
173 | ;; | |
174 | esac | |
175 | ||
176 | # Check if the QEMU helper is available if needed. | |
177 | if qemu_is_required "${build_arch}"; then | |
178 | local qemu_build_helper="$(qemu_find_build_helper_name "${build_arch}")" | |
179 | ||
180 | if [ -n "${qemu_build_helper}" ]; then | |
181 | QEMU_TARGET_HELPER="${qemu_build_helper}" | |
182 | else | |
183 | exiterror "Could not find a binfmt_misc helper entry for ${build_arch}" | |
184 | fi | |
185 | fi | |
186 | ||
187 | BUILD_ARCH="${build_arch}" | |
188 | TOOLS_DIR="/tools_${BUILD_ARCH}" | |
189 | ||
190 | # Enables hardening | |
191 | HARDENING_CFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4" | |
192 | ||
193 | CFLAGS="-O2 -pipe -Wall -fexceptions -fPIC ${CFLAGS_ARCH}" | |
194 | CXXFLAGS="${CFLAGS}" | |
195 | ||
196 | # Determine parallelism | |
197 | if [ -z "${MAKETUNING}" ]; then | |
198 | # We assume that each process consumes about | |
199 | # 192MB of memory. Therefore we find out how | |
200 | # many processes fit into memory. | |
201 | local mem_max=$(( ${HOST_MEM} / 192 )) | |
202 | ||
203 | local processors="$(system_processors)" | |
204 | local cpu_max=$(( ${processors} * 2 )) | |
205 | ||
206 | local parallelism | |
207 | if [ ${mem_max} -lt ${cpu_max} ]; then | |
208 | parallelism=${mem_max} | |
209 | else | |
210 | parallelism=${cpu_max} | |
211 | fi | |
212 | ||
213 | MAKETUNING="-j${parallelism}" | |
214 | fi | |
215 | } | |
216 | ||
217 | configure_build_guess() { | |
218 | case "${HOST_ARCH}" in | |
219 | x86_64|i686|i586) | |
220 | echo "i586" | |
221 | ;; | |
222 | ||
223 | aarch64) | |
224 | echo "aarch64" | |
225 | ;; | |
226 | ||
227 | armv7*|armv6*|armv5*) | |
228 | echo "armv5tel" | |
229 | ;; | |
230 | ||
231 | *) | |
232 | exiterror "Cannot guess build architecture" | |
233 | ;; | |
234 | esac | |
235 | } | |
236 | ||
237 | evaluate() { | |
238 | if [ "$?" -eq "0" ]; then | |
239 | beautify message DONE | |
240 | else | |
241 | EXITCODE=$1 | |
242 | shift 1 | |
243 | beautify message FAIL | |
244 | $* | |
245 | if [ $EXITCODE -ne "0" ]; then | |
246 | exit $EXITCODE | |
247 | fi | |
248 | fi | |
249 | } | |
250 | ||
251 | position_cursor() { | |
252 | # ARG1=starting position on screen | |
253 | # ARG2=string to be printed | |
254 | # ARG3=offset, negative for left movement, positive for right movement, relative to ARG1 | |
255 | # For example if your starting position is column 50 and you want to print Hello three columns to the right | |
256 | # of your starting position, your call will look like this: | |
257 | # position_cursor 50 "Hello" 3 (you'll get the string Hello at position 53 (= 50 + 3) | |
258 | # If on the other hand you want your string "Hello" to end three columns to the left of position 50, | |
259 | # your call will look like this: | |
260 | # position_cursor 50 "Hello" -3 (you'll get the string Hello at position 42 (= 50 - 5 -3) | |
261 | # If you want to start printing at the exact starting location, use offset 0 | |
262 | ||
263 | START=$1 | |
264 | STRING=$2 | |
265 | OFFSET=$3 | |
266 | ||
267 | STRING_LENGTH=${#STRING} | |
268 | ||
269 | if [ ${OFFSET} -lt 0 ]; then | |
270 | COL=$((${START} + ${OFFSET} - ${STRING_LENGTH})) | |
271 | else | |
272 | COL=$((${START} + ${OFFSET})) | |
273 | fi | |
274 | ||
275 | SET_COL="\\033[${COL}G" | |
276 | ||
277 | echo $SET_COL | |
278 | } | |
279 | ||
280 | beautify() { | |
281 | # Commands: build_stage, make_pkg, message, result | |
282 | case "$1" in | |
283 | message) | |
284 | case "$2" in | |
285 | DONE) | |
286 | echo -ne "${SET_RESULT_COL}[${DONE} DONE ${NORMAL}]\n" | |
287 | ;; | |
288 | WARN) | |
289 | echo -ne "${WARN}${3}${NORMAL}${SET_RESULT_COL}[${WARN} WARN ${NORMAL}]\n" | |
290 | ;; | |
291 | FAIL) | |
292 | echo -ne "${SET_RESULT_COL}[${FAIL} FAIL ${NORMAL}]\n" | |
293 | ;; | |
294 | SKIP) | |
295 | echo -ne "${SET_RESULT_COL}[${SKIP} SKIP ${NORMAL}]\n" | |
296 | ;; | |
297 | esac | |
298 | ;; | |
299 | build_stage) | |
300 | MESSAGE=$2 | |
301 | if [ "$STAGE_TIME_START" ]; then | |
302 | LAST_STAGE_TIME=$[ `date +%s` - $STAGE_TIME_START ] | |
303 | fi | |
304 | STAGE_TIME_START=`date +%s` | |
305 | echo -ne "${BOLD}*** (${BUILD_ARCH}) ${MESSAGE}${NORMAL}" | |
306 | if [ "$LAST_STAGE_TIME" ]; then | |
307 | echo -ne "${DONE} (Last stage took $LAST_STAGE_TIME secs)${NORMAL}\n" | |
308 | fi | |
309 | echo -ne "${BOLD}${SET_VER_COL} version${SET_OPT_COL} options${SET_TIME_COL} time (sec)${SET_RESULT_COL} status${NORMAL}\n" | |
310 | ;; | |
311 | build_start) | |
312 | BUILD_TIME_START=`date +%s` | |
313 | ;; | |
314 | build_end) | |
315 | BUILD_TIME_END=`date +%s` | |
316 | seconds=$[ $BUILD_TIME_END - $BUILD_TIME_START ] | |
317 | hours=$((seconds / 3600)) | |
318 | seconds=$((seconds % 3600)) | |
319 | minutes=$((seconds / 60)) | |
320 | seconds=$((seconds % 60)) | |
321 | ||
322 | echo -ne "${DONE}***Build is finished now and took $hours hour(s) $minutes minute(s) $seconds second(s)!${NORMAL}\n" | |
323 | ;; | |
324 | make_pkg) | |
325 | echo "$2" | while read PKG_VER PROGRAM OPTIONS | |
326 | do | |
327 | SET_VER_COL_REAL=`position_cursor $OPT_COL $PKG_VER -3` | |
328 | ||
329 | if [ "$OPTIONS" == "" ]; then | |
330 | echo -ne "${PROGRAM}${SET_VER_COL}[ ${BOLD}${SET_VER_COL_REAL}${PKG_VER}" | |
331 | echo -ne "${NORMAL} ]${SET_RESULT_COL}" | |
332 | else | |
333 | echo -ne "${PROGRAM}${SET_VER_COL}[ ${BOLD}${SET_VER_COL_REAL}${PKG_VER}" | |
334 | echo -ne "${NORMAL} ]${SET_OPT_COL}[ ${BOLD}${OPTIONS}" | |
335 | echo -ne "${NORMAL} ]${SET_RESULT_COL}" | |
336 | fi | |
337 | done | |
338 | ;; | |
339 | result) | |
340 | RESULT=$2 | |
341 | ||
342 | if [ ! $3 ]; then | |
343 | PKG_TIME=0 | |
344 | else | |
345 | PKG_TIME=$3 | |
346 | fi | |
347 | ||
348 | SET_TIME_COL_REAL=`position_cursor $RESULT_COL $PKG_TIME -3` | |
349 | case "$RESULT" in | |
350 | DONE) | |
351 | echo -ne "${SET_TIME_COL}[ ${BOLD}${SET_TIME_COL_REAL}$PKG_TIME${NORMAL} ]" | |
352 | echo -ne "${SET_RESULT_COL}[${DONE} DONE ${NORMAL}]\n" | |
353 | ;; | |
354 | FAIL) | |
355 | echo -ne "${SET_TIME_COL}[ ${BOLD}${SET_TIME_COL_REAL}$PKG_TIME${NORMAL} ]" | |
356 | echo -ne "${SET_RESULT_COL}[${FAIL} FAIL ${NORMAL}]\n" | |
357 | ;; | |
358 | SKIP) | |
359 | echo -ne "${SET_RESULT_COL}[${SKIP} SKIP ${NORMAL}]\n" | |
360 | ;; | |
361 | esac | |
362 | ;; | |
363 | esac | |
364 | } | |
365 | ||
366 | get_pkg_ver() { | |
367 | PKG_VER=`grep -E "^VER |^VER=|^VER " $1 | awk '{print $3}'` | |
368 | ||
369 | if [ -z $PKG_VER ]; then | |
370 | PKG_VER=`grep "Exp " $1 | awk '{print $4}'` | |
371 | fi | |
372 | if [ -z $PKG_VER ]; then | |
373 | PKG_VER="?" | |
374 | fi | |
375 | if [ ${#PKG_VER} -gt $VER_WIDTH ]; then | |
376 | # If a package version number is greater than $VER_WIDTH, we keep the first 4 characters | |
377 | # and replace enough characters to fit the resulting string on the screen. We'll replace | |
378 | # the extra character with .. (two dots). That's why the "+ 2" in the formula below. | |
379 | # Example: if we have a 21-long version number that we want to fit into a 10-long space, | |
380 | # we have to remove 11 characters. But if we replace 11 characters with 2 characters, we'll | |
381 | # end up with a 12-character long string. That's why we replace 12 characters with .. | |
382 | REMOVE=`expr substr "$PKG_VER" 4 $[ ${#PKG_VER} - $VER_WIDTH + 2 ]` | |
383 | PKG_VER=`echo ${PKG_VER/$REMOVE/..}` | |
384 | fi | |
385 | ||
386 | echo "$PKG_VER" | |
387 | } | |
388 | ||
389 | stdumount() { | |
390 | umount $BASEDIR/build/sys 2>/dev/null; | |
391 | umount $BASEDIR/build/dev/shm 2>/dev/null; | |
392 | umount $BASEDIR/build/dev/pts 2>/dev/null; | |
393 | umount $BASEDIR/build/dev 2>/dev/null; | |
394 | umount $BASEDIR/build/proc 2>/dev/null; | |
395 | umount $BASEDIR/build/install/mnt 2>/dev/null; | |
396 | umount $BASEDIR/build/usr/src/cache 2>/dev/null; | |
397 | umount $BASEDIR/build/usr/src/ccache 2>/dev/null; | |
398 | umount $BASEDIR/build/usr/src/config 2>/dev/null; | |
399 | umount $BASEDIR/build/usr/src/doc 2>/dev/null; | |
400 | umount $BASEDIR/build/usr/src/html 2>/dev/null; | |
401 | umount $BASEDIR/build/usr/src/langs 2>/dev/null; | |
402 | umount $BASEDIR/build/usr/src/lfs 2>/dev/null; | |
403 | umount $BASEDIR/build/usr/src/log 2>/dev/null; | |
404 | umount $BASEDIR/build/usr/src/src 2>/dev/null; | |
405 | } | |
406 | ||
407 | exiterror() { | |
408 | stdumount | |
409 | for i in `seq 0 7`; do | |
410 | if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then | |
411 | losetup -d /dev/loop${i} 2>/dev/null | |
412 | fi; | |
413 | done | |
414 | ||
415 | if [ -n "${LOGFILE}" ]; then | |
416 | echo # empty line | |
417 | ||
418 | local line | |
419 | while read -r line; do | |
420 | echo " ${line}" | |
421 | done <<< "$(tail -n30 ${LOGFILE})" | |
422 | fi | |
423 | ||
424 | echo -e "\nERROR: $*" | |
425 | echo " Check $LOGFILE for errors if applicable" | |
426 | exit 1 | |
427 | } | |
428 | ||
429 | enterchroot() { | |
430 | # Install QEMU helper, if needed | |
431 | qemu_install_helper | |
432 | ||
433 | local PATH="${TOOLS_DIR}/ccache/bin:/bin:/usr/bin:/sbin:/usr/sbin:${TOOLS_DIR}/bin" | |
434 | ||
435 | PATH="${PATH}" chroot ${LFS} env -i \ | |
436 | HOME="/root" \ | |
437 | TERM="${TERM}" \ | |
438 | PS1="${PS1}" \ | |
439 | PATH="${PATH}" \ | |
440 | SYSTEM_RELEASE="${SYSTEM_RELEASE}" \ | |
441 | PAKFIRE_CORE="${PAKFIRE_CORE}" \ | |
442 | NAME="${NAME}" \ | |
443 | SNAME="${SNAME}" \ | |
444 | VERSION="${VERSION}" \ | |
445 | CORE="${CORE}" \ | |
446 | SLOGAN="${SLOGAN}" \ | |
447 | TOOLS_DIR="${TOOLS_DIR}" \ | |
448 | CONFIG_ROOT="${CONFIG_ROOT}" \ | |
449 | CFLAGS="${CFLAGS} ${HARDENING_CFLAGS}" \ | |
450 | CXXFLAGS="${CXXFLAGS} ${HARDENING_CFLAGS}" \ | |
451 | BUILDTARGET="${BUILDTARGET}" \ | |
452 | CROSSTARGET="${CROSSTARGET}" \ | |
453 | BUILD_ARCH="${BUILD_ARCH}" \ | |
454 | BUILD_PLATFORM="${BUILD_PLATFORM}" \ | |
455 | CCACHE_DIR=/usr/src/ccache \ | |
456 | CCACHE_COMPRESS="${CCACHE_COMPRESS}" \ | |
457 | CCACHE_COMPILERCHECK="${CCACHE_COMPILERCHECK}" \ | |
458 | KVER="${KVER}" \ | |
459 | $(fake_environ) \ | |
460 | $(qemu_environ) \ | |
461 | "$@" | |
462 | } | |
463 | ||
464 | entershell() { | |
465 | if [ ! -e $BASEDIR/build/usr/src/lfs/ ]; then | |
466 | exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/" | |
467 | fi | |
468 | ||
469 | echo "Entering to a shell inside LFS chroot, go out with exit" | |
470 | local PS1="ipfire build chroot ($(uname -m)) \u:\w\$ " | |
471 | ||
472 | if enterchroot bash -i; then | |
473 | stdumount | |
474 | else | |
475 | beautify message FAIL | |
476 | exiterror "chroot error" | |
477 | fi | |
478 | } | |
479 | ||
480 | lfsmakecommoncheck() { | |
481 | # Script present? | |
482 | if [ ! -f $BASEDIR/lfs/$1 ]; then | |
483 | exiterror "No such file or directory: $BASEDIR/$1" | |
484 | fi | |
485 | ||
486 | local PKG_VER=`get_pkg_ver $BASEDIR/lfs/$1` | |
487 | beautify make_pkg "$PKG_VER $*" | |
488 | ||
489 | # Check if this package is supported by our architecture. | |
490 | # If no SUP_ARCH is found, we assume the package can be built for all. | |
491 | if grep "^SUP_ARCH" ${BASEDIR}/lfs/${1} >/dev/null; then | |
492 | # Check if package supports ${BUILD_ARCH} or all architectures. | |
493 | if ! grep -E "^SUP_ARCH.*${BUILD_ARCH}|^SUP_ARCH.*all" ${BASEDIR}/lfs/${1} >/dev/null; then | |
494 | beautify result SKIP | |
495 | return 1 | |
496 | fi | |
497 | fi | |
498 | ||
499 | # Script slipped? | |
500 | local i | |
501 | for i in $SKIP_PACKAGE_LIST | |
502 | do | |
503 | if [ "$i" == "$1" ]; then | |
504 | beautify result SKIP | |
505 | return 1; | |
506 | fi | |
507 | done | |
508 | ||
509 | echo -ne "`date -u '+%b %e %T'`: Building $* " >> $LOGFILE | |
510 | ||
511 | cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR BUILD_ARCH="${BUILD_ARCH}" \ | |
512 | MESSAGE="$1\t " download >> $LOGFILE 2>&1 | |
513 | if [ $? -ne 0 ]; then | |
514 | exiterror "Download error in $1" | |
515 | fi | |
516 | ||
517 | cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR BUILD_ARCH="${BUILD_ARCH}" \ | |
518 | MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1 | |
519 | if [ $? -ne 0 ]; then | |
520 | exiterror "md5sum error in $1, check file in cache or signature" | |
521 | fi | |
522 | ||
523 | return 0 # pass all! | |
524 | } | |
525 | ||
526 | lfsmake1() { | |
527 | lfsmakecommoncheck $* | |
528 | [ $? == 1 ] && return 0 | |
529 | ||
530 | local PKG_TIME_START=`date +%s` | |
531 | ||
532 | cd $BASEDIR/lfs && env -i \ | |
533 | PATH="${TOOLS_DIR}/ccache/bin:${TOOLS_DIR}/bin:$PATH" \ | |
534 | CCACHE_DIR="${CCACHE_DIR}" \ | |
535 | CCACHE_COMPRESS="${CCACHE_COMPRESS}" \ | |
536 | CCACHE_COMPILERCHECK="${CCACHE_COMPILERCHECK}" \ | |
537 | CFLAGS="${CFLAGS}" \ | |
538 | CXXFLAGS="${CXXFLAGS}" \ | |
539 | MAKETUNING="${MAKETUNING}" \ | |
540 | make -f $* \ | |
541 | TOOLCHAIN=1 \ | |
542 | TOOLS_DIR="${TOOLS_DIR}" \ | |
543 | CROSSTARGET="${CROSSTARGET}" \ | |
544 | BUILDTARGET="${BUILDTARGET}" \ | |
545 | BUILD_ARCH="${BUILD_ARCH}" \ | |
546 | BUILD_PLATFORM="${BUILD_PLATFORM}" \ | |
547 | LFS_BASEDIR="${BASEDIR}" \ | |
548 | ROOT="${LFS}" \ | |
549 | KVER="${KVER}" \ | |
550 | install >> $LOGFILE 2>&1 | |
551 | ||
552 | local COMPILE_SUCCESS=$? | |
553 | local PKG_TIME_END=`date +%s` | |
554 | ||
555 | if [ $COMPILE_SUCCESS -ne 0 ]; then | |
556 | beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ] | |
557 | exiterror "Building $*"; | |
558 | else | |
559 | beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ] | |
560 | fi | |
561 | ||
562 | return 0 | |
563 | } | |
564 | ||
565 | lfsmake2() { | |
566 | lfsmakecommoncheck $* | |
567 | [ $? == 1 ] && return 0 | |
568 | ||
569 | local PKG_TIME_START=`date +%s` | |
570 | local PS1='\u:\w$ ' | |
571 | ||
572 | enterchroot \ | |
573 | bash -x -c "cd /usr/src/lfs && \ | |
574 | MAKETUNING=${MAKETUNING} \ | |
575 | make -f $* \ | |
576 | LFS_BASEDIR=/usr/src install" \ | |
577 | >> ${LOGFILE} 2>&1 | |
578 | ||
579 | local COMPILE_SUCCESS=$? | |
580 | local PKG_TIME_END=`date +%s` | |
581 | ||
582 | if [ $COMPILE_SUCCESS -ne 0 ]; then | |
583 | beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ] | |
584 | exiterror "Building $*"; | |
585 | else | |
586 | beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ] | |
587 | fi | |
588 | ||
589 | return 0 | |
590 | } | |
591 | ||
592 | ipfiredist() { | |
593 | lfsmakecommoncheck $* | |
594 | [ $? == 1 ] && return 0 | |
595 | ||
596 | local PKG_TIME_START=`date +%s` | |
597 | local PS1='\u:\w$ ' | |
598 | ||
599 | enterchroot \ | |
600 | bash -x -c "cd /usr/src/lfs && make -f $* LFS_BASEDIR=/usr/src dist" \ | |
601 | >> ${LOGFILE} 2>&1 | |
602 | ||
603 | local COMPILE_SUCCESS=$? | |
604 | local PKG_TIME_END=`date +%s` | |
605 | ||
606 | if [ $COMPILE_SUCCESS -ne 0 ]; then | |
607 | beautify result FAIL $[ $PKG_TIME_END - $PKG_TIME_START ] | |
608 | exiterror "Packaging $*"; | |
609 | else | |
610 | beautify result DONE $[ $PKG_TIME_END - $PKG_TIME_START ] | |
611 | fi | |
612 | return 0 | |
613 | } | |
614 | ||
615 | fake_environ() { | |
616 | [ -e "${BASEDIR}/build${TOOLS_DIR}/lib/libpakfire_preload.so" ] || return | |
617 | ||
618 | local env="LD_PRELOAD=${TOOLS_DIR}/lib/libpakfire_preload.so" | |
619 | ||
620 | # Fake kernel version, because some of the packages do not compile | |
621 | # with kernel 3.0 and later. | |
622 | env="${env} UTS_RELEASE=${KVER}" | |
623 | ||
624 | # Fake machine version. | |
625 | env="${env} UTS_MACHINE=${BUILD_ARCH}" | |
626 | ||
627 | echo "${env}" | |
628 | } | |
629 | ||
630 | qemu_environ() { | |
631 | local env | |
632 | ||
633 | # Don't add anything if qemu is not used. | |
634 | if ! qemu_is_required; then | |
635 | return | |
636 | fi | |
637 | ||
638 | # Set default qemu options | |
639 | case "${BUILD_ARCH}" in | |
640 | arm*) | |
641 | QEMU_CPU="${QEMU_CPU:-cortex-a9}" | |
642 | ||
643 | env="${env} QEMU_CPU=${QEMU_CPU}" | |
644 | ;; | |
645 | esac | |
646 | ||
647 | # Enable QEMU strace | |
648 | #env="${env} QEMU_STRACE=1" | |
649 | ||
650 | echo "${env}" | |
651 | } | |
652 | ||
653 | qemu_is_required() { | |
654 | local build_arch="${1}" | |
655 | ||
656 | if [ -z "${build_arch}" ]; then | |
657 | build_arch="${BUILD_ARCH}" | |
658 | fi | |
659 | ||
660 | case "${HOST_ARCH},${build_arch}" in | |
661 | x86_64,arm*|i?86,arm*|i?86,x86_64) | |
662 | return 0 | |
663 | ;; | |
664 | *) | |
665 | return 1 | |
666 | ;; | |
667 | esac | |
668 | } | |
669 | ||
670 | qemu_install_helper() { | |
671 | # Do nothing, if qemu is not required | |
672 | if ! qemu_is_required; then | |
673 | return 0 | |
674 | fi | |
675 | ||
676 | if [ ! -e /proc/sys/fs/binfmt_misc/status ]; then | |
677 | exiterror "binfmt_misc not mounted. QEMU_TARGET_HELPER not useable." | |
678 | fi | |
679 | ||
680 | if [ ! $(cat /proc/sys/fs/binfmt_misc/status) = 'enabled' ]; then | |
681 | exiterror "binfmt_misc not enabled. QEMU_TARGET_HELPER not useable." | |
682 | fi | |
683 | ||
684 | ||
685 | if [ -z "${QEMU_TARGET_HELPER}" ]; then | |
686 | exiterror "QEMU_TARGET_HELPER not set" | |
687 | fi | |
688 | ||
689 | # Check if the helper is already installed. | |
690 | if [ -x "${LFS}${QEMU_TARGET_HELPER}" ]; then | |
691 | return 0 | |
692 | fi | |
693 | ||
694 | # Try to find a suitable binary that we can install | |
695 | # to the build environment. | |
696 | local file | |
697 | for file in "${QEMU_TARGET_HELPER}" "${QEMU_TARGET_HELPER}-static"; do | |
698 | # file must exist and be executable. | |
699 | [ -x "${file}" ] || continue | |
700 | ||
701 | # Must be static. | |
702 | file_is_static "${file}" || continue | |
703 | ||
704 | local dirname="${LFS}$(dirname "${file}")" | |
705 | mkdir -p "${dirname}" | |
706 | ||
707 | install -m 755 "${file}" "${LFS}${QEMU_TARGET_HELPER}" | |
708 | return 0 | |
709 | done | |
710 | ||
711 | exiterror "Could not find a statically-linked QEMU emulator: ${QEMU_TARGET_HELPER}" | |
712 | } | |
713 | ||
714 | qemu_find_build_helper_name() { | |
715 | local build_arch="${1}" | |
716 | ||
717 | local magic | |
718 | case "${build_arch}" in | |
719 | arm*) | |
720 | magic="7f454c4601010100000000000000000002002800" | |
721 | ;; | |
722 | x86_64) | |
723 | magic="7f454c4602010100000000000000000002003e00" | |
724 | ;; | |
725 | esac | |
726 | ||
727 | [ -z "${magic}" ] && return 1 | |
728 | ||
729 | local file | |
730 | for file in /proc/sys/fs/binfmt_misc/*; do | |
731 | # skip write only register entry | |
732 | [ $(basename "${file}") = "register" ] && continue | |
733 | # Search for the file with the correct magic value. | |
734 | grep -qE "^magic ${magic}$" "${file}" || continue | |
735 | ||
736 | local interpreter="$(grep "^interpreter" "${file}" | awk '{ print $2 }')" | |
737 | ||
738 | [ -n "${interpreter}" ] || continue | |
739 | [ "${interpreter:0:1}" = "/" ] || continue | |
740 | [ -x "${interpreter}" ] || continue | |
741 | ||
742 | echo "${interpreter}" | |
743 | return 0 | |
744 | done | |
745 | ||
746 | return 1 | |
747 | } | |
748 | ||
749 | file_is_static() { | |
750 | local file="${1}" | |
751 | ||
752 | file ${file} 2>/dev/null | grep -q "statically linked" | |
753 | } | |
754 | ||
755 | update_language_list() { | |
756 | local path="${1}" | |
757 | ||
758 | local lang | |
759 | for lang in ${path}/*.po; do | |
760 | lang="$(basename "${lang}")" | |
761 | echo "${lang%*.po}" | |
762 | done | sort -u > "${path}/LINGUAS" | |
763 | } | |
764 | ||
765 | # Load configuration file | |
766 | if [ -f .config ]; then | |
767 | . .config | |
768 | fi | |
769 | ||
770 | # TARGET_ARCH is BUILD_ARCH now | |
771 | if [ -n "${TARGET_ARCH}" ]; then | |
772 | BUILD_ARCH="${TARGET_ARCH}" | |
773 | unset TARGET_ARCH | |
774 | fi | |
775 | ||
776 | # Get the amount of memory in this build system | |
777 | HOST_MEM=$(system_memory) | |
778 | ||
779 | if [ -n "${BUILD_ARCH}" ]; then | |
780 | configure_build "${BUILD_ARCH}" | |
781 | else | |
782 | configure_build "default" | |
783 | fi | |
784 | ||
785 | prepareenv() { | |
786 | ############################################################################ | |
787 | # # | |
788 | # Are we running the right shell? # | |
789 | # # | |
790 | ############################################################################ | |
791 | if [ ! "$BASH" ]; then | |
792 | exiterror "BASH environment variable is not set. You're probably running the wrong shell." | |
793 | fi | |
794 | ||
795 | if [ -z "${BASH_VERSION}" ]; then | |
796 | exiterror "Not running BASH shell." | |
797 | fi | |
798 | ||
799 | ||
800 | ############################################################################ | |
801 | # # | |
802 | # Trap on emergency exit # | |
803 | # # | |
804 | ############################################################################ | |
805 | trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGKILL SIGSTOP SIGQUIT | |
806 | ||
807 | ||
808 | ############################################################################ | |
809 | # # | |
810 | # Resetting our nice level # | |
811 | # # | |
812 | ############################################################################ | |
813 | echo -ne "Resetting our nice level to $NICE" | tee -a $LOGFILE | |
814 | renice $NICE $$ > /dev/null | |
815 | if [ `nice` != "$NICE" ]; then | |
816 | beautify message FAIL | |
817 | exiterror "Failed to set correct nice level" | |
818 | else | |
819 | beautify message DONE | |
820 | fi | |
821 | ||
822 | ||
823 | ############################################################################ | |
824 | # # | |
825 | # Checking if running as root user # | |
826 | # # | |
827 | ############################################################################ | |
828 | echo -ne "Checking if we're running as root user" | tee -a $LOGFILE | |
829 | if [ `id -u` != 0 ]; then | |
830 | beautify message FAIL | |
831 | exiterror "Not building as root" | |
832 | else | |
833 | beautify message DONE | |
834 | fi | |
835 | ||
836 | ||
837 | ############################################################################ | |
838 | # # | |
839 | # Checking for necessary temporary space # | |
840 | # # | |
841 | ############################################################################ | |
842 | echo -ne "Checking for necessary space on disk $BASE_DEV" | tee -a $LOGFILE | |
843 | BASE_DEV=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $1 }'` | |
844 | BASE_ASPACE=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $4 }'` | |
845 | if (( 2048000 > $BASE_ASPACE )); then | |
846 | BASE_USPACE=`du -skx $BASEDIR | awk '{print $1}'` | |
847 | if (( 2048000 - $BASE_USPACE > $BASE_ASPACE )); then | |
848 | beautify message FAIL | |
849 | exiterror "Not enough temporary space available, need at least 2GB on $BASE_DEV" | |
850 | fi | |
851 | else | |
852 | beautify message DONE | |
853 | fi | |
854 | ||
855 | ############################################################################ | |
856 | # # | |
857 | # Building Linux From Scratch system # | |
858 | # # | |
859 | ############################################################################ | |
860 | # Set umask | |
861 | umask 022 | |
862 | ||
863 | # Set LFS Directory | |
864 | LFS=$BASEDIR/build | |
865 | ||
866 | # Check ${TOOLS_DIR} symlink | |
867 | if [ -h "${TOOLS_DIR}" ]; then | |
868 | rm -f "${TOOLS_DIR}" | |
869 | fi | |
870 | ||
871 | if [ ! -e "${TOOLS_DIR}" ]; then | |
872 | ln -s "${BASEDIR}/build${TOOLS_DIR}" "${TOOLS_DIR}" | |
873 | fi | |
874 | ||
875 | if [ ! -h "${TOOLS_DIR}" ]; then | |
876 | exiterror "Could not create ${TOOLS_DIR} symbolic link" | |
877 | fi | |
878 | ||
879 | # Setup environment | |
880 | set +h | |
881 | LC_ALL=POSIX | |
882 | export LFS LC_ALL CFLAGS CXXFLAGS MAKETUNING | |
883 | unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD | |
884 | ||
885 | # Make some extra directories | |
886 | mkdir -p "${BASEDIR}/build${TOOLS_DIR}" 2>/dev/null | |
887 | mkdir -p $BASEDIR/build/{etc,usr/src} 2>/dev/null | |
888 | mkdir -p $BASEDIR/build/{dev/{shm,pts},proc,sys} | |
889 | mkdir -p $BASEDIR/{cache,ccache} 2>/dev/null | |
890 | mkdir -p $BASEDIR/build/usr/src/{cache,config,doc,html,langs,lfs,log,src,ccache} | |
891 | ||
892 | mknod -m 600 $BASEDIR/build/dev/console c 5 1 2>/dev/null | |
893 | mknod -m 666 $BASEDIR/build/dev/null c 1 3 2>/dev/null | |
894 | ||
895 | # Make all sources and proc available under lfs build | |
896 | mount --bind /dev $BASEDIR/build/dev | |
897 | mount --bind /dev/pts $BASEDIR/build/dev/pts | |
898 | mount --bind /dev/shm $BASEDIR/build/dev/shm | |
899 | mount --bind /proc $BASEDIR/build/proc | |
900 | mount --bind /sys $BASEDIR/build/sys | |
901 | mount --bind $BASEDIR/cache $BASEDIR/build/usr/src/cache | |
902 | mount --bind $BASEDIR/ccache $BASEDIR/build/usr/src/ccache | |
903 | mount --bind $BASEDIR/config $BASEDIR/build/usr/src/config | |
904 | mount --bind $BASEDIR/doc $BASEDIR/build/usr/src/doc | |
905 | mount --bind $BASEDIR/html $BASEDIR/build/usr/src/html | |
906 | mount --bind $BASEDIR/langs $BASEDIR/build/usr/src/langs | |
907 | mount --bind $BASEDIR/lfs $BASEDIR/build/usr/src/lfs | |
908 | mount --bind $BASEDIR/log $BASEDIR/build/usr/src/log | |
909 | mount --bind $BASEDIR/src $BASEDIR/build/usr/src/src | |
910 | ||
911 | # Run LFS static binary creation scripts one by one | |
912 | export CCACHE_DIR=$BASEDIR/ccache | |
913 | export CCACHE_COMPRESS=1 | |
914 | export CCACHE_COMPILERCHECK="string:toolchain-${TOOLCHAINVER} ${BUILD_ARCH}" | |
915 | ||
916 | # Remove pre-install list of installed files in case user erase some files before rebuild | |
917 | rm -f $BASEDIR/build/usr/src/lsalr 2>/dev/null | |
918 | ||
919 | # Prepare string for /etc/system-release. | |
920 | SYSTEM_RELEASE="${NAME} ${VERSION} (${BUILD_ARCH})" | |
921 | if [ "$(git status -s | wc -l)" == "0" ]; then | |
922 | GIT_STATUS="" | |
923 | else | |
924 | GIT_STATUS="-dirty" | |
925 | fi | |
926 | case "$GIT_BRANCH" in | |
927 | core*|beta?|rc?) | |
928 | SYSTEM_RELEASE="${SYSTEM_RELEASE} - $GIT_BRANCH$GIT_STATUS" | |
929 | ;; | |
930 | *) | |
931 | SYSTEM_RELEASE="${SYSTEM_RELEASE} - Development Build: $GIT_BRANCH/$GIT_LASTCOMMIT$GIT_STATUS" | |
932 | ;; | |
933 | esac | |
934 | } | |
935 | ||
936 | buildtoolchain() { | |
937 | local error=false | |
938 | case "${BUILD_ARCH}:${HOST_ARCH}" in | |
939 | # x86_64 | |
940 | x86_64:x86_64) | |
941 | # This is working. | |
942 | ;; | |
943 | ||
944 | # x86 | |
945 | i586:i586|i586:i686|i586:x86_64) | |
946 | # These are working. | |
947 | ;; | |
948 | i586:*) | |
949 | error=true | |
950 | ;; | |
951 | ||
952 | # ARM | |
953 | arvm7hl:armv7hl|armv7hl:armv7l) | |
954 | # These are working. | |
955 | ;; | |
956 | ||
957 | armv5tel:armv5tel|armv5tel:armv5tejl|armv5tel:armv6l|armv5tel:armv7l|armv5tel:aarch64) | |
958 | # These are working. | |
959 | ;; | |
960 | armv5tel:*) | |
961 | error=true | |
962 | ;; | |
963 | esac | |
964 | ||
965 | ${error} && \ | |
966 | exiterror "Cannot build ${BUILD_ARCH} toolchain on $(uname -m). Please use the download if any." | |
967 | ||
968 | local gcc=$(type -p gcc) | |
969 | if [ -z "${gcc}" ]; then | |
970 | exiterror "Could not find GCC. You will need a working build enviroment in order to build the toolchain." | |
971 | fi | |
972 | ||
973 | LOGFILE="$BASEDIR/log/_build.toolchain.log" | |
974 | export LOGFILE | |
975 | ||
976 | lfsmake1 stage1 | |
977 | lfsmake1 ccache PASS=1 | |
978 | lfsmake1 binutils PASS=1 | |
979 | lfsmake1 gcc PASS=1 | |
980 | lfsmake1 linux KCFG="-headers" | |
981 | lfsmake1 glibc | |
982 | lfsmake1 gcc PASS=L | |
983 | lfsmake1 binutils PASS=2 | |
984 | lfsmake1 gcc PASS=2 | |
985 | lfsmake1 ccache PASS=2 | |
986 | lfsmake1 tcl | |
987 | lfsmake1 expect | |
988 | lfsmake1 dejagnu | |
989 | lfsmake1 pkg-config | |
990 | lfsmake1 ncurses | |
991 | lfsmake1 bash | |
992 | lfsmake1 bzip2 | |
993 | lfsmake1 automake | |
994 | lfsmake1 coreutils | |
995 | lfsmake1 diffutils | |
996 | lfsmake1 findutils | |
997 | lfsmake1 gawk | |
998 | lfsmake1 gettext | |
999 | lfsmake1 grep | |
1000 | lfsmake1 gzip | |
1001 | lfsmake1 m4 | |
1002 | lfsmake1 make | |
1003 | lfsmake1 patch | |
1004 | lfsmake1 perl | |
1005 | lfsmake1 sed | |
1006 | lfsmake1 tar | |
1007 | lfsmake1 texinfo | |
1008 | lfsmake1 xz | |
1009 | lfsmake1 fake-environ | |
1010 | lfsmake1 cleanup-toolchain | |
1011 | } | |
1012 | ||
1013 | buildbase() { | |
1014 | LOGFILE="$BASEDIR/log/_build.base.log" | |
1015 | export LOGFILE | |
1016 | lfsmake2 stage2 | |
1017 | lfsmake2 linux KCFG="-headers" | |
1018 | lfsmake2 man-pages | |
1019 | lfsmake2 glibc | |
1020 | lfsmake2 tzdata | |
1021 | lfsmake2 cleanup-toolchain | |
1022 | lfsmake2 zlib | |
1023 | lfsmake2 binutils | |
1024 | lfsmake2 gmp | |
1025 | lfsmake2 gmp-compat | |
1026 | lfsmake2 mpfr | |
1027 | lfsmake2 libmpc | |
1028 | lfsmake2 file | |
1029 | lfsmake2 gcc | |
1030 | lfsmake2 sed | |
1031 | lfsmake2 autoconf | |
1032 | lfsmake2 automake | |
1033 | lfsmake2 berkeley | |
1034 | lfsmake2 coreutils | |
1035 | lfsmake2 iana-etc | |
1036 | lfsmake2 m4 | |
1037 | lfsmake2 bison | |
1038 | lfsmake2 ncurses-compat | |
1039 | lfsmake2 ncurses | |
1040 | lfsmake2 procps | |
1041 | lfsmake2 libtool | |
1042 | lfsmake2 perl | |
1043 | lfsmake2 readline | |
1044 | lfsmake2 readline-compat | |
1045 | lfsmake2 bzip2 | |
1046 | lfsmake2 pcre | |
1047 | lfsmake2 pcre-compat | |
1048 | lfsmake2 bash | |
1049 | lfsmake2 diffutils | |
1050 | lfsmake2 e2fsprogs | |
1051 | lfsmake2 ed | |
1052 | lfsmake2 findutils | |
1053 | lfsmake2 flex | |
1054 | lfsmake2 gawk | |
1055 | lfsmake2 gettext | |
1056 | lfsmake2 grep | |
1057 | lfsmake2 groff | |
1058 | lfsmake2 gperf | |
1059 | lfsmake2 gzip | |
1060 | lfsmake2 hostname | |
1061 | lfsmake2 iproute2 | |
1062 | lfsmake2 jwhois | |
1063 | lfsmake2 kbd | |
1064 | lfsmake2 less | |
1065 | lfsmake2 make | |
1066 | lfsmake2 man | |
1067 | lfsmake2 kmod | |
1068 | lfsmake2 net-tools | |
1069 | lfsmake2 patch | |
1070 | lfsmake2 psmisc | |
1071 | lfsmake2 shadow | |
1072 | lfsmake2 sysklogd | |
1073 | lfsmake2 sysvinit | |
1074 | lfsmake2 tar | |
1075 | lfsmake2 texinfo | |
1076 | lfsmake2 util-linux | |
1077 | lfsmake2 udev | |
1078 | lfsmake2 vim | |
1079 | lfsmake2 xz | |
1080 | lfsmake2 paxctl | |
1081 | } | |
1082 | ||
1083 | buildipfire() { | |
1084 | LOGFILE="$BASEDIR/log/_build.ipfire.log" | |
1085 | export LOGFILE | |
1086 | lfsmake2 configroot | |
1087 | lfsmake2 initscripts | |
1088 | lfsmake2 backup | |
1089 | lfsmake2 pkg-config | |
1090 | lfsmake2 libusb | |
1091 | lfsmake2 libusb-compat | |
1092 | lfsmake2 libpcap | |
1093 | lfsmake2 ppp | |
1094 | lfsmake2 pptp | |
1095 | lfsmake2 unzip | |
1096 | lfsmake2 which | |
1097 | lfsmake2 linux-firmware | |
1098 | lfsmake2 ath10k-firmware | |
1099 | lfsmake2 dvb-firmwares | |
1100 | lfsmake2 mt7601u-firmware | |
1101 | lfsmake2 zd1211-firmware | |
1102 | lfsmake2 rpi-firmware | |
1103 | lfsmake2 bc | |
1104 | lfsmake2 u-boot | |
1105 | lfsmake2 cpio | |
1106 | lfsmake2 mdadm | |
1107 | lfsmake2 dracut | |
1108 | lfsmake2 lvm2 | |
1109 | lfsmake2 multipath-tools | |
1110 | lfsmake2 freetype | |
1111 | lfsmake2 grub | |
1112 | lfsmake2 libmnl | |
1113 | lfsmake2 libnfnetlink | |
1114 | lfsmake2 libnetfilter_queue | |
1115 | lfsmake2 libnetfilter_conntrack | |
1116 | lfsmake2 libnetfilter_cthelper | |
1117 | lfsmake2 libnetfilter_cttimeout | |
1118 | lfsmake2 iptables | |
1119 | ||
1120 | case "${BUILD_ARCH}" in | |
1121 | x86_64) | |
1122 | lfsmake2 linux KCFG="" | |
1123 | lfsmake2 backports KCFG="" | |
1124 | lfsmake2 e1000e KCFG="" | |
1125 | lfsmake2 igb KCFG="" | |
1126 | lfsmake2 ixgbe KCFG="" | |
1127 | lfsmake2 xtables-addons KCFG="" | |
1128 | lfsmake2 linux-initrd KCFG="" | |
1129 | ;; | |
1130 | i586) | |
1131 | # x86-pae (Native and new XEN) kernel build | |
1132 | lfsmake2 linux KCFG="-pae" | |
1133 | lfsmake2 backports KCFG="-pae" | |
1134 | lfsmake2 e1000e KCFG="-pae" | |
1135 | lfsmake2 igb KCFG="-pae" | |
1136 | lfsmake2 ixgbe KCFG="-pae" | |
1137 | lfsmake2 xtables-addons KCFG="-pae" | |
1138 | lfsmake2 linux-initrd KCFG="-pae" | |
1139 | ||
1140 | # x86 kernel build | |
1141 | lfsmake2 linux KCFG="" | |
1142 | lfsmake2 backports KCFG="" | |
1143 | lfsmake2 e1000e KCFG="" | |
1144 | lfsmake2 igb KCFG="" | |
1145 | lfsmake2 ixgbe KCFG="" | |
1146 | lfsmake2 xtables-addons KCFG="" | |
1147 | lfsmake2 linux-initrd KCFG="" | |
1148 | ;; | |
1149 | ||
1150 | armv5tel) | |
1151 | # arm-rpi (Raspberry Pi) kernel build | |
1152 | lfsmake2 linux KCFG="-rpi" | |
1153 | lfsmake2 backports KCFG="-rpi" | |
1154 | lfsmake2 xtables-addons KCFG="-rpi" | |
1155 | lfsmake2 linux-initrd KCFG="-rpi" | |
1156 | ||
1157 | # arm multi platform (Panda, Wandboard ...) kernel build | |
1158 | lfsmake2 linux KCFG="-multi" | |
1159 | lfsmake2 backports KCFG="-multi" | |
1160 | lfsmake2 e1000e KCFG="-multi" | |
1161 | lfsmake2 igb KCFG="-multi" | |
1162 | lfsmake2 ixgbe KCFG="-multi" | |
1163 | lfsmake2 xtables-addons KCFG="-multi" | |
1164 | lfsmake2 linux-initrd KCFG="-multi" | |
1165 | ||
1166 | # arm-kirkwood (Dreamplug, ICY-Box ...) kernel build | |
1167 | lfsmake2 linux KCFG="-kirkwood" | |
1168 | lfsmake2 backports KCFG="-kirkwood" | |
1169 | lfsmake2 e1000e KCFG="-kirkwood" | |
1170 | lfsmake2 igb KCFG="-kirkwood" | |
1171 | lfsmake2 ixgbe KCFG="-kirkwood" | |
1172 | lfsmake2 xtables-addons KCFG="-kirkwood" | |
1173 | lfsmake2 linux-initrd KCFG="-kirkwood" | |
1174 | ;; | |
1175 | esac | |
1176 | lfsmake2 xtables-addons USPACE="1" | |
1177 | lfsmake2 openssl | |
1178 | [ "${BUILD_ARCH}" = "i586" ] && lfsmake2 openssl KCFG='-sse2' | |
1179 | lfsmake2 libgpg-error | |
1180 | lfsmake2 libgcrypt | |
1181 | lfsmake2 libassuan | |
1182 | lfsmake2 nettle | |
1183 | lfsmake2 libevent | |
1184 | lfsmake2 libevent2 | |
1185 | lfsmake2 libevent2-compat | |
1186 | lfsmake2 expat | |
1187 | lfsmake2 apr | |
1188 | lfsmake2 aprutil | |
1189 | lfsmake2 unbound | |
1190 | lfsmake2 gnutls | |
1191 | lfsmake2 bind | |
1192 | lfsmake2 dhcp | |
1193 | lfsmake2 dhcpcd | |
1194 | lfsmake2 boost | |
1195 | lfsmake2 linux-atm | |
1196 | lfsmake2 gdbm | |
1197 | lfsmake2 pam | |
1198 | lfsmake2 curl | |
1199 | lfsmake2 tcl | |
1200 | lfsmake2 sqlite | |
1201 | lfsmake2 libffi | |
1202 | lfsmake2 python | |
1203 | lfsmake2 python3 | |
1204 | lfsmake2 ca-certificates | |
1205 | lfsmake2 fireinfo | |
1206 | lfsmake2 libnet | |
1207 | lfsmake2 libnl | |
1208 | lfsmake2 libnl-3 | |
1209 | lfsmake2 libidn | |
1210 | lfsmake2 nasm | |
1211 | lfsmake2 libjpeg | |
1212 | lfsmake2 libjpeg-compat | |
1213 | lfsmake2 libexif | |
1214 | lfsmake2 libpng | |
1215 | lfsmake2 libtiff | |
1216 | lfsmake2 libart | |
1217 | lfsmake2 gd | |
1218 | lfsmake2 popt | |
1219 | lfsmake2 slang | |
1220 | lfsmake2 newt | |
1221 | lfsmake2 libsmooth | |
1222 | lfsmake2 attr | |
1223 | lfsmake2 acl | |
1224 | lfsmake2 libcap | |
1225 | lfsmake2 pciutils | |
1226 | lfsmake2 usbutils | |
1227 | lfsmake2 libxml2 | |
1228 | lfsmake2 libxslt | |
1229 | lfsmake2 BerkeleyDB | |
1230 | lfsmake2 mysql | |
1231 | lfsmake2 cyrus-sasl | |
1232 | lfsmake2 openldap | |
1233 | lfsmake2 apache2 | |
1234 | lfsmake2 php | |
1235 | lfsmake2 web-user-interface | |
1236 | lfsmake2 flag-icons | |
1237 | lfsmake2 jquery | |
1238 | lfsmake2 bootstrap | |
1239 | lfsmake2 arping | |
1240 | lfsmake2 beep | |
1241 | lfsmake2 dvdrtools | |
1242 | lfsmake2 dosfstools | |
1243 | lfsmake2 reiserfsprogs | |
1244 | lfsmake2 xfsprogs | |
1245 | lfsmake2 sysfsutils | |
1246 | lfsmake2 fuse | |
1247 | lfsmake2 ntfs-3g | |
1248 | lfsmake2 ethtool | |
1249 | lfsmake2 ez-ipupdate | |
1250 | lfsmake2 fcron | |
1251 | lfsmake2 perl-GD | |
1252 | lfsmake2 GD-Graph | |
1253 | lfsmake2 GD-TextUtil | |
1254 | lfsmake2 perl-Device-SerialPort | |
1255 | lfsmake2 perl-Device-Modem | |
1256 | lfsmake2 perl-Apache-Htpasswd | |
1257 | lfsmake2 gnupg | |
1258 | lfsmake2 hdparm | |
1259 | lfsmake2 sdparm | |
1260 | lfsmake2 mtools | |
1261 | lfsmake2 whatmask | |
1262 | lfsmake2 conntrack-tools | |
1263 | lfsmake2 libupnp | |
1264 | lfsmake2 ipaddr | |
1265 | lfsmake2 iputils | |
1266 | lfsmake2 l7-protocols | |
1267 | lfsmake2 mISDNuser | |
1268 | lfsmake2 capi4k-utils | |
1269 | lfsmake2 hwdata | |
1270 | lfsmake2 logrotate | |
1271 | lfsmake2 logwatch | |
1272 | lfsmake2 misc-progs | |
1273 | lfsmake2 nano | |
1274 | lfsmake2 URI | |
1275 | lfsmake2 HTML-Tagset | |
1276 | lfsmake2 HTML-Parser | |
1277 | lfsmake2 HTML-Template | |
1278 | lfsmake2 Compress-Zlib | |
1279 | lfsmake2 Digest | |
1280 | lfsmake2 Digest-SHA1 | |
1281 | lfsmake2 Digest-HMAC | |
1282 | lfsmake2 libwww-perl | |
1283 | lfsmake2 Net-DNS | |
1284 | lfsmake2 Net-IPv4Addr | |
1285 | lfsmake2 Net_SSLeay | |
1286 | lfsmake2 IO-Stringy | |
1287 | lfsmake2 IO-Socket-SSL | |
1288 | lfsmake2 Unix-Syslog | |
1289 | lfsmake2 Mail-Tools | |
1290 | lfsmake2 MIME-Tools | |
1291 | lfsmake2 Net-Server | |
1292 | lfsmake2 Convert-TNEF | |
1293 | lfsmake2 Convert-UUlib | |
1294 | lfsmake2 Archive-Tar | |
1295 | lfsmake2 Archive-Zip | |
1296 | lfsmake2 Text-Tabs+Wrap | |
1297 | lfsmake2 Locale-Country | |
1298 | lfsmake2 XML-Parser | |
1299 | lfsmake2 Crypt-PasswdMD5 | |
1300 | lfsmake2 Net-Telnet | |
1301 | lfsmake2 python-setuptools | |
1302 | lfsmake2 python-clientform | |
1303 | lfsmake2 python-mechanize | |
1304 | lfsmake2 python-feedparser | |
1305 | lfsmake2 python-rssdler | |
1306 | lfsmake2 python-inotify | |
1307 | lfsmake2 python-docutils | |
1308 | lfsmake2 python-daemon | |
1309 | lfsmake2 python-ipaddress | |
1310 | lfsmake2 glib | |
1311 | lfsmake2 GeoIP | |
1312 | lfsmake2 noip_updater | |
1313 | lfsmake2 ntp | |
1314 | lfsmake2 openssh | |
1315 | lfsmake2 fontconfig | |
1316 | lfsmake2 dejavu-fonts-ttf | |
1317 | lfsmake2 ubuntu-font-family | |
1318 | lfsmake2 freefont | |
1319 | lfsmake2 pixman | |
1320 | lfsmake2 cairo | |
1321 | lfsmake2 pango | |
1322 | lfsmake2 rrdtool | |
1323 | lfsmake2 setserial | |
1324 | lfsmake2 setup | |
1325 | lfsmake2 libdnet | |
1326 | lfsmake2 daq | |
1327 | lfsmake2 snort | |
1328 | lfsmake2 oinkmaster | |
1329 | lfsmake2 squid | |
1330 | lfsmake2 squidguard | |
1331 | lfsmake2 calamaris | |
1332 | lfsmake2 tcpdump | |
1333 | lfsmake2 traceroute | |
1334 | lfsmake2 vlan | |
1335 | lfsmake2 wireless | |
1336 | lfsmake2 pakfire | |
1337 | lfsmake2 spandsp | |
1338 | lfsmake2 lzo | |
1339 | lfsmake2 openvpn | |
1340 | lfsmake2 pammysql | |
1341 | lfsmake2 mpage | |
1342 | lfsmake2 dbus | |
1343 | lfsmake2 intltool | |
1344 | lfsmake2 libdaemon | |
1345 | lfsmake2 cups | |
1346 | lfsmake2 lcms2 | |
1347 | lfsmake2 ghostscript | |
1348 | lfsmake2 qpdf | |
1349 | lfsmake2 poppler | |
1350 | lfsmake2 cups-filters | |
1351 | lfsmake2 epson-inkjet-printer-escpr | |
1352 | lfsmake2 foomatic | |
1353 | lfsmake2 hplip | |
1354 | lfsmake2 cifs-utils | |
1355 | lfsmake2 krb5 | |
1356 | lfsmake2 samba | |
1357 | lfsmake2 sudo | |
1358 | lfsmake2 mc | |
1359 | lfsmake2 wget | |
1360 | lfsmake2 bridge-utils | |
1361 | lfsmake2 screen | |
1362 | lfsmake2 smartmontools | |
1363 | lfsmake2 htop | |
1364 | lfsmake2 chkconfig | |
1365 | lfsmake2 postfix | |
1366 | lfsmake2 fetchmail | |
1367 | lfsmake2 cyrus-imapd | |
1368 | lfsmake2 openmailadmin | |
1369 | lfsmake2 clamav | |
1370 | lfsmake2 spamassassin | |
1371 | lfsmake2 amavisd | |
1372 | lfsmake2 dma | |
1373 | lfsmake2 alsa | |
1374 | lfsmake2 mpfire | |
1375 | lfsmake2 guardian | |
1376 | lfsmake2 libid3tag | |
1377 | lfsmake2 libmad | |
1378 | lfsmake2 libogg | |
1379 | lfsmake2 libvorbis | |
1380 | lfsmake2 libdvbpsi | |
1381 | lfsmake2 flac | |
1382 | lfsmake2 lame | |
1383 | lfsmake2 sox | |
1384 | lfsmake2 libshout | |
1385 | lfsmake2 xvid | |
1386 | lfsmake2 libmpeg2 | |
1387 | lfsmake2 libarchive | |
1388 | lfsmake2 cmake | |
1389 | lfsmake2 gnump3d | |
1390 | lfsmake2 rsync | |
1391 | lfsmake2 tcpwrapper | |
1392 | lfsmake2 libtirpc | |
1393 | lfsmake2 rpcbind | |
1394 | lfsmake2 nfs | |
1395 | lfsmake2 gnu-netcat | |
1396 | lfsmake2 ncat | |
1397 | lfsmake2 nmap | |
1398 | lfsmake2 etherwake | |
1399 | lfsmake2 bwm-ng | |
1400 | lfsmake2 sysstat | |
1401 | lfsmake2 vsftpd | |
1402 | lfsmake2 strongswan | |
1403 | lfsmake2 rng-tools | |
1404 | lfsmake2 lsof | |
1405 | lfsmake2 br2684ctl | |
1406 | lfsmake2 pcmciautils | |
1407 | lfsmake2 lm_sensors | |
1408 | lfsmake2 liboping | |
1409 | lfsmake2 collectd | |
1410 | lfsmake2 elinks | |
1411 | lfsmake2 igmpproxy | |
1412 | lfsmake2 fbset | |
1413 | lfsmake2 opus | |
1414 | lfsmake2 python-six | |
1415 | lfsmake2 python-pyparsing | |
1416 | lfsmake2 spice-protocol | |
1417 | lfsmake2 spice | |
1418 | lfsmake2 sdl | |
1419 | lfsmake2 libusbredir | |
1420 | lfsmake2 qemu | |
1421 | lfsmake2 sane | |
1422 | lfsmake2 netpbm | |
1423 | lfsmake2 phpSANE | |
1424 | lfsmake2 tunctl | |
1425 | lfsmake2 netsnmpd | |
1426 | lfsmake2 nagios | |
1427 | lfsmake2 nagios_nrpe | |
1428 | lfsmake2 icinga | |
1429 | lfsmake2 ebtables | |
1430 | lfsmake2 directfb | |
1431 | lfsmake2 faad2 | |
1432 | lfsmake2 ffmpeg | |
1433 | lfsmake2 vdr | |
1434 | lfsmake2 vdr_streamdev | |
1435 | lfsmake2 vdr_epgsearch | |
1436 | lfsmake2 vdr_dvbapi | |
1437 | lfsmake2 vdr_eepg | |
1438 | lfsmake2 w_scan | |
1439 | lfsmake2 icecast | |
1440 | lfsmake2 icegenerator | |
1441 | lfsmake2 mpd | |
1442 | lfsmake2 libmpdclient | |
1443 | lfsmake2 mpc | |
1444 | lfsmake2 perl-Net-SMTP-SSL | |
1445 | lfsmake2 perl-MIME-Base64 | |
1446 | lfsmake2 perl-Authen-SASL | |
1447 | lfsmake2 perl-MIME-Lite | |
1448 | lfsmake2 perl-Email-Date-Format | |
1449 | lfsmake2 git | |
1450 | lfsmake2 squidclamav | |
1451 | lfsmake2 vnstat | |
1452 | lfsmake2 iw | |
1453 | lfsmake2 wpa_supplicant | |
1454 | lfsmake2 hostapd | |
1455 | lfsmake2 pycurl | |
1456 | lfsmake2 urlgrabber | |
1457 | lfsmake2 syslinux | |
1458 | lfsmake2 tftpd | |
1459 | lfsmake2 cpufrequtils | |
1460 | lfsmake2 bluetooth | |
1461 | lfsmake2 gutenprint | |
1462 | lfsmake2 apcupsd | |
1463 | lfsmake2 iperf | |
1464 | lfsmake2 iperf3 | |
1465 | lfsmake2 7zip | |
1466 | lfsmake2 lynis | |
1467 | lfsmake2 streamripper | |
1468 | lfsmake2 sshfs | |
1469 | lfsmake2 taglib | |
1470 | #lfsmake2 mediatomb | |
1471 | lfsmake2 sslh | |
1472 | lfsmake2 perl-gettext | |
1473 | lfsmake2 perl-Sort-Naturally | |
1474 | lfsmake2 vdradmin | |
1475 | lfsmake2 miau | |
1476 | lfsmake2 perl-DBI | |
1477 | lfsmake2 perl-DBD-mysql | |
1478 | lfsmake2 perl-DBD-SQLite | |
1479 | lfsmake2 perl-File-ReadBackwards | |
1480 | lfsmake2 cacti | |
1481 | lfsmake2 openvmtools | |
1482 | lfsmake2 nagiosql | |
1483 | lfsmake2 motion | |
1484 | lfsmake2 joe | |
1485 | lfsmake2 monit | |
1486 | lfsmake2 nut | |
1487 | lfsmake2 watchdog | |
1488 | lfsmake2 libpri | |
1489 | lfsmake2 libsrtp | |
1490 | lfsmake2 asterisk | |
1491 | lfsmake2 lcr | |
1492 | lfsmake2 usb_modeswitch | |
1493 | lfsmake2 usb_modeswitch_data | |
1494 | lfsmake2 zerofree | |
1495 | lfsmake2 pound | |
1496 | lfsmake2 minicom | |
1497 | lfsmake2 ddrescue | |
1498 | lfsmake2 miniupnpd | |
1499 | lfsmake2 client175 | |
1500 | lfsmake2 powertop | |
1501 | lfsmake2 parted | |
1502 | lfsmake2 swig | |
1503 | lfsmake2 python-m2crypto | |
1504 | lfsmake2 wireless-regdb | |
1505 | lfsmake2 crda | |
1506 | lfsmake2 libsolv | |
1507 | lfsmake2 python-distutils-extra | |
1508 | lfsmake2 python-lzma | |
1509 | lfsmake2 python-progressbar | |
1510 | lfsmake2 python-xattr | |
1511 | lfsmake2 ddns | |
1512 | lfsmake2 transmission | |
1513 | lfsmake2 dpfhack | |
1514 | lfsmake2 lcd4linux | |
1515 | lfsmake2 mtr | |
1516 | lfsmake2 minidlna | |
1517 | lfsmake2 acpid | |
1518 | lfsmake2 fping | |
1519 | lfsmake2 telnet | |
1520 | lfsmake2 xinetd | |
1521 | lfsmake2 gpgme | |
1522 | lfsmake2 pygpgme | |
1523 | lfsmake2 pakfire3 | |
1524 | lfsmake2 stress | |
1525 | lfsmake2 libstatgrab | |
1526 | lfsmake2 sarg | |
1527 | lfsmake2 check_mk_agent | |
1528 | lfsmake2 nginx | |
1529 | lfsmake2 sendEmail | |
1530 | lfsmake2 sysbench | |
1531 | lfsmake2 strace | |
1532 | lfsmake2 elfutils | |
1533 | lfsmake2 ltrace | |
1534 | lfsmake2 ipfire-netboot | |
1535 | lfsmake2 lcdproc | |
1536 | lfsmake2 bitstream | |
1537 | lfsmake2 multicat | |
1538 | lfsmake2 keepalived | |
1539 | lfsmake2 ipvsadm | |
1540 | lfsmake2 perl-Carp-Clan | |
1541 | lfsmake2 perl-Date-Calc | |
1542 | lfsmake2 perl-Date-Manip | |
1543 | lfsmake2 perl-File-Tail | |
1544 | lfsmake2 perl-TimeDate | |
1545 | lfsmake2 swatch | |
1546 | lfsmake2 tor | |
1547 | lfsmake2 arm | |
1548 | lfsmake2 wavemon | |
1549 | lfsmake2 iptraf-ng | |
1550 | lfsmake2 iotop | |
1551 | lfsmake2 stunnel | |
1552 | lfsmake2 sslscan | |
1553 | lfsmake2 owncloud | |
1554 | lfsmake2 bacula | |
1555 | lfsmake2 batctl | |
1556 | lfsmake2 perl-Font-TTF | |
1557 | lfsmake2 perl-IO-String | |
1558 | lfsmake2 perl-PDF-API2 | |
1559 | lfsmake2 squid-accounting | |
1560 | lfsmake2 pigz | |
1561 | lfsmake2 tmux | |
1562 | lfsmake2 perl-Text-CSV_XS | |
1563 | lfsmake2 swconfig | |
1564 | lfsmake2 haproxy | |
1565 | lfsmake2 ipset | |
1566 | lfsmake2 lua | |
1567 | lfsmake2 dnsdist | |
1568 | lfsmake2 bird | |
1569 | lfsmake2 dmidecode | |
1570 | lfsmake2 mcelog | |
1571 | lfsmake2 rtpproxy | |
1572 | lfsmake2 util-macros | |
1573 | lfsmake2 libpciaccess | |
1574 | lfsmake2 libyajl | |
1575 | lfsmake2 libvirt | |
1576 | lfsmake2 python3-libvirt | |
1577 | lfsmake2 freeradius | |
1578 | lfsmake2 perl-common-sense | |
1579 | lfsmake2 perl-inotify2 | |
1580 | lfsmake2 perl-Net-IP | |
1581 | lfsmake2 wio | |
1582 | lfsmake2 iftop | |
1583 | } | |
1584 | ||
1585 | buildinstaller() { | |
1586 | # Run installer scripts one by one | |
1587 | LOGFILE="$BASEDIR/log/_build.installer.log" | |
1588 | export LOGFILE | |
1589 | lfsmake2 memtest | |
1590 | lfsmake2 installer | |
1591 | lfsmake1 strip | |
1592 | } | |
1593 | ||
1594 | buildpackages() { | |
1595 | LOGFILE="$BASEDIR/log/_build.packages.log" | |
1596 | export LOGFILE | |
1597 | echo "... see detailed log in _build.*.log files" >> $LOGFILE | |
1598 | ||
1599 | ||
1600 | # Generating list of packages used | |
1601 | echo -n "Generating packages list from logs" | tee -a $LOGFILE | |
1602 | rm -f $BASEDIR/doc/packages-list | |
1603 | for i in `ls -1tr $BASEDIR/log/[^_]*`; do | |
1604 | if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then | |
1605 | echo "* `basename $i`" >>$BASEDIR/doc/packages-list | |
1606 | fi | |
1607 | done | |
1608 | echo "== List of softwares used to build $NAME Version: $VERSION ==" > $BASEDIR/doc/packages-list.txt | |
1609 | grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$\|.tgz$\|-config$\|_missing_rootfile$\|install1$\|install2$\|pass1$\|pass2$\|pass3$' \ | |
1610 | $BASEDIR/doc/packages-list | sort >> $BASEDIR/doc/packages-list.txt | |
1611 | rm -f $BASEDIR/doc/packages-list | |
1612 | # packages-list.txt is ready to be displayed for wiki page | |
1613 | beautify message DONE | |
1614 | ||
1615 | # Update changelog | |
1616 | cd $BASEDIR | |
1617 | [ -z $GIT_TAG ] || LAST_TAG=$GIT_TAG | |
1618 | [ -z $LAST_TAG ] || EXT="$LAST_TAG..HEAD" | |
1619 | git log -n 500 --no-merges --pretty=medium --shortstat $EXT > $BASEDIR/doc/ChangeLog | |
1620 | ||
1621 | # Create images for install | |
1622 | lfsmake2 cdrom | |
1623 | ||
1624 | # Check if there is a loop device for building in virtual environments | |
1625 | modprobe loop 2>/dev/null | |
1626 | if [ $BUILD_IMAGES == 1 ] && ([ -e /dev/loop/0 ] || [ -e /dev/loop0 ] || [ -e "/dev/loop-control" ]); then | |
1627 | lfsmake2 flash-images | |
1628 | lfsmake2 flash-images SCON=1 | |
1629 | fi | |
1630 | ||
1631 | mv $LFS/install/images/{*.iso,*.tgz,*.img.gz,*.bz2} $BASEDIR >> $LOGFILE 2>&1 | |
1632 | ||
1633 | ipfirepackages | |
1634 | ||
1635 | lfsmake2 xen-image | |
1636 | mv $LFS/install/images/*.bz2 $BASEDIR >> $LOGFILE 2>&1 | |
1637 | ||
1638 | cd $BASEDIR | |
1639 | ||
1640 | # remove not useable iso on armv5tel (needed to build flash images) | |
1641 | [ "${BUILD_ARCH}" = "armv5tel" ] && rm -rf *.iso | |
1642 | ||
1643 | for i in `ls *.bz2 *.img.gz *.iso`; do | |
1644 | md5sum $i > $i.md5 | |
1645 | done | |
1646 | cd $PWD | |
1647 | ||
1648 | # Cleanup | |
1649 | stdumount | |
1650 | rm -rf $BASEDIR/build/tmp/* | |
1651 | ||
1652 | # Generating total list of files | |
1653 | echo -n "Generating files list from logs" | tee -a $LOGFILE | |
1654 | rm -f $BASEDIR/log/FILES | |
1655 | for i in `ls -1tr $BASEDIR/log/[^_]*`; do | |
1656 | if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then | |
1657 | echo "##" >>$BASEDIR/log/FILES | |
1658 | echo "## `basename $i`" >>$BASEDIR/log/FILES | |
1659 | echo "##" >>$BASEDIR/log/FILES | |
1660 | cat $i | sed "s%^\./%#%" | sort >> $BASEDIR/log/FILES | |
1661 | fi | |
1662 | done | |
1663 | beautify message DONE | |
1664 | ||
1665 | cd $PWD | |
1666 | } | |
1667 | ||
1668 | ipfirepackages() { | |
1669 | lfsmake2 core-updates | |
1670 | ||
1671 | local i | |
1672 | for i in $(find $BASEDIR/config/rootfiles/packages{/${BUILD_ARCH},} -maxdepth 1 -type f); do | |
1673 | i=$(basename ${i}) | |
1674 | if [ -e $BASEDIR/lfs/$i ]; then | |
1675 | ipfiredist $i | |
1676 | else | |
1677 | echo -n $i | |
1678 | beautify message SKIP | |
1679 | fi | |
1680 | done | |
1681 | test -d $BASEDIR/packages || mkdir $BASEDIR/packages | |
1682 | mv -f $LFS/install/packages/* $BASEDIR/packages >> $LOGFILE 2>&1 | |
1683 | rm -rf $BASEDIR/build/install/packages/* | |
1684 | } | |
1685 | ||
1686 | while [ $# -gt 0 ]; do | |
1687 | case "${1}" in | |
1688 | --target=*) | |
1689 | configure_build "${1#--target=}" | |
1690 | ;; | |
1691 | -*) | |
1692 | exiterror "Unknown configuration option: ${1}" | |
1693 | ;; | |
1694 | *) | |
1695 | # Found a command, so exit options parsing. | |
1696 | break | |
1697 | ;; | |
1698 | esac | |
1699 | shift | |
1700 | done | |
1701 | ||
1702 | # See what we're supposed to do | |
1703 | case "$1" in | |
1704 | build) | |
1705 | clear | |
1706 | PACKAGE=`ls -v -r $BASEDIR/cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.gz 2> /dev/null | head -n 1` | |
1707 | #only restore on a clean disk | |
1708 | if [ ! -e "${BASEDIR}/build${TOOLS_DIR}/.toolchain-successful" ]; then | |
1709 | if [ ! -n "$PACKAGE" ]; then | |
1710 | beautify build_stage "Full toolchain compilation" | |
1711 | prepareenv | |
1712 | buildtoolchain | |
1713 | else | |
1714 | PACKAGENAME=${PACKAGE%.tar.gz} | |
1715 | beautify build_stage "Packaged toolchain compilation" | |
1716 | if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then | |
1717 | tar zxf $PACKAGE | |
1718 | prepareenv | |
1719 | else | |
1720 | exiterror "$PACKAGENAME md5 did not match, check downloaded package" | |
1721 | fi | |
1722 | fi | |
1723 | else | |
1724 | echo -n "Using installed toolchain" | tee -a $LOGFILE | |
1725 | beautify message SKIP | |
1726 | prepareenv | |
1727 | fi | |
1728 | ||
1729 | beautify build_start | |
1730 | beautify build_stage "Building LFS" | |
1731 | buildbase | |
1732 | ||
1733 | beautify build_stage "Building IPFire" | |
1734 | buildipfire | |
1735 | ||
1736 | beautify build_stage "Building installer" | |
1737 | buildinstaller | |
1738 | ||
1739 | beautify build_stage "Building packages" | |
1740 | buildpackages | |
1741 | ||
1742 | beautify build_stage "Checking Logfiles for new Files" | |
1743 | ||
1744 | cd $BASEDIR | |
1745 | tools/checknewlog.pl | |
1746 | tools/checkrootfiles | |
1747 | cd $PWD | |
1748 | ||
1749 | beautify build_end | |
1750 | ;; | |
1751 | shell) | |
1752 | # enter a shell inside LFS chroot | |
1753 | # may be used to changed kernel settings | |
1754 | prepareenv | |
1755 | entershell | |
1756 | ;; | |
1757 | clean) | |
1758 | echo -en "${BOLD}Cleaning build directory...${NORMAL}" | |
1759 | for i in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do | |
1760 | $LOSETUP -d $i 2>/dev/null | |
1761 | done | |
1762 | for i in `mount | grep $BASEDIR | cut -d " " -f 1`; do | |
1763 | umount $i | |
1764 | done | |
1765 | stdumount | |
1766 | for i in `seq 0 7`; do | |
1767 | if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then | |
1768 | umount /dev/loop${i} 2>/dev/null; | |
1769 | losetup -d /dev/loop${i} 2>/dev/null; | |
1770 | fi; | |
1771 | done | |
1772 | rm -rf $BASEDIR/build | |
1773 | rm -rf $BASEDIR/cdrom | |
1774 | rm -rf $BASEDIR/packages | |
1775 | rm -rf $BASEDIR/log | |
1776 | if [ -h "${TOOLS_DIR}" ]; then | |
1777 | rm -f "${TOOLS_DIR}" | |
1778 | fi | |
1779 | rm -f $BASEDIR/ipfire-* | |
1780 | beautify message DONE | |
1781 | ;; | |
1782 | downloadsrc) | |
1783 | if [ ! -d $BASEDIR/cache ]; then | |
1784 | mkdir $BASEDIR/cache | |
1785 | fi | |
1786 | mkdir -p $BASEDIR/log | |
1787 | echo -e "${BOLD}Preload all source files${NORMAL}" | tee -a $LOGFILE | |
1788 | FINISHED=0 | |
1789 | cd $BASEDIR/lfs | |
1790 | for c in `seq $MAX_RETRIES`; do | |
1791 | if (( FINISHED==1 )); then | |
1792 | break | |
1793 | fi | |
1794 | FINISHED=1 | |
1795 | cd $BASEDIR/lfs | |
1796 | for i in *; do | |
1797 | if [ -f "$i" -a "$i" != "Config" ]; then | |
1798 | lfsmakecommoncheck ${i} || continue | |
1799 | ||
1800 | make -s -f $i LFS_BASEDIR=$BASEDIR BUILD_ARCH="${BUILD_ARCH}" \ | |
1801 | MESSAGE="$i\t ($c/$MAX_RETRIES)" download >> $LOGFILE 2>&1 | |
1802 | if [ $? -ne 0 ]; then | |
1803 | beautify message FAIL | |
1804 | FINISHED=0 | |
1805 | else | |
1806 | if [ $c -eq 1 ]; then | |
1807 | beautify message DONE | |
1808 | fi | |
1809 | fi | |
1810 | fi | |
1811 | done | |
1812 | done | |
1813 | echo -e "${BOLD}***Verifying md5sums${NORMAL}" | |
1814 | ERROR=0 | |
1815 | for i in *; do | |
1816 | if [ -f "$i" -a "$i" != "Config" ]; then | |
1817 | lfsmakecommoncheck ${i} > /dev/null || continue | |
1818 | make -s -f $i LFS_BASEDIR=$BASEDIR BUILD_ARCH="${BUILD_ARCH}" \ | |
1819 | MESSAGE="$i\t " md5 >> $LOGFILE 2>&1 | |
1820 | if [ $? -ne 0 ]; then | |
1821 | echo -ne "MD5 difference in lfs/$i" | |
1822 | beautify message FAIL | |
1823 | ERROR=1 | |
1824 | fi | |
1825 | fi | |
1826 | done | |
1827 | if [ $ERROR -eq 0 ]; then | |
1828 | echo -ne "${BOLD}all files md5sum match${NORMAL}" | |
1829 | beautify message DONE | |
1830 | else | |
1831 | echo -ne "${BOLD}not all files were correctly download${NORMAL}" | |
1832 | beautify message FAIL | |
1833 | fi | |
1834 | cd - >/dev/null 2>&1 | |
1835 | ;; | |
1836 | toolchain) | |
1837 | clear | |
1838 | prepareenv | |
1839 | beautify build_stage "Toolchain compilation" | |
1840 | buildtoolchain | |
1841 | echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for ${BUILD_ARCH}" | tee -a $LOGFILE | |
1842 | test -d $BASEDIR/cache/toolchains || mkdir -p $BASEDIR/cache/toolchains | |
1843 | cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.gz \ | |
1844 | build/${TOOLS_DIR} build/bin/sh log >> $LOGFILE | |
1845 | md5sum cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.gz \ | |
1846 | > cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.md5 | |
1847 | stdumount | |
1848 | ;; | |
1849 | gettoolchain) | |
1850 | # arbitrary name to be updated in case of new toolchain package upload | |
1851 | PACKAGE=$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH} | |
1852 | if [ ! -f $BASEDIR/cache/toolchains/$PACKAGE.tar.gz ]; then | |
1853 | URL_TOOLCHAIN=`grep URL_TOOLCHAIN lfs/Config | awk '{ print $3 }'` | |
1854 | test -d $BASEDIR/cache/toolchains || mkdir -p $BASEDIR/cache/toolchains | |
1855 | echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for ${BUILD_ARCH}" | tee -a $LOGFILE | |
1856 | cd $BASEDIR/cache/toolchains | |
1857 | wget -U "IPFireSourceGrabber/2.x" $URL_TOOLCHAIN/$PACKAGE.tar.gz $URL_TOOLCHAIN/$PACKAGE.md5 >& /dev/null | |
1858 | if [ $? -ne 0 ]; then | |
1859 | echo "`date -u '+%b %e %T'`: error downloading $PACKAGE toolchain for ${BUILD_ARCH} machine" | tee -a $LOGFILE | |
1860 | else | |
1861 | if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then | |
1862 | echo "`date -u '+%b %e %T'`: toolchain md5 ok" | tee -a $LOGFILE | |
1863 | else | |
1864 | exiterror "$PACKAGE.md5 did not match, check downloaded package" | |
1865 | fi | |
1866 | fi | |
1867 | else | |
1868 | echo "Toolchain is already downloaded. Exiting..." | |
1869 | fi | |
1870 | ;; | |
1871 | uploadsrc) | |
1872 | PWD=`pwd` | |
1873 | if [ -z $IPFIRE_USER ]; then | |
1874 | echo -n "You have to setup IPFIRE_USER first. See .config for details." | |
1875 | beautify message FAIL | |
1876 | exit 1 | |
1877 | fi | |
1878 | ||
1879 | URL_SOURCE=$(grep URL_SOURCE lfs/Config | awk '{ print $3 }') | |
1880 | REMOTE_FILES=$(echo "ls -1" | sftp -C ${IPFIRE_USER}@${URL_SOURCE}) | |
1881 | ||
1882 | for file in ${BASEDIR}/cache/*; do | |
1883 | [ -d "${file}" ] && continue | |
1884 | grep -q "$(basename ${file})" <<<$REMOTE_FILES && continue | |
1885 | NEW_FILES="$NEW_FILES $file" | |
1886 | done | |
1887 | [ -n "$NEW_FILES" ] && scp -2 $NEW_FILES ${IPFIRE_USER}@${URL_SOURCE} | |
1888 | cd $BASEDIR | |
1889 | cd $PWD | |
1890 | exit 0 | |
1891 | ;; | |
1892 | lang) | |
1893 | echo -ne "Checking the translations for missing or obsolete strings..." | |
1894 | chmod 755 $BASEDIR/tools/{check_strings.pl,sort_strings.pl,check_langs.sh} | |
1895 | $BASEDIR/tools/sort_strings.pl en | |
1896 | $BASEDIR/tools/sort_strings.pl de | |
1897 | $BASEDIR/tools/sort_strings.pl fr | |
1898 | $BASEDIR/tools/sort_strings.pl es | |
1899 | $BASEDIR/tools/sort_strings.pl pl | |
1900 | $BASEDIR/tools/sort_strings.pl ru | |
1901 | $BASEDIR/tools/sort_strings.pl nl | |
1902 | $BASEDIR/tools/sort_strings.pl tr | |
1903 | $BASEDIR/tools/sort_strings.pl it | |
1904 | $BASEDIR/tools/check_strings.pl en > $BASEDIR/doc/language_issues.en | |
1905 | $BASEDIR/tools/check_strings.pl de > $BASEDIR/doc/language_issues.de | |
1906 | $BASEDIR/tools/check_strings.pl fr > $BASEDIR/doc/language_issues.fr | |
1907 | $BASEDIR/tools/check_strings.pl es > $BASEDIR/doc/language_issues.es | |
1908 | $BASEDIR/tools/check_strings.pl es > $BASEDIR/doc/language_issues.pl | |
1909 | $BASEDIR/tools/check_strings.pl ru > $BASEDIR/doc/language_issues.ru | |
1910 | $BASEDIR/tools/check_strings.pl nl > $BASEDIR/doc/language_issues.nl | |
1911 | $BASEDIR/tools/check_strings.pl tr > $BASEDIR/doc/language_issues.tr | |
1912 | $BASEDIR/tools/check_strings.pl it > $BASEDIR/doc/language_issues.it | |
1913 | $BASEDIR/tools/check_langs.sh > $BASEDIR/doc/language_missings | |
1914 | beautify message DONE | |
1915 | ||
1916 | echo -ne "Updating language lists..." | |
1917 | update_language_list ${BASEDIR}/src/installer/po | |
1918 | update_language_list ${BASEDIR}/src/setup/po | |
1919 | beautify message DONE | |
1920 | ;; | |
1921 | *) | |
1922 | echo "Usage: $0 {build|changelog|clean|gettoolchain|downloadsrc|shell|sync|toolchain}" | |
1923 | cat doc/make.sh-usage | |
1924 | ;; | |
1925 | esac |