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