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