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