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