]> git.ipfire.org Git - ipfire-2.x.git/blob - make.sh
Merge branch 'bird' into next
[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="100" # Core Level (Filename)
29 PAKFIRE_CORE="99" # 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 ipfiremake bird
852 }
853
854 buildinstaller() {
855 # Run installer scripts one by one
856 LOGFILE="$BASEDIR/log/_build.installer.log"
857 export LOGFILE
858 ipfiremake memtest
859 ipfiremake installer
860 installmake strip
861 }
862
863 buildpackages() {
864 LOGFILE="$BASEDIR/log/_build.packages.log"
865 export LOGFILE
866 echo "... see detailed log in _build.*.log files" >> $LOGFILE
867
868
869 # Generating list of packages used
870 echo -n "Generating packages list from logs" | tee -a $LOGFILE
871 rm -f $BASEDIR/doc/packages-list
872 for i in `ls -1tr $BASEDIR/log/[^_]*`; do
873 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
874 echo "* `basename $i`" >>$BASEDIR/doc/packages-list
875 fi
876 done
877 echo "== List of softwares used to build $NAME Version: $VERSION ==" > $BASEDIR/doc/packages-list.txt
878 grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$\|.tgz$\|-config$\|_missing_rootfile$\|install1$\|install2$\|pass1$\|pass2$\|pass3$' \
879 $BASEDIR/doc/packages-list | sort >> $BASEDIR/doc/packages-list.txt
880 rm -f $BASEDIR/doc/packages-list
881 # packages-list.txt is ready to be displayed for wiki page
882 beautify message DONE
883
884 # Update changelog
885 cd $BASEDIR
886 [ -z $GIT_TAG ] || LAST_TAG=$GIT_TAG
887 [ -z $LAST_TAG ] || EXT="$LAST_TAG..HEAD"
888 git log -n 500 --no-merges --pretty=medium --shortstat $EXT > $BASEDIR/doc/ChangeLog
889
890 # Create images for install
891 ipfiremake cdrom
892
893 # Check if there is a loop device for building in virtual environments
894 modprobe loop 2>/dev/null
895 if [ $BUILD_IMAGES == 1 ] && ([ -e /dev/loop/0 ] || [ -e /dev/loop0 ] || [ -e "/dev/loop-control" ]); then
896 ipfiremake flash-images
897 ipfiremake flash-images SCON=1
898 fi
899
900 mv $LFS/install/images/{*.iso,*.tgz,*.img.gz,*.bz2} $BASEDIR >> $LOGFILE 2>&1
901
902 ipfirepackages
903
904 ipfiremake xen-image
905 mv $LFS/install/images/*.bz2 $BASEDIR >> $LOGFILE 2>&1
906
907 cd $BASEDIR
908
909 # remove not useable iso on armv5tel (needed to build flash images)
910 [ "${TARGET_ARCH}" = "armv5tel" ] && rm -rf *.iso
911
912 for i in `ls *.bz2 *.img.gz *.iso`; do
913 md5sum $i > $i.md5
914 done
915 cd $PWD
916
917 # Cleanup
918 stdumount
919 rm -rf $BASEDIR/build/tmp/*
920
921 # Generating total list of files
922 echo -n "Generating files list from logs" | tee -a $LOGFILE
923 rm -f $BASEDIR/log/FILES
924 for i in `ls -1tr $BASEDIR/log/[^_]*`; do
925 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
926 echo "##" >>$BASEDIR/log/FILES
927 echo "## `basename $i`" >>$BASEDIR/log/FILES
928 echo "##" >>$BASEDIR/log/FILES
929 cat $i | sed "s%^\./%#%" | sort >> $BASEDIR/log/FILES
930 fi
931 done
932 beautify message DONE
933
934 cd $PWD
935 }
936
937 ipfirepackages() {
938 ipfiremake core-updates
939
940 local i
941 for i in $(find $BASEDIR/config/rootfiles/packages{/${MACHINE},} -maxdepth 1 -type f); do
942 i=$(basename ${i})
943 if [ -e $BASEDIR/lfs/$i ]; then
944 ipfiredist $i
945 else
946 echo -n $i
947 beautify message SKIP
948 fi
949 done
950 test -d $BASEDIR/packages || mkdir $BASEDIR/packages
951 mv -f $LFS/install/packages/* $BASEDIR/packages >> $LOGFILE 2>&1
952 rm -rf $BASEDIR/build/install/packages/*
953 }
954
955 while [ $# -gt 0 ]; do
956 case "${1}" in
957 --target=*)
958 configure_target "${1#--target=}"
959 ;;
960 -*)
961 exiterror "Unknown configuration option: ${1}"
962 ;;
963 *)
964 # Found a command, so exit options parsing.
965 break
966 ;;
967 esac
968 shift
969 done
970
971 # See what we're supposed to do
972 case "$1" in
973 build)
974 clear
975 PACKAGE=`ls -v -r $BASEDIR/cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-$MACHINE.tar.gz 2> /dev/null | head -n 1`
976 #only restore on a clean disk
977 if [ ! -f log/cleanup-toolchain-2-tools ]; then
978 if [ ! -n "$PACKAGE" ]; then
979 beautify build_stage "Full toolchain compilation - Native GCC: `gcc --version | grep GCC | awk {'print $3'}`"
980 prepareenv
981 buildtoolchain
982 else
983 PACKAGENAME=${PACKAGE%.tar.gz}
984 beautify build_stage "Packaged toolchain compilation"
985 if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then
986 tar zxf $PACKAGE
987 prepareenv
988 else
989 exiterror "$PACKAGENAME md5 did not match, check downloaded package"
990 fi
991 fi
992 else
993 echo -n "Using installed toolchain" | tee -a $LOGFILE
994 beautify message SKIP
995 prepareenv
996 fi
997
998 beautify build_start
999 beautify build_stage "Building LFS"
1000 buildbase
1001
1002 beautify build_stage "Building IPFire"
1003 buildipfire
1004
1005 beautify build_stage "Building installer"
1006 buildinstaller
1007
1008 beautify build_stage "Building packages"
1009 buildpackages
1010
1011 beautify build_stage "Checking Logfiles for new Files"
1012
1013 cd $BASEDIR
1014 tools/checknewlog.pl
1015 tools/checkrootfiles
1016 cd $PWD
1017
1018 beautify build_end
1019 ;;
1020 shell)
1021 # enter a shell inside LFS chroot
1022 # may be used to changed kernel settings
1023 prepareenv
1024 entershell
1025 ;;
1026 clean)
1027 echo -en "${BOLD}Cleaning build directory...${NORMAL}"
1028 for i in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do
1029 $LOSETUP -d $i 2>/dev/null
1030 done
1031 for i in `mount | grep $BASEDIR | cut -d " " -f 1`; do
1032 umount $i
1033 done
1034 stdumount
1035 for i in `seq 0 7`; do
1036 if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
1037 umount /dev/loop${i} 2>/dev/null;
1038 losetup -d /dev/loop${i} 2>/dev/null;
1039 fi;
1040 done
1041 rm -rf $BASEDIR/build
1042 rm -rf $BASEDIR/cdrom
1043 rm -rf $BASEDIR/packages
1044 rm -rf $BASEDIR/log
1045 if [ -h /tools ]; then
1046 rm -f /tools
1047 fi
1048 rm -f $BASEDIR/ipfire-*
1049 beautify message DONE
1050 ;;
1051 downloadsrc)
1052 if [ ! -d $BASEDIR/cache ]; then
1053 mkdir $BASEDIR/cache
1054 fi
1055 mkdir -p $BASEDIR/log
1056 echo -e "${BOLD}Preload all source files${NORMAL}" | tee -a $LOGFILE
1057 FINISHED=0
1058 cd $BASEDIR/lfs
1059 for c in `seq $MAX_RETRIES`; do
1060 if (( FINISHED==1 )); then
1061 break
1062 fi
1063 FINISHED=1
1064 cd $BASEDIR/lfs
1065 for i in *; do
1066 if [ -f "$i" -a "$i" != "Config" ]; then
1067 lfsmakecommoncheck ${i} || continue
1068
1069 make -s -f $i LFS_BASEDIR=$BASEDIR MACHINE=$MACHINE \
1070 MESSAGE="$i\t ($c/$MAX_RETRIES)" download >> $LOGFILE 2>&1
1071 if [ $? -ne 0 ]; then
1072 beautify message FAIL
1073 FINISHED=0
1074 else
1075 if [ $c -eq 1 ]; then
1076 beautify message DONE
1077 fi
1078 fi
1079 fi
1080 done
1081 done
1082 echo -e "${BOLD}***Verifying md5sums${NORMAL}"
1083 ERROR=0
1084 for i in *; do
1085 if [ -f "$i" -a "$i" != "Config" ]; then
1086 lfsmakecommoncheck ${i} > /dev/null || continue
1087 make -s -f $i LFS_BASEDIR=$BASEDIR MACHINE=$MACHINE \
1088 MESSAGE="$i\t " md5 >> $LOGFILE 2>&1
1089 if [ $? -ne 0 ]; then
1090 echo -ne "MD5 difference in lfs/$i"
1091 beautify message FAIL
1092 ERROR=1
1093 fi
1094 fi
1095 done
1096 if [ $ERROR -eq 0 ]; then
1097 echo -ne "${BOLD}all files md5sum match${NORMAL}"
1098 beautify message DONE
1099 else
1100 echo -ne "${BOLD}not all files were correctly download${NORMAL}"
1101 beautify message FAIL
1102 fi
1103 cd - >/dev/null 2>&1
1104 ;;
1105 toolchain)
1106 clear
1107 prepareenv
1108 beautify build_stage "Toolchain compilation - Native GCC: `gcc --version | grep GCC | awk {'print $3'}`"
1109 buildtoolchain
1110 echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for $MACHINE" | tee -a $LOGFILE
1111 test -d $BASEDIR/cache/toolchains || mkdir -p $BASEDIR/cache/toolchains
1112 cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-$MACHINE.tar.gz \
1113 build/tools build/bin/sh log >> $LOGFILE
1114 md5sum cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-$MACHINE.tar.gz \
1115 > cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-$MACHINE.md5
1116 stdumount
1117 ;;
1118 gettoolchain)
1119 # arbitrary name to be updated in case of new toolchain package upload
1120 PACKAGE=$SNAME-$VERSION-toolchain-$TOOLCHAINVER-$MACHINE
1121 if [ ! -f $BASEDIR/cache/toolchains/$PACKAGE.tar.gz ]; then
1122 URL_TOOLCHAIN=`grep URL_TOOLCHAIN lfs/Config | awk '{ print $3 }'`
1123 test -d $BASEDIR/cache/toolchains || mkdir -p $BASEDIR/cache/toolchains
1124 echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for $MACHINE" | tee -a $LOGFILE
1125 cd $BASEDIR/cache/toolchains
1126 wget -U "IPFireSourceGrabber/2.x" $URL_TOOLCHAIN/$PACKAGE.tar.gz $URL_TOOLCHAIN/$PACKAGE.md5 >& /dev/null
1127 if [ $? -ne 0 ]; then
1128 echo "`date -u '+%b %e %T'`: error downloading $PACKAGE toolchain for $MACHINE machine" | tee -a $LOGFILE
1129 else
1130 if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then
1131 echo "`date -u '+%b %e %T'`: toolchain md5 ok" | tee -a $LOGFILE
1132 else
1133 exiterror "$PACKAGE.md5 did not match, check downloaded package"
1134 fi
1135 fi
1136 else
1137 echo "Toolchain is already downloaded. Exiting..."
1138 fi
1139 ;;
1140 othersrc)
1141 prepareenv
1142 echo -ne "`date -u '+%b %e %T'`: Build sources iso for $MACHINE" | tee -a $LOGFILE
1143 chroot $LFS /tools/bin/env -i HOME=/root \
1144 TERM=$TERM PS1='\u:\w\$ ' \
1145 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \
1146 VERSION=$VERSION NAME="$NAME" SNAME="$SNAME" MACHINE=$MACHINE \
1147 /bin/bash -x -c "cd /usr/src/lfs && make -f sources-iso LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
1148 mv $LFS/install/images/ipfire-* $BASEDIR >> $LOGFILE 2>&1
1149 if [ $? -eq "0" ]; then
1150 beautify message DONE
1151 else
1152 beautify message FAIL
1153 fi
1154 stdumount
1155 ;;
1156 uploadsrc)
1157 PWD=`pwd`
1158 if [ -z $IPFIRE_USER ]; then
1159 echo -n "You have to setup IPFIRE_USER first. See .config for details."
1160 beautify message FAIL
1161 exit 1
1162 fi
1163
1164 URL_SOURCE=$(grep URL_SOURCE lfs/Config | awk '{ print $3 }')
1165 REMOTE_FILES=$(echo "ls -1" | sftp -C ${IPFIRE_USER}@${URL_SOURCE})
1166
1167 for file in ${BASEDIR}/cache/*; do
1168 [ -d "${file}" ] && continue
1169 grep -q "$(basename ${file})" <<<$REMOTE_FILES && continue
1170 NEW_FILES="$NEW_FILES $file"
1171 done
1172 [ -n "$NEW_FILES" ] && scp -2 $NEW_FILES ${IPFIRE_USER}@${URL_SOURCE}
1173 cd $BASEDIR
1174 cd $PWD
1175 exit 0
1176 ;;
1177 lang)
1178 update_langs
1179 ;;
1180 *)
1181 echo "Usage: $0 {build|changelog|clean|gettoolchain|downloadsrc|shell|sync|toolchain}"
1182 cat doc/make.sh-usage
1183 ;;
1184 esac