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