]>
Commit | Line | Data |
---|---|---|
df5e82b3 | 1 | #!/bin/bash |
df5e82b3 MT |
2 | ############################################################################ |
3 | # # | |
f8e5510c | 4 | # This file is part of the IPFire Firewall. # |
df5e82b3 | 5 | # # |
f8e5510c | 6 | # IPFire is free software; you can redistribute it and/or modify # |
df5e82b3 MT |
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 | # # | |
f8e5510c | 11 | # IPFire is distributed in the hope that it will be useful, # |
df5e82b3 MT |
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 # | |
f8e5510c | 17 | # along with IPFire; if not, write to the Free Software # |
df5e82b3 MT |
18 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # |
19 | # # | |
06209efc | 20 | # Copyright (C) 2007 IPFire-Team <info@ipfire.org>. # |
df5e82b3 MT |
21 | # # |
22 | ############################################################################ | |
df5e82b3 MT |
23 | # |
24 | ||
06209efc MT |
25 | NAME="IPFire" # Software name |
26 | SNAME="ipfire" # Short name | |
ca8da28e MT |
27 | VERSION="2.9" # Version number |
28 | TOOLCHAINVERSION="${VERSION}" # Toolchain | |
06209efc | 29 | SLOGAN="www.ipfire.org" # Software slogan |
df5e82b3 | 30 | |
15679d9f | 31 | # Include funtions |
ca8da28e | 32 | . tools/make-include |
df5e82b3 | 33 | |
df5e82b3 | 34 | |
ca8da28e MT |
35 | ################################################################################ |
36 | # This builds the entire stage "toolchain" # | |
37 | ################################################################################ | |
38 | toolchain_build() { | |
df5e82b3 | 39 | |
ca8da28e MT |
40 | ORG_PATH=$PATH |
41 | export PATH=$BASEDIR/build_${MACHINE}/usr/local/ccache/bin:$BASEDIR/build_${MACHINE}/usr/local/distcc/bin:$BASEDIR/build_${MACHINE}/$TOOLS_DIR/bin:$PATH | |
42 | STAGE_ORDER=01 | |
43 | STAGE=toolchain | |
df5e82b3 | 44 | |
ca8da28e MT |
45 | LOGFILE="$BASEDIR/log_${MACHINE}/_build.toolchain.log" |
46 | export LOGFILE | |
47 | ||
48 | NATIVEGCC=`gcc --version | grep GCC | awk {'print $3'}` | |
49 | export NATIVEGCC GCCmajor=${NATIVEGCC:0:1} GCCminor=${NATIVEGCC:2:1} GCCrelease=${NATIVEGCC:4:1} | |
50 | ||
51 | # make distcc first so that CCACHE_PREFIX works immediately | |
0e61af85 | 52 | [ -z "$DISTCC_HOSTS" ] || toolchain_make distcc |
ca8da28e MT |
53 | toolchain_make ccache |
54 | ||
be472d5a MT |
55 | toolchain_make binutils PASS=1 |
56 | toolchain_make gcc PASS=1 | |
57 | toolchain_make linux | |
ca8da28e | 58 | toolchain_make glibc |
be472d5a | 59 | toolchain_make adjust-toolchain |
ca8da28e MT |
60 | toolchain_make tcl |
61 | toolchain_make expect | |
62 | toolchain_make dejagnu | |
be472d5a MT |
63 | toolchain_make gcc PASS=2 |
64 | toolchain_make binutils PASS=2 | |
ca8da28e MT |
65 | toolchain_make ncurses |
66 | toolchain_make bash | |
67 | toolchain_make bzip2 | |
68 | toolchain_make coreutils | |
69 | toolchain_make diffutils | |
70 | toolchain_make findutils | |
71 | toolchain_make gawk | |
72 | toolchain_make gettext | |
73 | toolchain_make grep | |
74 | toolchain_make gzip | |
ca8da28e MT |
75 | toolchain_make make |
76 | toolchain_make patch | |
77 | toolchain_make perl | |
78 | toolchain_make sed | |
79 | toolchain_make tar | |
80 | toolchain_make texinfo | |
81 | toolchain_make util-linux | |
3888140c | 82 | # toolchain_make strip |
ca8da28e MT |
83 | export PATH=$ORG_PATH |
84 | } | |
df5e82b3 | 85 | |
ca8da28e MT |
86 | ################################################################################ |
87 | # This builds the entire stage "base" # | |
88 | ################################################################################ | |
89 | base_build() { | |
90 | ||
91 | PATH=/usr/local/ccache/bin:/usr/local/distcc/bin:/bin:/usr/bin:/sbin:/usr/sbin:$TOOLS_DIR/bin | |
92 | STAGE_ORDER=02 | |
93 | STAGE=base | |
94 | ||
95 | LOGFILE="$BASEDIR/log_${MACHINE}/_build.base.log" | |
96 | export LOGFILE | |
3888140c | 97 | |
ca8da28e | 98 | ipfire_make stage2 |
3888140c | 99 | ipfire_make linux |
ca8da28e MT |
100 | ipfire_make man-pages |
101 | ipfire_make glibc | |
3888140c | 102 | ipfire_make adjust-toolchain |
ca8da28e MT |
103 | ipfire_make binutils |
104 | ipfire_make gcc | |
105 | ipfire_make berkeley | |
3888140c MT |
106 | ipfire_make sed |
107 | ipfire_make e2fsprogs | |
ca8da28e MT |
108 | ipfire_make coreutils |
109 | ipfire_make iana-etc | |
110 | ipfire_make m4 | |
111 | ipfire_make bison | |
112 | ipfire_make ncurses | |
113 | ipfire_make procps | |
ca8da28e MT |
114 | ipfire_make libtool |
115 | ipfire_make perl | |
116 | ipfire_make readline | |
117 | ipfire_make zlib | |
118 | ipfire_make autoconf | |
119 | ipfire_make automake | |
120 | ipfire_make bash | |
121 | ipfire_make bzip2 | |
122 | ipfire_make diffutils | |
ca8da28e MT |
123 | ipfire_make file |
124 | ipfire_make findutils | |
125 | ipfire_make flex | |
0e61af85 | 126 | ipfire_make grub |
ca8da28e MT |
127 | ipfire_make gawk |
128 | ipfire_make gettext | |
129 | ipfire_make grep | |
130 | ipfire_make groff | |
131 | ipfire_make gzip | |
132 | ipfire_make inetutils | |
133 | ipfire_make iproute2 | |
134 | ipfire_make kbd | |
135 | ipfire_make less | |
ca8da28e | 136 | ipfire_make make |
0e61af85 | 137 | ipfire_make man-db |
ca8da28e | 138 | ipfire_make mktemp |
0e61af85 | 139 | ipfire_make module-init-tools |
ca8da28e MT |
140 | ipfire_make patch |
141 | ipfire_make psmisc | |
ca8da28e MT |
142 | ipfire_make shadow |
143 | ipfire_make sysklogd | |
144 | ipfire_make sysvinit | |
145 | ipfire_make tar | |
146 | ipfire_make texinfo | |
147 | ipfire_make udev | |
148 | ipfire_make util-linux | |
149 | ipfire_make vim | |
ca8da28e | 150 | } |
df5e82b3 | 151 | |
ca8da28e MT |
152 | ################################################################################ |
153 | # This builds the entire stage "ipfire" # | |
154 | ################################################################################ | |
155 | ipfire_build() { | |
156 | PATH=/usr/local/ccache/bin:/usr/local/distcc/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/${MACHINE_REAL}-linux/bin | |
157 | STAGE_ORDER=03 | |
158 | STAGE=ipfire | |
159 | ||
160 | LOGFILE="$BASEDIR/log_${MACHINE}/_build.ipfire.log" | |
161 | export LOGFILE | |
162 | ||
f76aefec MT |
163 | ipfire_make linux |
164 | exiterror "Stop here." | |
ca8da28e MT |
165 | ipfire_make configroot |
166 | ipfire_make backup | |
167 | ipfire_make dhcp | |
168 | ipfire_make dhcpcd | |
169 | ipfire_make libusb | |
170 | ipfire_make libpcap | |
171 | ipfire_make ppp | |
172 | ipfire_make rp-pppoe | |
173 | ipfire_make unzip | |
174 | ipfire_make linux SMP=1 | |
175 | ipfire_make ipp2p SMP=1 | |
176 | ipfire_make zaptel SMP=1 | |
177 | ipfire_make linux | |
178 | ipfire_make ipp2p | |
179 | ipfire_make zaptel | |
180 | ipfire_make pkg-config | |
181 | ipfire_make linux-atm | |
182 | ipfire_make cpio | |
183 | ipfire_make klibc | |
184 | ipfire_make mkinitcpio | |
185 | ipfire_make udev KLIBC=1 | |
186 | ipfire_make expat | |
187 | ipfire_make gdbm | |
188 | ipfire_make gmp | |
189 | ipfire_make pam | |
190 | ipfire_make openssl | |
191 | ipfire_make curl | |
192 | ipfire_make python | |
193 | ipfire_make libnet | |
194 | ipfire_make libidn | |
195 | ipfire_make libjpeg | |
196 | ipfire_make libpng | |
197 | ipfire_make libtiff | |
198 | ipfire_make libart | |
199 | ipfire_make freetype | |
200 | ipfire_make gd | |
201 | ipfire_make popt | |
202 | ipfire_make pcre | |
203 | ipfire_make slang | |
204 | ipfire_make newt | |
205 | ipfire_make libcap | |
206 | ipfire_make pciutils | |
207 | ipfire_make usbutils | |
208 | ipfire_make libxml2 | |
209 | ipfire_make libxslt | |
210 | ipfire_make BerkeleyDB | |
ca8da28e MT |
211 | ipfire_make cyrus-sasl |
212 | ipfire_make openldap | |
213 | ipfire_make apache2 | |
ca8da28e MT |
214 | ipfire_make apache2 PASS=C |
215 | ipfire_make arping | |
216 | ipfire_make beep | |
217 | ipfire_make bind | |
218 | ipfire_make cdrtools | |
219 | ipfire_make dnsmasq | |
220 | ipfire_make dosfstools | |
221 | ipfire_make squashfstools | |
222 | ipfire_make reiserfsprogs | |
223 | ipfire_make sysfsutils | |
224 | ipfire_make fuse | |
225 | ipfire_make ntfs-3g | |
226 | ipfire_make ethtool | |
227 | ipfire_make ez-ipupdate | |
228 | ipfire_make fcron | |
229 | ipfire_make perl-GD | |
230 | ipfire_make GD-Graph | |
231 | ipfire_make GD-TextUtil | |
232 | ipfire_make gnupg | |
233 | ipfire_make hdparm | |
234 | ipfire_make sdparm | |
235 | ipfire_make mtools | |
236 | ipfire_make initscripts | |
237 | ipfire_make whatmask | |
238 | ipfire_make iptables | |
239 | ipfire_make libupnp | |
240 | ipfire_make ipp2p IPT=1 | |
241 | ipfire_make linux-igd | |
242 | ipfire_make ipac-ng | |
243 | ipfire_make ipaddr | |
244 | ipfire_make iptstate | |
245 | ipfire_make iputils | |
246 | ipfire_make l7-protocols | |
247 | ipfire_make mISDN | |
248 | ipfire_make hwdata | |
249 | ipfire_make kudzu | |
250 | ipfire_make logrotate | |
251 | ipfire_make logwatch | |
252 | ipfire_make misc-progs | |
253 | ipfire_make nano | |
254 | ipfire_make nasm | |
255 | ipfire_make URI | |
256 | ipfire_make HTML-Tagset | |
257 | ipfire_make HTML-Parser | |
258 | ipfire_make Compress-Zlib | |
259 | ipfire_make Digest | |
260 | ipfire_make Digest-SHA1 | |
261 | ipfire_make Digest-HMAC | |
262 | ipfire_make libwww-perl | |
263 | ipfire_make Net-DNS | |
264 | ipfire_make Net-IPv4Addr | |
265 | ipfire_make Net_SSLeay | |
266 | ipfire_make IO-Stringy | |
267 | ipfire_make Unix-Syslog | |
268 | ipfire_make Mail-Tools | |
269 | ipfire_make MIME-Tools | |
270 | ipfire_make Net-Server | |
271 | ipfire_make Convert-TNEF | |
272 | ipfire_make Convert-UUlib | |
273 | ipfire_make Archive-Tar | |
274 | ipfire_make Archive-Zip | |
275 | ipfire_make Text-Tabs+Wrap | |
276 | ipfire_make Locale-Country | |
277 | ipfire_make XML-Parser | |
278 | ipfire_make glib | |
279 | ipfire_make GeoIP | |
280 | ipfire_make fwhits | |
281 | ipfire_make noip_updater | |
282 | ipfire_make ntp | |
283 | ipfire_make openssh | |
284 | ipfire_make openswan | |
285 | ipfire_make rrdtool | |
286 | ipfire_make setserial | |
287 | ipfire_make setup | |
288 | ipfire_make snort | |
289 | ipfire_make oinkmaster | |
290 | ipfire_make squid | |
291 | ipfire_make squid-graph | |
292 | ipfire_make squidguard | |
293 | ipfire_make calamaris | |
294 | ipfire_make tcpdump | |
295 | ipfire_make traceroute | |
296 | ipfire_make vlan | |
297 | ipfire_make wireless | |
298 | ipfire_make libsafe | |
299 | ipfire_make pakfire | |
300 | ipfire_make java | |
301 | ipfire_make spandsp | |
302 | ipfire_make lzo | |
303 | ipfire_make openvpn | |
304 | ipfire_make pammysql | |
305 | ipfire_make cups | |
306 | ipfire_make ghostscript | |
307 | ipfire_make foomatic | |
308 | ipfire_make hplip | |
309 | ipfire_make samba | |
310 | ipfire_make sudo | |
311 | ipfire_make mc | |
312 | ipfire_make wget | |
313 | ipfire_make bridge-utils | |
314 | ipfire_make screen | |
315 | ipfire_make hddtemp | |
316 | ipfire_make smartmontools | |
317 | ipfire_make htop | |
318 | ipfire_make postfix | |
319 | ipfire_make fetchmail | |
320 | ipfire_make cyrus-imapd | |
321 | ipfire_make openmailadmin | |
322 | ipfire_make clamav | |
323 | ipfire_make spamassassin | |
324 | ipfire_make amavisd | |
325 | ipfire_make alsa | |
326 | ipfire_make mpg123 | |
327 | ipfire_make mpfire | |
328 | ipfire_make guardian | |
329 | ipfire_make libid3tag | |
330 | ipfire_make libmad | |
331 | ipfire_make libogg | |
332 | ipfire_make libvorbis | |
333 | ipfire_make lame | |
334 | ipfire_make sox | |
335 | ipfire_make libshout | |
336 | ipfire_make icecast | |
337 | ipfire_make icegenerator | |
338 | ipfire_make mpd | |
339 | ipfire_make mpc | |
340 | ipfire_make xvid | |
341 | ipfire_make libmpeg2 | |
342 | ipfire_make videolan | |
343 | ipfire_make libpri | |
344 | ipfire_make asterisk | |
345 | ipfire_make gnump3d | |
346 | ipfire_make libsigc++ | |
347 | ipfire_make applejuice | |
348 | ipfire_make ocaml | |
349 | ipfire_make mldonkey | |
350 | ipfire_make libtorrent | |
351 | ipfire_make rtorrent | |
352 | ipfire_make ipfireseeder | |
353 | ipfire_make rsync | |
354 | ipfire_make tcpwrapper | |
355 | ipfire_make portmap | |
356 | ipfire_make nfs | |
357 | ipfire_make nmap | |
358 | ipfire_make mbmon | |
359 | ipfire_make ncftp | |
360 | ipfire_make etherwake | |
361 | ipfire_make bwm-ng | |
362 | ipfire_make tripwire | |
363 | ipfire_make sysstat | |
364 | ipfire_make vsftpd | |
365 | ipfire_make which | |
366 | ipfire_make lsof | |
367 | ipfire_make centerim | |
368 | ipfire_make br2684ctl | |
369 | } | |
119ee469 | 370 | |
ca8da28e MT |
371 | ################################################################################ |
372 | # This builds the entire stage "misc" # | |
373 | ################################################################################ | |
374 | misc_build() { | |
df5e82b3 | 375 | |
ca8da28e MT |
376 | PATH=/usr/local/ccache/bin:/usr/local/distcc/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/${MACHINE_REAL}-linux/bin |
377 | STAGE_ORDER=04 | |
378 | STAGE=misc | |
df5e82b3 | 379 | |
ca8da28e MT |
380 | LOGFILE="$BASEDIR/log_${MACHINE}/_build.misc.log" |
381 | export LOGFILE | |
382 | ||
383 | ipfire_make stage4 | |
384 | ipfire_make cdrtools | |
385 | ipfire_make syslinux | |
386 | ipfire_make parted | |
387 | ipfire_make slang | |
388 | ipfire_make newt | |
df5e82b3 MT |
389 | } |
390 | ||
ca8da28e MT |
391 | ################################################################################ |
392 | # This builds the entire stage "installer" # | |
393 | ################################################################################ | |
394 | installer_build() { | |
395 | ||
396 | PATH=/usr/local/ccache/bin:/usr/local/distcc/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/${MACHINE_REAL}-linux/bin | |
397 | STAGE_ORDER=05 | |
398 | STAGE=installer | |
399 | ||
400 | LOGFILE="$BASEDIR/log_${MACHINE}/_build.installer.log" | |
401 | export LOGFILE | |
402 | ||
403 | ipfire_make as86 | |
404 | ipfire_make mbr | |
405 | ipfire_make memtest | |
406 | ipfire_make linux-libc-header | |
407 | ipfire_make binutils | |
408 | ipfire_make uClibc PASS=1 | |
409 | ipfire_make gcc INST=1 | |
410 | ipfire_make uClibc PASS=2 | |
411 | ipfire_make gcc INST=2 | |
412 | ipfire_make uClibc PASS=3 | |
413 | ipfire_make busybox | |
414 | ipfire_make udev | |
415 | ipfire_make gettext | |
416 | ipfire_make kbd | |
417 | ipfire_make popt | |
418 | ipfire_make sysvinit | |
419 | ipfire_make misc-progs | |
420 | ipfire_make libaal | |
421 | ipfire_make reiser4progs | |
422 | ipfire_make reiserfsprogs | |
423 | ipfire_make sysfsutils | |
424 | ipfire_make util-linux | |
425 | ipfire_make pciutils | |
426 | ipfire_make zlib | |
427 | ipfire_make mtd | |
428 | ipfire_make wget | |
429 | ipfire_make hwdata | |
430 | ipfire_make kudzu | |
431 | ipfire_make installer | |
432 | ipfire_make initrd | |
df5e82b3 MT |
433 | } |
434 | ||
ca8da28e MT |
435 | ################################################################################ |
436 | # This builds the entire stage "packages" # | |
437 | ################################################################################ | |
438 | packages_build() { | |
df5e82b3 | 439 | |
ca8da28e MT |
440 | PATH=/usr/local/ccache/bin:/usr/local/distcc/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/${MACHINE_REAL}-linux/bin |
441 | STAGE_ORDER=06 | |
442 | STAGE=packages | |
df5e82b3 | 443 | |
ca8da28e MT |
444 | LOGFILE="$BASEDIR/log_${MACHINE}/_build.packages.log" |
445 | export LOGFILE | |
446 | ||
df5e82b3 | 447 | echo "... see detailed log in _build.*.log files" >> $LOGFILE |
0fbb45e9 | 448 | |
ca8da28e | 449 | ipfire_make strip |
df5e82b3 MT |
450 | |
451 | # Generating list of packages used | |
0fbb45e9 | 452 | echo -n "Generating packages list from logs" | tee -a $LOGFILE |
df5e82b3 MT |
453 | rm -f $BASEDIR/doc/packages-list |
454 | for i in `ls -1tr $BASEDIR/log/[^_]*`; do | |
455 | if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then | |
7471f6ab | 456 | echo "* `basename $i`" >>$BASEDIR/doc/packages-list |
df5e82b3 MT |
457 | fi |
458 | done | |
7471f6ab | 459 | echo "== List of softwares used to build $NAME Version: $VERSION ==" > $BASEDIR/doc/packages-list.txt |
4fe9acb2 | 460 | grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$\|.tgz$\|-config$\|_missing_rootfile$\|install1$\|install2$\|pass1$\|pass2$\|pass3$' \ |
df5e82b3 MT |
461 | $BASEDIR/doc/packages-list | sort >> $BASEDIR/doc/packages-list.txt |
462 | rm -f $BASEDIR/doc/packages-list | |
c9673262 | 463 | # packages-list.txt is ready to be displayed for wiki page |
0fbb45e9 | 464 | beautify message DONE |
df5e82b3 | 465 | |
9607771a | 466 | # Create images for install |
ca8da28e | 467 | ipfire_make cdrom ED=full |
74dbbc36 | 468 | |
4dc82852 | 469 | # Check if there is a loop device for building in virtual environments |
eedc26d9 | 470 | if [ -e /dev/loop/0 ] || [ -e /dev/loop0 ]; then |
ca8da28e | 471 | ipfire_make usb-stick |
4dc82852 | 472 | fi |
4dc82852 | 473 | mv $LFS/install/images/{*.iso,*.tgz,*.img.gz} $BASEDIR >> $LOGFILE 2>&1 |
c9673262 | 474 | |
0d909a4a | 475 | ipfirepackages |
e67a57fe MT |
476 | |
477 | # Cleanup | |
478 | stdumount | |
479 | rm -rf $BASEDIR/build/tmp/* | |
480 | ||
481 | # Generating total list of files | |
0d909a4a | 482 | echo -n "Generating files list from logs" | tee -a $LOGFILE |
e67a57fe MT |
483 | rm -f $BASEDIR/log/FILES |
484 | for i in `ls -1tr $BASEDIR/log/[^_]*`; do | |
485 | if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then | |
486 | echo "##" >>$BASEDIR/log/FILES | |
487 | echo "## `basename $i`" >>$BASEDIR/log/FILES | |
488 | echo "##" >>$BASEDIR/log/FILES | |
489 | cat $i | sed "s%^\./%#%" | sort >> $BASEDIR/log/FILES | |
490 | fi | |
491 | done | |
0d909a4a | 492 | beautify message DONE |
e67a57fe MT |
493 | |
494 | cd $PWD | |
e67a57fe MT |
495 | } |
496 | ||
497 | ipfirepackages() { | |
ca8da28e | 498 | ipfire_make core-updates |
fe7fe395 | 499 | for i in $(ls -1 $BASEDIR/config/rootfiles/packages); do |
453b418b | 500 | if [ -e $BASEDIR/lfs/$i ]; then |
ca8da28e | 501 | ipfire_dist $i |
453b418b MT |
502 | else |
503 | echo -n $i | |
504 | beautify message SKIP | |
505 | fi | |
fe7fe395 | 506 | done |
78331e30 | 507 | test -d $BASEDIR/packages || mkdir $BASEDIR/packages |
5c8cfc99 | 508 | mv -f $LFS/install/packages/* $BASEDIR/packages >> $LOGFILE 2>&1 |
483f59cd | 509 | rm -rf $BASEDIR/build/install/packages/* |
df5e82b3 MT |
510 | } |
511 | ||
512 | # See what we're supposed to do | |
513 | case "$1" in | |
514 | build) | |
9729e787 | 515 | clear |
ca8da28e MT |
516 | #a prebuilt toolchain package is only used if found in cache |
517 | if [ ! -d $BASEDIR/cache ]; then | |
518 | exiterror "Use make.sh downloadsrc first!" | |
519 | fi | |
520 | cd $BASEDIR/cache | |
521 | PACKAGE=`ls -v -r $TOOLCHAINNAME.tar.gz 2> /dev/null | head -n 1` | |
df5e82b3 | 522 | #only restore on a clean disk |
ca8da28e MT |
523 | |
524 | echo -ne "Building for ${BOLD}${MACHINE} on ${MACHINE_REAL}${NORMAL}\n" | |
525 | ||
3888140c | 526 | if [ -f $BASEDIR/log_${MACHINE}/02_base/stage2-LFS ]; then |
ca8da28e MT |
527 | prepareenv |
528 | echo "Using installed toolchain" >> $LOGFILE | |
529 | beautify message DONE "Stage toolchain already built or extracted" | |
530 | else | |
531 | if [ -z "$PACKAGE" ]; then | |
532 | echo "Full toolchain compilation" | tee -a $LOGFILE | |
df5e82b3 | 533 | prepareenv |
ca8da28e MT |
534 | |
535 | # Check if host can build the toolchain | |
536 | check_toolchain_prerequisites | |
537 | ||
538 | beautify build_stage "Building toolchain" | |
539 | toolchain_build | |
df5e82b3 | 540 | else |
ca8da28e MT |
541 | echo "Restore from $PACKAGE" | tee -a $LOGFILE |
542 | if [ `md5sum $BASEDIR/cache/$PACKAGE | awk '{print $1}'` == `cat $BASEDIR/cache/$TOOLCHAINNAME.md5 | awk '{print $1}'` ]; then | |
543 | cd $BASEDIR && tar zxf $BASEDIR/cache/$PACKAGE | |
df5e82b3 MT |
544 | prepareenv |
545 | else | |
ca8da28e | 546 | exiterror "$TOOLCHAINNAME md5 did not match, check downloaded package" |
df5e82b3 MT |
547 | fi |
548 | fi | |
ca8da28e MT |
549 | fi |
550 | ||
3888140c | 551 | if [ ! -e $BASEDIR/log_${MACHINE}/03_ipfire/stage3-LFS ]; then |
ca8da28e MT |
552 | beautify build_stage "Building base" |
553 | base_build | |
df5e82b3 | 554 | else |
ca8da28e | 555 | beautify message DONE "Stage base already built" |
df5e82b3 | 556 | fi |
5cfe86e6 | 557 | |
3888140c | 558 | if [ ! -e $BASEDIR/log_${MACHINE}/04_misc/stage4-LFS ]; then |
ca8da28e MT |
559 | beautify build_stage "Building $NAME" |
560 | ipfire_build | |
561 | else | |
562 | beautify message DONE "Stage ipfire already built" | |
563 | fi | |
5cfe86e6 | 564 | |
3888140c | 565 | if [ ! -e $BASEDIR/log_${MACHINE}/05_installer/stage5-LFS ]; then |
ca8da28e MT |
566 | beautify build_stage "Building miscellaneous" |
567 | misc_build | |
5cfe86e6 | 568 | else |
ca8da28e | 569 | beautify message DONE "Stage misc already built" |
5cfe86e6 HS |
570 | fi |
571 | ||
0b59f25c | 572 | beautify build_stage "Building installer" |
ca8da28e | 573 | installer_build |
15679d9f | 574 | |
0b59f25c | 575 | beautify build_stage "Building packages" |
ca8da28e MT |
576 | packages_build |
577 | ||
578 | echo "" | |
579 | echo "Burn a CD (floppy is too big) or use pxe to boot." | |
580 | echo "... and all this hard work for this:" | |
581 | du -bsh $BASEDIR/${SNAME}-${VERSION}*.${MACHINE}.iso | |
df5e82b3 | 582 | ;; |
ca8da28e | 583 | |
df5e82b3 MT |
584 | shell) |
585 | # enter a shell inside LFS chroot | |
586 | # may be used to changed kernel settings | |
587 | prepareenv | |
588 | entershell | |
589 | ;; | |
ca8da28e | 590 | |
df5e82b3 | 591 | changelog) |
d1dd6669 | 592 | echo -n "Loading new Changelog from SVN: " |
223ad6a4 | 593 | svn log http://svn.ipfire.org/svn/ipfire > doc/ChangeLog |
a50d04ab | 594 | beautify message DONE |
df5e82b3 | 595 | ;; |
ca8da28e | 596 | |
df5e82b3 | 597 | clean) |
ca8da28e MT |
598 | echo -ne "Cleaning ${BOLD}$MACHINE${NORMAL} buildtree" |
599 | for i in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'` | |
600 | do | |
df5e82b3 MT |
601 | $LOSETUP -d $i 2>/dev/null |
602 | done | |
ca8da28e MT |
603 | |
604 | for i in `mount | grep $BASEDIR | cut -d " " -f 1` | |
605 | do | |
df5e82b3 MT |
606 | umount $i |
607 | done | |
ca8da28e | 608 | |
df5e82b3 | 609 | stdumount |
ca8da28e MT |
610 | |
611 | for i in `seq 0 7` | |
612 | do | |
613 | if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then | |
614 | umount /dev/loop${i} 2>/dev/null; | |
615 | losetup -d /dev/loop${i} 2>/dev/null; | |
616 | fi; | |
df5e82b3 | 617 | done |
ca8da28e MT |
618 | |
619 | rm -rf $BASEDIR/build_${MACHINE} | |
620 | rm -rf $BASEDIR/log_${MACHINE} | |
f9315063 | 621 | rm -rf $BASEDIR/packages |
ca8da28e MT |
622 | |
623 | if [ -h $TOOLS_DIR ]; then | |
624 | rm -f $TOOLS_DIR | |
df5e82b3 | 625 | fi |
a50d04ab | 626 | beautify message DONE |
df5e82b3 | 627 | ;; |
ca8da28e | 628 | |
c3db995c | 629 | downloadsrc) |
be472d5a MT |
630 | LOGFILE=$BASEDIR/log_${MACHINE}/_build.preparation.log |
631 | ||
df5e82b3 MT |
632 | if [ ! -d $BASEDIR/cache ]; then |
633 | mkdir $BASEDIR/cache | |
634 | fi | |
be472d5a | 635 | mkdir -p $BASEDIR/log_${MACHINE} |
857d9bf2 | 636 | echo -e "${BOLD}Preload all source files${NORMAL}" | tee -a $LOGFILE |
df5e82b3 MT |
637 | FINISHED=0 |
638 | cd $BASEDIR/lfs | |
639 | for c in `seq $MAX_RETRIES`; do | |
640 | if (( FINISHED==1 )); then | |
641 | break | |
642 | fi | |
643 | FINISHED=1 | |
644 | cd $BASEDIR/lfs | |
645 | for i in *; do | |
646 | if [ -f "$i" -a "$i" != "Config" ]; then | |
e22c7973 | 647 | echo -ne "Loading $i" |
df5e82b3 MT |
648 | make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t ($c/$MAX_RETRIES)" download >> $LOGFILE 2>&1 |
649 | if [ $? -ne 0 ]; then | |
e22c7973 | 650 | beautify message FAIL |
df5e82b3 MT |
651 | FINISHED=0 |
652 | else | |
653 | if [ $c -eq 1 ]; then | |
e22c7973 | 654 | beautify message DONE |
df5e82b3 MT |
655 | fi |
656 | fi | |
657 | fi | |
658 | done | |
659 | done | |
e22c7973 | 660 | cd - >/dev/null 2>&1 |
df5e82b3 | 661 | ;; |
ca8da28e | 662 | |
df5e82b3 MT |
663 | toolchain) |
664 | prepareenv | |
ca8da28e MT |
665 | # Check if host can build the toolchain |
666 | check_toolchain_prerequisites | |
667 | toolchain_build | |
3888140c | 668 | echo "Create toolchain tar.bz for $MACHINE" | tee -a $LOGFILE |
ca8da28e MT |
669 | # Safer inside the chroot |
670 | echo -ne "Stripping lib" | |
671 | chroot $LFS $TOOLS_DIR/bin/find $TOOLS_DIR/lib \ | |
672 | -type f \( -name '*.so' -o -name '*.so[\.0-9]*' \) \ | |
673 | -exec $TOOLS_DIR/bin/strip --strip-debug {} \; 2>/dev/null | |
674 | beautify message DONE | |
675 | echo -ne "Stripping binaries" | |
676 | chroot $LFS $TOOLS_DIR/bin/find /usr/local /usr/src/binutils-build $TOOLS_DIR/bin $TOOLS_DIR/sbin \ | |
677 | -type f \ | |
678 | -exec $TOOLS_DIR/bin/strip --strip-all {} \; 2> /dev/null | |
679 | beautify message DONE | |
680 | stdumount | |
681 | echo -ne "Tar creation " | |
682 | cd $BASEDIR && tar cvj \ | |
683 | --exclude='log_${MACHINE}/_build.*.log' \ | |
684 | --file=cache/$TOOLCHAINNAME.tar.bz2 \ | |
685 | build_${MACHINE} \ | |
686 | log_${MACHINE} >> $LOGFILE | |
687 | beautify message DONE | |
688 | echo `ls -sh cache/$TOOLCHAINNAME.tar.bz2` | |
689 | md5sum cache/$TOOLCHAINNAME.tar.bz2 \ | |
690 | > cache/$TOOLCHAINNAME.md5 | |
691 | ||
df5e82b3 MT |
692 | stdumount |
693 | ;; | |
ca8da28e | 694 | |
df5e82b3 | 695 | gettoolchain) |
ca8da28e | 696 | if [ ! -f $BASEDIR/cache/toolchains/$TOOLCHAINNAME.tar.bz2 ]; then |
5bd13f01 | 697 | URL_TOOLCHAIN=`grep URL_TOOLCHAIN lfs/Config | awk '{ print $3 }'` |
712d859c | 698 | test -d $BASEDIR/cache/toolchains || mkdir $BASEDIR/cache/toolchains |
ca8da28e | 699 | echo "Load toolchain tar.bz2 for $MACHINE" | tee -a $LOGFILE |
712d859c | 700 | cd $BASEDIR/cache/toolchains |
ca8da28e | 701 | wget -c -nv $URL_TOOLCHAIN/$TOOLCHAINNAME.tar.bz2 $URL_TOOLCHAIN/$TOOLCHAINNAME.md5 |
712d859c | 702 | if [ $? -ne 0 ]; then |
ca8da28e MT |
703 | echo -ne "Error downloading toolchain for $MACHINE machine" | tee -a $LOGFILE |
704 | beautify message FAIL | |
705 | echo "Precompiled toolchain not always available for every MACHINE" | tee -a $LOGFILE | |
40a4ea4c | 706 | else |
ca8da28e MT |
707 | if [ "`md5sum $TOOLCHAINNAME.tar.bz2 | awk '{print $1}'`" = "`cat $TOOLCHAINNAME.md5 | awk '{print $1}'`" ]; then |
708 | beautify message DONE | |
709 | echo "Toolchain md5 ok" | tee -a $LOGFILE | |
712d859c | 710 | else |
ca8da28e | 711 | exiterror "$TOOLCHAINNAME.md5 did not match, check downloaded package" |
712d859c | 712 | fi |
40a4ea4c | 713 | fi |
712d859c | 714 | else |
ca8da28e MT |
715 | echo "Toolchain tar.bz2 for $MACHINE is already downloaded" | tee -a $LOGFILE |
716 | beautify message SKIP | |
df5e82b3 MT |
717 | fi |
718 | ;; | |
ca8da28e | 719 | |
15679d9f | 720 | othersrc) |
ce56e927 | 721 | prepareenv |
15679d9f | 722 | echo -ne "`date -u '+%b %e %T'`: Build sources iso for $MACHINE" | tee -a $LOGFILE |
ce56e927 MT |
723 | chroot $LFS /tools/bin/env -i HOME=/root \ |
724 | TERM=$TERM PS1='\u:\w\$ ' \ | |
725 | PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \ | |
726 | VERSION=$VERSION NAME="$NAME" SNAME="$SNAME" MACHINE=$MACHINE \ | |
727 | /bin/bash -x -c "cd /usr/src/lfs && make -f sources-iso LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1 | |
728 | mv $LFS/install/images/ipfire-* $BASEDIR >> $LOGFILE 2>&1 | |
15679d9f MT |
729 | if [ $? -eq "0" ]; then |
730 | beautify message DONE | |
731 | else | |
732 | beautify message FAIL | |
733 | fi | |
ce56e927 MT |
734 | stdumount |
735 | ;; | |
ca8da28e | 736 | |
c6cb9d25 MT |
737 | svn) |
738 | case "$2" in | |
739 | update|up) | |
cc0e56be | 740 | # clear |
15679d9f | 741 | echo -ne "Loading the latest source files...\n" |
7471f6ab MT |
742 | if [ $3 ]; then |
743 | svn update -r $3 | tee -a $PWD/log/_build.svn.update.log | |
744 | else | |
745 | svn update | tee -a $PWD/log/_build.svn.update.log | |
746 | fi | |
15679d9f MT |
747 | if [ $? -eq "0" ]; then |
748 | beautify message DONE | |
c6cb9d25 | 749 | else |
15679d9f | 750 | beautify message FAIL |
c6cb9d25 MT |
751 | exit 1 |
752 | fi | |
15679d9f | 753 | echo -ne "Writing the svn-info to a file" |
c6cb9d25 | 754 | svn info > $PWD/svn_status |
15679d9f MT |
755 | if [ $? -eq "0" ]; then |
756 | beautify message DONE | |
c6cb9d25 | 757 | else |
15679d9f | 758 | beautify message FAIL |
c6cb9d25 MT |
759 | exit 1 |
760 | fi | |
712d859c | 761 | chmod 755 $0 |
cc0e56be | 762 | exit 0 |
c6cb9d25 MT |
763 | ;; |
764 | commit|ci) | |
765 | clear | |
6b8cff41 MT |
766 | if [ -f /usr/bin/mcedit ]; then |
767 | export EDITOR=/usr/bin/mcedit | |
73d9a908 MT |
768 | fi |
769 | if [ -f /usr/bin/nano ]; then | |
770 | export EDITOR=/usr/bin/nano | |
6b8cff41 MT |
771 | fi |
772 | echo -ne "Selecting editor $EDITOR..." | |
773 | beautify message DONE | |
d79b46cb | 774 | if [ -e /sbin/yast ]; then |
028698e8 MT |
775 | if [ "`echo $SVN_REVISION | cut -c 3`" -eq "0" ]; then |
776 | $0 changelog | |
777 | fi | |
d79b46cb | 778 | fi |
8a5f0f44 | 779 | update_langs |
15679d9f | 780 | svn commit |
c6cb9d25 | 781 | $0 svn up |
1065bfea MT |
782 | if [ -n "$FTP_CACHE_URL" ]; then |
783 | $0 uploadsrc | |
784 | fi | |
c6cb9d25 MT |
785 | ;; |
786 | dist) | |
7471f6ab MT |
787 | if [ $3 ]; then |
788 | SVN_REVISION=$3 | |
789 | fi | |
790 | if [ -f ipfire-source-r$SVN_REVISION.tar.gz ]; then | |
791 | echo -ne "REV $SVN_REVISION: SKIPPED!\n" | |
792 | exit 0 | |
793 | fi | |
794 | echo -en "REV $SVN_REVISION: Downloading..." | |
223ad6a4 MT |
795 | svn export http://svn.ipfire.org/svn/ipfire/trunk ipfire-source/ --force > /dev/null |
796 | svn log http://svn.ipfire.org/svn/ipfire/trunk -r 1:$SVN_REVISION > ipfire-source/Changelog | |
797 | #svn info http://svn.ipfire.org/svn/ipfire/trunk -r $SVN_REVISION > ipfire-source/svn_status | |
15679d9f MT |
798 | evaluate 1 |
799 | ||
7471f6ab MT |
800 | echo -en "REV $SVN_REVISION: Compressing files..." |
801 | if [ -e ipfire-source/trunk/make.sh ]; then | |
802 | chmod 755 ipfire-source/trunk/make.sh | |
803 | fi | |
9dc02b38 | 804 | tar cfz ipfire-source-r$SVN_REVISION.tar.gz ipfire-source |
15679d9f | 805 | evaluate 1 |
7471f6ab | 806 | echo -en "REV $SVN_REVISION: Cleaning up..." |
c6cb9d25 | 807 | rm ipfire-source/ -r |
15679d9f | 808 | evaluate 1 |
7471f6ab | 809 | ;; |
028698e8 | 810 | diff|di) |
1a8688ba | 811 | update_langs |
15679d9f | 812 | echo -ne "Make a local diff to last svn revision" |
c6cb9d25 | 813 | svn diff > ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff |
15679d9f | 814 | evaluate 1 |
c6cb9d25 | 815 | echo "Diff was successfully saved to ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff" |
bf7c473f | 816 | svn status |
c6cb9d25 MT |
817 | ;; |
818 | esac | |
f9315063 | 819 | ;; |
ca8da28e | 820 | |
15679d9f MT |
821 | uploadsrc) |
822 | PWD=`pwd` | |
823 | cd $BASEDIR/cache/ | |
824 | echo -e "Uploading cache to ftp server:" | |
3888140c MT |
825 | for i in *; do |
826 | echo "${i}" | fgrep -q .md5 && continue | |
827 | [ -e ${i}.md5 ] && continue | |
828 | md5sum ${i} | tee ${i}.md5 | |
829 | done | |
fd1b8061 | 830 | ncftpls -u $FTP_CACHE_USER -p $FTP_CACHE_PASS ftp://$FTP_CACHE_URL/$FTP_CACHE_PATH/ > /tmp/ftplist |
15679d9f | 831 | for i in *; do |
fd1b8061 MT |
832 | if [ "$(basename $i)" == "toolchains" ]; then continue; fi |
833 | grep -q $(basename $i) /tmp/ftplist | |
0eab8e84 | 834 | if [ "$?" -ne "0" ]; then |
fd1b8061 MT |
835 | echo -ne "$(basename $i)" |
836 | ncftpput -u $FTP_CACHE_USER -p $FTP_CACHE_PASS $FTP_CACHE_URL $FTP_CACHE_PATH/ $(basename $i) | |
6fb8ec08 | 837 | if [ "$?" -ne "0" ]; then |
15679d9f | 838 | beautify message FAIL |
0eab8e84 MT |
839 | fi |
840 | fi | |
841 | done | |
6fb8ec08 | 842 | rm -f /tmp/ftplist |
15679d9f MT |
843 | cd $PWD |
844 | exit 0 | |
0eab8e84 | 845 | ;; |
ca8da28e | 846 | |
cc0e56be | 847 | upload) |
b2c64f8c MT |
848 | FTP_ISO_PORT=`echo "$FTP_ISO_URL" | awk -F: '{ print $2 }'` |
849 | FTP_ISO_URL=`echo "$FTP_ISO_URL" | awk -F: '{ print $1 }'` | |
850 | if [ -z $FTP_ISO_PORT ]; then | |
851 | FTP_ISO_PORT=21 | |
852 | fi | |
853 | cat <<EOF > .ftp-commands | |
de2c999d | 854 | mkdir -p $FTP_ISO_PATH$SVN_REVISION |
b2c64f8c | 855 | mkdir -p $FTP_ISO_PATH$SVN_REVISION/paks |
9dc02b38 MT |
856 | quit |
857 | EOF | |
b2c64f8c MT |
858 | ncftp -u $FTP_ISO_USER -p $FTP_ISO_PASS -P $FTP_ISO_PORT $FTP_ISO_URL < .ftp-commands |
859 | rm -f .ftp-commands | |
860 | ||
861 | case "$2" in | |
862 | iso) | |
863 | echo -e "Uploading the iso to $FTP_ISO_PATH/$SVN_REVISION." | |
864 | ||
8f55c54e | 865 | md5sum ipfire-$VERSION.$MACHINE-full.iso > ipfire-$VERSION.$MACHINE-full.iso.md5 |
dff9df9d MT |
866 | for i in svn_status ipfire-source-r$SVN_REVISION.tar.gz ipfire-$VERSION.$MACHINE-full.iso ipfire-$VERSION.$MACHINE-full.iso.md5 ipfire-$VERSION.$MACHINE-devel.iso ipfire-$VERSION.$MACHINE-devel.iso.md5; do |
867 | if [ -e "$i" ]; then | |
b2c64f8c MT |
868 | ncftpput -u $FTP_ISO_USER -p $FTP_ISO_PASS -P $FTP_ISO_PORT $FTP_ISO_URL $FTP_ISO_PATH$SVN_REVISION/ $i |
869 | if [ "$?" -eq "0" ]; then | |
870 | echo "The file with name $i was successfully uploaded to $FTP_ISO_URL$FTP_ISO_PATH$SVN_REVISION/." | |
871 | else | |
872 | echo "There was an error while uploading the file $i to the ftp server." | |
873 | exit 1 | |
874 | fi | |
dff9df9d | 875 | fi |
b2c64f8c | 876 | done |
a4c9c660 | 877 | rm -f ipfire-$VERSION.$MACHINE-full.iso.md5 |
6aae8d61 | 878 | if [ "$3" = "--with-sources-cd" ]; then |
b2c64f8c | 879 | ncftpput -u $FTP_ISO_USER -p $FTP_ISO_PASS -P $FTP_ISO_PORT $FTP_ISO_URL $FTP_ISO_PATH/$SVN_REVISION/ ipfire-sources-cd-$VERSION.$MACHINE.iso |
6aae8d61 | 880 | fi |
cc0e56be MT |
881 | ;; |
882 | paks) | |
b2c64f8c | 883 | ncftpput -u $FTP_ISO_USER -p $FTP_ISO_PASS -P $FTP_ISO_PORT $FTP_ISO_URL $FTP_ISO_PATH$SVN_REVISION/paks packages/* |
cc0e56be | 884 | if [ "$?" -eq "0" ]; then |
822c5bd0 | 885 | echo -e "The packages were successfully uploaded to $FTP_ISO_URL$FTP_ISO_PATH$SVN_REVISION/." |
cc0e56be MT |
886 | else |
887 | echo -e "There was an error while uploading the packages to the ftp server." | |
712d859c | 888 | exit 1 |
cc0e56be MT |
889 | fi |
890 | ;; | |
891 | esac | |
0d0521b6 | 892 | ;; |
ca8da28e | 893 | |
cc0e56be | 894 | batch) |
c8582074 | 895 | if [ "$2" = "--background" ]; then |
15679d9f MT |
896 | batch_script |
897 | exit $? | |
898 | fi | |
27ac55bf | 899 | if [ `screen -ls | grep -q ipfire` ]; then |
712d859c MT |
900 | echo "Build is already running, sorry!" |
901 | exit 1 | |
902 | else | |
27ac55bf MT |
903 | if [ "$2" = "--rebuild" ]; then |
904 | export IPFIRE_REBUILD=1 | |
905 | echo "REBUILD!" | |
906 | else | |
907 | export IPFIRE_REBUILD=0 | |
908 | fi | |
15679d9f MT |
909 | echo -en "${BOLD}***IPFire-Batch-Build is starting...${NORMAL}" |
910 | screen -dmS ipfire $0 batch --background | |
911 | evaluate 1 | |
712d859c MT |
912 | exit 0 |
913 | fi | |
cc0e56be | 914 | ;; |
ca8da28e MT |
915 | |
916 | watch|attach) | |
15679d9f | 917 | watch_screen |
028698e8 | 918 | ;; |
ca8da28e | 919 | |
6b8cff41 | 920 | *) |
6b8cff41 MT |
921 | cat doc/make.sh-usage |
922 | ;; | |
ca8da28e | 923 | |
3ea75603 | 924 | esac |