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