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