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