]> git.ipfire.org Git - ipfire-2.x.git/blame - make.sh
general-functions.pl: Read output first before we wait for the process to terminate
[ipfire-2.x.git] / make.sh
CommitLineData
df5e82b3 1#!/bin/bash
9a7e4d85
PM
2###############################################################################
3# #
4# IPFire.org - A linux based firewall #
6ca4e2f2 5# Copyright (C) 2007-2025 IPFire Team <info@ipfire.org> #
9a7e4d85
PM
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###############################################################################
df5e82b3 21
e8ee3199
AF
22NAME="IPFire" # Software name
23SNAME="ipfire" # Short name
d12e3fcd 24# If you update the version don't forget to update backupiso and add it to core update
e36e826a 25VERSION="2.29" # Version number
2271a47b 26CORE="198" # Core Level (Filename)
e8ee3199
AF
27SLOGAN="www.ipfire.org" # Software slogan
28CONFIG_ROOT=/var/ipfire # Configuration rootdir
36e2e992
MT
29
30# Information from Git
31GIT_BRANCH="$(git rev-parse --abbrev-ref HEAD)" # Git Branch
32GIT_TAG="$(git tag | tail -1)" # Git Tag
33GIT_LASTCOMMIT="$(git rev-parse --verify HEAD)" # Last commit
628e8c3a 34
e70f4ae6 35TOOLCHAINVER="20250814"
03ad5f93 36
9db251ee
MT
37KVER_SUFFIX="-${SNAME}"
38
39# Kernel Version
40KVER="$(grep --max-count=1 VER lfs/linux | awk '{ print $3 }')"
41KVER="${KVER/-rc/.0-rc}${KVER_SUFFIX}"
42
69a6ec55
MT
43###############################################################################
44#
45# Beautifying variables & presentation & input output interface
46#
47###############################################################################
48
5be3501e
MT
49# All supported architectures
50ARCHES=(
51 aarch64
52 riscv64
53 x86_64
54)
55
0de9b403 56HOST_ARCH="${HOSTTYPE}"
faccfa70 57HOST_KERNEL="$(uname -r)"
dfb583fe 58LC_ALL=POSIX
9948d3d9
MT
59PS1='\u:\w$ '
60
faccfa70
MT
61HAS_TIME_NAMESPACE="true"
62
63# Disable time namespaces for older kernels
64case "${HOST_KERNEL}" in
65 4.*|5.[12345].*)
66 HAS_TIME_NAMESPACE="false"
67 ;;
68esac
69
0de9b403
MT
70# Are we reading from/writing to a terminal?
71is_terminal() {
72 [ -t 0 ] && [ -t 1 ] && [ -t 2 ]
73}
8eeaf1ab 74
0de9b403
MT
75# Define color for messages
76if is_terminal; then
77 BOLD="$(tput bold)"
78 RED="$(tput setaf 1)"
79 GREEN="$(tput setaf 2)"
80 YELLOW="$(tput setaf 3)"
81 CYAN="$(tput setaf 6)"
82 NORMAL="$(tput sgr0)"
83fi
8eeaf1ab 84
401a1edc
MT
85# Sets or adjusts pretty formatting variables
86resize_terminal() {
401a1edc 87 # Find current screen size
0de9b403 88 COLUMNS="$(tput cols)"
401a1edc
MT
89
90 # When using remote connections, such as a serial port, stty size returns 0
0de9b403 91 if ! is_terminal || [ "${COLUMNS}" = "0" ]; then
401a1edc
MT
92 COLUMNS=80
93 fi
69a6ec55 94
56312598
MT
95 # Wipe any previous content before updating the counters
96 if [ -n "${TIME_COL}" ]; then
97 tput hpa "${TIME_COL}"
98 tput el
99 fi
100
0de9b403 101 # The status column is always 8 characters wide
401a1edc 102 STATUS_WIDTH=8
401a1edc 103
0de9b403
MT
104 # The time column is always 12 characters wide
105 TIME_WIDTH=12
106
107 # Where do the columns start?
108 (( STATUS_COL = COLUMNS - STATUS_WIDTH ))
109 (( TIME_COL = STATUS_COL - TIME_WIDTH ))
401a1edc 110}
69a6ec55 111
401a1edc
MT
112# Initially setup terminal
113resize_terminal
f9783277 114
401a1edc
MT
115# Call resize_terminal when terminal is being resized
116trap "resize_terminal" WINCH
69a6ec55 117
74371ed5
MT
118# Writes a line to the log file
119log() {
120 local line="$@"
121
122 # Fetch the current timestamp
123 local t="$(date -u "+%b %e %T")"
124
125 # Append the line to file
126 if [ -w "${LOGFILE}" ]; then
127 echo "${t}: ${line}" >> "${LOGFILE}"
128 fi
129
130 return 0
131}
132
510dd732
MT
133find_base() {
134 local path
135
136 # Figure out the absolute script path using readlink
137 path="$(readlink -f "${0}" 2>&1)"
138
139 # If that failed, try realpath
140 if [ -z "${path}" ]; then
141 path="$(realpath "${0}" 2>&1)"
142 fi
143
144 # If that failed, I am out of ideas
145 if [ -z "${path}" ]; then
146 echo "${0}: Could not determine BASEDIR" >&2
147 return 1
148 fi
149
150 # Return the dirname
151 dirname "${path}"
152}
153
69a6ec55
MT
154system_processors() {
155 getconf _NPROCESSORS_ONLN 2>/dev/null || echo "1"
156}
157
158system_memory() {
159 local key val unit
160
161 while read -r key val unit; do
162 case "${key}" in
163 MemTotal:*)
164 # Convert to MB
165 echo "$(( ${val} / 1024 ))"
166 break
167 ;;
168 esac
169 done < /proc/meminfo
170}
171
f9783277
MT
172format_runtime() {
173 local seconds=${1}
174
175 if [ ${seconds} -ge 3600 ]; then
176 printf "%d:%02d:%02d\n" \
177 "$(( seconds / 3600 ))" \
178 "$(( seconds % 3600 / 60 ))" \
179 "$(( seconds % 3600 % 60 ))"
180 elif [ ${seconds} -ge 60 ]; then
181 printf "%d:%02d\n" \
182 "$(( seconds / 60 ))" \
183 "$(( seconds % 60 ))"
69a6ec55 184 else
f9783277 185 printf "%d\n" "${seconds}"
69a6ec55 186 fi
f9783277 187}
69a6ec55 188
f9783277 189print_line() {
0de9b403
MT
190 # Print the string all the way to the status column
191 printf "%-${STATUS_COL}s" "$*"
f9783277
MT
192}
193
194print_headline() {
0de9b403 195 printf "${BOLD}%s${NORMAL}\n" "$*"
f9783277
MT
196}
197
198print_package() {
199 local name="${1}"
200 shift
69a6ec55 201
f9783277
MT
202 local version="$(grep -E "^VER |^VER=|^VER " $BASEDIR/lfs/${name} | awk '{ print $3 }')"
203 local options="$@"
204
205 local string="${name}"
206 if [ -n "${version}" ] && [ "${version}" != "ipfire" ]; then
207 string="${string} (${version})"
208 fi
209
0de9b403
MT
210 # Add the options
211 if [ -n "${options}" ]; then
9a07118b 212 string="${string} ${options[@]}"
0de9b403
MT
213 fi
214
215 # Print the string
216 print_line "${string}"
f9783277
MT
217}
218
219print_runtime() {
220 local runtime=$(format_runtime $@)
221
0de9b403
MT
222 # Move back the cursor to rewrite the runtime
223 if is_terminal; then
224 tput hpa "${TIME_COL}"
69a6ec55 225 fi
0de9b403
MT
226
227 printf "[ ${BOLD}%$(( TIME_WIDTH - 4 ))s${NORMAL} ]" "${runtime}"
f9783277
MT
228}
229
230print_status() {
231 local status="${1}"
0de9b403 232 local color
f9783277 233
0de9b403
MT
234 case "${status}" in
235 DONE)
236 color="${BOLD}${GREEN}"
237 ;;
238 FAIL)
239 color="${BOLD}${RED}"
240 ;;
241 SKIP)
242 color="${BOLD}${CYAN}"
243 ;;
244 WARN)
245 color="${BOLD}${YELLOW}"
246 ;;
247 *)
248 color="${BOLD}"
249 ;;
250 esac
f9783277 251
0de9b403
MT
252 # Move to the start of the column
253 if is_terminal; then
254 tput hpa "${STATUS_COL}"
69a6ec55 255 fi
f9783277 256
0de9b403 257 printf "[ ${color}%$(( STATUS_WIDTH - 4 ))s${NORMAL} ]\n" "${status}"
69a6ec55
MT
258}
259
f9783277 260print_build_summary() {
787d9428 261 local runtime="${1}"
f9783277 262
787d9428
MT
263 print_line "*** Build Finished"
264 print_runtime "${runtime}"
f9783277 265 print_status DONE
69a6ec55
MT
266}
267
9d9c7cef
MT
268# Launches a timer process as a co-process
269launch_timer() {
270 # Do nothing if the timer is already running
271 if [ -n "${TIMER_PID}" ]; then
272 return 0
273 fi
274
0de9b403
MT
275 # Don't launch the timer when we are not on a terminal
276 if ! is_terminal; then
277 return 0
278 fi
279
9d9c7cef
MT
280 # Launch the co-process
281 coproc TIMER { "${0}" "__timer" "$$"; }
282
283 # Register the signal handlers
284 trap "__timer_event" SIGUSR1
285 trap "terminate_timer" EXIT
286}
287
288# Terminates a previously launched timer
289terminate_timer() {
290 if [ -n "${TIMER_PID}" ]; then
291 kill -TERM "${TIMER_PID}"
292 fi
293}
294
295# The timer main loop
296__timer() {
297 local pid="${1}"
298
299 # Send SIGUSR1 to the main process once a second
b55434ff 300 # If the parent process has gone away, we will terminate.
9d9c7cef 301 while sleep 1; do
b55434ff
MT
302 if ! kill -USR1 "${pid}" &>/dev/null; then
303 break
304 fi
9d9c7cef
MT
305 done
306
307 return 0
308}
309
310# Called when the timer triggers
6e6cb046 311# This function does nothing, but is needed interrupt the wait call
9d9c7cef 312__timer_event() {
b55434ff 313 return 0
9d9c7cef
MT
314}
315
69a6ec55 316exiterror() {
f9783277 317 # Dump logfile
66028310 318 if [ -n "${LOGFILE}" ] && [ -e "${LOGFILE}" ]; then
69a6ec55
MT
319 echo # empty line
320
321 local line
322 while read -r line; do
323 echo " ${line}"
324 done <<< "$(tail -n30 ${LOGFILE})"
325 fi
326
f9783277
MT
327 echo # empty line
328
329 local line
330 for line in "ERROR: $@" " Check ${LOGFILE} for errors if applicable"; do
a8e10869 331 print_line "${line}"
f9783277
MT
332 print_status FAIL
333 done
334
69a6ec55
MT
335 exit 1
336}
337
aecbe123 338prepareenv() {
dae1ac41
MT
339 local network="false"
340
aecbe123 341 # Are we running the right shell?
54328605 342 if [ -z "${BASH}" ]; then
aecbe123
MT
343 exiterror "BASH environment variable is not set. You're probably running the wrong shell."
344 fi
345
346 if [ -z "${BASH_VERSION}" ]; then
347 exiterror "Not running BASH shell."
348 fi
349
350 # Trap on emergency exit
db9ba592 351 trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGQUIT
aecbe123 352
aecbe123 353 # Checking if running as root user
b0c45169
MT
354 if [ "${UID}" -ne 0 ]; then
355 exiterror "root privileges required for building"
aecbe123
MT
356 fi
357
25817601 358 local required_space
f8b5e93d 359
25817601
MT
360 # Parse arguments
361 while [ $# -gt 0 ]; do
362 case "${1}" in
363 --required-space=*)
364 required_space="${1#--required-space=}"
365 ;;
366
dae1ac41
MT
367 --network)
368 network="true"
369 ;;
370
25817601
MT
371 *)
372 exiterror "Unknown argument: ${1}"
373 ;;
374 esac
375 shift
376 done
377
378 # Do we need to check the required space?
379 if [ -n "${required_space}" ]; then
380 local free_space free_blocks block_size
a50bd44c 381 local consumed_space path
f8b5e93d 382
25817601
MT
383 # Fetch free blocks
384 read -r free_blocks block_size <<< "$(stat --file-system --format="%a %S" "${BASEDIR}")"
f8b5e93d 385
25817601
MT
386 # Calculate free space
387 (( free_space = free_blocks * block_size / 1024 / 1024 ))
388
a50bd44c 389 # If we don't have the total space free, we need to check how much we have consumed already...
25817601 390 if [ "${free_space}" -lt "${required_space}" ]; then
a50bd44c
MT
391 # Add any consumed space
392 while read -r consumed_space path; do
393 (( free_space += consumed_space / 1024 / 1024 ))
656e3b79 394 done <<< "$(du --summarize --bytes "${BUILD_DIR}" "${IMAGES_DIR}" "${LOG_DIR}" 2>/dev/null)"
a50bd44c
MT
395 fi
396
397 # Check that we have the required space
398 if [ "${free_space}" -lt "${required_space}" ]; then
399 exiterror "Not enough temporary space available, need at least ${required_space}MiB, but only have ${free_space}MiB"
25817601 400 fi
aecbe123
MT
401 fi
402
403 # Set umask
404 umask 022
405
aecbe123 406 # Make some extra directories
814360a3 407 mkdir -p "${CCACHE_DIR}"
68fea175 408 mkdir -p "${IMAGES_DIR}"
2c33bdf0 409 mkdir -p "${PACKAGES_DIR}"
86565d7f
MT
410 mkdir -p "${BUILD_DIR}/${TOOLS_DIR}"
411 mkdir -p "${BUILD_DIR}/cache"
daa17f2e 412 mkdir -p "${BUILD_DIR}/dev"
86565d7f 413 mkdir -p "${BUILD_DIR}/etc"
b2e0324e 414 mkdir -p "${BUILD_DIR}/proc"
a3bd0672 415 mkdir -p "${BUILD_DIR}/root"
daa17f2e 416 mkdir -p "${BUILD_DIR}/sys"
86565d7f
MT
417 mkdir -p "${BUILD_DIR}/tmp"
418 mkdir -p "${BUILD_DIR}/usr/src"
419 mkdir -p "${BUILD_DIR}/usr/src/cache"
420 mkdir -p "${BUILD_DIR}/usr/src/ccache"
421 mkdir -p "${BUILD_DIR}/usr/src/config"
422 mkdir -p "${BUILD_DIR}/usr/src/doc"
423 mkdir -p "${BUILD_DIR}/usr/src/html"
68fea175 424 mkdir -p "${BUILD_DIR}/usr/src/images"
86565d7f
MT
425 mkdir -p "${BUILD_DIR}/usr/src/langs"
426 mkdir -p "${BUILD_DIR}/usr/src/lfs"
427 mkdir -p "${BUILD_DIR}/usr/src/log"
428 mkdir -p "${BUILD_DIR}/usr/src/src"
aecbe123 429
d4e9fc7f
MT
430 # Make BUILD_DIR a mountpoint
431 mount -o bind "${BUILD_DIR}" "${BUILD_DIR}"
432
e940d23c
MT
433 # Create a new, minimal /dev
434 mount build_dev "${BUILD_DIR}/dev" \
2b0ecf4d 435 -t devtmpfs -o "nosuid,noexec,mode=0755,size=4m,nr_inodes=64k"
e940d23c
MT
436
437 # Mount a new /dev/pts
438 mount build_dev_pts "${BUILD_DIR}/dev/pts" \
439 -t devpts -o "nosuid,noexec,newinstance,ptmxmode=0666,mode=620"
440
441 # Mount a new /dev/shm
442 mount build_dev_shm "${BUILD_DIR}/dev/shm" \
443 -t tmpfs -o "nosuid,nodev,strictatime,mode=1777,size=1024m"
aecbe123 444
3a5d7b88
MT
445 # Mount a new /tmp
446 mount build_tmp "${BUILD_DIR}/tmp" \
447 -t tmpfs -o "nosuid,nodev,strictatime,size=4G,nr_inodes=1M,mode=1777"
448
5e8730eb
MT
449 # Create an empty /proc directory and make it a mountpoint
450 mkdir -p "${BUILD_DIR}/proc"
451 mount --bind "${BUILD_DIR}/proc" "${BUILD_DIR}/proc"
452
aecbe123 453 # Make all sources and proc available under lfs build
27b8db24
MT
454 mount --bind /sys "${BUILD_DIR}/sys"
455 mount --bind -o ro "${BASEDIR}/cache" "${BUILD_DIR}/usr/src/cache"
456 mount --bind -o ro "${BASEDIR}/config" "${BUILD_DIR}/usr/src/config"
457 mount --bind -o ro "${BASEDIR}/doc" "${BUILD_DIR}/usr/src/doc"
458 mount --bind -o ro "${BASEDIR}/html" "${BUILD_DIR}/usr/src/html"
459 mount --bind -o ro "${BASEDIR}/langs" "${BUILD_DIR}/usr/src/langs"
460 mount --bind -o ro "${BASEDIR}/lfs" "${BUILD_DIR}/usr/src/lfs"
27b8db24 461 mount --bind -o ro "${BASEDIR}/src" "${BUILD_DIR}/usr/src/src"
aecbe123 462
372f8088
MT
463 # Mount the log directory
464 mount --bind "${LOG_DIR}" "${BUILD_DIR}/usr/src/log"
465
814360a3
MT
466 # Mount the ccache
467 mount --bind "${CCACHE_DIR}" "${BUILD_DIR}/usr/src/ccache"
468
68fea175
MT
469 # Mount the images directory
470 mount --bind "${IMAGES_DIR}" "${BUILD_DIR}/usr/src/images"
471
dae1ac41
MT
472 # Bind-mount files requires for networking if requested
473 if [ "${network}" = "true" ]; then
474 local file
475
476 for file in /etc/resolv.conf /etc/hosts; do
477 # Skip if the source files does not exist
478 if [ ! -e "${file}" ]; then
479 continue
480 fi
481
482 # Create the destination if it does not exist
483 if [ ! -e "${BUILD_DIR}/${file}" ]; then
484 touch "${BUILD_DIR}/${file}"
485 fi
486
487 # Mount the file read-only
488 mount --bind -o ro "${file}" "${BUILD_DIR}/${file}"
489 done
490 fi
491
814360a3 492 # Configure the ccache
36065e42 493 export CCACHE_TEMPDIR="/tmp"
aecbe123
MT
494 export CCACHE_COMPILERCHECK="string:toolchain-${TOOLCHAINVER} ${BUILD_ARCH}"
495
92a2ed67
MT
496 # Install the QEMU helper
497 qemu_install_helper
498
aecbe123 499 # Remove pre-install list of installed files in case user erase some files before rebuild
86565d7f 500 rm -f "${BUILD_DIR}/usr/src/lsalr"
aecbe123
MT
501
502 # Prepare string for /etc/system-release.
f48643e5
MT
503 local system_release="${NAME} ${VERSION} (${BUILD_ARCH})"
504
505 case "${GIT_BRANCH}" in
506 core*|beta?|rc?)
507 system_release="${system_release} - ${GIT_BRANCH}"
508 ;;
509 *)
9ff65bfa 510 system_release="${system_release} - core${CORE} Development Build: ${GIT_BRANCH}/${GIT_LASTCOMMIT:0:8}"
f48643e5 511 ;;
aecbe123 512 esac
4e54a8e2 513
f48643e5
MT
514 # Append -dirty tag for local changes
515 if [ "$(git status -s | wc -l)" != "0" ]; then
516 system_release="${system_release}-dirty"
517 fi
518
519 # Export variable
520 SYSTEM_RELEASE="${system_release}"
521
040160c7
MT
522 # Decide on PAKFIRE_TREE
523 case "${GIT_BRANCH}" in
524 core*)
525 PAKFIRE_TREE="stable"
526 ;;
527 master)
528 PAKFIRE_TREE="testing"
529 ;;
530 *)
531 PAKFIRE_TREE="unstable"
532 ;;
533 esac
534
4e54a8e2 535 # Setup ccache cache size
9fc24981 536 execute --chroot ccache --max-size="${CCACHE_CACHE_SIZE}"
69a6ec55
MT
537}
538
539entershell() {
4fd413a1 540 echo "Entering to a shell inside the build environment, go out with exit"
d630cfec 541
ab8464f4 542 local PS1="ipfire build chroot (${BUILD_ARCH}) \u:\w\$ "
69a6ec55 543
d630cfec 544 # Run an interactive shell
07f6a51a 545 execute --chroot --interactive --network bash -i
69a6ec55
MT
546}
547
548lfsmakecommoncheck() {
549 # Script present?
550 if [ ! -f $BASEDIR/lfs/$1 ]; then
551 exiterror "No such file or directory: $BASEDIR/$1"
552 fi
553
f9783277
MT
554 # Print package name and version
555 print_package $@
69a6ec55
MT
556
557 # Check if this package is supported by our architecture.
558 # If no SUP_ARCH is found, we assume the package can be built for all.
559 if grep "^SUP_ARCH" ${BASEDIR}/lfs/${1} >/dev/null; then
560 # Check if package supports ${BUILD_ARCH} or all architectures.
561 if ! grep -E "^SUP_ARCH.*${BUILD_ARCH}|^SUP_ARCH.*all" ${BASEDIR}/lfs/${1} >/dev/null; then
405ee2b4 562 print_runtime 0
f9783277 563 print_status SKIP
69a6ec55
MT
564 return 1
565 fi
566 fi
567
69a6ec55
MT
568 echo -ne "`date -u '+%b %e %T'`: Building $* " >> $LOGFILE
569
69a6ec55
MT
570 return 0 # pass all!
571}
572
9fc24981 573execute() {
9fc24981 574 local chroot="false"
ba844d1d 575 local command=()
9fc24981
MT
576 local interactive="false"
577 local timer
91942800 578 local network="false"
1c74bc46 579
449f2879
MT
580 # Collect environment variables
581 local -A environ=(
582 [PATH]="${TOOLS_DIR}/ccache/bin:${TOOLS_DIR}/sbin:${TOOLS_DIR}/bin:${PATH}"
583 [HOME]="${HOME}"
584 [PS1]="${PS1}"
585 [TERM]="vt100"
586
587 # Distro Information
588 [NAME]="${NAME}"
589 [SNAME]="${SNAME}"
590 [VERSION]="${VERSION}"
591 [CORE]="${CORE}"
592 [SLOGAN]="${SLOGAN}"
593 [SYSTEM_RELEASE]="${SYSTEM_RELEASE}"
594 [PAKFIRE_TREE]="${PAKFIRE_TREE}"
595 [CONFIG_ROOT]="${CONFIG_ROOT}"
596
597 # Kernel Version
598 [KVER]="${KVER}"
9db251ee 599 [KVER_SUFFIX]="${KVER_SUFFIX}"
449f2879
MT
600
601 # Compiler flags
27d0a2c4
MT
602 [CFLAGS]="${CFLAGS[@]}"
603 [CXXFLAGS]="${CFLAGS[@]}"
604 [RUSTFLAGS]="${RUSTFLAGS[@]}"
449f2879
MT
605
606 # ccache
607 [CCACHE_DIR]="${CCACHE_DIR}"
608 [CCACHE_TEMPDIR]="${CCACHE_TEMPDIR}"
609 [CCACHE_COMPILERCHECK]="${CCACHE_COMPILERCHECK}"
610
611 # System Properties
612 [SYSTEM_PROCESSORS]="${SYSTEM_PROCESSORS}"
613 [SYSTEM_MEMORY]="${SYSTEM_MEMORY}"
614
615 # Parallelism
616 [DEFAULT_PARALLELISM]="${DEFAULT_PARALLELISM}"
617
618 # Compression Options
b1cf1d9c
MT
619 [XZ_OPT]="${XZ_OPT[*]}"
620 [ZSTD_OPT]="${ZSTD_OPT[*]}"
449f2879
MT
621
622 # Build Architecture
623 [BUILD_ARCH]="${BUILD_ARCH}"
624 [BUILD_PLATFORM]="${BUILD_PLATFORM}"
625
626 # Targets
627 [CROSSTARGET]="${CROSSTARGET}"
628 [BUILDTARGET]="${BUILDTARGET}"
629
630 # Paths
631 [LFS_BASEDIR]="${BASEDIR}"
c08841bb 632 [BUILD_DIR]="${BUILD_DIR}"
449f2879 633 [IMAGES_DIR]="${IMAGES_DIR}"
c08841bb 634 [LOG_DIR]="${LOG_DIR}"
20e49206 635 [PACKAGES_DIR]="${PACKAGES_DIR}"
449f2879
MT
636 [TOOLS_DIR]="${TOOLS_DIR}"
637 )
638
ba844d1d
MT
639 local unshare=()
640
449f2879 641 # Configure a new namespace
ba844d1d
MT
642 if [ -n "${IN_NAMESPACE}" ]; then
643 unshare+=(
644 # Create a new cgroup namespace
645 "--cgroup"
449f2879 646
ba844d1d
MT
647 # Create a new mount namespace
648 "--mount"
2b4d457c 649 "--propagation=slave"
449f2879 650
ba844d1d
MT
651 # Create a new PID namespace and fork
652 "--pid"
653 "--fork"
449f2879 654
ba844d1d
MT
655 # Create a new UTS namespace
656 "--uts"
449f2879 657
0a110703
MT
658 # Mount /proc so that the build environment does not see
659 # any foreign processes.
660 "--mount-proc=${BUILD_DIR}/proc"
661
ba844d1d
MT
662 # If unshare is asked to terminate, terminate all child processes
663 "--kill-child"
664 )
faccfa70
MT
665
666 # Optionally set up a new time namespace
667 if [ "${HAS_TIME_NAMESPACE}" = "true" ]; then
668 unshare+=( "--time" )
669 fi
ba844d1d 670 fi
0ce11c68 671
9fc24981
MT
672 while [ $# -gt 0 ]; do
673 case "${1}" in
674 --chroot)
675 chroot="true"
69a6ec55 676
449f2879
MT
677 # Update some variables
678 environ+=(
679 [PATH]="${TOOLS_DIR}/ccache/bin:/bin:/usr/bin:/sbin:/usr/sbin:${TOOLS_DIR}/sbin:${TOOLS_DIR}/bin"
680 [HOME]="/root"
681
682 # Paths
683 [LFS_BASEDIR]="/usr/src"
c08841bb 684 [BUILD_DIR]="/"
449f2879 685 [IMAGES_DIR]="/usr/src/images"
c08841bb 686 [LOG_DIR]="/usr/src/log"
20e49206 687 [PACKAGES_DIR]="/usr/src/images/packages"
449f2879
MT
688
689 # Compiler Cache
690 [CCACHE_DIR]="/usr/src/ccache"
691
692 # Go Cache
693 [GOCACHE]="/usr/src/ccache/go"
694 )
695
696 # Fake environment
697 if [ -e "${BUILD_DIR}${TOOLS_DIR}/lib/libpakfire_preload.so" ]; then
698 environ+=(
699 [LD_PRELOAD]="${TOOLS_DIR}/lib/libpakfire_preload.so"
700
701 # Fake kernel version, because some of the packages do not
702 # compile with kernel 3.0 and later
9db251ee 703 [UTS_RELEASE]="${KVER}"
449f2879
MT
704
705 # Fake machine
706 [UTS_MACHINE]="${BUILD_ARCH}"
707 )
708 fi
9fc24981 709 ;;
69a6ec55 710
9fc24981
MT
711 --interactive)
712 interactive="true"
449f2879
MT
713
714 # Use the actual value of $TERM
715 environ+=(
716 [TERM]="${TERM}"
717 )
9fc24981 718 ;;
fcbe8019 719
91942800
MT
720 --network)
721 network="true"
07f6a51a
MT
722
723 # Export the proxy configuration
724 environ+=(
725 [https_proxy]="${https_proxy}"
726 [http_proxy]="${http_proxy}"
727 )
91942800
MT
728 ;;
729
9fc24981
MT
730 --timer=*)
731 timer="${1#--timer=}"
732 ;;
fcbe8019 733
9fc24981
MT
734 -*)
735 echo "Unknown argument: ${1}" >&2
736 return 2
737 ;;
28fa6877 738
9fc24981
MT
739 # Parse any custom environment variables
740 *=*)
449f2879 741 environ["${1%=*}"]="${1#*=}"
9fc24981 742 ;;
28fa6877 743
9fc24981
MT
744 # The rest is the command
745 *)
746 command+=( "$@" )
747 break
748 ;;
749 esac
750 shift
751 done
752
9fc24981
MT
753 # Prepend any custom changes to PATH
754 if [ -n "${CUSTOM_PATH}" ]; then
449f2879 755 environ[PATH]="${CUSTOM_PATH}:${environ[PATH]}"
9fc24981
MT
756 fi
757
449f2879
MT
758 # Setup QEMU
759 if qemu_is_required; then
760 environ+=(
761 [QEMU_TARGET_HELPER]="${QEMU_TARGET_HELPER}"
28fa6877 762
449f2879
MT
763 # Enable QEMU strace
764 #[QEMU_STRACE]="1"
765 )
9fc24981 766
449f2879
MT
767 case "${BUILD_ARCH}" in
768 arm*)
769 environ+=(
770 [QEMU_CPU]="${QEMU_CPU:-cortex-a9}"
771 )
772 ;;
9fc24981 773
449f2879
MT
774 riscv64)
775 environ+=(
776 [QEMU_CPU]="${QEMU_CPU:-sifive-u54}"
9fc24981 777
449f2879
MT
778 # Bug fix for QEMU locking up
779 [G_SLICE]="always-malloc"
780 )
781 ;;
782 esac
783 fi
9fc24981 784
91942800
MT
785 # Network
786 if [ "${network}" = "false" ]; then
787 unshare+=( "--net" )
788 fi
789
449f2879
MT
790 local execute=()
791 local env
9fc24981 792
449f2879 793 # Create new namespaces
ba844d1d
MT
794 if [ "${#unshare[@]}" -gt 0 ]; then
795 execute+=(
796 "unshare" "${unshare[@]}"
797 )
798 fi
28fa6877 799
f5160566
MT
800 # Call a setup script in the new namespaces to perform
801 # further set up, but before we change root.
802 execute+=( "${BASEDIR}/tools/execute.sh" )
803
449f2879
MT
804 # Run in chroot?
805 if [ "${chroot}" = "true" ]; then
806 execute+=( "chroot" "${BUILD_DIR}" )
807 fi
3a272cfe 808
1090b297
MT
809 # Set PATH so that we can find the env binary
810 local PATH="${environ[PATH]}:${PATH}"
811
449f2879
MT
812 # Reset the environment
813 execute+=(
814 "env"
fcbe8019 815
449f2879
MT
816 # Clear the previous environment
817 "--ignore-environment"
fcbe8019 818
eba9f280
MT
819 # Change to the home directory
820 --chdir="${environ[HOME]}"
28fa6877
MT
821 )
822
449f2879
MT
823 # Export the environment
824 for env in ${!environ[@]}; do
825 execute+=( "${env}=${environ[${env}]}" )
826 done
9fc24981 827
449f2879
MT
828 # Append the command
829 execute+=( "${command[@]}" )
fcbe8019 830
59e07d4b
MT
831 local pid
832
2e90be3e
MT
833 # Return code
834 local r=0
835
836 # Store the start time
837 local t="${SECONDS}"
838
9fc24981
MT
839 # Run the command in the background and pipe all output to the logfile
840 case "${interactive}" in
841 true)
449f2879 842 "${execute[@]}" || return $?
b55434ff 843 ;;
b55434ff 844
9fc24981
MT
845 false)
846 # Launch the timer if needed
847 if [ -n "${timer}" ]; then
848 launch_timer
849 fi
b55434ff 850
9fc24981
MT
851 # Dispatch the command to the background
852 {
449f2879 853 "${execute[@]}" >> "${LOGFILE}" 2>&1 </dev/null
9fc24981 854 } &
b55434ff 855
59e07d4b
MT
856 # Store the PID
857 pid="$!"
858
9fc24981
MT
859 # Wait for the process to complete
860 while :; do
59e07d4b 861 wait "${pid}"
9fc24981
MT
862
863 # Store the return code
864 r="$?"
865
a44e11e8
MT
866 case "${r}" in
867 # Code means that we have received SIGUSR1 from the timer
868 138)
869 # Call the timer callback
870 if [ -n "${timer}" ]; then
871 "${timer}"
872 fi
873
874 # Go back and wait
875 continue
876 ;;
5e45d49e
MT
877
878 # Ignore SIGWINCH
879 156)
880 continue
881 ;;
a44e11e8 882 esac
9fc24981
MT
883
884 break
885 done
886
887 # Call the timer callback at least once
888 if [ -n "${timer}" ]; then
889 "${timer}"
0754f99f 890 fi
0754f99f 891 esac
2e90be3e
MT
892
893 return "${r}"
69a6ec55
MT
894}
895
9fc24981
MT
896# Calls the makefile of a package
897make_pkg() {
898 local args=()
899 local pkg
900
eba9f280
MT
901 local basedir="${BASEDIR}"
902
9fc24981
MT
903 while [ $# -gt 0 ]; do
904 local arg="${1}"
905 shift
906
907 case "${arg}" in
908 --*)
eba9f280
MT
909 case "${arg}" in
910 --chroot)
911 basedir="/usr/src"
912 ;;
913 esac
914
9fc24981
MT
915 args+=( "${arg}" )
916 ;;
917
918 *)
919 pkg="${arg}"
920 break
921 ;;
922 esac
923 done
924
925 # Execute the make command in the environment
eba9f280 926 execute "${args[@]}" make --directory="${basedir}/lfs" --file="${pkg}" "$@"
9fc24981
MT
927}
928
929lfsmake1() {
930 local pkg="${1}"
931 shift
932
933 # Run the common check
934 lfsmakecommoncheck "${pkg}" "$@"
935 [ $? == 1 ] && return 0
936
dd813c6b 937 # Download source outside of the toolchain
07358a9f 938 if ! make_pkg --network "${pkg}" download "$@"; then
dd813c6b
MT
939 exiterror "Downloading ${pkg}"
940 fi
941
df7d6c99 942 if ! make_pkg --timer="update_runtime" "${pkg}" TOOLCHAIN=1 ROOT="${BUILD_DIR}" b2 install "$@"; then
9fc24981
MT
943 print_status FAIL
944
945 exiterror "Building ${pkg}"
946 fi
947
948 print_status DONE
949}
950
fcbe8019
MT
951lfsmake2() {
952 local pkg="${1}"
a061f9a5 953 shift
69a6ec55 954
2bf48a73 955 # Run the common check
a061f9a5 956 lfsmakecommoncheck "${pkg}" "$@"
2bf48a73
MT
957 [ $? == 1 ] && return 0
958
84dc5631 959 # Download source outside of the toolchain
07358a9f 960 if ! make_pkg --network "${pkg}" download "$@"; then
84dc5631
MT
961 exiterror "Downloading ${pkg}"
962 fi
963
fcbe8019 964 # Run install on the package
50f8a139 965 if ! make_pkg --chroot --timer="update_runtime" "${pkg}" b2 install "$@"; then
9fc24981
MT
966 print_status FAIL
967
fcbe8019 968 exiterror "Building ${pkg}"
f9783277 969 fi
9fc24981
MT
970
971 print_status DONE
fcbe8019 972}
69a6ec55 973
fcbe8019
MT
974ipfiredist() {
975 local pkg="${1}"
a061f9a5 976 shift
fcbe8019 977
2bf48a73 978 # Run the common check
a061f9a5 979 lfsmakecommoncheck "${pkg}" "$@"
2bf48a73
MT
980 [ $? == 1 ] && return 0
981
fcbe8019 982 # Run dist on the package
9fc24981
MT
983 if ! make_pkg --chroot --timer="update_runtime" "${pkg}" dist "$@"; then
984 print_status FAIL
f9783277 985
9fc24981 986 exiterror "Packaging ${pkg}"
69a6ec55 987 fi
f9783277 988
9fc24981
MT
989 print_status DONE
990}
f9783277 991
9fc24981
MT
992update_runtime() {
993 print_runtime "$(( SECONDS - t ))"
69a6ec55
MT
994}
995
69a6ec55
MT
996qemu_is_required() {
997 local build_arch="${1}"
998
999 if [ -z "${build_arch}" ]; then
1000 build_arch="${BUILD_ARCH}"
1001 fi
1002
1003 case "${HOST_ARCH},${build_arch}" in
161eb15d 1004 x86_64,arm*|x86_64,aarch64|x86_64,riscv64|i?86,arm*|i?86,aarch64|i?86,x86_64)
69a6ec55
MT
1005 return 0
1006 ;;
1007 *)
1008 return 1
1009 ;;
1010 esac
1011}
1012
1013qemu_install_helper() {
1014 # Do nothing, if qemu is not required
1015 if ! qemu_is_required; then
1016 return 0
1017 fi
1018
1019 if [ ! -e /proc/sys/fs/binfmt_misc/status ]; then
1020 exiterror "binfmt_misc not mounted. QEMU_TARGET_HELPER not useable."
1021 fi
1022
1023 if [ ! $(cat /proc/sys/fs/binfmt_misc/status) = 'enabled' ]; then
1024 exiterror "binfmt_misc not enabled. QEMU_TARGET_HELPER not useable."
1025 fi
1026
27d0a2c4
MT
1027 # Search for the helper binary
1028 local qemu_build_helper="$(qemu_find_build_helper_name "${BUILD_ARCH}")"
69a6ec55
MT
1029
1030 # Try to find a suitable binary that we can install
1031 # to the build environment.
1032 local file
27d0a2c4 1033 for file in "${qemu_build_helper}" "${qemu_build_helper}-static"; do
69a6ec55
MT
1034 # file must exist and be executable.
1035 [ -x "${file}" ] || continue
1036
1037 # Must be static.
1038 file_is_static "${file}" || continue
1039
4fd413a1 1040 local dirname="${BUILD_DIR}$(dirname "${file}")"
69a6ec55
MT
1041 mkdir -p "${dirname}"
1042
5db99637 1043 # Create the mountpoint
75493bbc 1044 touch "${BUILD_DIR}${file}"
5db99637 1045
27d0a2c4 1046 # Mount the helper
75493bbc
MT
1047 if ! mount --bind -o ro "${file}" "${BUILD_DIR}${file}"; then
1048 exiterror "Could not mount ${file}"
27d0a2c4
MT
1049 fi
1050
1051 # Set
1052 QEMU_TARGET_HELPER="${file}"
1053
69a6ec55
MT
1054 return 0
1055 done
1056
27d0a2c4 1057 exiterror "Could not find a statically-linked QEMU emulator: ${qemu_build_helper}"
69a6ec55
MT
1058}
1059
1060qemu_find_build_helper_name() {
1061 local build_arch="${1}"
1062
1063 local magic
1064 case "${build_arch}" in
0db0f7fa
AF
1065 aarch64)
1066 magic="7f454c460201010000000000000000000200b700"
1067 ;;
4576ca4c
MT
1068 arm*)
1069 magic="7f454c4601010100000000000000000002002800"
1070 ;;
161eb15d
MT
1071 riscv64)
1072 magic="7f454c460201010000000000000000000200f300"
1073 ;;
69a6ec55
MT
1074 x86_64)
1075 magic="7f454c4602010100000000000000000002003e00"
1076 ;;
1077 esac
1078
1079 [ -z "${magic}" ] && return 1
1080
1081 local file
1082 for file in /proc/sys/fs/binfmt_misc/*; do
1083 # skip write only register entry
1084 [ $(basename "${file}") = "register" ] && continue
1085 # Search for the file with the correct magic value.
1086 grep -qE "^magic ${magic}$" "${file}" || continue
1087
1088 local interpreter="$(grep "^interpreter" "${file}" | awk '{ print $2 }')"
1089
1090 [ -n "${interpreter}" ] || continue
1091 [ "${interpreter:0:1}" = "/" ] || continue
1092 [ -x "${interpreter}" ] || continue
1093
1094 echo "${interpreter}"
1095 return 0
1096 done
1097
1098 return 1
1099}
1100
1101file_is_static() {
1102 local file="${1}"
1103
1985774f 1104 file -L "${file}" 2>/dev/null | grep -q -e "statically linked" -e "static-pie linked"
69a6ec55
MT
1105}
1106
1107update_language_list() {
1108 local path="${1}"
1109
1110 local lang
1111 for lang in ${path}/*.po; do
1112 lang="$(basename "${lang}")"
1113 echo "${lang%*.po}"
1114 done | sort -u > "${path}/LINGUAS"
1115}
1116
1fb7f56e
MT
1117contributors() {
1118 local commits name
1119
1120 git shortlog --summary --numbered | while read -r commits name; do
1121 echo "${name}"
1122 done | grep -vE -e "^(alpha197|morlix|root|ummeegge)$" -e "via Development$" -e "@" -e "#$"
1123}
1124
1125update_contributors() {
1126 echo -n "Updating list of contributors"
1127
1128 local contributors="$(contributors | paste -sd , - | sed -e "s/,/&\\\\n/g")"
1129
1130 # Edit contributors into credits.cgi
e2338aa7
MT
1131 local tmp="$(mktemp)"
1132
1133 awk "/<!-- CONTRIBUTORS -->/{ p=1; print; printf \"${contributors}\n\"}/<!-- END -->/{ p=0 } !p" \
1134 < "${BASEDIR}/html/cgi-bin/credits.cgi" > "${tmp}"
1135
1136 # Copy back modified content
1137 cat "${tmp}" > "${BASEDIR}/html/cgi-bin/credits.cgi"
1138 unlink "${tmp}"
1fb7f56e
MT
1139
1140 print_status DONE
1141 return 0
1142}
1143
e2e0d087
MT
1144# Download sources
1145download_sources() {
1146 local file
1147 local pkg
1148
cf4b9118 1149 local failed_packages=()
e2e0d087
MT
1150
1151 # Walk through all files in LFS
1152 for file in "${BASEDIR}/lfs/"*; do
1153 pkg="${file##*/}"
1154
1155 # Skip some packages
1156 case "${pkg}" in
1157 Config)
1158 continue
1159 ;;
1160 esac
1161
1162 # Run the common check
1163 lfsmakecommoncheck "${pkg}"
1164 [ $? == 1 ] && continue
1165
1166 # Download and check the package
07358a9f 1167 if ! make_pkg --network "${pkg}" download b2; then
cf4b9118 1168 failed_packages+=( "${pkg}" )
560b9ecc 1169 print_status FAIL
560b9ecc 1170 continue
e2e0d087 1171 fi
560b9ecc
MT
1172
1173 print_status DONE
e2e0d087
MT
1174 done
1175
cf4b9118
MT
1176 # Fail if we could not download/verify all packages
1177 if [ "${#failed_packages[@]}" -gt 0 ]; then
1178 exiterror "Failed to download or verify some packages: ${failed_packages[@]}"
1179 fi
e2e0d087
MT
1180}
1181
baf15b60
MT
1182# Download the toolchain
1183download_toolchain() {
1184 local toolchain="${1}"
1185
1186 # Do nothing if the toolchain has already been downloaded
1187 if [ -e "${TOOLCHAIN_DIR}/${toolchain}" ]; then
1188 return 0
1189 fi
1190
1191 # Ensure the directory exists
1192 mkdir -p "${TOOLCHAIN_DIR}"
1193
1194 # Create a temporary directory
1195 local tmp="$(mktemp -d)"
1196
1197 # Make the name for the checksum file
1198 local checksums="${toolchain/.tar.zst/.b2}"
1199
1200 # Download the toolchain and checksum files
1201 if ! wget --quiet --directory-prefix="${tmp}" \
1202 "${TOOLCHAIN_URL}/${toolchain}" \
1203 "${TOOLCHAIN_URL}/${checksums}"; then
1204 # Cleanup
1205 rm -rf "${tmp}"
1206
1207 return 1
1208 fi
1209
1210 # Check integrity
54d59f56 1211 if ! cd "${tmp}" && b2sum --quiet --check "${checksums}"; then
baf15b60
MT
1212 # Cleanup
1213 rm -rf "${tmp}"
1214
1215 return 1
1216 fi
1217
1218 # Everything is good, move the files to their destination
1219 if ! mv \
1220 "${tmp}/${toolchain}" \
1221 "${tmp}/${checksums}" \
1222 "${TOOLCHAIN_DIR}"; then
1223 # Cleanup
1224 rm -rf "${tmp}"
1225
1226 return 1
1227 fi
1228
1229 # Cleanup
1230 rm -rf "${tmp}"
1231
1232 return 0
1233}
1234
cf4652d6
MT
1235# Extracts the toolchain
1236extract_toolchain() {
1237 local toolchain="${1}"
1238
1239 local build_dir="${BUILD_DIR#${BASEDIR}/}"
1240 local log_dir="${LOG_DIR#${BASEDIR}/}"
1241
1242 local args=(
1243 # Extract
1244 "ax"
1245
1246 # The file to extract
baf15b60 1247 "-f" "${TOOLCHAIN_DIR}/${toolchain}"
cf4652d6
MT
1248
1249 # The destination
1250 "-C" "${BASEDIR}"
1251
1252 # Transform any older toolchains
1253 "--transform" "s@^build/@${build_dir}/@"
1254 "--transform" "s@^log/@${log_dir}/@"
1255 )
1256
1257 # Extract the toolchain
1258 tar "${args[@]}" || return $?
1259}
1260
3db20d6f
MT
1261# Compresses the toolchain
1262compress_toolchain() {
1263 local toolchain="${1}"
1264
1265 log "Creating toolchain image for ${BUILD_ARCH}"
1266
1267 # Create a temporary directory
1268 local tmp="$(mktemp -d)"
1269
1270 # Make the name for the checksum file
1271 local checksums="${toolchain/.tar.zst/.b2}"
1272
1273 local build_dir="${BUILD_DIR#${BASEDIR}/}"
1274 local log_dir="${LOG_DIR#${BASEDIR}/}"
1275
1276 local args=(
1277 "--create"
1278
1279 # Filter through zstd with custom options
b1cf1d9c 1280 "-I" "zstd ${ZSTD_OPT[*]}"
3db20d6f
MT
1281
1282 # Write to the temporary directory
1283 "-f" "${tmp}/${toolchain}"
1284
1285 # Start in the base directory
1286 "-C" "${BASEDIR}"
1287
1288 # Exclude the build logs
1289 "--exclude" "${log_dir}/_build.*.log"
1290
1291 # Include /bin/sh
1292 "${build_dir}/bin/sh"
1293
1294 # Include the /tools_${BUILD_ARCH} directory
1295 "${build_dir}/${TOOLS_DIR}"
1296
1297 # Include the log directory
1298 "${log_dir}"
1299 )
1300
1301 # Create the archive
1302 if ! tar "${args[@]}"; then
1303 # Cleanup
1304 rm -rf "${tmp}"
1305
1306 return 1
1307 fi
1308
63faf359
MT
1309 # Change to the temporary directory
1310 pushd "${tmp}" &>/dev/null
1311
3db20d6f 1312 # Create the checksums
63faf359
MT
1313 if ! b2sum "${toolchain}" > "${tmp}/${checksums}"; then
1314 popd &>/dev/null
1315
3db20d6f
MT
1316 # Cleanup
1317 rm -rf "${tmp}"
1318
1319 return 1
1320 fi
1321
63faf359
MT
1322 popd &>/dev/null
1323
3db20d6f
MT
1324 # Everything is good, move the files to their destination
1325 if ! mv \
1326 "${tmp}/${toolchain}" \
1327 "${tmp}/${checksums}" \
1328 "${TOOLCHAIN_DIR}"; then
1329 # Cleanup
1330 rm -rf "${tmp}"
1331
1332 return 1
1333 fi
1334
1335 return 0
1336}
1337
1338build_toolchain() {
69a6ec55
MT
1339 local gcc=$(type -p gcc)
1340 if [ -z "${gcc}" ]; then
1341 exiterror "Could not find GCC. You will need a working build enviroment in order to build the toolchain."
1342 fi
1343
6bd3a131
MT
1344 # Check ${TOOLS_DIR} symlink
1345 if [ -h "${TOOLS_DIR}" ]; then
1346 rm -f "${TOOLS_DIR}"
1347 fi
1348
1349 if [ ! -e "${TOOLS_DIR}" ]; then
829f2b46 1350 ln -s "${BUILD_DIR}${TOOLS_DIR}" "${TOOLS_DIR}"
6bd3a131
MT
1351 fi
1352
1353 if [ ! -h "${TOOLS_DIR}" ]; then
1354 exiterror "Could not create ${TOOLS_DIR} symbolic link"
1355 fi
1356
79ea5921 1357 local LOGFILE="${LOG_DIR}/_build.toolchain.log"
69a6ec55
MT
1358
1359 lfsmake1 stage1
69a6ec55
MT
1360 lfsmake1 binutils PASS=1
1361 lfsmake1 gcc PASS=1
9db251ee 1362 lfsmake1 linux HEADERS=1
69a6ec55 1363 lfsmake1 glibc
178c7a6a 1364 lfsmake1 libxcrypt
69a6ec55 1365 lfsmake1 gcc PASS=L
c4a21542 1366 lfsmake1 zlib-ng
7d14c775
MT
1367 lfsmake1 binutils PASS=2
1368 lfsmake1 gcc PASS=2
0250d332 1369 lfsmake1 zstd
74ee1c7a 1370 lfsmake1 ccache
69a6ec55
MT
1371 lfsmake1 tcl
1372 lfsmake1 expect
1373 lfsmake1 dejagnu
1374 lfsmake1 pkg-config
1375 lfsmake1 ncurses
1376 lfsmake1 bash
1377 lfsmake1 bzip2
1378 lfsmake1 automake
1379 lfsmake1 coreutils
1380 lfsmake1 diffutils
1381 lfsmake1 findutils
1382 lfsmake1 gawk
1383 lfsmake1 gettext
1384 lfsmake1 grep
1385 lfsmake1 gzip
1386 lfsmake1 m4
1387 lfsmake1 make
1388 lfsmake1 patch
1389 lfsmake1 perl
46bbc13b 1390 lfsmake1 python3
69a6ec55
MT
1391 lfsmake1 sed
1392 lfsmake1 tar
1393 lfsmake1 texinfo
1394 lfsmake1 xz
85439ac7 1395 lfsmake1 bison
11b5e5cb 1396 lfsmake1 flex
69a6ec55 1397 lfsmake1 fake-environ
0ce11c68 1398 CUSTOM_PATH="${PATH}" lfsmake1 strip
69a6ec55 1399 lfsmake1 cleanup-toolchain
df5e82b3
MT
1400}
1401
513814ab
MT
1402build_system() {
1403 local LOGFILE="${LOG_DIR}/_build.${SNAME}.log"
49714ec4 1404
69a6ec55 1405 lfsmake2 stage2
9db251ee 1406 lfsmake2 linux HEADERS=1
69a6ec55
MT
1407 lfsmake2 man-pages
1408 lfsmake2 glibc
1409 lfsmake2 tzdata
1410 lfsmake2 cleanup-toolchain
c4a21542 1411 lfsmake2 zlib-ng
b2af45b2 1412 [ "${BUILD_ARCH}" = "riscv64" ] && lfsmake2 gcc PASS=A
8fa66ce7 1413 lfsmake2 zstd
cf6c8e67 1414 lfsmake2 autoconf
79ed9095 1415 lfsmake2 autoconf-archive
cf6c8e67 1416 lfsmake2 automake
37f48533 1417 lfsmake2 help2man
cf6c8e67 1418 lfsmake2 libtool
69a6ec55
MT
1419 lfsmake2 binutils
1420 lfsmake2 gmp
69a6ec55
MT
1421 lfsmake2 mpfr
1422 lfsmake2 libmpc
7cb00d0a 1423 lfsmake2 pkg-config
cf6c8e67 1424 lfsmake2 libxcrypt
69a6ec55
MT
1425 lfsmake2 file
1426 lfsmake2 gcc
e38fb3f6
MT
1427 lfsmake2 attr
1428 lfsmake2 acl
69a6ec55 1429 lfsmake2 sed
69a6ec55
MT
1430 lfsmake2 berkeley
1431 lfsmake2 coreutils
1432 lfsmake2 iana-etc
1433 lfsmake2 m4
1434 lfsmake2 bison
69a6ec55 1435 lfsmake2 ncurses
69a6ec55
MT
1436 lfsmake2 perl
1437 lfsmake2 readline
69a6ec55 1438 lfsmake2 bzip2
3ece7859 1439 lfsmake2 xz
f407f05a 1440 lfsmake2 lzip
69a6ec55 1441 lfsmake2 pcre
b0c37190 1442 lfsmake2 pcre2
d701756a 1443 lfsmake2 gettext
69a6ec55
MT
1444 lfsmake2 bash
1445 lfsmake2 diffutils
69a6ec55
MT
1446 lfsmake2 ed
1447 lfsmake2 findutils
1448 lfsmake2 flex
1449 lfsmake2 gawk
d2315d00 1450 lfsmake2 go
69a6ec55
MT
1451 lfsmake2 grep
1452 lfsmake2 groff
1453 lfsmake2 gperf
1454 lfsmake2 gzip
1455 lfsmake2 hostname
ac36f9f2 1456 lfsmake2 whois
69a6ec55
MT
1457 lfsmake2 kbd
1458 lfsmake2 less
50992c73 1459 lfsmake2 procps
69a6ec55 1460 lfsmake2 make
908a25c6 1461 lfsmake2 libpipeline
69a6ec55 1462 lfsmake2 man
69a6ec55
MT
1463 lfsmake2 net-tools
1464 lfsmake2 patch
1465 lfsmake2 psmisc
1466 lfsmake2 shadow
1467 lfsmake2 sysklogd
1468 lfsmake2 sysvinit
1469 lfsmake2 tar
1470 lfsmake2 texinfo
1471 lfsmake2 util-linux
69a6ec55 1472 lfsmake2 vim
69b3d63b 1473 lfsmake2 e2fsprogs
c9fb8808 1474 lfsmake2 jq
ce2cea17
MT
1475 lfsmake2 configroot
1476 lfsmake2 initscripts
1477 lfsmake2 backup
1478 lfsmake2 rust
1479 lfsmake2 openssl
1480 lfsmake2 popt
1481 lfsmake2 libedit
bd1a3ad8
AB
1482 lfsmake2 expat
1483 lfsmake2 libffi
1484 lfsmake2 gdbm
1485 lfsmake2 sqlite
1486 lfsmake2 python3
aadcd093 1487 lfsmake2 python3-wheel
cccb6ff9 1488 lfsmake2 python3-toml
e153297e 1489 lfsmake2 python3-setuptools
cccb6ff9 1490 lfsmake2 python3-pyproject2setuppy
959abb02 1491 lfsmake2 python3-packaging
cccb6ff9
MT
1492 lfsmake2 python3-pep517
1493 lfsmake2 python3-build
1494 lfsmake2 python3-install
1495 lfsmake2 python3-urllib3
1496 lfsmake2 python3-charset-normalizer
1497 lfsmake2 python3-idna
1498 lfsmake2 python3-certifi
1499 lfsmake2 python3-requests
1500 lfsmake2 python3-docutils
1501 lfsmake2 python3-flit
611f4d67 1502 lfsmake2 python3-more_itertools
bd1a3ad8
AB
1503 lfsmake2 ninja
1504 lfsmake2 meson
ce2cea17
MT
1505 lfsmake2 pam
1506 lfsmake2 libcap
1507 lfsmake2 libcap-ng
1508 lfsmake2 libpcap
1509 lfsmake2 ppp
1510 lfsmake2 pptp
1511 lfsmake2 unzip
1512 lfsmake2 which
1513 lfsmake2 bc
1514 lfsmake2 cpio
1515 lfsmake2 libaio
1516 lfsmake2 freetype
1517 lfsmake2 libmnl
1518 lfsmake2 libnfnetlink
1519 lfsmake2 libnetfilter_queue
1520 lfsmake2 libnetfilter_conntrack
1521 lfsmake2 libnetfilter_cthelper
1522 lfsmake2 libnetfilter_cttimeout
1523 lfsmake2 iptables
1524 lfsmake2 iproute2
1525 lfsmake2 screen
1526 lfsmake2 elfutils
ce2cea17
MT
1527 lfsmake2 libconfig
1528 lfsmake2 curl
1529 lfsmake2 libarchive
1530 lfsmake2 cmake
1531 lfsmake2 json-c
1532 lfsmake2 tcl
ce2cea17
MT
1533 lfsmake2 python3-MarkupSafe
1534 lfsmake2 python3-Jinja2
ce2cea17
MT
1535 lfsmake2 kmod
1536 lfsmake2 udev
1537 lfsmake2 libusb
1538 lfsmake2 mdadm
1539 lfsmake2 dracut
1540 lfsmake2 lvm2
1541 lfsmake2 multipath-tools
1542 lfsmake2 glib
ae84010c 1543 lfsmake2 json-glib
ce2cea17
MT
1544 lfsmake2 libgudev
1545 lfsmake2 libgpg-error
1546 lfsmake2 libgcrypt
1547 lfsmake2 libassuan
1548 lfsmake2 nettle
1549 lfsmake2 libsodium
1550 lfsmake2 libevent2
1551 lfsmake2 apr
1552 lfsmake2 aprutil
1553 lfsmake2 unbound
9e9c059a 1554 lfsmake2 libtasn1
06000889 1555 lfsmake2 libunistring
ce2cea17
MT
1556 lfsmake2 gnutls
1557 lfsmake2 libuv
9d58c441 1558 lfsmake2 liburcu
ce2cea17
MT
1559 lfsmake2 bind
1560 lfsmake2 dhcp
1561 lfsmake2 dhcpcd
1562 lfsmake2 boost
1563 lfsmake2 linux-atm
1564 lfsmake2 libqmi
1565 lfsmake2 c-ares
1566 lfsmake2 rust-dissimilar
1567 lfsmake2 rust-cfg-if
1568 lfsmake2 rust-libc
1569 lfsmake2 rust-getrandom
1570 lfsmake2 rust-typenum
1571 lfsmake2 rust-version-check
1572 lfsmake2 rust-generic-array
1573 lfsmake2 rust-crypto-common
1574 lfsmake2 rust-cipher
1575 lfsmake2 rust-hex
1576 lfsmake2 rust-unicode-xid
2491a837 1577 lfsmake2 rust-unicode-ident
ce2cea17
MT
1578 lfsmake2 rust-proc-macro2
1579 lfsmake2 rust-quote
2491a837 1580 lfsmake2 rust-syn-1.0.109
ce2cea17
MT
1581 lfsmake2 rust-syn
1582 lfsmake2 rust-home
1583 lfsmake2 rust-lazy-static
1584 lfsmake2 rust-memchr
1585 lfsmake2 rust-aho-corasick
1586 lfsmake2 rust-regex-syntax
1587 lfsmake2 rust-regex
1588 lfsmake2 rust-ucd-trie
1589 lfsmake2 rust-pest
1590 lfsmake2 rust-semver-parser
1591 lfsmake2 rust-semver
1592 lfsmake2 rust-same-file
1593 lfsmake2 rust-walkdir
1594 lfsmake2 rust-dirs
1595 lfsmake2 rust-toolchain_find
2491a837 1596 lfsmake2 rust-serde_derive
ce2cea17
MT
1597 lfsmake2 rust-serde
1598 lfsmake2 rust-itoa
1599 lfsmake2 rust-ryu
1600 lfsmake2 rust-serde_json
1601 lfsmake2 rust-synstructure
1602 lfsmake2 rust-block-buffer
1603 lfsmake2 rust-digest
1604 lfsmake2 rust-ppv-lite86
1605 lfsmake2 rust-rand_core
1606 lfsmake2 rust-rand_core-0.4.2
1607 lfsmake2 rust-rand_core-0.3.1
1608 lfsmake2 rust-rand_chacha
1609 lfsmake2 rust-rand_hc
1610 lfsmake2 rust-rand
1611 lfsmake2 rust-rdrand
1612 lfsmake2 rust-rand-0.4
1613 lfsmake2 rust-log
1614 lfsmake2 rust-num_cpus
1615 lfsmake2 rust-crossbeam-utils
1616 lfsmake2 rust-autocfg
1617 lfsmake2 rust-memoffset
1618 lfsmake2 rust-scopeguard
1619 lfsmake2 rust-crossbeam-epoch
1620 lfsmake2 rust-crossbeam-deque
1621 lfsmake2 rust-either
1622 lfsmake2 rust-crossbeam-channel
1623 lfsmake2 rust-rayon-core
1624 lfsmake2 rust-rayon
1625 lfsmake2 rust-remove_dir_all
1626 lfsmake2 rust-tempdir
1627 lfsmake2 rust-glob
1628 lfsmake2 rust-once_cell
1629 lfsmake2 rust-termcolor
2491a837
AB
1630 lfsmake2 rust-serde_spanned
1631 lfsmake2 rust-toml_datetime
1632 lfsmake2 rust-equivalent
1633 lfsmake2 rust-allocator-api2
1634 lfsmake2 rust-foldhash
1635 lfsmake2 rust-hashbrown
1636 lfsmake2 rust-indexmap
1637 lfsmake2 rust-winnow
1638 lfsmake2 rust-toml_edit
ce2cea17 1639 lfsmake2 rust-toml
2491a837 1640 lfsmake2 rust-target-triple
ce2cea17
MT
1641 lfsmake2 rust-trybuild
1642 lfsmake2 rust-unindent
1643 lfsmake2 rust-proc-macro-hack
1644 lfsmake2 rust-indoc-impl
2491a837 1645 lfsmake2 rust-indoc-impl-0.3.6
ce2cea17
MT
1646 lfsmake2 rust-indoc
1647 lfsmake2 rust-indoc-0.3.6
1648 lfsmake2 rust-instant
1649 lfsmake2 rust-lock_api
1650 lfsmake2 rust-smallvec
1651 lfsmake2 rust-parking_lot_core
1652 lfsmake2 rust-parking_lot
1653 lfsmake2 rust-paste-impl
1654 lfsmake2 rust-paste
1655 lfsmake2 rust-paste-0.1.18
1656 lfsmake2 rust-ctor
1657 lfsmake2 rust-ghost
1658 lfsmake2 rust-inventory-impl
1659 lfsmake2 rust-inventory
1660 lfsmake2 rust-pyo3-build-config
1661 lfsmake2 rust-pyo3-macros-backend
1662 lfsmake2 rust-pyo3-macros
1663 lfsmake2 rust-pyo3
1664 lfsmake2 rust-num-traits
1665 lfsmake2 rust-num-integer
1666 lfsmake2 rust-num_threads
1667 lfsmake2 rust-time
1668 lfsmake2 rust-iana-time-zone
1669 lfsmake2 rust-chrono
1670 lfsmake2 rust-asn1_derive
1671 lfsmake2 rust-asn1
1672 lfsmake2 rust-proc-macro-error-attr
1673 lfsmake2 rust-proc-macro-error
1674 lfsmake2 rust-Inflector
1675 lfsmake2 rust-ouroboros_macro
1676 lfsmake2 rust-aliasable
1677 lfsmake2 rust-stable_deref_trait
1678 lfsmake2 rust-ouroboros
1679 lfsmake2 rust-base64
1680 lfsmake2 rust-pem
1681 lfsmake2 gdb
1682 lfsmake2 grub
1683 lfsmake2 mandoc
1684 lfsmake2 efivar
1685 lfsmake2 efibootmgr
ce2cea17
MT
1686 lfsmake2 p11-kit
1687 lfsmake2 ca-certificates
1688 lfsmake2 fireinfo
1689 lfsmake2 libnet
1690 lfsmake2 libnl-3
137ce0bd 1691 lfsmake2 libidn2
ce2cea17 1692 lfsmake2 nasm
ce2cea17 1693 lfsmake2 libexif
c5d2db20 1694 lfsmake2 libjpeg
ce2cea17 1695 lfsmake2 libpng
ce2cea17
MT
1696 lfsmake2 gd
1697 lfsmake2 slang
1698 lfsmake2 newt
1699 lfsmake2 libsmooth
1700 lfsmake2 pciutils
1701 lfsmake2 usbutils
1702 lfsmake2 libxml2
1703 lfsmake2 libxslt
1704 lfsmake2 perl-BerkeleyDB
1705 lfsmake2 cyrus-sasl
1706 lfsmake2 openldap
1707 lfsmake2 apache2
1708 lfsmake2 web-user-interface
1709 lfsmake2 flag-icons
1710 lfsmake2 jquery
1711 lfsmake2 bootstrap
1712 lfsmake2 arping
1713 lfsmake2 beep
1714 lfsmake2 libssh
1715 lfsmake2 libinih
f8020292 1716 lfsmake2 xorriso
ce2cea17
MT
1717 lfsmake2 dosfstools
1718 lfsmake2 exfatprogs
1719 lfsmake2 reiserfsprogs
ce2cea17
MT
1720 lfsmake2 xfsprogs
1721 lfsmake2 sysfsutils
1722 lfsmake2 fuse
1723 lfsmake2 ntfs-3g
1724 lfsmake2 ethtool
1725 lfsmake2 fcron
6c228fab 1726 lfsmake2 wireguard-tools
ce2cea17
MT
1727 lfsmake2 perl-ExtUtils-PkgConfig
1728 lfsmake2 perl-GD
1729 lfsmake2 perl-GD-Graph
1730 lfsmake2 perl-GD-TextUtil
1731 lfsmake2 perl-Device-SerialPort
1732 lfsmake2 perl-Device-Modem
ce2cea17
MT
1733 lfsmake2 perl-Parse-Yapp
1734 lfsmake2 perl-Data-UUID
1735 lfsmake2 perl-Try-Tiny
1736 lfsmake2 perl-HTTP-Message
1737 lfsmake2 perl-HTTP-Date
1738 lfsmake2 gnupg
1739 lfsmake2 hdparm
1740 lfsmake2 whatmask
1741 lfsmake2 libtirpc
1742 lfsmake2 conntrack-tools
1743 lfsmake2 iputils
1744 lfsmake2 l7-protocols
1745 lfsmake2 hwdata
1746 lfsmake2 logrotate
1747 lfsmake2 logwatch
1748 lfsmake2 misc-progs
1749 lfsmake2 nano
1750 lfsmake2 perl-URI
1751 lfsmake2 perl-CGI
1752 lfsmake2 perl-Switch
1753 lfsmake2 perl-HTML-Tagset
1754 lfsmake2 perl-HTML-Parser
1755 lfsmake2 perl-HTML-Template
ce2cea17
MT
1756 lfsmake2 perl-libwww
1757 lfsmake2 perl-LWP-Protocol-https
1758 lfsmake2 perl-Net-HTTP
1759 lfsmake2 perl-Net-DNS
1760 lfsmake2 perl-Net-IPv4Addr
1761 lfsmake2 perl-Net_SSLeay
1762 lfsmake2 perl-IO-Stringy
1763 lfsmake2 perl-IO-Socket-SSL
1764 lfsmake2 perl-Unix-Syslog
1765 lfsmake2 perl-Mail-Tools
1766 lfsmake2 perl-MIME-Tools
1767 lfsmake2 perl-Net-Server
1768 lfsmake2 perl-Canary-Stability
1769 lfsmake2 perl-Convert-TNEF
1770 lfsmake2 perl-Convert-UUlib
ce2cea17
MT
1771 lfsmake2 perl-Archive-Zip
1772 lfsmake2 perl-Text-Tabs+Wrap
1773 lfsmake2 perl-XML-Parser
1774 lfsmake2 perl-Crypt-PasswdMD5
1775 lfsmake2 perl-Net-Telnet
ce2cea17
MT
1776 lfsmake2 perl-Capture-Tiny
1777 lfsmake2 perl-Config-AutoConf
d705f5e5 1778 lfsmake2 perl-File-LibMagic
ce2cea17
MT
1779 lfsmake2 perl-Object-Tiny
1780 lfsmake2 perl-Archive-Peek-Libarchive
1781 lfsmake2 python3-inotify
ce2cea17
MT
1782 lfsmake2 python3-daemon
1783 lfsmake2 ntp
1784 lfsmake2 openssh
1785 lfsmake2 fontconfig
c2c0f0b2 1786 lfsmake2 prompt
ce2cea17
MT
1787 lfsmake2 dejavu-fonts-ttf
1788 lfsmake2 ubuntu-font-family
1789 lfsmake2 freefont
1790 lfsmake2 pixman
1791 lfsmake2 cairo
1792 lfsmake2 harfbuzz
1793 lfsmake2 fribidi
1794 lfsmake2 pango
1795 lfsmake2 rrdtool
1796 lfsmake2 setup
1797 lfsmake2 jansson
1798 lfsmake2 yaml
ce2cea17
MT
1799 lfsmake2 colm
1800 lfsmake2 ragel
1801 lfsmake2 vectorscan
1802 lfsmake2 suricata
1803 lfsmake2 ids-ruleset-sources
1804 lfsmake2 ipblocklist-sources
1805 lfsmake2 squid
1806 lfsmake2 squidguard
1807 lfsmake2 calamaris
1808 lfsmake2 tcpdump
1809 lfsmake2 traceroute
ce2cea17
MT
1810 lfsmake2 wireless
1811 lfsmake2 pakfire
1812 lfsmake2 lz4
1813 lfsmake2 lzo
1814 lfsmake2 openvpn
1815 lfsmake2 mpage
1816 lfsmake2 dbus
1817 lfsmake2 intltool
1818 lfsmake2 libdaemon
1819 lfsmake2 avahi
f1a1b377 1820 lfsmake2 libtalloc
ce2cea17
MT
1821 lfsmake2 cifs-utils
1822 lfsmake2 krb5
1823 lfsmake2 rpcsvc-proto
39239d2b 1824 lfsmake2 lmdb
ce2cea17 1825 lfsmake2 samba
dba19944 1826 lfsmake2 iniparser
ce2cea17
MT
1827 lfsmake2 netatalk
1828 lfsmake2 sudo
1829 lfsmake2 mc
1830 lfsmake2 wget
1831 lfsmake2 bridge-utils
1832 lfsmake2 smartmontools
1833 lfsmake2 htop
1834 lfsmake2 chkconfig
1835 lfsmake2 postfix
1836 lfsmake2 fetchmail
1837 lfsmake2 clamav
1838 lfsmake2 perl-NetAddr-IP
1839 lfsmake2 dma
1840 lfsmake2 alsa
ce2cea17
MT
1841 lfsmake2 guardian
1842 lfsmake2 libid3tag
1843 lfsmake2 libmad
1844 lfsmake2 libogg
1845 lfsmake2 libvorbis
1846 lfsmake2 flac
1847 lfsmake2 lame
1848 lfsmake2 soxr
1849 lfsmake2 libshout
ce2cea17 1850 lfsmake2 gnump3d
a08b674d 1851 lfsmake2 libxxhash
ce2cea17
MT
1852 lfsmake2 rsync
1853 lfsmake2 rpcbind
1854 lfsmake2 keyutils
1855 lfsmake2 nfs
1856 lfsmake2 ncat
1857 lfsmake2 nmap
1858 lfsmake2 etherwake
1859 lfsmake2 bwm-ng
1860 lfsmake2 sysstat
1861 lfsmake2 strongswan
1862 lfsmake2 rng-tools
1863 lfsmake2 lsof
ce2cea17
MT
1864 lfsmake2 lm_sensors
1865 lfsmake2 libstatgrab
1866 lfsmake2 liboping
4145cffd
AB
1867 lfsmake2 netsnmpd
1868 lfsmake2 nut
ce2cea17
MT
1869 lfsmake2 collectd
1870 lfsmake2 git
1871 lfsmake2 linux-firmware
1872 lfsmake2 dvb-firmwares
1873 lfsmake2 zd1211-firmware
1874 lfsmake2 rpi-firmware
1875 lfsmake2 intel-microcode
1876 lfsmake2 pcengines-apu-firmware
1877 lfsmake2 elinks
1878 lfsmake2 igmpproxy
1879 lfsmake2 opus
ce2cea17
MT
1880 lfsmake2 python3-pyparsing
1881 lfsmake2 spice-protocol
1882 lfsmake2 spice
1883 lfsmake2 sdl2
1884 lfsmake2 libusbredir
1885 lfsmake2 libseccomp
1886 lfsmake2 libslirp
82c9e495 1887 lfsmake2 dtc
44b8e06f 1888 lfsmake2 python3-tomli
ce2cea17 1889 lfsmake2 qemu
ce2cea17
MT
1890 lfsmake2 nagios_nrpe
1891 lfsmake2 nagios-plugins
1892 lfsmake2 observium-agent
1893 lfsmake2 ebtables
1894 lfsmake2 faad2
1895 lfsmake2 alac
1896 lfsmake2 ffmpeg
1897 lfsmake2 vdr
1898 lfsmake2 vdr_streamdev
1899 lfsmake2 vdr_epgsearch
1900 lfsmake2 vdr_dvbapi
1901 lfsmake2 vdr_eepg
1902 lfsmake2 w_scan
1903 lfsmake2 fmt
1904 lfsmake2 mpd
1905 lfsmake2 libmpdclient
1906 lfsmake2 mpc
1907 lfsmake2 perl-Net-CIDR-Lite
1908 lfsmake2 perl-Net-SMTP-SSL
ce2cea17
MT
1909 lfsmake2 perl-Authen-SASL
1910 lfsmake2 perl-MIME-Lite
1911 lfsmake2 perl-Email-Date-Format
1912 lfsmake2 vnstat
1913 lfsmake2 iw
1914 lfsmake2 wpa_supplicant
1915 lfsmake2 hostapd
1916 lfsmake2 syslinux
1917 lfsmake2 tftpd
ce2cea17
MT
1918 lfsmake2 apcupsd
1919 lfsmake2 fireperf
1920 lfsmake2 iperf
1921 lfsmake2 iperf3
1922 lfsmake2 7zip
1923 lfsmake2 lynis
1924 lfsmake2 sshfs
1925 lfsmake2 utfcpp
1926 lfsmake2 taglib
1927 lfsmake2 perl-gettext
1928 lfsmake2 perl-Sort-Naturally
1929 lfsmake2 vdradmin
1930 lfsmake2 perl-DBI
1931 lfsmake2 perl-DBD-SQLite
1932 lfsmake2 perl-File-ReadBackwards
1933 lfsmake2 openvmtools
1934 lfsmake2 joe
1935 lfsmake2 monit
ce2cea17
MT
1936 lfsmake2 watchdog
1937 lfsmake2 usb_modeswitch
1938 lfsmake2 usb_modeswitch_data
1939 lfsmake2 zerofree
1940 lfsmake2 minicom
1941 lfsmake2 ddrescue
1942 lfsmake2 parted
1943 lfsmake2 swig
2186f19f 1944 lfsmake2 python3-pyelftools
ce2cea17
MT
1945 lfsmake2 u-boot
1946 lfsmake2 wireless-regdb
1947 lfsmake2 ddns
1948 lfsmake2 python3-pycparser
ce2cea17
MT
1949 lfsmake2 python3-typing-extensions
1950 lfsmake2 python3-semantic-version
1951 lfsmake2 python3-setuptools-scm
1952 lfsmake2 python3-setuptools-rust
1953 lfsmake2 python3-six
1954 lfsmake2 python3-dateutil
1955 lfsmake2 python3-jmespath
1956 lfsmake2 python3-colorama
1957 lfsmake2 python3-yaml
1958 lfsmake2 python3-s3transfer
1959 lfsmake2 python3-rsa
1960 lfsmake2 python3-pyasn1
1961 lfsmake2 python3-botocore
1962 lfsmake2 python3-cffi
1963 lfsmake2 python3-cryptography
1964 lfsmake2 python3-circuitbreaker
1965 lfsmake2 python3-pytz
1966 lfsmake2 python3-click
1967 lfsmake2 python3-arrow
1968 lfsmake2 python3-terminaltables
1969 lfsmake2 python3-pkgconfig
1970 lfsmake2 python3-msgpack
1971 lfsmake2 python3-editables
1972 lfsmake2 python3-pathspec
1973 lfsmake2 python3-pluggy
1974 lfsmake2 python3-calver
1975 lfsmake2 python3-trove-classifiers
1976 lfsmake2 python3-hatchling
1977 lfsmake2 python3-hatch-vcs
1978 lfsmake2 python3-hatch-fancy-pypi-readme
1979 lfsmake2 python3-attrs
1980 lfsmake2 python3-sniffio
1981 lfsmake2 python3-sortedcontainers
1982 lfsmake2 python3-outcome
1983 lfsmake2 python3-async_generator
1984 lfsmake2 python3-flit_scm
1985 lfsmake2 python3-exceptiongroup
1986 lfsmake2 python3-trio
1987 lfsmake2 python3-pyfuse3
6cc2d2bf 1988 lfsmake2 python3-pillow
47c89384 1989 lfsmake2 python3-reportlab
ce2cea17
MT
1990 lfsmake2 aws-cli
1991 lfsmake2 oci-python-sdk
1992 lfsmake2 oci-cli
1993 lfsmake2 transmission
1994 lfsmake2 mtr
1995 lfsmake2 minidlna
1996 lfsmake2 acpid
1997 lfsmake2 fping
1998 lfsmake2 telnet
1999 lfsmake2 xinetd
2000 lfsmake2 stress
2001 lfsmake2 sarg
2002 lfsmake2 nginx
2003 lfsmake2 sysbench
2004 lfsmake2 strace
2005 lfsmake2 ltrace
2006 lfsmake2 ipfire-netboot
ce2cea17
MT
2007 lfsmake2 keepalived
2008 lfsmake2 ipvsadm
2009 lfsmake2 perl-Carp-Clan
2010 lfsmake2 perl-Date-Calc
2011 lfsmake2 perl-Date-Manip
2012 lfsmake2 perl-File-Tail
2013 lfsmake2 perl-TimeDate
2014 lfsmake2 swatch
2015 lfsmake2 tor
2016 lfsmake2 wavemon
2017 lfsmake2 iptraf-ng
2018 lfsmake2 iotop
2019 lfsmake2 stunnel
2020 lfsmake2 bacula
2021 lfsmake2 perl-Font-TTF
2022 lfsmake2 perl-IO-String
2023 lfsmake2 perl-PDF-API2
2024 lfsmake2 proxy-accounting
2025 lfsmake2 tmux
2026 lfsmake2 perl-Text-CSV_XS
2027 lfsmake2 lua
2028 lfsmake2 haproxy
2029 lfsmake2 ipset
2030 lfsmake2 dnsdist
2031 lfsmake2 bird
2032 lfsmake2 libyang
2033 lfsmake2 abseil-cpp
2034 lfsmake2 protobuf
2035 lfsmake2 protobuf-c
2036 lfsmake2 frr
2037 lfsmake2 dmidecode
2038 lfsmake2 mcelog
e45961cc 2039 lfsmake2 socat
63dbb72a 2040 lfsmake2 libtpms
e45961cc 2041 lfsmake2 swtpm
ce2cea17 2042 lfsmake2 libpciaccess
041adb61 2043 lfsmake2 ovmf
ce2cea17 2044 lfsmake2 libvirt
ce2cea17
MT
2045 lfsmake2 freeradius
2046 lfsmake2 perl-common-sense
2047 lfsmake2 perl-inotify2
2048 lfsmake2 perl-Net-IP
2049 lfsmake2 wio
2050 lfsmake2 iftop
2051 lfsmake2 mdns-repeater
2052 lfsmake2 i2c-tools
2053 lfsmake2 nss-myhostname
2054 lfsmake2 dehydrated
2055 lfsmake2 libplist
2056 lfsmake2 nqptp
2057 lfsmake2 shairport-sync
2058 lfsmake2 borgbackup
ce2cea17
MT
2059 lfsmake2 knot
2060 lfsmake2 spectre-meltdown-checker
2061 lfsmake2 zabbix_agentd
2062 lfsmake2 flashrom
2063 lfsmake2 firmware-update
2064 lfsmake2 ruby
2065 lfsmake2 asciidoctor
2066 lfsmake2 speexdsp
2067 lfsmake2 tshark
2068 lfsmake2 speedtest-cli
2069 lfsmake2 amazon-ssm-agent
2070 lfsmake2 libloc
2071 lfsmake2 ncdu
2072 lfsmake2 lshw
ce2cea17
MT
2073 lfsmake2 libcdada
2074 lfsmake2 pmacct
2075 lfsmake2 squid-asnbl
2076 lfsmake2 qemu-ga
2077 lfsmake2 gptfdisk
2078 lfsmake2 oath-toolkit
2079 lfsmake2 qrencode
2080 lfsmake2 perl-File-Remove
2081 lfsmake2 perl-Module-Build
2082 lfsmake2 perl-Module-ScanDeps
2083 lfsmake2 perl-YAML-Tiny
2084 lfsmake2 perl-Module-Install
2085 lfsmake2 perl-Imager
2086 lfsmake2 perl-Imager-QRCode
2087 lfsmake2 perl-MIME-Base32
2088 lfsmake2 perl-URI-Encode
2089 lfsmake2 rsnapshot
2090 lfsmake2 mympd
2091 lfsmake2 wsdd
2092 lfsmake2 btrfs-progs
2093 lfsmake2 inotify-tools
2094 lfsmake2 grub-btrfs
6d970496 2095 lfsmake2 fort-validator
c8540f81 2096 lfsmake2 arpwatch
620eaa5e 2097 lfsmake2 suricata-reporter
ce2cea17 2098
048d2be9
MT
2099 lfsmake2 linux
2100 lfsmake2 rtl8812au
2101 lfsmake2 linux-initrd
49714ec4 2102
ce2cea17 2103 lfsmake2 memtest
513814ab
MT
2104
2105 # Build the installer
ce2cea17 2106 lfsmake2 installer
513814ab 2107
e9fcb8c3
MT
2108 # Build images
2109 lfsmake2 cdrom
2110 lfsmake2 flash-images
36fb6a66 2111 lfsmake2 core-updates
df5e82b3
MT
2112}
2113
20e49206
MT
2114build_packages() {
2115 local LOGFILE="${LOG_DIR}/_build.packages.log"
49714ec4 2116
20e49206 2117 # Build packages
0de9b403 2118 print_headline "Building Packages"
e67a57fe 2119
20e49206
MT
2120 local path
2121 local -A pkgs=()
2122 local pkg
e67a57fe 2123
20e49206
MT
2124 # Collect all packages
2125 for path in \
2126 "${BASEDIR}/config/rootfiles/packages/"* \
2127 "${BASEDIR}/config/rootfiles/packages/${BUILD_ARCH}"/*; do
b368b190
MT
2128 # Skip directories
2129 if [ -d "${path}" ]; then
2130 continue
2131 fi
2132
20e49206
MT
2133 pkgs["${path##*/}"]="${path}"
2134 done
5596077b 2135
20e49206
MT
2136 # Package them all
2137 for pkg in ${!pkgs[@]}; do
2138 ipfiredist "${pkg}"
fe7fe395 2139 done
df5e82b3
MT
2140}
2141
6dcd1931
MT
2142# This function will re-execute a command in a new namespace
2143exec_in_namespace() {
2144 # Nothing to do if we are already in a new namespace
2145 if [ -n "${IN_NAMESPACE}" ]; then
2146 return 0
2147 fi
2148
2b81545b
MT
2149 # Forward any configuration
2150 local args=(
2151 "--target=${BUILD_ARCH}"
2152 )
2153
6dcd1931
MT
2154 IN_NAMESPACE=1 \
2155 exec unshare \
2156 --mount \
2b4d457c 2157 --propagation=private \
2b81545b 2158 "${0}" "${args[@]}" "$@"
6dcd1931
MT
2159}
2160
5be3501e
MT
2161check_for_missing_rootfiles() {
2162 print_headline "Checking for missing rootfiles..."
deb95014
MT
2163
2164 local file
2165 for file in ${LOG_DIR}/*_missing_rootfile; do
60b5c6c2
MT
2166 [ -e "${file}" ] || continue
2167
deb95014
MT
2168 file="${file##*/}"
2169 file="${file/_missing_rootfile/}";
2170
2171 print_line "${file} is missing a rootfile"
2172 print_status FAIL
2173 done
2174
2175 return 0
2176}
2177
5be3501e
MT
2178check_rootfiles_for_arch() {
2179 local arch="${1}"
2180
2181 local args=(
2182 # Search path
2183 "${BASEDIR}/config/rootfiles"
2184
2185 # Exclude old core updates
2186 "--exclude-dir" "oldcore"
2187
2188 # Ignore the update scripts
2189 "--exclude" "update.sh"
2190 )
2191
2192 # A list of files that are not scanned
2193 # because they probably cause some false positives.
2194 local excluded_files=(
a23189d2
AF
2195 abseil-cpp
2196 cmake
2197 gdb
2198 liburcu
041adb61 2199 ovmf
5be3501e 2200 qemu
a23189d2
AF
2201 rust-memchr
2202 rust-libc
2203 rust-ppv-lite86
2204 xfsprogs
5be3501e
MT
2205 )
2206
2207 # Exclude any architecture-specific directories
2208 local a
2209 for a in ${ARCHES[@]}; do
2210 args+=( "--exclude-dir" "${a}" )
2211 done
2212
2213 # Exclude all excluded files
2214 local x
2215 for x in ${excluded_files[@]}; do
2216 args+=( "--exclude" "${x}" )
2217 done
2218
a23189d2 2219 # Search for all files that contain the architecture
32ec5667 2220 local files=(
a23189d2 2221 $(grep --files-with-matches -r "^.*${arch}" "${args[@]}")
32ec5667 2222 )
5be3501e 2223
32ec5667
MT
2224 local file
2225 for file in ${files[@]}; do
2226 print_line "${file} contains ${arch}"
2227 print_status FAIL
2228 done
2229
2230 return "${#files[@]}"
5be3501e
MT
2231}
2232
2233check_rootfiles_for_pattern() {
2234 local pattern="${1}"
2235 local message="${2}"
2236
2237 local args=(
2238 # Search path
2239 "${BASEDIR}/config/rootfiles"
2240
2241 # Exclude old core updates
2242 "--exclude-dir" "oldcore"
2243
2244 # Ignore the update scripts
2245 "--exclude" "update.sh"
2246 )
2247
2248 if grep -r "${pattern}" "${args[@]}"; then
2249 if [ -n "${message}" ]; then
2250 print_line "${message}"
2251 print_status FAIL
2252 else
2253 print_file "Files matching '${pattern}' have been found in the rootfiles"
2254 print_status FAIL
2255 fi
2256 return 1
2257 fi
2258
2259 return 0
2260}
2261
2262check_rootfiles() {
2263 local failed=0
2264
2265 print_headline "Checking for rootfile consistency..."
2266
aab8f48a
MT
2267 # Check for changes
2268 if ! check_rootfiles_for_pattern "^[\+\-]" \
2269 "Rootfiles have changed in them"; then
2270 failed=1
2271 fi
2272
5be3501e
MT
2273 # Check for /etc/init.d
2274 if ! check_rootfiles_for_pattern "^etc/init\.d/" \
2275 "/etc/init.d/* has been found. Please replace by /etc/rc.d/init.d"; then
2276 failed=1
2277 fi
2278
2279 # Check for /var/run
2280 if ! check_rootfiles_for_pattern "^var/run/.*" \
2281 "You cannot ship files in /var/run as it is a ramdisk"; then
2282 failed=1
2283 fi
2284
2285 # Check architectures
2286 local arch
2287 for arch in ${ARCHES[@]}; do
2288 check_rootfiles_for_arch "${arch}" || failed=$?
2289 done
2290
2291 # Return the error
2292 return ${failed}
2293}
2294
40571258
MT
2295check_changed_rootfiles() {
2296 local files=(
2297 $(grep --files-with-matches -r "^+" "${LOG_DIR}" --exclude="_*" | sort)
2298 )
2299
2300 # If we have no matches, there is nothing to do
2301 [ "${#files[@]}" -eq 0 ] && return 0
2302
2303 print_line "Packages have created new files"
2304 print_status WARN
2305
2306 local file
2307 for file in ${files[@]}; do
2308 print_line " ${file##*/}"
2309 print_status WARN
2310 done
2311
2312 return 0
2313}
2314
510dd732
MT
2315# Set BASEDIR
2316readonly BASEDIR="$(find_base)"
8eeaf1ab 2317
8eeaf1ab
MT
2318# Get some information about the host system
2319SYSTEM_PROCESSORS="$(system_processors)"
2320SYSTEM_MEMORY="$(system_memory)"
2321
2322# Default settings
27d0a2c4 2323BUILD_ARCH="${HOST_ARCH}"
8eeaf1ab 2324CCACHE_CACHE_SIZE="4G"
8eeaf1ab
MT
2325
2326# Load configuration file
2327if [ -f .config ]; then
2328 source .config
2329fi
2330
8eeaf1ab 2331# Parse any command line options (not commands)
bcb9dc13
MT
2332while [ $# -gt 0 ]; do
2333 case "${1}" in
2334 --target=*)
8eeaf1ab 2335 BUILD_ARCH="${1#--target=}"
bcb9dc13 2336 ;;
8eeaf1ab 2337
bcb9dc13
MT
2338 -*)
2339 exiterror "Unknown configuration option: ${1}"
2340 ;;
8eeaf1ab
MT
2341
2342 # Found a command, so exit options parsing
bcb9dc13 2343 *)
bcb9dc13
MT
2344 break
2345 ;;
2346 esac
2347 shift
2348done
2349
27d0a2c4
MT
2350# Check the architecture
2351case "${BUILD_ARCH}" in
2352 aarch64|x86_64|riscv64)
2353 ;;
2354
2355 *)
2356 exiterror "Unsupported architecture: ${BUILD_ARCH}"
2357 ;;
2358esac
2359
2360# Set build platform
2361case "${BUILD_ARCH}" in
2362 aarch64)
2363 BUILD_PLATFORM="arm"
2364 ;;
2365
2366 riscv64)
2367 BUILD_PLATFORM="riscv"
2368 ;;
2369
2370 x86_64)
2371 BUILD_PLATFORM="x86"
2372 ;;
2373esac
2374
2375# Configure the C compiler
2376CFLAGS=(
2377 # Optimize the code
2378 "-O2"
2379
2380 # Do not compile in any debugging information
2381 "-g0"
2382
2383 # Do not write temporary files
2384 "-pipe"
2385
2386 # Enable all warnings
2387 "-Wall"
2388
2389 # Enable exceptions
2390 "-fexceptions"
2391
2392 # Compile place-independent code
2393 "-fPIC"
2394
2395 # Fortify Source
2396 "-Wp,-U_FORTIFY_SOURCE"
2397 "-Wp,-D_FORTIFY_SOURCE=3"
2398
2399 # Enable additional checks for C++ in glibc
2400 "-Wp,-D_GLIBCXX_ASSERTIONS"
2401
2402 # Enable stack smashing protection
2403 "-fstack-protector-strong"
2404
2405 # Enable stack clash protection
2406 "-fstack-clash-protection"
2407)
2408
2409# Architecture-dependent compiler flags
2410case "${BUILD_ARCH}" in
2411 aarch64)
2412 CFLAGS+=(
2413 "-mbranch-protection=standard"
2414 )
2415 ;;
2416
2417 x86_64)
2418 CFLAGS+=(
2419 "-m64" "-mtune=generic" "-fcf-protection=full"
2420 )
2421 ;;
2422esac
2423
2424# Configure the Rust compiler
2425RUSTFLAGS=(
2426 "-Copt-level=3"
2427 "-Clink-arg=-Wl,-z,relro,-z,now"
2428 "-Ccodegen-units=1"
2429 "--cap-lints=warn"
2430)
2431
2432# Configure the compiler tuple
2433CROSSTARGET="${BUILD_ARCH}-cross-linux-gnu"
2434BUILDTARGET="${BUILD_ARCH}-pc-linux-gnu"
2435
2436# Use this as default PARALLELISM
2437DEFAULT_PARALLELISM="${SYSTEM_PROCESSORS}"
2438
2439# Limit lauched ninja build jobs to computed parallel value
2440NINJAJOBS="${DEFAULT_PARALLELISM}"
2441
2442# Configure XZ
2443XZ_OPT=(
2444 "-T0" "-8"
2445)
2446
2447# Configure Zstandard
2448ZSTD_OPT=(
64192acb 2449 "-T0" "-19" "--long"
27d0a2c4 2450)
8eeaf1ab
MT
2451
2452# Set directories
38b4f088 2453readonly CACHE_DIR="${BASEDIR}/cache"
baf15b60 2454readonly TOOLCHAIN_DIR="${CACHE_DIR}/toolchains"
8eeaf1ab 2455readonly CCACHE_DIR="${BASEDIR}/ccache/${BUILD_ARCH}/${TOOLCHAINVER}"
38b4f088 2456readonly BUILD_DIR="${BASEDIR}/build_${BUILD_ARCH}"
68fea175 2457readonly IMAGES_DIR="${BASEDIR}/images_${BUILD_ARCH}"
38b4f088 2458readonly LOG_DIR="${BASEDIR}/log_${BUILD_ARCH}"
20e49206 2459readonly PACKAGES_DIR="${IMAGES_DIR}/packages"
38b4f088 2460readonly TOOLS_DIR="/tools_${BUILD_ARCH}"
49714ec4 2461
baf15b60 2462# Set URLs
97732901 2463readonly SOURCE_URL="https://source.ipfire.org/ipfire-2.x"
baf15b60
MT
2464readonly TOOLCHAIN_URL="https://source.ipfire.org/toolchains"
2465
49714ec4
MT
2466# Set the LOGFILE
2467LOGFILE="${LOG_DIR}/_build.preparation.log"
2468
e2e0d087
MT
2469# Ensure that some basic directories exist
2470mkdir -p "${CACHE_DIR}" "${LOG_DIR}"
8eeaf1ab 2471
baf15b60
MT
2472# Toolchain Archive
2473readonly TOOLCHAIN="${SNAME}-${VERSION}-toolchain-${TOOLCHAINVER}-${BUILD_ARCH}.tar.zst"
cf4652d6 2474
df5e82b3 2475# See what we're supposed to do
2f8ae1c2 2476case "$1" in
df5e82b3 2477build)
3080500d 2478 START_TIME="${SECONDS}"
f9783277 2479
6dcd1931
MT
2480 # Launch in a new namespace
2481 exec_in_namespace "$@"
2482
cf4652d6 2483 # Prepare the environment
a54da991 2484 prepareenv --required-space=8192
cf4652d6
MT
2485
2486 # Check if the toolchain is available
2487 if [ ! -e "${BUILD_DIR}${TOOLS_DIR}/.toolchain-successful" ]; then
2488 # If we have the toolchain available, we extract it into the build environment
baf15b60 2489 if [ -r "${TOOLCHAIN_DIR}/${TOOLCHAIN}" ]; then
0de9b403 2490 print_headline "Packaged toolchain compilation"
cf4652d6
MT
2491
2492 # Extract the toolchain
2493 if ! extract_toolchain "${TOOLCHAIN}"; then
2494 exiterror "Failed extracting the toolchain"
df5e82b3 2495 fi
cf4652d6
MT
2496
2497 # Otherwise perform a full toolchain compilation
2498 else
0de9b403 2499 print_headline "Full toolchain compilation"
3db20d6f 2500 build_toolchain
df5e82b3 2501 fi
df5e82b3 2502 fi
5cfe86e6 2503
0de9b403 2504 print_headline "Building ${NAME}"
513814ab 2505 build_system
15679d9f 2506
20e49206
MT
2507 # Build all packages
2508 build_packages
2f8ae1c2 2509
5be3501e
MT
2510 # Check for missing rootfiles
2511 check_for_missing_rootfiles
deb95014 2512
5be3501e
MT
2513 # Check for rootfile consistency
2514 if ! check_rootfiles; then
2515 exiterror "Rootfiles are inconsistent"
2516 fi
a23731d1 2517
40571258
MT
2518 check_changed_rootfiles
2519
3080500d 2520 print_build_summary $(( SECONDS - START_TIME ))
df5e82b3 2521 ;;
90e50883
MT
2522tail)
2523 tail -F \
abbcbd1a 2524 "${LOG_DIR}/_build.preparation.log" \
90e50883
MT
2525 "${LOG_DIR}/_build.toolchain.log" \
2526 "${LOG_DIR}/_build.${SNAME}.log" \
2527 "${LOG_DIR}/_build.packages.log" 2>/dev/null
2528 ;;
df5e82b3 2529shell)
6dcd1931
MT
2530 # Launch in a new namespace
2531 exec_in_namespace "$@"
2532
df5e82b3
MT
2533 # enter a shell inside LFS chroot
2534 # may be used to changed kernel settings
dae1ac41 2535 prepareenv --network
df5e82b3
MT
2536 entershell
2537 ;;
40571258 2538check)
a23189d2
AF
2539 # Check for rootfile consistency
2540 if ! check_rootfiles; then
2541 exiterror "Rootfiles are inconsistent"
2542 fi
2543
40571258
MT
2544 check_changed_rootfiles
2545 ;;
df5e82b3 2546clean)
f9783277
MT
2547 print_line "Cleaning build directory..."
2548
711a047b
MT
2549 # Cleanup build files
2550 rm -rf \
2551 "${BUILD_DIR}" \
ecacbaac 2552 "${IMAGES_DIR}" \
711a047b
MT
2553 "${LOG_DIR}"
2554
2555 # Remove the /tools symlink
6c4cc7ea
MT
2556 if [ -h "${TOOLS_DIR}" ]; then
2557 rm -f "${TOOLS_DIR}"
df5e82b3 2558 fi
711a047b 2559
f9783277 2560 print_status DONE
df5e82b3 2561 ;;
c3db995c 2562downloadsrc)
e2e0d087
MT
2563 # Tell the user what we are about to do
2564 print_headline "Pre-loading all source files"
2565
2566 # Download all sources
cf4b9118 2567 download_sources
df5e82b3 2568 ;;
df5e82b3 2569toolchain)
6dcd1931
MT
2570 # Launch in a new namespace
2571 exec_in_namespace "$@"
2572
3db20d6f 2573 # Prepare the environment
df5e82b3 2574 prepareenv
3db20d6f 2575
0de9b403 2576 print_headline "Toolchain compilation (${BUILD_ARCH})"
3db20d6f
MT
2577
2578 # Build the toolchain
2579 build_toolchain
2580
2581 # Ensure the toolchain directory exists
2582 mkdir -p "${TOOLCHAIN_DIR}"
2583
2584 # Compress the toolchain
2585 if ! compress_toolchain "${TOOLCHAIN}"; then
2586 exiterror "Could not compress toolchain"
2587 fi
df5e82b3 2588 ;;
3db20d6f 2589
df5e82b3 2590gettoolchain)
baf15b60 2591 download_toolchain "${TOOLCHAIN}"
df5e82b3 2592 ;;
15679d9f 2593uploadsrc)
97732901
MT
2594 # Check if IPFIRE_USER is set
2595 if [ -z "${IPFIRE_USER}" ]; then
2596 exiterror "You have to setup IPFIRE_USER first. See .config for details."
661d9388 2597 fi
ae23a606 2598
97732901 2599 # Sync with upstream
dbd455ef
MT
2600 rsync \
2601 --recursive \
2602 --update \
2603 --ignore-existing \
2604 --progress \
2605 --human-readable \
2606 --exclude="toolchains/" \
97732901
MT
2607 "${CACHE_DIR}/" \
2608 "${IPFIRE_USER}@people.ipfire.org:/pub/sources/source-2.x"
661d9388 2609
15679d9f 2610 exit 0
0eab8e84 2611 ;;
bf7c473f 2612lang)
69a6ec55
MT
2613 echo -ne "Checking the translations for missing or obsolete strings..."
2614 chmod 755 $BASEDIR/tools/{check_strings.pl,sort_strings.pl,check_langs.sh}
2615 $BASEDIR/tools/sort_strings.pl en
2616 $BASEDIR/tools/sort_strings.pl de
2617 $BASEDIR/tools/sort_strings.pl fr
2618 $BASEDIR/tools/sort_strings.pl es
2619 $BASEDIR/tools/sort_strings.pl pl
2620 $BASEDIR/tools/sort_strings.pl ru
2621 $BASEDIR/tools/sort_strings.pl nl
2622 $BASEDIR/tools/sort_strings.pl tr
2623 $BASEDIR/tools/sort_strings.pl it
207e59c1
MT
2624 $BASEDIR/tools/sort_strings.pl tw
2625 $BASEDIR/tools/sort_strings.pl zh
69a6ec55
MT
2626 $BASEDIR/tools/check_strings.pl en > $BASEDIR/doc/language_issues.en
2627 $BASEDIR/tools/check_strings.pl de > $BASEDIR/doc/language_issues.de
2628 $BASEDIR/tools/check_strings.pl fr > $BASEDIR/doc/language_issues.fr
2629 $BASEDIR/tools/check_strings.pl es > $BASEDIR/doc/language_issues.es
72c8478e 2630 $BASEDIR/tools/check_strings.pl pl > $BASEDIR/doc/language_issues.pl
69a6ec55
MT
2631 $BASEDIR/tools/check_strings.pl ru > $BASEDIR/doc/language_issues.ru
2632 $BASEDIR/tools/check_strings.pl nl > $BASEDIR/doc/language_issues.nl
2633 $BASEDIR/tools/check_strings.pl tr > $BASEDIR/doc/language_issues.tr
2634 $BASEDIR/tools/check_strings.pl it > $BASEDIR/doc/language_issues.it
207e59c1
MT
2635 $BASEDIR/tools/check_strings.pl tw > $BASEDIR/doc/language_issues.tw
2636 $BASEDIR/tools/check_strings.pl zh > $BASEDIR/doc/language_issues.zh
69a6ec55 2637 $BASEDIR/tools/check_langs.sh > $BASEDIR/doc/language_missings
f9783277 2638 print_status DONE
69a6ec55
MT
2639
2640 echo -ne "Updating language lists..."
2641 update_language_list ${BASEDIR}/src/installer/po
2642 update_language_list ${BASEDIR}/src/setup/po
f9783277 2643 print_status DONE
bf7c473f 2644 ;;
1fb7f56e
MT
2645update-contributors)
2646 update_contributors
2647 ;;
ba137dd8
MT
2648find-dependencies)
2649 shift
3e071939 2650 exec "${BASEDIR}/tools/find-dependencies" "${BUILD_DIR}" "$@"
ba137dd8 2651 ;;
4edcd4b2
LAH
2652check-manualpages)
2653 echo "Checking the manual pages for broken links..."
2f8ae1c2 2654
4edcd4b2
LAH
2655 chmod 755 $BASEDIR/tools/check_manualpages.pl
2656 if $BASEDIR/tools/check_manualpages.pl; then
2657 print_status DONE
2658 else
2659 print_status FAIL
2660 fi
2661 ;;
9d9c7cef
MT
2662__timer)
2663 __timer "${2}" || exit $?
2664 ;;
6b8cff41 2665*)
90e50883 2666 echo "Usage: $0 [OPTIONS] {build|check-manualpages|clean|downloadsrc|find-dependencies|gettoolchain|lang|shell|tail|toolchain|update-contributors|uploadsrc}"
6b8cff41
MT
2667 cat doc/make.sh-usage
2668 ;;
3ea75603 2669esac