]>
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 | |
246556fe | 147 | ipfire_make udev ## NEED TO INSTALL CONFIG |
ca8da28e MT |
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 | |
246556fe MT |
162 | |
163 | ### Building the configuration dirs and files | |
164 | # | |
165 | ipfire_make stage3 | |
166 | ||
167 | ### Building the kernel stuff | |
168 | # | |
f76aefec | 169 | ipfire_make linux |
246556fe | 170 | |
a97daddb MT |
171 | ### Building pkg-config |
172 | # | |
173 | ipfire_make pkg-config | |
174 | ||
246556fe MT |
175 | ### Building some network stuff |
176 | # | |
177 | ipfire_make libpcap | |
178 | ipfire_make linux-atm | |
179 | ipfire_make ppp | |
180 | ipfire_make rp-pppoe | |
181 | ipfire_make dhcp | |
182 | ipfire_make iptables | |
a97daddb MT |
183 | ipfire_make libnfnetlink |
184 | ipfire_make libnetfilter_queue | |
185 | ipfire_make libnetfilter_conntrack | |
246556fe | 186 | ipfire_make dnsmasq |
a97daddb MT |
187 | ipfire_make l7-protocols |
188 | ipfire_make iptstate | |
189 | ipfire_make bridge-utils | |
190 | ipfire_make vlan | |
246556fe MT |
191 | |
192 | ### Building some general stuff | |
193 | # | |
194 | ipfire_make openssl | |
195 | ipfire_make pam PASS=1 | |
196 | ipfire_make shadow | |
197 | ipfire_make pam PASS=2 | |
198 | ||
b8b94b55 | 199 | #ipfire_make libidn ### Do we need this? |
246556fe MT |
200 | ipfire_make pcre |
201 | ipfire_make popt | |
202 | ipfire_make python | |
203 | ipfire_make libxml2 | |
204 | ipfire_make libxslt | |
205 | ipfire_make slang | |
206 | ipfire_make newt | |
207 | ipfire_make cyrus-sasl | |
208 | ipfire_make openldap | |
209 | ipfire_make sqlite | |
210 | ipfire_make curl | |
211 | ipfire_make libusb | |
212 | ipfire_make gnupg | |
213 | ipfire_make sudo | |
214 | #ipfire_make libjpeg ### Do we need this? | |
215 | ipfire_make libpng | |
216 | ipfire_make libtiff | |
217 | ipfire_make libart | |
218 | ipfire_make freetype | |
219 | ipfire_make lzo | |
b8b94b55 MT |
220 | ipfire_make lsof |
221 | ipfire_make br2684ctl | |
222 | ipfire_make etherwake | |
223 | ipfire_make htop | |
224 | ipfire_make beep | |
246556fe MT |
225 | |
226 | ### Building filesystem stuff | |
227 | # | |
228 | ipfire_make reiserfsprogs | |
229 | ipfire_make libaal | |
230 | ipfire_make reiser4progs | |
a97daddb | 231 | ipfire_make xfsprogs |
246556fe MT |
232 | |
233 | ### Building hardware utils | |
234 | # | |
235 | ipfire_make pciutils | |
236 | ipfire_make usbutils | |
237 | ipfire_make hdparm | |
238 | ipfire_make kudzu | |
b8b94b55 | 239 | ipfire_make smartmontools |
246556fe MT |
240 | |
241 | ### Building some important tools | |
242 | # | |
243 | ipfire_make fcron | |
244 | ipfire_make which | |
245 | ipfire_make nano | |
246 | ipfire_make screen | |
247 | ipfire_make rrdtool | |
248 | ipfire_make ntp ### Needs config. | |
249 | ipfire_make openssh | |
b8b94b55 MT |
250 | ipfire_make ez-ipupdate |
251 | ipfire_make noip | |
252 | ipfire_make lighttpd | |
246556fe MT |
253 | |
254 | ### Programs that are still for discussion | |
255 | # package or in the standard system | |
256 | # | |
257 | ## NTFS | |
258 | #ipfire_make fuse | |
259 | #ipfire_make ntfs-3g | |
260 | # | |
261 | ## Net tools | |
262 | #ipfire_make bwm-ng | |
263 | #ipfire_make openvpn | |
264 | # | |
265 | ## UPNP | |
266 | #ipfire_make libupnp | |
267 | #ipfire_make linux-igd | |
268 | ||
269 | #ipfire_make pakfire | |
270 | #ipfire_make initscripts | |
271 | ||
f76aefec | 272 | exiterror "Stop here." |
246556fe | 273 | |
ca8da28e | 274 | ipfire_make backup |
ca8da28e | 275 | ipfire_make unzip |
ca8da28e | 276 | ipfire_make pkg-config |
ca8da28e | 277 | ipfire_make cpio |
ca8da28e | 278 | ipfire_make expat |
ca8da28e | 279 | ipfire_make gmp |
ca8da28e | 280 | ipfire_make gd |
ca8da28e | 281 | ipfire_make libcap |
246556fe | 282 | |
ca8da28e MT |
283 | ipfire_make bind |
284 | ipfire_make cdrtools | |
ca8da28e | 285 | ipfire_make dosfstools |
ca8da28e | 286 | ipfire_make sysfsutils |
ca8da28e | 287 | ipfire_make mtools |
ca8da28e | 288 | ipfire_make mISDN |
ca8da28e MT |
289 | ipfire_make logrotate |
290 | ipfire_make logwatch | |
ca8da28e | 291 | ipfire_make nasm |
ca8da28e | 292 | ipfire_make glib |
246556fe | 293 | |
ca8da28e MT |
294 | ipfire_make wireless |
295 | ipfire_make libsafe | |
246556fe MT |
296 | } |
297 | ||
298 | ################################################################################ | |
299 | # This builds the entire stage "misc" # | |
300 | ################################################################################ | |
301 | misc_build() { | |
302 | ||
303 | PATH=/usr/local/ccache/bin:/usr/local/distcc/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/${MACHINE_REAL}-linux/bin | |
304 | STAGE_ORDER=04 | |
305 | STAGE=misc | |
306 | ||
307 | LOGFILE="$BASEDIR/log_${MACHINE}/_build.misc.log" | |
308 | export LOGFILE | |
309 | ||
310 | ipfire_make stage4 | |
311 | ||
312 | #ipfire_make snort | |
313 | #ipfire_make oinkmaster | |
314 | #ipfire_make squid | |
315 | #ipfire_make squid-graph | |
316 | #ipfire_make squidguard | |
317 | #ipfire_make calamaris | |
318 | ipfire_make tcpdump | |
319 | ipfire_make traceroute | |
320 | ipfire_make vsftpd | |
321 | ipfire_make centerim | |
322 | ipfire_make ncftp | |
323 | ipfire_make tripwire | |
324 | ipfire_make java | |
ca8da28e | 325 | ipfire_make spandsp |
ca8da28e MT |
326 | ipfire_make cups |
327 | ipfire_make ghostscript | |
328 | ipfire_make foomatic | |
329 | ipfire_make hplip | |
330 | ipfire_make samba | |
ca8da28e MT |
331 | ipfire_make mc |
332 | ipfire_make wget | |
ca8da28e MT |
333 | ipfire_make postfix |
334 | ipfire_make fetchmail | |
335 | ipfire_make cyrus-imapd | |
ca8da28e | 336 | ipfire_make clamav |
ca8da28e MT |
337 | ipfire_make alsa |
338 | ipfire_make mpg123 | |
339 | ipfire_make mpfire | |
340 | ipfire_make guardian | |
341 | ipfire_make libid3tag | |
342 | ipfire_make libmad | |
343 | ipfire_make libogg | |
344 | ipfire_make libvorbis | |
345 | ipfire_make lame | |
346 | ipfire_make sox | |
347 | ipfire_make libshout | |
348 | ipfire_make icecast | |
349 | ipfire_make icegenerator | |
350 | ipfire_make mpd | |
351 | ipfire_make mpc | |
352 | ipfire_make xvid | |
353 | ipfire_make libmpeg2 | |
354 | ipfire_make videolan | |
355 | ipfire_make libpri | |
356 | ipfire_make asterisk | |
357 | ipfire_make gnump3d | |
358 | ipfire_make libsigc++ | |
359 | ipfire_make applejuice | |
360 | ipfire_make ocaml | |
361 | ipfire_make mldonkey | |
362 | ipfire_make libtorrent | |
363 | ipfire_make rtorrent | |
364 | ipfire_make ipfireseeder | |
365 | ipfire_make rsync | |
ca8da28e MT |
366 | ipfire_make nfs |
367 | ipfire_make nmap | |
ca8da28e | 368 | |
ca8da28e MT |
369 | ipfire_make cdrtools |
370 | ipfire_make syslinux | |
371 | ipfire_make parted | |
372 | ipfire_make slang | |
373 | ipfire_make newt | |
df5e82b3 MT |
374 | } |
375 | ||
ca8da28e MT |
376 | ################################################################################ |
377 | # This builds the entire stage "installer" # | |
378 | ################################################################################ | |
379 | installer_build() { | |
380 | ||
381 | PATH=/usr/local/ccache/bin:/usr/local/distcc/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/${MACHINE_REAL}-linux/bin | |
382 | STAGE_ORDER=05 | |
383 | STAGE=installer | |
384 | ||
385 | LOGFILE="$BASEDIR/log_${MACHINE}/_build.installer.log" | |
386 | export LOGFILE | |
246556fe MT |
387 | |
388 | #ipfire_make klibc ##### Maybe this will be in the installer | |
389 | #ipfire_make mkinitcpio | |
390 | #ipfire_make udev KLIBC=1 | |
ca8da28e MT |
391 | |
392 | ipfire_make as86 | |
393 | ipfire_make mbr | |
394 | ipfire_make memtest | |
395 | ipfire_make linux-libc-header | |
396 | ipfire_make binutils | |
397 | ipfire_make uClibc PASS=1 | |
398 | ipfire_make gcc INST=1 | |
399 | ipfire_make uClibc PASS=2 | |
400 | ipfire_make gcc INST=2 | |
401 | ipfire_make uClibc PASS=3 | |
402 | ipfire_make busybox | |
403 | ipfire_make udev | |
404 | ipfire_make gettext | |
405 | ipfire_make kbd | |
406 | ipfire_make popt | |
407 | ipfire_make sysvinit | |
408 | ipfire_make misc-progs | |
409 | ipfire_make libaal | |
410 | ipfire_make reiser4progs | |
411 | ipfire_make reiserfsprogs | |
412 | ipfire_make sysfsutils | |
413 | ipfire_make util-linux | |
414 | ipfire_make pciutils | |
415 | ipfire_make zlib | |
416 | ipfire_make mtd | |
417 | ipfire_make wget | |
418 | ipfire_make hwdata | |
419 | ipfire_make kudzu | |
420 | ipfire_make installer | |
421 | ipfire_make initrd | |
df5e82b3 MT |
422 | } |
423 | ||
ca8da28e MT |
424 | ################################################################################ |
425 | # This builds the entire stage "packages" # | |
426 | ################################################################################ | |
427 | packages_build() { | |
df5e82b3 | 428 | |
ca8da28e MT |
429 | PATH=/usr/local/ccache/bin:/usr/local/distcc/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/${MACHINE_REAL}-linux/bin |
430 | STAGE_ORDER=06 | |
431 | STAGE=packages | |
df5e82b3 | 432 | |
ca8da28e MT |
433 | LOGFILE="$BASEDIR/log_${MACHINE}/_build.packages.log" |
434 | export LOGFILE | |
435 | ||
df5e82b3 | 436 | echo "... see detailed log in _build.*.log files" >> $LOGFILE |
0fbb45e9 | 437 | |
ca8da28e | 438 | ipfire_make strip |
df5e82b3 MT |
439 | |
440 | # Generating list of packages used | |
0fbb45e9 | 441 | echo -n "Generating packages list from logs" | tee -a $LOGFILE |
df5e82b3 MT |
442 | rm -f $BASEDIR/doc/packages-list |
443 | for i in `ls -1tr $BASEDIR/log/[^_]*`; do | |
444 | if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then | |
7471f6ab | 445 | echo "* `basename $i`" >>$BASEDIR/doc/packages-list |
df5e82b3 MT |
446 | fi |
447 | done | |
7471f6ab | 448 | echo "== List of softwares used to build $NAME Version: $VERSION ==" > $BASEDIR/doc/packages-list.txt |
4fe9acb2 | 449 | 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 |
450 | $BASEDIR/doc/packages-list | sort >> $BASEDIR/doc/packages-list.txt |
451 | rm -f $BASEDIR/doc/packages-list | |
c9673262 | 452 | # packages-list.txt is ready to be displayed for wiki page |
0fbb45e9 | 453 | beautify message DONE |
df5e82b3 | 454 | |
9607771a | 455 | # Create images for install |
ca8da28e | 456 | ipfire_make cdrom ED=full |
74dbbc36 | 457 | |
4dc82852 | 458 | # Check if there is a loop device for building in virtual environments |
eedc26d9 | 459 | if [ -e /dev/loop/0 ] || [ -e /dev/loop0 ]; then |
ca8da28e | 460 | ipfire_make usb-stick |
4dc82852 | 461 | fi |
4dc82852 | 462 | mv $LFS/install/images/{*.iso,*.tgz,*.img.gz} $BASEDIR >> $LOGFILE 2>&1 |
c9673262 | 463 | |
0d909a4a | 464 | ipfirepackages |
e67a57fe MT |
465 | |
466 | # Cleanup | |
467 | stdumount | |
468 | rm -rf $BASEDIR/build/tmp/* | |
469 | ||
470 | # Generating total list of files | |
0d909a4a | 471 | echo -n "Generating files list from logs" | tee -a $LOGFILE |
e67a57fe MT |
472 | rm -f $BASEDIR/log/FILES |
473 | for i in `ls -1tr $BASEDIR/log/[^_]*`; do | |
474 | if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then | |
475 | echo "##" >>$BASEDIR/log/FILES | |
476 | echo "## `basename $i`" >>$BASEDIR/log/FILES | |
477 | echo "##" >>$BASEDIR/log/FILES | |
478 | cat $i | sed "s%^\./%#%" | sort >> $BASEDIR/log/FILES | |
479 | fi | |
480 | done | |
0d909a4a | 481 | beautify message DONE |
e67a57fe MT |
482 | |
483 | cd $PWD | |
e67a57fe MT |
484 | } |
485 | ||
486 | ipfirepackages() { | |
ca8da28e | 487 | ipfire_make core-updates |
fe7fe395 | 488 | for i in $(ls -1 $BASEDIR/config/rootfiles/packages); do |
453b418b | 489 | if [ -e $BASEDIR/lfs/$i ]; then |
ca8da28e | 490 | ipfire_dist $i |
453b418b MT |
491 | else |
492 | echo -n $i | |
493 | beautify message SKIP | |
494 | fi | |
fe7fe395 | 495 | done |
78331e30 | 496 | test -d $BASEDIR/packages || mkdir $BASEDIR/packages |
5c8cfc99 | 497 | mv -f $LFS/install/packages/* $BASEDIR/packages >> $LOGFILE 2>&1 |
483f59cd | 498 | rm -rf $BASEDIR/build/install/packages/* |
df5e82b3 MT |
499 | } |
500 | ||
501 | # See what we're supposed to do | |
502 | case "$1" in | |
503 | build) | |
9729e787 | 504 | clear |
ca8da28e MT |
505 | #a prebuilt toolchain package is only used if found in cache |
506 | if [ ! -d $BASEDIR/cache ]; then | |
507 | exiterror "Use make.sh downloadsrc first!" | |
508 | fi | |
509 | cd $BASEDIR/cache | |
510 | PACKAGE=`ls -v -r $TOOLCHAINNAME.tar.gz 2> /dev/null | head -n 1` | |
df5e82b3 | 511 | #only restore on a clean disk |
ca8da28e MT |
512 | |
513 | echo -ne "Building for ${BOLD}${MACHINE} on ${MACHINE_REAL}${NORMAL}\n" | |
514 | ||
3888140c | 515 | if [ -f $BASEDIR/log_${MACHINE}/02_base/stage2-LFS ]; then |
ca8da28e MT |
516 | prepareenv |
517 | echo "Using installed toolchain" >> $LOGFILE | |
518 | beautify message DONE "Stage toolchain already built or extracted" | |
519 | else | |
520 | if [ -z "$PACKAGE" ]; then | |
521 | echo "Full toolchain compilation" | tee -a $LOGFILE | |
df5e82b3 | 522 | prepareenv |
ca8da28e MT |
523 | |
524 | # Check if host can build the toolchain | |
525 | check_toolchain_prerequisites | |
526 | ||
527 | beautify build_stage "Building toolchain" | |
528 | toolchain_build | |
df5e82b3 | 529 | else |
ca8da28e MT |
530 | echo "Restore from $PACKAGE" | tee -a $LOGFILE |
531 | if [ `md5sum $BASEDIR/cache/$PACKAGE | awk '{print $1}'` == `cat $BASEDIR/cache/$TOOLCHAINNAME.md5 | awk '{print $1}'` ]; then | |
532 | cd $BASEDIR && tar zxf $BASEDIR/cache/$PACKAGE | |
df5e82b3 MT |
533 | prepareenv |
534 | else | |
ca8da28e | 535 | exiterror "$TOOLCHAINNAME md5 did not match, check downloaded package" |
df5e82b3 MT |
536 | fi |
537 | fi | |
ca8da28e MT |
538 | fi |
539 | ||
3888140c | 540 | if [ ! -e $BASEDIR/log_${MACHINE}/03_ipfire/stage3-LFS ]; then |
ca8da28e MT |
541 | beautify build_stage "Building base" |
542 | base_build | |
df5e82b3 | 543 | else |
ca8da28e | 544 | beautify message DONE "Stage base already built" |
df5e82b3 | 545 | fi |
5cfe86e6 | 546 | |
3888140c | 547 | if [ ! -e $BASEDIR/log_${MACHINE}/04_misc/stage4-LFS ]; then |
ca8da28e MT |
548 | beautify build_stage "Building $NAME" |
549 | ipfire_build | |
550 | else | |
551 | beautify message DONE "Stage ipfire already built" | |
552 | fi | |
5cfe86e6 | 553 | |
3888140c | 554 | if [ ! -e $BASEDIR/log_${MACHINE}/05_installer/stage5-LFS ]; then |
ca8da28e MT |
555 | beautify build_stage "Building miscellaneous" |
556 | misc_build | |
5cfe86e6 | 557 | else |
ca8da28e | 558 | beautify message DONE "Stage misc already built" |
5cfe86e6 HS |
559 | fi |
560 | ||
0b59f25c | 561 | beautify build_stage "Building installer" |
ca8da28e | 562 | installer_build |
15679d9f | 563 | |
0b59f25c | 564 | beautify build_stage "Building packages" |
ca8da28e MT |
565 | packages_build |
566 | ||
567 | echo "" | |
568 | echo "Burn a CD (floppy is too big) or use pxe to boot." | |
569 | echo "... and all this hard work for this:" | |
570 | du -bsh $BASEDIR/${SNAME}-${VERSION}*.${MACHINE}.iso | |
df5e82b3 | 571 | ;; |
ca8da28e | 572 | |
df5e82b3 MT |
573 | shell) |
574 | # enter a shell inside LFS chroot | |
575 | # may be used to changed kernel settings | |
576 | prepareenv | |
577 | entershell | |
578 | ;; | |
ca8da28e | 579 | |
df5e82b3 | 580 | changelog) |
d1dd6669 | 581 | echo -n "Loading new Changelog from SVN: " |
223ad6a4 | 582 | svn log http://svn.ipfire.org/svn/ipfire > doc/ChangeLog |
a50d04ab | 583 | beautify message DONE |
df5e82b3 | 584 | ;; |
ca8da28e | 585 | |
df5e82b3 | 586 | clean) |
ca8da28e MT |
587 | echo -ne "Cleaning ${BOLD}$MACHINE${NORMAL} buildtree" |
588 | for i in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'` | |
589 | do | |
df5e82b3 MT |
590 | $LOSETUP -d $i 2>/dev/null |
591 | done | |
ca8da28e MT |
592 | |
593 | for i in `mount | grep $BASEDIR | cut -d " " -f 1` | |
594 | do | |
df5e82b3 MT |
595 | umount $i |
596 | done | |
ca8da28e | 597 | |
df5e82b3 | 598 | stdumount |
ca8da28e MT |
599 | |
600 | for i in `seq 0 7` | |
601 | do | |
602 | if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then | |
603 | umount /dev/loop${i} 2>/dev/null; | |
604 | losetup -d /dev/loop${i} 2>/dev/null; | |
605 | fi; | |
df5e82b3 | 606 | done |
ca8da28e MT |
607 | |
608 | rm -rf $BASEDIR/build_${MACHINE} | |
609 | rm -rf $BASEDIR/log_${MACHINE} | |
f9315063 | 610 | rm -rf $BASEDIR/packages |
ca8da28e MT |
611 | |
612 | if [ -h $TOOLS_DIR ]; then | |
613 | rm -f $TOOLS_DIR | |
df5e82b3 | 614 | fi |
a50d04ab | 615 | beautify message DONE |
df5e82b3 | 616 | ;; |
ca8da28e | 617 | |
c3db995c | 618 | downloadsrc) |
be472d5a MT |
619 | LOGFILE=$BASEDIR/log_${MACHINE}/_build.preparation.log |
620 | ||
df5e82b3 MT |
621 | if [ ! -d $BASEDIR/cache ]; then |
622 | mkdir $BASEDIR/cache | |
623 | fi | |
be472d5a | 624 | mkdir -p $BASEDIR/log_${MACHINE} |
857d9bf2 | 625 | echo -e "${BOLD}Preload all source files${NORMAL}" | tee -a $LOGFILE |
df5e82b3 MT |
626 | FINISHED=0 |
627 | cd $BASEDIR/lfs | |
628 | for c in `seq $MAX_RETRIES`; do | |
629 | if (( FINISHED==1 )); then | |
630 | break | |
631 | fi | |
632 | FINISHED=1 | |
633 | cd $BASEDIR/lfs | |
634 | for i in *; do | |
635 | if [ -f "$i" -a "$i" != "Config" ]; then | |
e22c7973 | 636 | echo -ne "Loading $i" |
df5e82b3 MT |
637 | make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t ($c/$MAX_RETRIES)" download >> $LOGFILE 2>&1 |
638 | if [ $? -ne 0 ]; then | |
e22c7973 | 639 | beautify message FAIL |
df5e82b3 MT |
640 | FINISHED=0 |
641 | else | |
642 | if [ $c -eq 1 ]; then | |
e22c7973 | 643 | beautify message DONE |
df5e82b3 MT |
644 | fi |
645 | fi | |
646 | fi | |
647 | done | |
648 | done | |
e22c7973 | 649 | cd - >/dev/null 2>&1 |
df5e82b3 | 650 | ;; |
ca8da28e | 651 | |
df5e82b3 MT |
652 | toolchain) |
653 | prepareenv | |
ca8da28e MT |
654 | # Check if host can build the toolchain |
655 | check_toolchain_prerequisites | |
656 | toolchain_build | |
3888140c | 657 | echo "Create toolchain tar.bz for $MACHINE" | tee -a $LOGFILE |
ca8da28e MT |
658 | # Safer inside the chroot |
659 | echo -ne "Stripping lib" | |
660 | chroot $LFS $TOOLS_DIR/bin/find $TOOLS_DIR/lib \ | |
661 | -type f \( -name '*.so' -o -name '*.so[\.0-9]*' \) \ | |
662 | -exec $TOOLS_DIR/bin/strip --strip-debug {} \; 2>/dev/null | |
663 | beautify message DONE | |
664 | echo -ne "Stripping binaries" | |
665 | chroot $LFS $TOOLS_DIR/bin/find /usr/local /usr/src/binutils-build $TOOLS_DIR/bin $TOOLS_DIR/sbin \ | |
666 | -type f \ | |
667 | -exec $TOOLS_DIR/bin/strip --strip-all {} \; 2> /dev/null | |
668 | beautify message DONE | |
669 | stdumount | |
670 | echo -ne "Tar creation " | |
671 | cd $BASEDIR && tar cvj \ | |
672 | --exclude='log_${MACHINE}/_build.*.log' \ | |
673 | --file=cache/$TOOLCHAINNAME.tar.bz2 \ | |
674 | build_${MACHINE} \ | |
675 | log_${MACHINE} >> $LOGFILE | |
676 | beautify message DONE | |
677 | echo `ls -sh cache/$TOOLCHAINNAME.tar.bz2` | |
678 | md5sum cache/$TOOLCHAINNAME.tar.bz2 \ | |
679 | > cache/$TOOLCHAINNAME.md5 | |
680 | ||
df5e82b3 MT |
681 | stdumount |
682 | ;; | |
ca8da28e | 683 | |
df5e82b3 | 684 | gettoolchain) |
ca8da28e | 685 | if [ ! -f $BASEDIR/cache/toolchains/$TOOLCHAINNAME.tar.bz2 ]; then |
5bd13f01 | 686 | URL_TOOLCHAIN=`grep URL_TOOLCHAIN lfs/Config | awk '{ print $3 }'` |
712d859c | 687 | test -d $BASEDIR/cache/toolchains || mkdir $BASEDIR/cache/toolchains |
ca8da28e | 688 | echo "Load toolchain tar.bz2 for $MACHINE" | tee -a $LOGFILE |
712d859c | 689 | cd $BASEDIR/cache/toolchains |
ca8da28e | 690 | wget -c -nv $URL_TOOLCHAIN/$TOOLCHAINNAME.tar.bz2 $URL_TOOLCHAIN/$TOOLCHAINNAME.md5 |
712d859c | 691 | if [ $? -ne 0 ]; then |
ca8da28e MT |
692 | echo -ne "Error downloading toolchain for $MACHINE machine" | tee -a $LOGFILE |
693 | beautify message FAIL | |
694 | echo "Precompiled toolchain not always available for every MACHINE" | tee -a $LOGFILE | |
40a4ea4c | 695 | else |
ca8da28e MT |
696 | if [ "`md5sum $TOOLCHAINNAME.tar.bz2 | awk '{print $1}'`" = "`cat $TOOLCHAINNAME.md5 | awk '{print $1}'`" ]; then |
697 | beautify message DONE | |
698 | echo "Toolchain md5 ok" | tee -a $LOGFILE | |
712d859c | 699 | else |
ca8da28e | 700 | exiterror "$TOOLCHAINNAME.md5 did not match, check downloaded package" |
712d859c | 701 | fi |
40a4ea4c | 702 | fi |
712d859c | 703 | else |
ca8da28e MT |
704 | echo "Toolchain tar.bz2 for $MACHINE is already downloaded" | tee -a $LOGFILE |
705 | beautify message SKIP | |
df5e82b3 MT |
706 | fi |
707 | ;; | |
ca8da28e | 708 | |
15679d9f | 709 | othersrc) |
ce56e927 | 710 | prepareenv |
15679d9f | 711 | echo -ne "`date -u '+%b %e %T'`: Build sources iso for $MACHINE" | tee -a $LOGFILE |
ce56e927 MT |
712 | chroot $LFS /tools/bin/env -i HOME=/root \ |
713 | TERM=$TERM PS1='\u:\w\$ ' \ | |
714 | PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \ | |
715 | VERSION=$VERSION NAME="$NAME" SNAME="$SNAME" MACHINE=$MACHINE \ | |
716 | /bin/bash -x -c "cd /usr/src/lfs && make -f sources-iso LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1 | |
717 | mv $LFS/install/images/ipfire-* $BASEDIR >> $LOGFILE 2>&1 | |
15679d9f MT |
718 | if [ $? -eq "0" ]; then |
719 | beautify message DONE | |
720 | else | |
721 | beautify message FAIL | |
722 | fi | |
ce56e927 MT |
723 | stdumount |
724 | ;; | |
ca8da28e | 725 | |
c6cb9d25 MT |
726 | svn) |
727 | case "$2" in | |
728 | update|up) | |
cc0e56be | 729 | # clear |
15679d9f | 730 | echo -ne "Loading the latest source files...\n" |
7471f6ab MT |
731 | if [ $3 ]; then |
732 | svn update -r $3 | tee -a $PWD/log/_build.svn.update.log | |
733 | else | |
734 | svn update | tee -a $PWD/log/_build.svn.update.log | |
735 | fi | |
15679d9f MT |
736 | if [ $? -eq "0" ]; then |
737 | beautify message DONE | |
c6cb9d25 | 738 | else |
15679d9f | 739 | beautify message FAIL |
c6cb9d25 MT |
740 | exit 1 |
741 | fi | |
15679d9f | 742 | echo -ne "Writing the svn-info to a file" |
c6cb9d25 | 743 | svn info > $PWD/svn_status |
15679d9f MT |
744 | if [ $? -eq "0" ]; then |
745 | beautify message DONE | |
c6cb9d25 | 746 | else |
15679d9f | 747 | beautify message FAIL |
c6cb9d25 MT |
748 | exit 1 |
749 | fi | |
712d859c | 750 | chmod 755 $0 |
cc0e56be | 751 | exit 0 |
c6cb9d25 MT |
752 | ;; |
753 | commit|ci) | |
754 | clear | |
6b8cff41 MT |
755 | if [ -f /usr/bin/mcedit ]; then |
756 | export EDITOR=/usr/bin/mcedit | |
73d9a908 MT |
757 | fi |
758 | if [ -f /usr/bin/nano ]; then | |
759 | export EDITOR=/usr/bin/nano | |
6b8cff41 MT |
760 | fi |
761 | echo -ne "Selecting editor $EDITOR..." | |
762 | beautify message DONE | |
d79b46cb | 763 | if [ -e /sbin/yast ]; then |
028698e8 MT |
764 | if [ "`echo $SVN_REVISION | cut -c 3`" -eq "0" ]; then |
765 | $0 changelog | |
766 | fi | |
d79b46cb | 767 | fi |
8a5f0f44 | 768 | update_langs |
15679d9f | 769 | svn commit |
c6cb9d25 | 770 | $0 svn up |
1065bfea MT |
771 | if [ -n "$FTP_CACHE_URL" ]; then |
772 | $0 uploadsrc | |
773 | fi | |
c6cb9d25 MT |
774 | ;; |
775 | dist) | |
7471f6ab MT |
776 | if [ $3 ]; then |
777 | SVN_REVISION=$3 | |
778 | fi | |
779 | if [ -f ipfire-source-r$SVN_REVISION.tar.gz ]; then | |
780 | echo -ne "REV $SVN_REVISION: SKIPPED!\n" | |
781 | exit 0 | |
782 | fi | |
783 | echo -en "REV $SVN_REVISION: Downloading..." | |
223ad6a4 MT |
784 | svn export http://svn.ipfire.org/svn/ipfire/trunk ipfire-source/ --force > /dev/null |
785 | svn log http://svn.ipfire.org/svn/ipfire/trunk -r 1:$SVN_REVISION > ipfire-source/Changelog | |
786 | #svn info http://svn.ipfire.org/svn/ipfire/trunk -r $SVN_REVISION > ipfire-source/svn_status | |
15679d9f MT |
787 | evaluate 1 |
788 | ||
7471f6ab MT |
789 | echo -en "REV $SVN_REVISION: Compressing files..." |
790 | if [ -e ipfire-source/trunk/make.sh ]; then | |
791 | chmod 755 ipfire-source/trunk/make.sh | |
792 | fi | |
9dc02b38 | 793 | tar cfz ipfire-source-r$SVN_REVISION.tar.gz ipfire-source |
15679d9f | 794 | evaluate 1 |
7471f6ab | 795 | echo -en "REV $SVN_REVISION: Cleaning up..." |
c6cb9d25 | 796 | rm ipfire-source/ -r |
15679d9f | 797 | evaluate 1 |
7471f6ab | 798 | ;; |
028698e8 | 799 | diff|di) |
1a8688ba | 800 | update_langs |
15679d9f | 801 | echo -ne "Make a local diff to last svn revision" |
c6cb9d25 | 802 | svn diff > ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff |
15679d9f | 803 | evaluate 1 |
c6cb9d25 | 804 | echo "Diff was successfully saved to ipfire-diff-`date +'%Y-%m-%d-%H:%M'`-r`svn info | grep Revision | cut -c 11-`.diff" |
bf7c473f | 805 | svn status |
c6cb9d25 MT |
806 | ;; |
807 | esac | |
f9315063 | 808 | ;; |
ca8da28e | 809 | |
15679d9f MT |
810 | uploadsrc) |
811 | PWD=`pwd` | |
812 | cd $BASEDIR/cache/ | |
813 | echo -e "Uploading cache to ftp server:" | |
3888140c MT |
814 | for i in *; do |
815 | echo "${i}" | fgrep -q .md5 && continue | |
816 | [ -e ${i}.md5 ] && continue | |
817 | md5sum ${i} | tee ${i}.md5 | |
818 | done | |
fd1b8061 | 819 | ncftpls -u $FTP_CACHE_USER -p $FTP_CACHE_PASS ftp://$FTP_CACHE_URL/$FTP_CACHE_PATH/ > /tmp/ftplist |
15679d9f | 820 | for i in *; do |
fd1b8061 MT |
821 | if [ "$(basename $i)" == "toolchains" ]; then continue; fi |
822 | grep -q $(basename $i) /tmp/ftplist | |
0eab8e84 | 823 | if [ "$?" -ne "0" ]; then |
fd1b8061 MT |
824 | echo -ne "$(basename $i)" |
825 | ncftpput -u $FTP_CACHE_USER -p $FTP_CACHE_PASS $FTP_CACHE_URL $FTP_CACHE_PATH/ $(basename $i) | |
6fb8ec08 | 826 | if [ "$?" -ne "0" ]; then |
15679d9f | 827 | beautify message FAIL |
0eab8e84 MT |
828 | fi |
829 | fi | |
830 | done | |
6fb8ec08 | 831 | rm -f /tmp/ftplist |
15679d9f MT |
832 | cd $PWD |
833 | exit 0 | |
0eab8e84 | 834 | ;; |
ca8da28e | 835 | |
cc0e56be | 836 | upload) |
b2c64f8c MT |
837 | FTP_ISO_PORT=`echo "$FTP_ISO_URL" | awk -F: '{ print $2 }'` |
838 | FTP_ISO_URL=`echo "$FTP_ISO_URL" | awk -F: '{ print $1 }'` | |
839 | if [ -z $FTP_ISO_PORT ]; then | |
840 | FTP_ISO_PORT=21 | |
841 | fi | |
842 | cat <<EOF > .ftp-commands | |
de2c999d | 843 | mkdir -p $FTP_ISO_PATH$SVN_REVISION |
b2c64f8c | 844 | mkdir -p $FTP_ISO_PATH$SVN_REVISION/paks |
9dc02b38 MT |
845 | quit |
846 | EOF | |
b2c64f8c MT |
847 | ncftp -u $FTP_ISO_USER -p $FTP_ISO_PASS -P $FTP_ISO_PORT $FTP_ISO_URL < .ftp-commands |
848 | rm -f .ftp-commands | |
849 | ||
850 | case "$2" in | |
851 | iso) | |
852 | echo -e "Uploading the iso to $FTP_ISO_PATH/$SVN_REVISION." | |
853 | ||
8f55c54e | 854 | md5sum ipfire-$VERSION.$MACHINE-full.iso > ipfire-$VERSION.$MACHINE-full.iso.md5 |
dff9df9d MT |
855 | 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 |
856 | if [ -e "$i" ]; then | |
b2c64f8c MT |
857 | ncftpput -u $FTP_ISO_USER -p $FTP_ISO_PASS -P $FTP_ISO_PORT $FTP_ISO_URL $FTP_ISO_PATH$SVN_REVISION/ $i |
858 | if [ "$?" -eq "0" ]; then | |
859 | echo "The file with name $i was successfully uploaded to $FTP_ISO_URL$FTP_ISO_PATH$SVN_REVISION/." | |
860 | else | |
861 | echo "There was an error while uploading the file $i to the ftp server." | |
862 | exit 1 | |
863 | fi | |
dff9df9d | 864 | fi |
b2c64f8c | 865 | done |
a4c9c660 | 866 | rm -f ipfire-$VERSION.$MACHINE-full.iso.md5 |
6aae8d61 | 867 | if [ "$3" = "--with-sources-cd" ]; then |
b2c64f8c | 868 | 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 | 869 | fi |
cc0e56be MT |
870 | ;; |
871 | paks) | |
b2c64f8c | 872 | ncftpput -u $FTP_ISO_USER -p $FTP_ISO_PASS -P $FTP_ISO_PORT $FTP_ISO_URL $FTP_ISO_PATH$SVN_REVISION/paks packages/* |
cc0e56be | 873 | if [ "$?" -eq "0" ]; then |
822c5bd0 | 874 | echo -e "The packages were successfully uploaded to $FTP_ISO_URL$FTP_ISO_PATH$SVN_REVISION/." |
cc0e56be MT |
875 | else |
876 | echo -e "There was an error while uploading the packages to the ftp server." | |
712d859c | 877 | exit 1 |
cc0e56be MT |
878 | fi |
879 | ;; | |
880 | esac | |
0d0521b6 | 881 | ;; |
ca8da28e | 882 | |
cc0e56be | 883 | batch) |
c8582074 | 884 | if [ "$2" = "--background" ]; then |
15679d9f MT |
885 | batch_script |
886 | exit $? | |
887 | fi | |
27ac55bf | 888 | if [ `screen -ls | grep -q ipfire` ]; then |
712d859c MT |
889 | echo "Build is already running, sorry!" |
890 | exit 1 | |
891 | else | |
27ac55bf MT |
892 | if [ "$2" = "--rebuild" ]; then |
893 | export IPFIRE_REBUILD=1 | |
894 | echo "REBUILD!" | |
895 | else | |
896 | export IPFIRE_REBUILD=0 | |
897 | fi | |
15679d9f MT |
898 | echo -en "${BOLD}***IPFire-Batch-Build is starting...${NORMAL}" |
899 | screen -dmS ipfire $0 batch --background | |
900 | evaluate 1 | |
712d859c MT |
901 | exit 0 |
902 | fi | |
cc0e56be | 903 | ;; |
ca8da28e MT |
904 | |
905 | watch|attach) | |
15679d9f | 906 | watch_screen |
028698e8 | 907 | ;; |
ca8da28e | 908 | |
6b8cff41 | 909 | *) |
6b8cff41 MT |
910 | cat doc/make.sh-usage |
911 | ;; | |
ca8da28e | 912 | |
3ea75603 | 913 | esac |