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