]> git.ipfire.org Git - ipfire-2.x.git/blame - make.sh
glibc: Test toolchain after build
[ipfire-2.x.git] / make.sh
CommitLineData
df5e82b3 1#!/bin/bash
df5e82b3
MT
2############################################################################
3# #
f8e5510c 4# This file is part of the IPFire Firewall. #
df5e82b3 5# #
f8e5510c 6# IPFire is free software; you can redistribute it and/or modify #
df5e82b3
MT
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# #
f8e5510c 11# IPFire is distributed in the hope that it will be useful, #
df5e82b3
MT
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 #
f8e5510c 17# along with IPFire; if not, write to the Free Software #
df5e82b3
MT
18# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
19# #
f7a48dd3 20# Copyright (C) 2007-2017 IPFire Team <info@ipfire.org>. #
df5e82b3
MT
21# #
22############################################################################
df5e82b3
MT
23#
24
e8ee3199
AF
25NAME="IPFire" # Software name
26SNAME="ipfire" # Short name
33513817 27VERSION="2.19" # Version number
63de1e48 28CORE="110" # Core Level (Filename)
7ea716b4 29PAKFIRE_CORE="110" # Core Level (PAKFIRE)
595e89a8 30GIT_BRANCH=`git rev-parse --abbrev-ref HEAD` # Git Branch
e8ee3199
AF
31SLOGAN="www.ipfire.org" # Software slogan
32CONFIG_ROOT=/var/ipfire # Configuration rootdir
33NICE=10 # Nice level
34MAX_RETRIES=1 # prefetch/check loop
305a7b38 35BUILD_IMAGES=1 # Flash and Xen Downloader
15679d9f 36KVER=`grep --max-count=1 VER lfs/linux | awk '{ print $3 }'`
e8ee3199
AF
37GIT_TAG=$(git tag | tail -1) # Git Tag
38GIT_LASTCOMMIT=$(git log | head -n1 | cut -d" " -f2 |head -c8) # Last commit
363e358f 39TOOLCHAINVER=12
03ad5f93 40
bcb9dc13 41# New architecture variables
dc7d6b20 42HOST_ARCH="$(uname -m)"
94571564 43
15679d9f
MT
44# Debian specific settings
45if [ ! -e /etc/debian_version ]; then
df5e82b3 46 FULLPATH=`which $0`
15679d9f 47else
df5e82b3
MT
48 if [ -x /usr/bin/realpath ]; then
49 FULLPATH=`/usr/bin/realpath $0`
50 else
51 echo "ERROR: Need to do apt-get install realpath"
52 exit 1
53 fi
15679d9f 54fi
df5e82b3 55
15679d9f
MT
56PWD=`pwd`
57BASENAME=`basename $0`
58BASEDIR=`echo $FULLPATH | sed "s/\/$BASENAME//g"`
59LOGFILE=$BASEDIR/log/_build.preparation.log
60export BASEDIR LOGFILE
61DIR_CHK=$BASEDIR/cache/check
62mkdir $BASEDIR/log/ 2>/dev/null
df5e82b3 63
15679d9f
MT
64# Include funtions
65. tools/make-functions
df5e82b3 66
15679d9f
MT
67if [ -f .config ]; then
68 . .config
15679d9f 69fi
df5e82b3 70
dc7d6b20
MT
71if [ -n "${BUILD_ARCH}" ]; then
72 configure_build "${BUILD_ARCH}"
73elif [ -n "${TARGET_ARCH}" ]; then
74 configure_build "${TARGET_ARCH}"
75 unset TARGET_ARCH
949544f5 76else
dc7d6b20 77 configure_build "default"
949544f5
MT
78fi
79
483b7768
MT
80if [ -z $EDITOR ]; then
81 for i in nano emacs vi; do
82 EDITOR=$(which $i 2>/dev/null)
83 if ! [ -z $EDITOR ]; then
84 export EDITOR=$EDITOR
85 break
86 fi
87 done
88 [ -z $EDITOR ] && exiterror "You should have installed an editor."
89fi
90
d02853e7 91
df5e82b3
MT
92prepareenv() {
93 ############################################################################
94 # #
95 # Are we running the right shell? #
96 # #
97 ############################################################################
98 if [ ! "$BASH" ]; then
1b273e8f 99 exiterror "BASH environment variable is not set. You're probably running the wrong shell."
df5e82b3
MT
100 fi
101
102 if [ -z "${BASH_VERSION}" ]; then
1b273e8f 103 exiterror "Not running BASH shell."
df5e82b3
MT
104 fi
105
106
107 ############################################################################
108 # #
109 # Trap on emergency exit #
110 # #
111 ############################################################################
112 trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGKILL SIGSTOP SIGQUIT
113
114
115 ############################################################################
116 # #
117 # Resetting our nice level #
118 # #
119 ############################################################################
9b0ff0a0 120 echo -ne "Resetting our nice level to $NICE" | tee -a $LOGFILE
df5e82b3
MT
121 renice $NICE $$ > /dev/null
122 if [ `nice` != "$NICE" ]; then
1b273e8f
MT
123 beautify message FAIL
124 exiterror "Failed to set correct nice level"
15679d9f 125 else
1b273e8f 126 beautify message DONE
df5e82b3
MT
127 fi
128
15679d9f 129
df5e82b3
MT
130 ############################################################################
131 # #
132 # Checking if running as root user #
133 # #
134 ############################################################################
9b0ff0a0 135 echo -ne "Checking if we're running as root user" | tee -a $LOGFILE
df5e82b3 136 if [ `id -u` != 0 ]; then
1b273e8f
MT
137 beautify message FAIL
138 exiterror "Not building as root"
15679d9f 139 else
1b273e8f 140 beautify message DONE
df5e82b3
MT
141 fi
142
143
144 ############################################################################
145 # #
146 # Checking for necessary temporary space #
147 # #
148 ############################################################################
9b0ff0a0 149 echo -ne "Checking for necessary space on disk $BASE_DEV" | tee -a $LOGFILE
df5e82b3
MT
150 BASE_DEV=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $1 }'`
151 BASE_ASPACE=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $4 }'`
41921bd9 152 if (( 2048000 > $BASE_ASPACE )); then
1b273e8f
MT
153 BASE_USPACE=`du -skx $BASEDIR | awk '{print $1}'`
154 if (( 2048000 - $BASE_USPACE > $BASE_ASPACE )); then
155 beautify message FAIL
156 exiterror "Not enough temporary space available, need at least 2GB on $BASE_DEV"
157 fi
15679d9f 158 else
1b273e8f 159 beautify message DONE
df5e82b3
MT
160 fi
161
162 ############################################################################
163 # #
164 # Building Linux From Scratch system #
165 # #
166 ############################################################################
df5e82b3
MT
167 # Set umask
168 umask 022
169
170 # Set LFS Directory
171 LFS=$BASEDIR/build
172
173 # Check /tools symlink
174 if [ -h /tools ]; then
175 rm -f /tools
176 fi
177 if [ ! -a /tools ]; then
1b273e8f 178 ln -s $BASEDIR/build/tools /
df5e82b3
MT
179 fi
180 if [ ! -h /tools ]; then
1b273e8f 181 exiterror "Could not create /tools symbolic link."
df5e82b3
MT
182 fi
183
184 # Setup environment
185 set +h
186 LC_ALL=POSIX
e4e74858 187 if [ -z $MAKETUNING ]; then
26b34186
MT
188 CPU_COUNT="$(getconf _NPROCESSORS_ONLN 2>/dev/null)"
189 if [ -z "${CPU_COUNT}" ]; then
190 CPU_COUNT=1
191 fi
192
193 MAKETUNING="-j$(( ${CPU_COUNT} * 2 + 1 ))"
e4e74858 194 fi
dd714b8a 195 export LFS LC_ALL CFLAGS CXXFLAGS MAKETUNING
df5e82b3
MT
196 unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
197
198 # Make some extra directories
199 mkdir -p $BASEDIR/build/{tools,etc,usr/src} 2>/dev/null
90d372c4 200 mkdir -p $BASEDIR/build/{dev/{shm,pts},proc,sys}
df5e82b3 201 mkdir -p $BASEDIR/{cache,ccache} 2>/dev/null
90d372c4
MT
202 mkdir -p $BASEDIR/build/usr/src/{cache,config,doc,html,langs,lfs,log,src,ccache}
203
204 mknod -m 600 $BASEDIR/build/dev/console c 5 1 2>/dev/null
205 mknod -m 666 $BASEDIR/build/dev/null c 1 3 2>/dev/null
df5e82b3
MT
206
207 # Make all sources and proc available under lfs build
90d372c4 208 mount --bind /dev $BASEDIR/build/dev
857d9bf2
MT
209 mount --bind /dev/pts $BASEDIR/build/dev/pts
210 mount --bind /dev/shm $BASEDIR/build/dev/shm
211 mount --bind /proc $BASEDIR/build/proc
212 mount --bind /sys $BASEDIR/build/sys
df5e82b3
MT
213 mount --bind $BASEDIR/cache $BASEDIR/build/usr/src/cache
214 mount --bind $BASEDIR/ccache $BASEDIR/build/usr/src/ccache
215 mount --bind $BASEDIR/config $BASEDIR/build/usr/src/config
216 mount --bind $BASEDIR/doc $BASEDIR/build/usr/src/doc
217 mount --bind $BASEDIR/html $BASEDIR/build/usr/src/html
218 mount --bind $BASEDIR/langs $BASEDIR/build/usr/src/langs
219 mount --bind $BASEDIR/lfs $BASEDIR/build/usr/src/lfs
220 mount --bind $BASEDIR/log $BASEDIR/build/usr/src/log
221 mount --bind $BASEDIR/src $BASEDIR/build/usr/src/src
222
223 # Run LFS static binary creation scripts one by one
224 export CCACHE_DIR=$BASEDIR/ccache
36d351ff 225 export CCACHE_COMPRESS=1
dc7d6b20 226 export CCACHE_COMPILERCHECK="string:toolchain-${TOOLCHAINVER} ${BUILD_ARCH}"
df5e82b3
MT
227
228 # Remove pre-install list of installed files in case user erase some files before rebuild
229 rm -f $BASEDIR/build/usr/src/lsalr 2>/dev/null
7f69895c
AF
230
231 # Prepare string for /etc/system-release.
dc7d6b20 232 SYSTEM_RELEASE="${NAME} ${VERSION} (${BUILD_ARCH})"
7f69895c
AF
233 if [ "$(git status -s | wc -l)" == "0" ]; then
234 GIT_STATUS=""
235 else
236 GIT_STATUS="-dirty"
237 fi
238 case "$GIT_BRANCH" in
239 core*|beta?|rc?)
240 SYSTEM_RELEASE="${SYSTEM_RELEASE} - $GIT_BRANCH$GIT_STATUS"
241 ;;
242 *)
243 SYSTEM_RELEASE="${SYSTEM_RELEASE} - Development Build: $GIT_BRANCH/$GIT_LASTCOMMIT$GIT_STATUS"
244 ;;
245 esac
df5e82b3
MT
246}
247
df5e82b3 248buildtoolchain() {
f13d4e0b 249 local error=false
dc7d6b20 250 case "${BUILD_ARCH}:${HOST_ARCH}" in
fc155193
MT
251 # x86_64
252 x86_64:x86_64)
253 # This is working.
254 ;;
255
f13d4e0b 256 # x86
8399842e 257 i586:i586|i586:i686|i586:x86_64)
f13d4e0b
MT
258 # These are working.
259 ;;
260 i586:*)
261 error=true
262 ;;
263
264 # ARM
4162dbae
MT
265 arvm7hl:armv7hl|armv7hl:armv7l)
266 # These are working.
267 ;;
268
b5548cbb 269 armv5tel:armv5tel|armv5tel:armv5tejl|armv5tel:armv6l|armv5tel:armv7l|armv5tel:aarch64)
f13d4e0b
MT
270 # These are working.
271 ;;
272 armv5tel:*)
273 error=true
274 ;;
275 esac
276
277 ${error} && \
dc7d6b20 278 exiterror "Cannot build ${BUILD_ARCH} toolchain on $(uname -m). Please use the download if any."
f13d4e0b 279
8399842e
MT
280 local gcc=$(type -p gcc)
281 if [ -z "${gcc}" ]; then
282 exiterror "Could not find GCC. You will need a working build enviroment in order to build the toolchain."
6c9d6fcc
AF
283 fi
284
df5e82b3
MT
285 LOGFILE="$BASEDIR/log/_build.toolchain.log"
286 export LOGFILE
40e38688 287
b7093f17 288 lfsmake1 stage1
40e38688
MT
289 lfsmake1 ccache PASS=1
290 lfsmake1 binutils PASS=1
291 lfsmake1 gcc PASS=1
991d11d7 292 lfsmake1 linux KCFG="-headers"
dd714b8a 293 lfsmake1 glibc
764a3f1f 294 lfsmake1 gcc PASS=L
40e38688
MT
295 lfsmake1 binutils PASS=2
296 lfsmake1 gcc PASS=2
40e38688 297 lfsmake1 ccache PASS=2
df5e82b3
MT
298 lfsmake1 tcl
299 lfsmake1 expect
df5e82b3 300 lfsmake1 dejagnu
ec149ba0 301 lfsmake1 pkg-config
dd714b8a
MT
302 lfsmake1 ncurses
303 lfsmake1 bash
df5e82b3 304 lfsmake1 bzip2
b48a6c97 305 lfsmake1 automake
dd714b8a 306 lfsmake1 coreutils
df5e82b3
MT
307 lfsmake1 diffutils
308 lfsmake1 findutils
dd714b8a 309 lfsmake1 gawk
df5e82b3 310 lfsmake1 gettext
dd714b8a
MT
311 lfsmake1 grep
312 lfsmake1 gzip
313 lfsmake1 m4
40e38688 314 lfsmake1 make
df5e82b3 315 lfsmake1 patch
dd714b8a
MT
316 lfsmake1 perl
317 lfsmake1 sed
df5e82b3
MT
318 lfsmake1 tar
319 lfsmake1 texinfo
31e94846 320 lfsmake1 xz
997736b7 321 lfsmake1 fake-environ
174498ef 322 lfsmake1 cleanup-toolchain
df5e82b3
MT
323}
324
325buildbase() {
326 LOGFILE="$BASEDIR/log/_build.base.log"
327 export LOGFILE
df5e82b3 328 lfsmake2 stage2
cc24c14b 329 lfsmake2 linux KCFG="-headers"
df5e82b3
MT
330 lfsmake2 man-pages
331 lfsmake2 glibc
f7623512 332 lfsmake2 tzdata
174498ef 333 lfsmake2 cleanup-toolchain
28d70963 334 lfsmake2 zlib
df5e82b3 335 lfsmake2 binutils
28d70963
MT
336 lfsmake2 gmp
337 lfsmake2 gmp-compat
338 lfsmake2 mpfr
bdfd41c4 339 lfsmake2 libmpc
28d70963 340 lfsmake2 file
df5e82b3 341 lfsmake2 gcc
28d70963 342 lfsmake2 sed
9b0ff0a0 343 lfsmake2 berkeley
7cf3a80b
ML
344 lfsmake2 autoconf
345 lfsmake2 automake
df5e82b3 346 lfsmake2 coreutils
df5e82b3 347 lfsmake2 iana-etc
df5e82b3
MT
348 lfsmake2 m4
349 lfsmake2 bison
ec149ba0 350 lfsmake2 ncurses-compat
9b0ff0a0
MT
351 lfsmake2 ncurses
352 lfsmake2 procps
9b0ff0a0 353 lfsmake2 libtool
df5e82b3 354 lfsmake2 perl
9b0ff0a0 355 lfsmake2 readline
f19b3cb6 356 lfsmake2 readline-compat
eb03f017 357 lfsmake2 bzip2
542244b3
MT
358 lfsmake2 pcre
359 lfsmake2 pcre-compat
df5e82b3 360 lfsmake2 bash
df5e82b3 361 lfsmake2 diffutils
df5e82b3 362 lfsmake2 e2fsprogs
65998e0a 363 lfsmake2 ed
9b0ff0a0
MT
364 lfsmake2 findutils
365 lfsmake2 flex
9b0ff0a0
MT
366 lfsmake2 gawk
367 lfsmake2 gettext
368 lfsmake2 grep
369 lfsmake2 groff
d1347595 370 lfsmake2 gperf
df5e82b3 371 lfsmake2 gzip
f4e9a251 372 lfsmake2 hostname
9b0ff0a0 373 lfsmake2 iproute2
c5e5324c 374 lfsmake2 jwhois
9b0ff0a0
MT
375 lfsmake2 kbd
376 lfsmake2 less
df5e82b3 377 lfsmake2 make
9b0ff0a0 378 lfsmake2 man
ba109afd 379 lfsmake2 kmod
65998e0a 380 lfsmake2 net-tools
df5e82b3 381 lfsmake2 patch
df5e82b3
MT
382 lfsmake2 psmisc
383 lfsmake2 shadow
384 lfsmake2 sysklogd
385 lfsmake2 sysvinit
386 lfsmake2 tar
90d372c4 387 lfsmake2 texinfo
df5e82b3 388 lfsmake2 util-linux
1ee33dda 389 lfsmake2 udev
90d372c4 390 lfsmake2 vim
31e94846 391 lfsmake2 xz
19ba0366 392 lfsmake2 paxctl
df5e82b3
MT
393}
394
15679d9f 395buildipfire() {
907cd036 396 LOGFILE="$BASEDIR/log/_build.ipfire.log"
df5e82b3 397 export LOGFILE
15679d9f 398 ipfiremake configroot
ad898e7f 399 ipfiremake initscripts
dc8b9670 400 ipfiremake backup
b8e0573b 401 ipfiremake pkg-config
15679d9f 402 ipfiremake libusb
5d4c1d20 403 ipfiremake libusb-compat
15679d9f 404 ipfiremake libpcap
15679d9f 405 ipfiremake ppp
a456f23e 406 ipfiremake pptp
15679d9f 407 ipfiremake unzip
2b2e03ed 408 ipfiremake which
443aece5 409 ipfiremake linux-firmware
ee1148d1 410 ipfiremake ath10k-firmware
beecbb59 411 ipfiremake dvb-firmwares
d731b1f9 412 ipfiremake mt7601u-firmware
162d2e2f 413 ipfiremake zd1211-firmware
9007007b 414 ipfiremake rpi-firmware
bb5f0bf8 415 ipfiremake bc
ddc492dd 416 ipfiremake u-boot
4db4aeee 417 ipfiremake cpio
9f572d66 418 ipfiremake mdadm
4db4aeee 419 ipfiremake dracut
da45819d
MT
420 ipfiremake lvm2
421 ipfiremake multipath-tools
ed8977a1 422 ipfiremake freetype
da45819d 423 ipfiremake grub
b8e0573b 424 ipfiremake libmnl
4ebb37c8 425 ipfiremake libnfnetlink
d2f2ca65 426 ipfiremake libnetfilter_queue
b5722656 427 ipfiremake libnetfilter_conntrack
fec7a5b7 428 ipfiremake libnetfilter_cthelper
ead1c73f 429 ipfiremake libnetfilter_cttimeout
b8e0573b 430 ipfiremake iptables
8e6fb99d 431
dc7d6b20 432 case "${BUILD_ARCH}" in
fc155193 433 x86_64)
ba583892 434 ipfiremake linux KCFG=""
1f2bda9b 435 ipfiremake backports KCFG=""
ba583892 436 ipfiremake e1000e KCFG=""
db151fde 437 ipfiremake igb KCFG=""
ba583892
MT
438 ipfiremake ixgbe KCFG=""
439 ipfiremake xtables-addons KCFG=""
440 ipfiremake linux-initrd KCFG=""
fc155193 441 ;;
3d02c091
MT
442 i586)
443 # x86-pae (Native and new XEN) kernel build
444 ipfiremake linux KCFG="-pae"
91e56a59 445 ipfiremake backports KCFG="-pae"
3d02c091 446 ipfiremake e1000e KCFG="-pae"
db151fde 447 ipfiremake igb KCFG="-pae"
af396901 448 ipfiremake ixgbe KCFG="-pae"
b8e0573b 449 ipfiremake xtables-addons KCFG="-pae"
22820bf2 450 ipfiremake linux-initrd KCFG="-pae"
3d02c091
MT
451
452 # x86 kernel build
453 ipfiremake linux KCFG=""
91e56a59 454 ipfiremake backports KCFG=""
3d02c091 455 ipfiremake e1000e KCFG=""
db151fde 456 ipfiremake igb KCFG=""
af396901 457 ipfiremake ixgbe KCFG=""
b8e0573b 458 ipfiremake xtables-addons KCFG=""
22820bf2 459 ipfiremake linux-initrd KCFG=""
3d02c091 460 ;;
544f40d4 461
3d02c091
MT
462 armv5tel)
463 # arm-rpi (Raspberry Pi) kernel build
464 ipfiremake linux KCFG="-rpi"
91e56a59 465 ipfiremake backports KCFG="-rpi"
b8e0573b 466 ipfiremake xtables-addons KCFG="-rpi"
22820bf2 467 ipfiremake linux-initrd KCFG="-rpi"
3d02c091
MT
468
469 # arm multi platform (Panda, Wandboard ...) kernel build
470 ipfiremake linux KCFG="-multi"
91e56a59 471 ipfiremake backports KCFG="-multi"
3d02c091 472 ipfiremake e1000e KCFG="-multi"
db151fde 473 ipfiremake igb KCFG="-multi"
af396901 474 ipfiremake ixgbe KCFG="-multi"
b8e0573b 475 ipfiremake xtables-addons KCFG="-multi"
22820bf2 476 ipfiremake linux-initrd KCFG="-multi"
3d02c091
MT
477
478 # arm-kirkwood (Dreamplug, ICY-Box ...) kernel build
479 ipfiremake linux KCFG="-kirkwood"
91e56a59 480 ipfiremake backports KCFG="-kirkwood"
af396901 481 ipfiremake e1000e KCFG="-kirkwood"
db151fde 482 ipfiremake igb KCFG="-kirkwood"
af396901 483 ipfiremake ixgbe KCFG="-kirkwood"
b8e0573b 484 ipfiremake xtables-addons KCFG="-kirkwood"
22820bf2 485 ipfiremake linux-initrd KCFG="-kirkwood"
3d02c091
MT
486 ;;
487 esac
b8e0573b 488 ipfiremake xtables-addons USPACE="1"
c0845171 489 ipfiremake openssl
dc7d6b20 490 [ "${BUILD_ARCH}" = "i586" ] && ipfiremake openssl KCFG='-sse2'
c0845171
MT
491 ipfiremake libgpg-error
492 ipfiremake libgcrypt
493 ipfiremake libassuan
5c9d32f6
MT
494 ipfiremake nettle
495 ipfiremake libevent
496 ipfiremake libevent2
ac69a292 497 ipfiremake libevent2-compat
30aff66a 498 ipfiremake expat
5c9d32f6
MT
499 ipfiremake unbound
500 ipfiremake gnutls
c0845171
MT
501 ipfiremake bind
502 ipfiremake dhcp
503 ipfiremake dhcpcd
c226543b 504 ipfiremake boost
a89770fa 505 ipfiremake linux-atm
15679d9f 506 ipfiremake gdbm
c8ead4a5 507 ipfiremake pam
eac942d9 508 ipfiremake curl
404094ce 509 ipfiremake tcl
1916a97e 510 ipfiremake sqlite
67bc7ab2 511 ipfiremake libffi
15679d9f 512 ipfiremake python
2b6cce9b 513 ipfiremake python3
f0aa99fb 514 ipfiremake ca-certificates
01d103a9 515 ipfiremake fireinfo
15679d9f 516 ipfiremake libnet
999d55de 517 ipfiremake libnl
f808e589 518 ipfiremake libnl-3
27b8cc24 519 ipfiremake libidn
79518a2f 520 ipfiremake nasm
ddac6087 521 ipfiremake libjpeg
71a95ee3 522 ipfiremake libjpeg-compat
946a2afe 523 ipfiremake libexif
15679d9f
MT
524 ipfiremake libpng
525 ipfiremake libtiff
fd3e7da0 526 ipfiremake libart
15679d9f
MT
527 ipfiremake gd
528 ipfiremake popt
411afd1f 529 ipfiremake pcre
15679d9f
MT
530 ipfiremake slang
531 ipfiremake newt
2d01ecf5 532 ipfiremake libsmooth
5e8b8362 533 ipfiremake attr
989a31e2 534 ipfiremake acl
fd3e7da0 535 ipfiremake libcap
15679d9f 536 ipfiremake pciutils
51f3b7f5 537 ipfiremake usbutils
15679d9f 538 ipfiremake libxml2
c6c9630e 539 ipfiremake libxslt
6b8cff41 540 ipfiremake BerkeleyDB
15679d9f 541 ipfiremake mysql
411afd1f 542 ipfiremake cyrus-sasl
15679d9f
MT
543 ipfiremake openldap
544 ipfiremake apache2
545 ipfiremake php
afdf1483 546 ipfiremake web-user-interface
97a5baac 547 ipfiremake flag-icons
f9935652 548 ipfiremake jquery
15679d9f
MT
549 ipfiremake arping
550 ipfiremake beep
849d454a 551 ipfiremake dvdrtools
15679d9f 552 ipfiremake dosfstools
72d80898 553 ipfiremake reiserfsprogs
e0c749da 554 ipfiremake xfsprogs
93afd047 555 ipfiremake sysfsutils
8e055e65 556 ipfiremake fuse
d02350a2 557 ipfiremake ntfs-3g
15679d9f
MT
558 ipfiremake ethtool
559 ipfiremake ez-ipupdate
560 ipfiremake fcron
e3670217 561 ipfiremake perl-GD
330345c2 562 ipfiremake GD-Graph
786f2c8a 563 ipfiremake GD-TextUtil
c5e3d520
MT
564 ipfiremake perl-Device-SerialPort
565 ipfiremake perl-Device-Modem
52b08bc1 566 ipfiremake perl-Apache-Htpasswd
15679d9f
MT
567 ipfiremake gnupg
568 ipfiremake hdparm
f9956330 569 ipfiremake sdparm
7861f575 570 ipfiremake mtools
406f019f 571 ipfiremake whatmask
a10733a5 572 ipfiremake conntrack-tools
490256d5 573 ipfiremake libupnp
15679d9f 574 ipfiremake ipaddr
fd3e7da0 575 ipfiremake iputils
15679d9f 576 ipfiremake l7-protocols
d644d86f 577 ipfiremake mISDNuser
83bac7f3 578 ipfiremake capi4k-utils
93afd047 579 ipfiremake hwdata
15679d9f
MT
580 ipfiremake logrotate
581 ipfiremake logwatch
15679d9f 582 ipfiremake misc-progs
15679d9f 583 ipfiremake nano
15679d9f
MT
584 ipfiremake URI
585 ipfiremake HTML-Tagset
586 ipfiremake HTML-Parser
d3112744 587 ipfiremake HTML-Template
15679d9f
MT
588 ipfiremake Compress-Zlib
589 ipfiremake Digest
590 ipfiremake Digest-SHA1
591 ipfiremake Digest-HMAC
592 ipfiremake libwww-perl
593 ipfiremake Net-DNS
594 ipfiremake Net-IPv4Addr
595 ipfiremake Net_SSLeay
596 ipfiremake IO-Stringy
f98766eb 597 ipfiremake IO-Socket-SSL
15679d9f
MT
598 ipfiremake Unix-Syslog
599 ipfiremake Mail-Tools
600 ipfiremake MIME-Tools
601 ipfiremake Net-Server
602 ipfiremake Convert-TNEF
603 ipfiremake Convert-UUlib
604 ipfiremake Archive-Tar
605 ipfiremake Archive-Zip
606 ipfiremake Text-Tabs+Wrap
607 ipfiremake Locale-Country
93afd047 608 ipfiremake XML-Parser
d8799d92 609 ipfiremake Crypt-PasswdMD5
54fd0535 610 ipfiremake Net-Telnet
87b91593
MT
611 ipfiremake python-setuptools
612 ipfiremake python-clientform
613 ipfiremake python-mechanize
614 ipfiremake python-feedparser
615 ipfiremake python-rssdler
08f6cdcf 616 ipfiremake python-inotify
89b0810b
MT
617 ipfiremake python-docutils
618 ipfiremake python-daemon
3f1b94b9 619 ipfiremake python-ipaddress
c5568d64 620 ipfiremake glib
15679d9f
MT
621 ipfiremake GeoIP
622 ipfiremake fwhits
623 ipfiremake noip_updater
624 ipfiremake ntp
15679d9f 625 ipfiremake openssh
68a3ec7d 626 ipfiremake fontconfig
5c08baab 627 ipfiremake dejavu-fonts-ttf
68a3ec7d
MT
628 ipfiremake freefont
629 ipfiremake pixman
630 ipfiremake cairo
631 ipfiremake pango
15679d9f
MT
632 ipfiremake rrdtool
633 ipfiremake setserial
634 ipfiremake setup
853b7559
CS
635 ipfiremake libdnet
636 ipfiremake daq
15679d9f 637 ipfiremake snort
8a5604bf 638 ipfiremake oinkmaster
15679d9f 639 ipfiremake squid
15679d9f 640 ipfiremake squidguard
069ae085 641 ipfiremake calamaris
f4c3f459 642 ipfiremake tcpdump
15679d9f
MT
643 ipfiremake traceroute
644 ipfiremake vlan
645 ipfiremake wireless
15679d9f 646 ipfiremake pakfire
15679d9f
MT
647 ipfiremake spandsp
648 ipfiremake lzo
649 ipfiremake openvpn
15679d9f 650 ipfiremake pammysql
64c5bbc4 651 ipfiremake mpage
16e27e9a 652 ipfiremake dbus
e8689bfa
MT
653 ipfiremake intltool
654 ipfiremake libdaemon
15679d9f 655 ipfiremake cups
fccb3371 656 ipfiremake ghostscript
460a510b 657 ipfiremake lcms2
ee072e10 658 ipfiremake qpdf
5f8203b2 659 ipfiremake poppler
d46244f3 660 ipfiremake cups-filters
bdd2de73 661 ipfiremake epson-inkjet-printer-escpr
fccb3371 662 ipfiremake foomatic
2231d107 663 ipfiremake hplip
a45d2204 664 ipfiremake cifs-utils
cfba7c56 665 ipfiremake krb5
15679d9f
MT
666 ipfiremake samba
667 ipfiremake sudo
668 ipfiremake mc
669 ipfiremake wget
c0b99a4c 670 ipfiremake bridge-utils
15679d9f 671 ipfiremake screen
15679d9f
MT
672 ipfiremake smartmontools
673 ipfiremake htop
31847530 674 ipfiremake chkconfig
8f28e1b8 675 ipfiremake postfix
15679d9f 676 ipfiremake fetchmail
5ad5a6bc 677 ipfiremake cyrus-imapd
58493e1e 678 ipfiremake openmailadmin
15679d9f 679 ipfiremake clamav
15679d9f 680 ipfiremake spamassassin
fd3e7da0 681 ipfiremake amavisd
de849bc5 682 ipfiremake dma
0708852c 683 ipfiremake alsa
a28fdc01 684 ipfiremake mpfire
6c98857b 685 ipfiremake guardian
67081922 686 ipfiremake libid3tag
15679d9f
MT
687 ipfiremake libmad
688 ipfiremake libogg
689 ipfiremake libvorbis
3de6d1b9 690 ipfiremake libdvbpsi
946a2afe 691 ipfiremake flac
15679d9f 692 ipfiremake lame
15679d9f 693 ipfiremake sox
a6931e7e 694 ipfiremake libshout
0dde24fa
MT
695 ipfiremake xvid
696 ipfiremake libmpeg2
5184e8d3 697 ipfiremake libarchive
3926e90d 698 ipfiremake cmake
15679d9f 699 ipfiremake gnump3d
15679d9f
MT
700 ipfiremake rsync
701 ipfiremake tcpwrapper
a1a05a44 702 ipfiremake libtirpc
e93a0b06 703 ipfiremake rpcbind
15679d9f 704 ipfiremake nfs
33a24fcc 705 ipfiremake gnu-netcat
b395d328 706 ipfiremake ncat
e0fe704b 707 ipfiremake nmap
15679d9f 708 ipfiremake ncftp
15679d9f 709 ipfiremake etherwake
06da1292 710 ipfiremake bwm-ng
1a8688ba 711 ipfiremake sysstat
a08c3a2e 712 ipfiremake vsftpd
6652626c 713 ipfiremake strongswan
8af8d5d1 714 ipfiremake rng-tools
186e3d2c 715 ipfiremake lsof
d83f547d 716 ipfiremake br2684ctl
bb565aa4 717 ipfiremake pcmciautils
87846bb3 718 ipfiremake lm_sensors
7c7ea34a 719 ipfiremake liboping
a332b303 720 ipfiremake collectd
3495f7ba 721 ipfiremake elinks
3fcb086e 722 ipfiremake igmpproxy
47d36d8e 723 ipfiremake fbset
8d90174a
JS
724 ipfiremake opus
725 ipfiremake python-six
726 ipfiremake python-pyparsing
727 ipfiremake spice-protocol
728 ipfiremake spice
bc38ecd0 729 ipfiremake sdl
678a7970 730 ipfiremake libusbredir
bc38ecd0 731 ipfiremake qemu
08fc1a19 732 ipfiremake sane
b332d4ea
AF
733 ipfiremake netpbm
734 ipfiremake phpSANE
f8abcd46 735 ipfiremake tunctl
4e6e5af8 736 ipfiremake netsnmpd
3fcb086e 737 ipfiremake nagios
bddc81b4 738 ipfiremake nagios_nrpe
776029bb 739 ipfiremake icinga
eb20e136 740 ipfiremake ebtables
78c655ac
AF
741 ipfiremake directfb
742 ipfiremake dfb++
03df93e9 743 ipfiremake faad2
4dab22a1 744 ipfiremake ffmpeg
debeaeaa 745 ipfiremake vdr
58ccbbd4 746 ipfiremake vdr_streamdev
1d39d23d 747 ipfiremake vdr_vnsiserver5
58ccbbd4 748 ipfiremake vdr_epgsearch
d1dee6c1 749 ipfiremake vdr_dvbapi
c39413f2 750 ipfiremake vdr_eepg
9dd15f03 751 ipfiremake w_scan
4276eb31
AF
752 ipfiremake icecast
753 ipfiremake icegenerator
754 ipfiremake mpd
48d52263 755 ipfiremake libmpdclient
4276eb31 756 ipfiremake mpc
96396af0 757 ipfiremake perl-Net-SMTP-SSL
60c16cfd 758 ipfiremake perl-MIME-Base64
37672a3d 759 ipfiremake perl-Authen-SASL
42edc41f
AM
760 ipfiremake perl-MIME-Lite
761 ipfiremake perl-Email-Date-Format
77a2f0af 762 ipfiremake git
3900a6c7 763 ipfiremake squidclamav
6c33dc5c 764 ipfiremake vnstat
999d55de 765 ipfiremake iw
fad7b108 766 ipfiremake wpa_supplicant
d0817963 767 ipfiremake hostapd
cfeb8fa3 768 ipfiremake pycurl
396eca1a 769 ipfiremake urlgrabber
1596f7ff 770 ipfiremake syslinux
d49c3993 771 ipfiremake tftpd
d2c65e37 772 ipfiremake cpufrequtils
44e8a23a 773 ipfiremake bluetooth
95257a66 774 ipfiremake gutenprint
4e464f98 775 ipfiremake apcupsd
034a390e 776 ipfiremake iperf
5a9c9396 777 ipfiremake iperf3
3799d284 778 ipfiremake 7zip
1aa810ea 779 ipfiremake lynis
c268aebd 780 ipfiremake streamripper
18163ef2 781 ipfiremake sshfs
52fbfb8c 782 ipfiremake taglib
21819b54 783 #ipfiremake mediatomb
d0515b01 784 ipfiremake sslh
f902119c 785 ipfiremake perl-gettext
158a4318 786 ipfiremake perl-Sort-Naturally
c0b229ae 787 ipfiremake vdradmin
791b2270 788 ipfiremake miau
cc3f6e5c 789 ipfiremake perl-DBI
880cb343 790 ipfiremake perl-DBD-mysql
3704887e 791 ipfiremake perl-DBD-SQLite
abff56f0 792 ipfiremake perl-File-ReadBackwards
31f3654f 793 ipfiremake cacti
a075b9c5 794 ipfiremake openvmtools
91d539ab 795 ipfiremake nagiosql
653bee2b 796 ipfiremake iftop
f4c3f459 797 ipfiremake motion
245e26c9 798 ipfiremake joe
58dca4e5 799 ipfiremake monit
ffc22d72 800 ipfiremake nut
3f4aa73d 801 ipfiremake watchdog
b6541fec 802 ipfiremake libpri
65418d1d 803 ipfiremake libsrtp
76628c77
MT
804 ipfiremake asterisk
805 ipfiremake lcr
3fc69b3e 806 ipfiremake usb_modeswitch
d1c956e8 807 ipfiremake usb_modeswitch_data
dfc4bc56 808 ipfiremake zerofree
6b406afb 809 ipfiremake pound
7afbf8c4 810 ipfiremake minicom
69e29b22 811 ipfiremake ddrescue
aac0f711 812 ipfiremake imspector
fd69d6f6 813 ipfiremake miniupnpd
35f90335 814 ipfiremake client175
aafa82e7 815 ipfiremake powertop
5d547072 816 ipfiremake parted
ff305ff7
AF
817 ipfiremake swig
818 ipfiremake python-m2crypto
3ced8695 819 ipfiremake wireless-regdb
ff305ff7 820 ipfiremake crda
b297f517 821 ipfiremake libsolv
ce457e7f 822 ipfiremake python-distutils-extra
32c95e11 823 ipfiremake python-lzma
8ce0db7c
AF
824 ipfiremake python-progressbar
825 ipfiremake python-xattr
c05bbee7 826 ipfiremake ddns
c7270944 827 ipfiremake transmission
c1250cd8
AF
828 ipfiremake dpfhack
829 ipfiremake lcd4linux
e70bd5b7
EK
830 ipfiremake mtr
831 ipfiremake tcpick
3bdc0102 832 ipfiremake minidlna
d75b739e 833 ipfiremake acpid
9d0acf61 834 ipfiremake fping
b52f6eb2 835 ipfiremake telnet
8ec8462c 836 ipfiremake xinetd
9983d55f
EK
837 ipfiremake gpgme
838 ipfiremake pygpgme
0adb55f2 839 ipfiremake pakfire3
cc8ac763 840 ipfiremake stress
ce819132 841 ipfiremake libstatgrab
fb6e700b 842 ipfiremake sarg
30213d32 843 ipfiremake check_mk_agent
c3ad835a 844 ipfiremake nginx
f98766eb 845 ipfiremake sendEmail
ada69e12 846 ipfiremake sysbench
7739c2db 847 ipfiremake strace
015640d6 848 ipfiremake elfutils
f0c71e72 849 ipfiremake ltrace
76d5aabd 850 ipfiremake ipfire-netboot
2e6c5015 851 ipfiremake lcdproc
0a21ce42
JL
852 ipfiremake bitstream
853 ipfiremake multicat
fc621876 854 ipfiremake keepalived
9ba34569 855 ipfiremake ipvsadm
85981472
JL
856 ipfiremake perl-Carp-Clan
857 ipfiremake perl-Date-Calc
858 ipfiremake perl-Date-Manip
859 ipfiremake perl-File-Tail
860 ipfiremake perl-TimeDate
861 ipfiremake swatch
b312967c 862 ipfiremake tor
ce33eb3e 863 ipfiremake arm
7a6bb67a 864 ipfiremake wavemon
9e49a099 865 ipfiremake iptraf-ng
5a038beb 866 ipfiremake iotop
d2d7a46b 867 ipfiremake stunnel
0f7ee3ea 868 ipfiremake sslscan
7140a7a8 869 ipfiremake owncloud
008c392e 870 ipfiremake bacula
f808e589 871 ipfiremake batctl
db8a01e0
AM
872 ipfiremake perl-PDF-API2
873 ipfiremake squid-accounting
2d37f412 874 ipfiremake pigz
940c90d0 875 ipfiremake tmux
67716b19 876 ipfiremake perl-Text-CSV_XS
ffeb717f 877 ipfiremake swconfig
0f0e30dc 878 ipfiremake haproxy
63cbd2c1 879 ipfiremake ipset
6138d53b 880 ipfiremake lua
98b8cabf 881 ipfiremake dnsdist
8c1cf3b1 882 ipfiremake bird
4ffb9f95 883 ipfiremake dmidecode
9f19223e 884 ipfiremake mcelog
57bf7620 885 ipfiremake rtpproxy
7e39a893 886 ipfiremake util-macros
534199c2 887 ipfiremake libpciaccess
15c80cec 888 ipfiremake libyajl
272ac1b4 889 ipfiremake libvirt
fd15f250 890 ipfiremake python3-libvirt
71f578bb 891 ipfiremake freeradius
65c61b57 892 ipfiremake perl-common-sense
7f218a58 893 ipfiremake perl-inotify2
8afd763e 894 ipfiremake perl-Net-IP
d0817963 895}
df5e82b3
MT
896
897buildinstaller() {
898 # Run installer scripts one by one
899 LOGFILE="$BASEDIR/log/_build.installer.log"
900 export LOGFILE
fd0763dc 901 ipfiremake memtest
6cf9e770
AF
902 ipfiremake installer
903 installmake strip
df5e82b3
MT
904}
905
906buildpackages() {
907 LOGFILE="$BASEDIR/log/_build.packages.log"
908 export LOGFILE
909 echo "... see detailed log in _build.*.log files" >> $LOGFILE
0fbb45e9 910
df5e82b3
MT
911
912 # Generating list of packages used
0fbb45e9 913 echo -n "Generating packages list from logs" | tee -a $LOGFILE
df5e82b3
MT
914 rm -f $BASEDIR/doc/packages-list
915 for i in `ls -1tr $BASEDIR/log/[^_]*`; do
916 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
7471f6ab 917 echo "* `basename $i`" >>$BASEDIR/doc/packages-list
df5e82b3
MT
918 fi
919 done
7471f6ab 920 echo "== List of softwares used to build $NAME Version: $VERSION ==" > $BASEDIR/doc/packages-list.txt
4fe9acb2 921 grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$\|.tgz$\|-config$\|_missing_rootfile$\|install1$\|install2$\|pass1$\|pass2$\|pass3$' \
df5e82b3
MT
922 $BASEDIR/doc/packages-list | sort >> $BASEDIR/doc/packages-list.txt
923 rm -f $BASEDIR/doc/packages-list
c9673262 924 # packages-list.txt is ready to be displayed for wiki page
0fbb45e9 925 beautify message DONE
4b06f504
MT
926
927 # Update changelog
e49f7f0d 928 cd $BASEDIR
c43b07fd
AF
929 [ -z $GIT_TAG ] || LAST_TAG=$GIT_TAG
930 [ -z $LAST_TAG ] || EXT="$LAST_TAG..HEAD"
931 git log -n 500 --no-merges --pretty=medium --shortstat $EXT > $BASEDIR/doc/ChangeLog
df5e82b3 932
9607771a 933 # Create images for install
3c937429 934 ipfiremake cdrom
bada0832 935
4dc82852 936 # Check if there is a loop device for building in virtual environments
841663e7
MT
937 modprobe loop 2>/dev/null
938 if [ $BUILD_IMAGES == 1 ] && ([ -e /dev/loop/0 ] || [ -e /dev/loop0 ] || [ -e "/dev/loop-control" ]); then
3c937429 939 ipfiremake flash-images
c42cbc86 940 ipfiremake flash-images SCON=1
4dc82852 941 fi
c9673262 942
f0fc8807 943 mv $LFS/install/images/{*.iso,*.tgz,*.img.gz,*.bz2} $BASEDIR >> $LOGFILE 2>&1
c9673262 944
0d909a4a 945 ipfirepackages
e67a57fe 946
305a7b38 947 ipfiremake xen-image
939c2a21 948 mv $LFS/install/images/*.bz2 $BASEDIR >> $LOGFILE 2>&1
bada0832 949
b307417f 950 cd $BASEDIR
744a04ea
AF
951
952 # remove not useable iso on armv5tel (needed to build flash images)
dc7d6b20 953 [ "${BUILD_ARCH}" = "armv5tel" ] && rm -rf *.iso
744a04ea 954
b307417f
AF
955 for i in `ls *.bz2 *.img.gz *.iso`; do
956 md5sum $i > $i.md5
957 done
958 cd $PWD
959
e67a57fe
MT
960 # Cleanup
961 stdumount
962 rm -rf $BASEDIR/build/tmp/*
963
964 # Generating total list of files
0d909a4a 965 echo -n "Generating files list from logs" | tee -a $LOGFILE
e67a57fe
MT
966 rm -f $BASEDIR/log/FILES
967 for i in `ls -1tr $BASEDIR/log/[^_]*`; do
968 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
969 echo "##" >>$BASEDIR/log/FILES
970 echo "## `basename $i`" >>$BASEDIR/log/FILES
971 echo "##" >>$BASEDIR/log/FILES
972 cat $i | sed "s%^\./%#%" | sort >> $BASEDIR/log/FILES
973 fi
974 done
0d909a4a 975 beautify message DONE
e67a57fe
MT
976
977 cd $PWD
e67a57fe
MT
978}
979
980ipfirepackages() {
4378d325 981 ipfiremake core-updates
5596077b
MT
982
983 local i
dc7d6b20 984 for i in $(find $BASEDIR/config/rootfiles/packages{/${BUILD_ARCH},} -maxdepth 1 -type f); do
5596077b 985 i=$(basename ${i})
453b418b
MT
986 if [ -e $BASEDIR/lfs/$i ]; then
987 ipfiredist $i
988 else
989 echo -n $i
990 beautify message SKIP
991 fi
fe7fe395 992 done
78331e30 993 test -d $BASEDIR/packages || mkdir $BASEDIR/packages
5c8cfc99 994 mv -f $LFS/install/packages/* $BASEDIR/packages >> $LOGFILE 2>&1
483f59cd 995 rm -rf $BASEDIR/build/install/packages/*
df5e82b3
MT
996}
997
bcb9dc13
MT
998while [ $# -gt 0 ]; do
999 case "${1}" in
1000 --target=*)
1001 configure_target "${1#--target=}"
1002 ;;
1003 -*)
1004 exiterror "Unknown configuration option: ${1}"
1005 ;;
1006 *)
1007 # Found a command, so exit options parsing.
1008 break
1009 ;;
1010 esac
1011 shift
1012done
1013
df5e82b3
MT
1014# See what we're supposed to do
1015case "$1" in
1016build)
9729e787 1017 clear
dc7d6b20 1018 PACKAGE=`ls -v -r $BASEDIR/cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.gz 2> /dev/null | head -n 1`
df5e82b3 1019 #only restore on a clean disk
bdc6837d 1020 if [ ! -e "${BASEDIR}/build/tools/.toolchain-successful" ]; then
df5e82b3 1021 if [ ! -n "$PACKAGE" ]; then
15679d9f 1022 beautify build_stage "Full toolchain compilation - Native GCC: `gcc --version | grep GCC | awk {'print $3'}`"
df5e82b3
MT
1023 prepareenv
1024 buildtoolchain
1025 else
1026 PACKAGENAME=${PACKAGE%.tar.gz}
15679d9f 1027 beautify build_stage "Packaged toolchain compilation"
df5e82b3
MT
1028 if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then
1029 tar zxf $PACKAGE
1030 prepareenv
1031 else
1032 exiterror "$PACKAGENAME md5 did not match, check downloaded package"
1033 fi
1034 fi
1035 else
9729e787
MT
1036 echo -n "Using installed toolchain" | tee -a $LOGFILE
1037 beautify message SKIP
df5e82b3
MT
1038 prepareenv
1039 fi
5cfe86e6 1040
7ab7a9b4 1041 beautify build_start
0b59f25c 1042 beautify build_stage "Building LFS"
df5e82b3 1043 buildbase
15679d9f 1044
0b59f25c 1045 beautify build_stage "Building IPFire"
15679d9f 1046 buildipfire
5cfe86e6 1047
0b59f25c 1048 beautify build_stage "Building installer"
df5e82b3 1049 buildinstaller
15679d9f 1050
0b59f25c 1051 beautify build_stage "Building packages"
df5e82b3 1052 buildpackages
7a5ed24e
CS
1053
1054 beautify build_stage "Checking Logfiles for new Files"
b307417f
AF
1055
1056 cd $BASEDIR
7a5ed24e 1057 tools/checknewlog.pl
e0c923f4 1058 tools/checkrootfiles
b307417f 1059 cd $PWD
a23731d1 1060
7ab7a9b4 1061 beautify build_end
df5e82b3
MT
1062 ;;
1063shell)
1064 # enter a shell inside LFS chroot
1065 # may be used to changed kernel settings
1066 prepareenv
1067 entershell
1068 ;;
df5e82b3 1069clean)
a50d04ab 1070 echo -en "${BOLD}Cleaning build directory...${NORMAL}"
df5e82b3
MT
1071 for i in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do
1072 $LOSETUP -d $i 2>/dev/null
1073 done
1074 for i in `mount | grep $BASEDIR | cut -d " " -f 1`; do
1075 umount $i
1076 done
1077 stdumount
1078 for i in `seq 0 7`; do
1079 if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
1080 umount /dev/loop${i} 2>/dev/null;
1081 losetup -d /dev/loop${i} 2>/dev/null;
1082 fi;
1083 done
1084 rm -rf $BASEDIR/build
1085 rm -rf $BASEDIR/cdrom
f9315063 1086 rm -rf $BASEDIR/packages
df5e82b3 1087 rm -rf $BASEDIR/log
df5e82b3
MT
1088 if [ -h /tools ]; then
1089 rm -f /tools
1090 fi
b307417f 1091 rm -f $BASEDIR/ipfire-*
a50d04ab 1092 beautify message DONE
df5e82b3 1093 ;;
c3db995c 1094downloadsrc)
df5e82b3
MT
1095 if [ ! -d $BASEDIR/cache ]; then
1096 mkdir $BASEDIR/cache
1097 fi
1098 mkdir -p $BASEDIR/log
857d9bf2 1099 echo -e "${BOLD}Preload all source files${NORMAL}" | tee -a $LOGFILE
df5e82b3
MT
1100 FINISHED=0
1101 cd $BASEDIR/lfs
1102 for c in `seq $MAX_RETRIES`; do
1103 if (( FINISHED==1 )); then
1104 break
1105 fi
1106 FINISHED=1
1107 cd $BASEDIR/lfs
1108 for i in *; do
1109 if [ -f "$i" -a "$i" != "Config" ]; then
846e756e
MT
1110 lfsmakecommoncheck ${i} || continue
1111
dc7d6b20 1112 make -s -f $i LFS_BASEDIR=$BASEDIR BUILD_ARCH="${BUILD_ARCH}" \
51f9e7ac 1113 MESSAGE="$i\t ($c/$MAX_RETRIES)" download >> $LOGFILE 2>&1
df5e82b3 1114 if [ $? -ne 0 ]; then
e22c7973 1115 beautify message FAIL
df5e82b3
MT
1116 FINISHED=0
1117 else
1118 if [ $c -eq 1 ]; then
e22c7973 1119 beautify message DONE
df5e82b3
MT
1120 fi
1121 fi
1122 fi
1123 done
1124 done
e22c7973 1125 echo -e "${BOLD}***Verifying md5sums${NORMAL}"
df5e82b3
MT
1126 ERROR=0
1127 for i in *; do
1128 if [ -f "$i" -a "$i" != "Config" ]; then
a4130265 1129 lfsmakecommoncheck ${i} > /dev/null || continue
dc7d6b20 1130 make -s -f $i LFS_BASEDIR=$BASEDIR BUILD_ARCH="${BUILD_ARCH}" \
51f9e7ac 1131 MESSAGE="$i\t " md5 >> $LOGFILE 2>&1
df5e82b3 1132 if [ $? -ne 0 ]; then
e22c7973
MT
1133 echo -ne "MD5 difference in lfs/$i"
1134 beautify message FAIL
df5e82b3
MT
1135 ERROR=1
1136 fi
1137 fi
1138 done
1139 if [ $ERROR -eq 0 ]; then
e22c7973
MT
1140 echo -ne "${BOLD}all files md5sum match${NORMAL}"
1141 beautify message DONE
1142 else
1143 echo -ne "${BOLD}not all files were correctly download${NORMAL}"
1144 beautify message FAIL
df5e82b3 1145 fi
e22c7973 1146 cd - >/dev/null 2>&1
df5e82b3 1147 ;;
df5e82b3 1148toolchain)
9729e787 1149 clear
df5e82b3 1150 prepareenv
15679d9f 1151 beautify build_stage "Toolchain compilation - Native GCC: `gcc --version | grep GCC | awk {'print $3'}`"
df5e82b3 1152 buildtoolchain
dc7d6b20 1153 echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for ${BUILD_ARCH}" | tee -a $LOGFILE
11104bfe 1154 test -d $BASEDIR/cache/toolchains || mkdir -p $BASEDIR/cache/toolchains
dc7d6b20 1155 cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.gz \
3e106ae5 1156 build/tools build/bin/sh log >> $LOGFILE
dc7d6b20
MT
1157 md5sum cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.gz \
1158 > cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.md5
df5e82b3
MT
1159 stdumount
1160 ;;
1161gettoolchain)
df5e82b3 1162 # arbitrary name to be updated in case of new toolchain package upload
dc7d6b20 1163 PACKAGE=$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}
712d859c 1164 if [ ! -f $BASEDIR/cache/toolchains/$PACKAGE.tar.gz ]; then
5bd13f01 1165 URL_TOOLCHAIN=`grep URL_TOOLCHAIN lfs/Config | awk '{ print $3 }'`
11104bfe 1166 test -d $BASEDIR/cache/toolchains || mkdir -p $BASEDIR/cache/toolchains
dc7d6b20 1167 echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for ${BUILD_ARCH}" | tee -a $LOGFILE
712d859c 1168 cd $BASEDIR/cache/toolchains
74f3678b 1169 wget -U "IPFireSourceGrabber/2.x" $URL_TOOLCHAIN/$PACKAGE.tar.gz $URL_TOOLCHAIN/$PACKAGE.md5 >& /dev/null
712d859c 1170 if [ $? -ne 0 ]; then
dc7d6b20 1171 echo "`date -u '+%b %e %T'`: error downloading $PACKAGE toolchain for ${BUILD_ARCH} machine" | tee -a $LOGFILE
40a4ea4c 1172 else
712d859c
MT
1173 if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then
1174 echo "`date -u '+%b %e %T'`: toolchain md5 ok" | tee -a $LOGFILE
1175 else
1176 exiterror "$PACKAGE.md5 did not match, check downloaded package"
1177 fi
40a4ea4c 1178 fi
712d859c
MT
1179 else
1180 echo "Toolchain is already downloaded. Exiting..."
df5e82b3
MT
1181 fi
1182 ;;
15679d9f 1183othersrc)
ce56e927 1184 prepareenv
dc7d6b20 1185 echo -ne "`date -u '+%b %e %T'`: Build sources iso for ${BUILD_ARCH}" | tee -a $LOGFILE
ce56e927
MT
1186 chroot $LFS /tools/bin/env -i HOME=/root \
1187 TERM=$TERM PS1='\u:\w\$ ' \
1188 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
dc7d6b20 1189 VERSION=$VERSION NAME="$NAME" SNAME="$SNAME" BUILD_ARCH="${BUILD_ARCH}" \
ce56e927
MT
1190 /bin/bash -x -c "cd /usr/src/lfs && make -f sources-iso LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
1191 mv $LFS/install/images/ipfire-* $BASEDIR >> $LOGFILE 2>&1
15679d9f
MT
1192 if [ $? -eq "0" ]; then
1193 beautify message DONE
1194 else
1195 beautify message FAIL
1196 fi
ce56e927
MT
1197 stdumount
1198 ;;
15679d9f
MT
1199uploadsrc)
1200 PWD=`pwd`
661d9388
CS
1201 if [ -z $IPFIRE_USER ]; then
1202 echo -n "You have to setup IPFIRE_USER first. See .config for details."
1203 beautify message FAIL
1204 exit 1
1205 fi
ae23a606 1206
661d9388 1207 URL_SOURCE=$(grep URL_SOURCE lfs/Config | awk '{ print $3 }')
15e38431 1208 REMOTE_FILES=$(echo "ls -1" | sftp -C ${IPFIRE_USER}@${URL_SOURCE})
661d9388 1209
15e38431
MT
1210 for file in ${BASEDIR}/cache/*; do
1211 [ -d "${file}" ] && continue
1212 grep -q "$(basename ${file})" <<<$REMOTE_FILES && continue
661d9388 1213 NEW_FILES="$NEW_FILES $file"
0eab8e84 1214 done
661d9388
CS
1215 [ -n "$NEW_FILES" ] && scp -2 $NEW_FILES ${IPFIRE_USER}@${URL_SOURCE}
1216 cd $BASEDIR
15679d9f
MT
1217 cd $PWD
1218 exit 0
0eab8e84 1219 ;;
bf7c473f
MT
1220lang)
1221 update_langs
1222 ;;
6b8cff41 1223*)
a50d04ab 1224 echo "Usage: $0 {build|changelog|clean|gettoolchain|downloadsrc|shell|sync|toolchain}"
6b8cff41
MT
1225 cat doc/make.sh-usage
1226 ;;
3ea75603 1227esac