]>
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 | |
d3a6643e | 191 | ipfire_make bind |
246556fe MT |
192 | |
193 | ### Building some general stuff | |
194 | # | |
195 | ipfire_make openssl | |
196 | ipfire_make pam PASS=1 | |
197 | ipfire_make shadow | |
198 | ipfire_make pam PASS=2 | |
199 | ||
b8b94b55 | 200 | #ipfire_make libidn ### Do we need this? |
246556fe MT |
201 | ipfire_make pcre |
202 | ipfire_make popt | |
203 | ipfire_make python | |
204 | ipfire_make libxml2 | |
205 | ipfire_make libxslt | |
206 | ipfire_make slang | |
207 | ipfire_make newt | |
208 | ipfire_make cyrus-sasl | |
209 | ipfire_make openldap | |
210 | ipfire_make sqlite | |
211 | ipfire_make curl | |
212 | ipfire_make libusb | |
213 | ipfire_make gnupg | |
214 | ipfire_make sudo | |
215 | #ipfire_make libjpeg ### Do we need this? | |
216 | ipfire_make libpng | |
217 | ipfire_make libtiff | |
218 | ipfire_make libart | |
219 | ipfire_make freetype | |
220 | ipfire_make lzo | |
b8b94b55 MT |
221 | ipfire_make lsof |
222 | ipfire_make br2684ctl | |
223 | ipfire_make etherwake | |
224 | ipfire_make htop | |
225 | ipfire_make beep | |
246556fe MT |
226 | |
227 | ### Building filesystem stuff | |
228 | # | |
229 | ipfire_make reiserfsprogs | |
230 | ipfire_make libaal | |
231 | ipfire_make reiser4progs | |
a97daddb | 232 | ipfire_make xfsprogs |
90708ef5 | 233 | ipfire_make sysfsutils |
246556fe MT |
234 | |
235 | ### Building hardware utils | |
236 | # | |
237 | ipfire_make pciutils | |
238 | ipfire_make usbutils | |
239 | ipfire_make hdparm | |
240 | ipfire_make kudzu | |
b8b94b55 | 241 | ipfire_make smartmontools |
90708ef5 | 242 | ipfire_make lm-sensors |
246556fe MT |
243 | |
244 | ### Building some important tools | |
245 | # | |
246 | ipfire_make fcron | |
247 | ipfire_make which | |
248 | ipfire_make nano | |
249 | ipfire_make screen | |
250 | ipfire_make rrdtool | |
251 | ipfire_make ntp ### Needs config. | |
252 | ipfire_make openssh | |
b8b94b55 MT |
253 | ipfire_make ez-ipupdate |
254 | ipfire_make noip | |
255 | ipfire_make lighttpd | |
31c59de6 | 256 | ipfire_make lzma |
90708ef5 | 257 | ipfire_make collectd |
d3a6643e MT |
258 | #ipfire_make logrotate |
259 | #ipfire_make logwatch | |
260 | ipfire_make cpio | |
261 | ipfire_make cdrtools | |
262 | ipfire_make parted | |
263 | ipfire_make memtest86+ | |
246556fe MT |
264 | #ipfire_make pakfire |
265 | #ipfire_make initscripts | |
d3a6643e MT |
266 | |
267 | ### ------------------------------------------------------------------------- | |
268 | ### Tools that maybe not needed | |
269 | # | |
e53fbf32 MT |
270 | #ipfire_make expat |
271 | #ipfire_make gmp | |
272 | #ipfire_make gd | |
273 | #ipfire_make libcap | |
e53fbf32 MT |
274 | #ipfire_make mtools |
275 | #ipfire_make mISDN | |
d3a6643e | 276 | |
e53fbf32 | 277 | #ipfire_make nasm |
e53fbf32 MT |
278 | #ipfire_make wireless |
279 | #ipfire_make libsafe | |
246556fe MT |
280 | } |
281 | ||
282 | ################################################################################ | |
283 | # This builds the entire stage "misc" # | |
284 | ################################################################################ | |
285 | misc_build() { | |
286 | ||
287 | PATH=/usr/local/ccache/bin:/usr/local/distcc/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/${MACHINE_REAL}-linux/bin | |
288 | STAGE_ORDER=04 | |
289 | STAGE=misc | |
290 | ||
291 | LOGFILE="$BASEDIR/log_${MACHINE}/_build.misc.log" | |
292 | export LOGFILE | |
293 | ||
d3a6643e | 294 | ipfire_make stage4 |
e53fbf32 | 295 | |
d3a6643e MT |
296 | ### Console tools |
297 | # | |
67deab0a MT |
298 | ipfire_make glib |
299 | ipfire_make mc | |
d3a6643e MT |
300 | #ipfire_make traceroute |
301 | #ipfire_make nmap | |
302 | #ipfire_make rsync | |
303 | #ipfire_make tcpdump | |
67deab0a | 304 | |
d3a6643e MT |
305 | #ipfire_make squid |
306 | #ipfire_make squid-graph ## WILL THIS BE BANISHED BY COLLECTD? | |
307 | #ipfire_make squidguard ## CAN THIS BE BANISHED BY ANYTHING BETTER? | |
308 | #ipfire_make calamaris ## CAN THIS BE BANISHED BY ANYTHING BETTER? | |
309 | #ipfire_make vsftpd | |
246556fe | 310 | |
d3a6643e MT |
311 | ### Programs that are still for discussion |
312 | # package or in the standard system | |
313 | # | |
314 | ## NTFS | |
315 | #ipfire_make fuse | |
316 | #ipfire_make ntfs-3g | |
317 | # | |
318 | ## Net tools | |
319 | #ipfire_make bwm-ng | |
320 | #ipfire_make openvpn | |
321 | # | |
322 | ## UPNP | |
323 | #ipfire_make libupnp | |
324 | #ipfire_make linux-igd | |
325 | ||
326 | ### These will become addons as usual but will be integrated later | |
327 | # | |
246556fe MT |
328 | #ipfire_make snort |
329 | #ipfire_make oinkmaster | |
e53fbf32 | 330 | #ipfire_make centerim |
e53fbf32 MT |
331 | #ipfire_make tripwire |
332 | #ipfire_make java | |
31c59de6 MT |
333 | #ipfire_make cups |
334 | #ipfire_make ghostscript | |
335 | #ipfire_make foomatic | |
336 | #ipfire_make hplip | |
337 | #ipfire_make samba | |
31c59de6 MT |
338 | #ipfire_make postfix |
339 | #ipfire_make fetchmail | |
340 | #ipfire_make cyrus-imapd | |
341 | #ipfire_make clamav | |
342 | #ipfire_make alsa | |
343 | #ipfire_make mpg123 | |
344 | #ipfire_make mpfire | |
345 | #ipfire_make guardian | |
346 | #ipfire_make libid3tag | |
347 | #ipfire_make libmad | |
348 | #ipfire_make libogg | |
349 | #ipfire_make libvorbis | |
350 | #ipfire_make lame | |
351 | #ipfire_make sox | |
352 | #ipfire_make libshout | |
353 | #ipfire_make icecast | |
354 | #ipfire_make icegenerator | |
355 | #ipfire_make mpd | |
356 | #ipfire_make mpc | |
357 | #ipfire_make xvid | |
358 | #ipfire_make libmpeg2 | |
359 | #ipfire_make videolan | |
360 | #ipfire_make libpri | |
361 | #ipfire_make asterisk | |
31c59de6 MT |
362 | #ipfire_make libsigc++ |
363 | #ipfire_make applejuice | |
31c59de6 MT |
364 | #ipfire_make libtorrent |
365 | #ipfire_make rtorrent | |
366 | #ipfire_make ipfireseeder | |
31c59de6 | 367 | #ipfire_make nfs |
ca8da28e | 368 | |
d3a6643e MT |
369 | # --------------------------------------------------------------------------- |
370 | #ipfire_make as86 | |
371 | #ipfire_make mbr | |
df5e82b3 MT |
372 | } |
373 | ||
ca8da28e MT |
374 | ################################################################################ |
375 | # This builds the entire stage "installer" # | |
376 | ################################################################################ | |
377 | installer_build() { | |
378 | ||
379 | PATH=/usr/local/ccache/bin:/usr/local/distcc/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/${MACHINE_REAL}-linux/bin | |
380 | STAGE_ORDER=05 | |
381 | STAGE=installer | |
382 | ||
383 | LOGFILE="$BASEDIR/log_${MACHINE}/_build.installer.log" | |
384 | export LOGFILE | |
246556fe | 385 | |
e53fbf32 | 386 | ipfire_make busybox |
f90f9467 | 387 | #ipfire_make installer |
e53fbf32 | 388 | ipfire_make initramfs |
df5e82b3 MT |
389 | } |
390 | ||
ca8da28e MT |
391 | ################################################################################ |
392 | # This builds the entire stage "packages" # | |
393 | ################################################################################ | |
394 | packages_build() { | |
df5e82b3 | 395 | |
ca8da28e MT |
396 | PATH=/usr/local/ccache/bin:/usr/local/distcc/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/${MACHINE_REAL}-linux/bin |
397 | STAGE_ORDER=06 | |
398 | STAGE=packages | |
df5e82b3 | 399 | |
ca8da28e MT |
400 | LOGFILE="$BASEDIR/log_${MACHINE}/_build.packages.log" |
401 | export LOGFILE | |
402 | ||
df5e82b3 | 403 | echo "... see detailed log in _build.*.log files" >> $LOGFILE |
0fbb45e9 | 404 | |
ca8da28e | 405 | ipfire_make strip |
df5e82b3 MT |
406 | |
407 | # Generating list of packages used | |
f90f9467 | 408 | ### MISSING ATM |
df5e82b3 | 409 | |
f90f9467 | 410 | ipfire_make cdrom |
74dbbc36 | 411 | |
4dc82852 | 412 | # Check if there is a loop device for building in virtual environments |
65151129 MT |
413 | #if [ -e /dev/loop/0 ] || [ -e /dev/loop0 ]; then |
414 | # ipfire_make usb-stick | |
415 | #fi | |
f90f9467 | 416 | mv $LFS/$IMAGES_DIR/{*.iso,*.tgz,*.img.gz} $BASEDIR >> $LOGFILE 2>&1 |
c9673262 | 417 | |
f90f9467 MT |
418 | #ipfire_make core-updates |
419 | ### DISABLED ATM | |
420 | ||
084ab6f4 | 421 | for i in $(ls -1 $BASEDIR/src/rootfiles/extras); do |
453b418b | 422 | if [ -e $BASEDIR/lfs/$i ]; then |
f90f9467 MT |
423 | echo -n |
424 | ### Do nothing at the moment, we are gonna use a new packager | |
453b418b MT |
425 | else |
426 | echo -n $i | |
427 | beautify message SKIP | |
428 | fi | |
fe7fe395 | 429 | done |
f90f9467 MT |
430 | |
431 | # Cleanup | |
432 | stdumount | |
433 | rm -rf $LFS/tmp/* | |
434 | ||
435 | cd $PWD | |
df5e82b3 MT |
436 | } |
437 | ||
438 | # See what we're supposed to do | |
439 | case "$1" in | |
440 | build) | |
9729e787 | 441 | clear |
ca8da28e MT |
442 | #a prebuilt toolchain package is only used if found in cache |
443 | if [ ! -d $BASEDIR/cache ]; then | |
444 | exiterror "Use make.sh downloadsrc first!" | |
445 | fi | |
6b96312d MT |
446 | cd $BASEDIR/cache/toolchains |
447 | PACKAGE=`ls -v -r $TOOLCHAINNAME.tar.bz2 2> /dev/null | head -n 1` | |
df5e82b3 | 448 | #only restore on a clean disk |
ca8da28e MT |
449 | |
450 | echo -ne "Building for ${BOLD}${MACHINE} on ${MACHINE_REAL}${NORMAL}\n" | |
451 | ||
3888140c | 452 | if [ -f $BASEDIR/log_${MACHINE}/02_base/stage2-LFS ]; then |
ca8da28e MT |
453 | prepareenv |
454 | echo "Using installed toolchain" >> $LOGFILE | |
455 | beautify message DONE "Stage toolchain already built or extracted" | |
456 | else | |
457 | if [ -z "$PACKAGE" ]; then | |
458 | echo "Full toolchain compilation" | tee -a $LOGFILE | |
df5e82b3 | 459 | prepareenv |
ca8da28e MT |
460 | |
461 | # Check if host can build the toolchain | |
462 | check_toolchain_prerequisites | |
463 | ||
464 | beautify build_stage "Building toolchain" | |
465 | toolchain_build | |
df5e82b3 | 466 | else |
ca8da28e | 467 | echo "Restore from $PACKAGE" | tee -a $LOGFILE |
f90f9467 MT |
468 | if [ `md5sum $BASEDIR/cache/toolchains/$PACKAGE | awk '{print $1}'` == `cat $BASEDIR/cache/toolchains/$TOOLCHAINNAME.md5 | awk '{print $1}'` ]; then |
469 | cd $BASEDIR && tar jxf $BASEDIR/cache/toolchains/$PACKAGE | |
df5e82b3 MT |
470 | prepareenv |
471 | else | |
ca8da28e | 472 | exiterror "$TOOLCHAINNAME md5 did not match, check downloaded package" |
df5e82b3 MT |
473 | fi |
474 | fi | |
ca8da28e MT |
475 | fi |
476 | ||
3888140c | 477 | if [ ! -e $BASEDIR/log_${MACHINE}/03_ipfire/stage3-LFS ]; then |
ca8da28e MT |
478 | beautify build_stage "Building base" |
479 | base_build | |
df5e82b3 | 480 | else |
ca8da28e | 481 | beautify message DONE "Stage base already built" |
df5e82b3 | 482 | fi |
5cfe86e6 | 483 | |
3888140c | 484 | if [ ! -e $BASEDIR/log_${MACHINE}/04_misc/stage4-LFS ]; then |
ca8da28e MT |
485 | beautify build_stage "Building $NAME" |
486 | ipfire_build | |
487 | else | |
488 | beautify message DONE "Stage ipfire already built" | |
489 | fi | |
5cfe86e6 | 490 | |
3888140c | 491 | if [ ! -e $BASEDIR/log_${MACHINE}/05_installer/stage5-LFS ]; then |
ca8da28e MT |
492 | beautify build_stage "Building miscellaneous" |
493 | misc_build | |
5cfe86e6 | 494 | else |
ca8da28e | 495 | beautify message DONE "Stage misc already built" |
5cfe86e6 HS |
496 | fi |
497 | ||
0b59f25c | 498 | beautify build_stage "Building installer" |
ca8da28e | 499 | installer_build |
15679d9f | 500 | |
0b59f25c | 501 | beautify build_stage "Building packages" |
ca8da28e MT |
502 | packages_build |
503 | ||
504 | echo "" | |
ca8da28e | 505 | echo "... and all this hard work for this:" |
f90f9467 | 506 | du -bsh $BASEDIR/${SNAME}-${VERSION}.${MACHINE}.iso |
df5e82b3 | 507 | ;; |
ca8da28e | 508 | |
df5e82b3 MT |
509 | shell) |
510 | # enter a shell inside LFS chroot | |
511 | # may be used to changed kernel settings | |
512 | prepareenv | |
513 | entershell | |
514 | ;; | |
ca8da28e | 515 | |
df5e82b3 | 516 | changelog) |
d1dd6669 | 517 | echo -n "Loading new Changelog from SVN: " |
223ad6a4 | 518 | svn log http://svn.ipfire.org/svn/ipfire > doc/ChangeLog |
a50d04ab | 519 | beautify message DONE |
df5e82b3 | 520 | ;; |
ca8da28e | 521 | |
df5e82b3 | 522 | clean) |
ca8da28e MT |
523 | echo -ne "Cleaning ${BOLD}$MACHINE${NORMAL} buildtree" |
524 | for i in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'` | |
525 | do | |
df5e82b3 MT |
526 | $LOSETUP -d $i 2>/dev/null |
527 | done | |
ca8da28e MT |
528 | |
529 | for i in `mount | grep $BASEDIR | cut -d " " -f 1` | |
530 | do | |
df5e82b3 MT |
531 | umount $i |
532 | done | |
ca8da28e | 533 | |
df5e82b3 | 534 | stdumount |
ca8da28e MT |
535 | |
536 | for i in `seq 0 7` | |
537 | do | |
538 | if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then | |
539 | umount /dev/loop${i} 2>/dev/null; | |
540 | losetup -d /dev/loop${i} 2>/dev/null; | |
541 | fi; | |
df5e82b3 | 542 | done |
ca8da28e MT |
543 | |
544 | rm -rf $BASEDIR/build_${MACHINE} | |
545 | rm -rf $BASEDIR/log_${MACHINE} | |
f9315063 | 546 | rm -rf $BASEDIR/packages |
ca8da28e MT |
547 | |
548 | if [ -h $TOOLS_DIR ]; then | |
549 | rm -f $TOOLS_DIR | |
df5e82b3 | 550 | fi |
a50d04ab | 551 | beautify message DONE |
df5e82b3 | 552 | ;; |
ca8da28e | 553 | |
c3db995c | 554 | downloadsrc) |
be472d5a MT |
555 | LOGFILE=$BASEDIR/log_${MACHINE}/_build.preparation.log |
556 | ||
df5e82b3 MT |
557 | if [ ! -d $BASEDIR/cache ]; then |
558 | mkdir $BASEDIR/cache | |
559 | fi | |
be472d5a | 560 | mkdir -p $BASEDIR/log_${MACHINE} |
857d9bf2 | 561 | echo -e "${BOLD}Preload all source files${NORMAL}" | tee -a $LOGFILE |
df5e82b3 MT |
562 | FINISHED=0 |
563 | cd $BASEDIR/lfs | |
564 | for c in `seq $MAX_RETRIES`; do | |
565 | if (( FINISHED==1 )); then | |
566 | break | |
567 | fi | |
568 | FINISHED=1 | |
569 | cd $BASEDIR/lfs | |
570 | for i in *; do | |
571 | if [ -f "$i" -a "$i" != "Config" ]; then | |
e22c7973 | 572 | echo -ne "Loading $i" |
df5e82b3 MT |
573 | make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t ($c/$MAX_RETRIES)" download >> $LOGFILE 2>&1 |
574 | if [ $? -ne 0 ]; then | |
e22c7973 | 575 | beautify message FAIL |
df5e82b3 MT |
576 | FINISHED=0 |
577 | else | |
578 | if [ $c -eq 1 ]; then | |
e22c7973 | 579 | beautify message DONE |
df5e82b3 MT |
580 | fi |
581 | fi | |
582 | fi | |
583 | done | |
584 | done | |
e22c7973 | 585 | cd - >/dev/null 2>&1 |
df5e82b3 | 586 | ;; |
ca8da28e | 587 | |
df5e82b3 MT |
588 | toolchain) |
589 | prepareenv | |
ca8da28e MT |
590 | # Check if host can build the toolchain |
591 | check_toolchain_prerequisites | |
592 | toolchain_build | |
3888140c | 593 | echo "Create toolchain tar.bz for $MACHINE" | tee -a $LOGFILE |
ca8da28e MT |
594 | # Safer inside the chroot |
595 | echo -ne "Stripping lib" | |
596 | chroot $LFS $TOOLS_DIR/bin/find $TOOLS_DIR/lib \ | |
597 | -type f \( -name '*.so' -o -name '*.so[\.0-9]*' \) \ | |
598 | -exec $TOOLS_DIR/bin/strip --strip-debug {} \; 2>/dev/null | |
599 | beautify message DONE | |
600 | echo -ne "Stripping binaries" | |
601 | chroot $LFS $TOOLS_DIR/bin/find /usr/local /usr/src/binutils-build $TOOLS_DIR/bin $TOOLS_DIR/sbin \ | |
602 | -type f \ | |
603 | -exec $TOOLS_DIR/bin/strip --strip-all {} \; 2> /dev/null | |
604 | beautify message DONE | |
605 | stdumount | |
606 | echo -ne "Tar creation " | |
f90f9467 | 607 | [ -d cache/toolchains ] || mkdir cache/toolchains |
6b96312d | 608 | cd $BASEDIR && tar cj \ |
ca8da28e | 609 | --exclude='log_${MACHINE}/_build.*.log' \ |
f90f9467 | 610 | --file=cache/toolchains/$TOOLCHAINNAME.tar.bz2 \ |
ca8da28e MT |
611 | build_${MACHINE} \ |
612 | log_${MACHINE} >> $LOGFILE | |
613 | beautify message DONE | |
f90f9467 MT |
614 | echo `ls -sh cache/toolchains/$TOOLCHAINNAME.tar.bz2` |
615 | md5sum cache/toolchains/$TOOLCHAINNAME.tar.bz2 \ | |
616 | > cache/toolchains/$TOOLCHAINNAME.md5 | |
ca8da28e | 617 | |
df5e82b3 MT |
618 | stdumount |
619 | ;; | |
ca8da28e | 620 | |
df5e82b3 | 621 | gettoolchain) |
ca8da28e | 622 | if [ ! -f $BASEDIR/cache/toolchains/$TOOLCHAINNAME.tar.bz2 ]; then |
5bd13f01 | 623 | URL_TOOLCHAIN=`grep URL_TOOLCHAIN lfs/Config | awk '{ print $3 }'` |
712d859c | 624 | test -d $BASEDIR/cache/toolchains || mkdir $BASEDIR/cache/toolchains |
6b96312d | 625 | echo "Loading toolchain for $MACHINE" |
712d859c | 626 | cd $BASEDIR/cache/toolchains |
ca8da28e | 627 | wget -c -nv $URL_TOOLCHAIN/$TOOLCHAINNAME.tar.bz2 $URL_TOOLCHAIN/$TOOLCHAINNAME.md5 |
712d859c | 628 | if [ $? -ne 0 ]; then |
6b96312d | 629 | echo -n "ERROR: Downloading toolchain for $MACHINE machine" |
ca8da28e | 630 | beautify message FAIL |
6b96312d | 631 | echo "Precompiled toolchain not always available for every machine" |
40a4ea4c | 632 | else |
ca8da28e MT |
633 | if [ "`md5sum $TOOLCHAINNAME.tar.bz2 | awk '{print $1}'`" = "`cat $TOOLCHAINNAME.md5 | awk '{print $1}'`" ]; then |
634 | beautify message DONE | |
6b96312d | 635 | echo "Toolchain md5 ok" |
712d859c | 636 | else |
ca8da28e | 637 | exiterror "$TOOLCHAINNAME.md5 did not match, check downloaded package" |
712d859c | 638 | fi |
40a4ea4c | 639 | fi |
712d859c | 640 | else |
6b96312d | 641 | echo -n "Toolchain for $MACHINE is already existing" |
ca8da28e | 642 | beautify message SKIP |
df5e82b3 MT |
643 | fi |
644 | ;; | |
ca8da28e | 645 | |
15679d9f | 646 | othersrc) |
ce56e927 | 647 | prepareenv |
15679d9f | 648 | echo -ne "`date -u '+%b %e %T'`: Build sources iso for $MACHINE" | tee -a $LOGFILE |
ce56e927 MT |
649 | chroot $LFS /tools/bin/env -i HOME=/root \ |
650 | TERM=$TERM PS1='\u:\w\$ ' \ | |
651 | PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \ | |
652 | VERSION=$VERSION NAME="$NAME" SNAME="$SNAME" MACHINE=$MACHINE \ | |
653 | /bin/bash -x -c "cd /usr/src/lfs && make -f sources-iso LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1 | |
654 | mv $LFS/install/images/ipfire-* $BASEDIR >> $LOGFILE 2>&1 | |
15679d9f MT |
655 | if [ $? -eq "0" ]; then |
656 | beautify message DONE | |
657 | else | |
658 | beautify message FAIL | |
659 | fi | |
ce56e927 MT |
660 | stdumount |
661 | ;; | |
ca8da28e | 662 | |
c6cb9d25 | 663 | svn) |
67deab0a | 664 | . $BASEDIR/tools/make-subversion |
c6cb9d25 | 665 | case "$2" in |
67deab0a MT |
666 | update|up) |
667 | svn_up | |
668 | ;; | |
669 | commit|ci) | |
670 | clear | |
671 | svn_commit | |
672 | svn_up | |
673 | ;; | |
674 | dist) | |
675 | svn_dist | |
676 | ;; | |
677 | diff|di) | |
678 | svn_diff | |
679 | ;; | |
c6cb9d25 | 680 | esac |
f9315063 | 681 | ;; |
ca8da28e | 682 | |
15679d9f MT |
683 | uploadsrc) |
684 | PWD=`pwd` | |
685 | cd $BASEDIR/cache/ | |
686 | echo -e "Uploading cache to ftp server:" | |
3888140c MT |
687 | for i in *; do |
688 | echo "${i}" | fgrep -q .md5 && continue | |
689 | [ -e ${i}.md5 ] && continue | |
690 | md5sum ${i} | tee ${i}.md5 | |
691 | done | |
fd1b8061 | 692 | ncftpls -u $FTP_CACHE_USER -p $FTP_CACHE_PASS ftp://$FTP_CACHE_URL/$FTP_CACHE_PATH/ > /tmp/ftplist |
15679d9f | 693 | for i in *; do |
fd1b8061 MT |
694 | if [ "$(basename $i)" == "toolchains" ]; then continue; fi |
695 | grep -q $(basename $i) /tmp/ftplist | |
0eab8e84 | 696 | if [ "$?" -ne "0" ]; then |
fd1b8061 MT |
697 | echo -ne "$(basename $i)" |
698 | ncftpput -u $FTP_CACHE_USER -p $FTP_CACHE_PASS $FTP_CACHE_URL $FTP_CACHE_PATH/ $(basename $i) | |
6fb8ec08 | 699 | if [ "$?" -ne "0" ]; then |
15679d9f | 700 | beautify message FAIL |
0eab8e84 MT |
701 | fi |
702 | fi | |
703 | done | |
6fb8ec08 | 704 | rm -f /tmp/ftplist |
15679d9f MT |
705 | cd $PWD |
706 | exit 0 | |
0eab8e84 | 707 | ;; |
ca8da28e | 708 | |
cc0e56be | 709 | upload) |
b2c64f8c MT |
710 | FTP_ISO_PORT=`echo "$FTP_ISO_URL" | awk -F: '{ print $2 }'` |
711 | FTP_ISO_URL=`echo "$FTP_ISO_URL" | awk -F: '{ print $1 }'` | |
712 | if [ -z $FTP_ISO_PORT ]; then | |
713 | FTP_ISO_PORT=21 | |
714 | fi | |
715 | cat <<EOF > .ftp-commands | |
de2c999d | 716 | mkdir -p $FTP_ISO_PATH$SVN_REVISION |
b2c64f8c | 717 | mkdir -p $FTP_ISO_PATH$SVN_REVISION/paks |
9dc02b38 MT |
718 | quit |
719 | EOF | |
b2c64f8c MT |
720 | ncftp -u $FTP_ISO_USER -p $FTP_ISO_PASS -P $FTP_ISO_PORT $FTP_ISO_URL < .ftp-commands |
721 | rm -f .ftp-commands | |
722 | ||
723 | case "$2" in | |
724 | iso) | |
725 | echo -e "Uploading the iso to $FTP_ISO_PATH/$SVN_REVISION." | |
726 | ||
8f55c54e | 727 | md5sum ipfire-$VERSION.$MACHINE-full.iso > ipfire-$VERSION.$MACHINE-full.iso.md5 |
dff9df9d MT |
728 | 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 |
729 | if [ -e "$i" ]; then | |
b2c64f8c MT |
730 | ncftpput -u $FTP_ISO_USER -p $FTP_ISO_PASS -P $FTP_ISO_PORT $FTP_ISO_URL $FTP_ISO_PATH$SVN_REVISION/ $i |
731 | if [ "$?" -eq "0" ]; then | |
732 | echo "The file with name $i was successfully uploaded to $FTP_ISO_URL$FTP_ISO_PATH$SVN_REVISION/." | |
733 | else | |
734 | echo "There was an error while uploading the file $i to the ftp server." | |
735 | exit 1 | |
736 | fi | |
dff9df9d | 737 | fi |
b2c64f8c | 738 | done |
a4c9c660 | 739 | rm -f ipfire-$VERSION.$MACHINE-full.iso.md5 |
6aae8d61 | 740 | if [ "$3" = "--with-sources-cd" ]; then |
b2c64f8c | 741 | 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 | 742 | fi |
cc0e56be MT |
743 | ;; |
744 | paks) | |
b2c64f8c | 745 | ncftpput -u $FTP_ISO_USER -p $FTP_ISO_PASS -P $FTP_ISO_PORT $FTP_ISO_URL $FTP_ISO_PATH$SVN_REVISION/paks packages/* |
cc0e56be | 746 | if [ "$?" -eq "0" ]; then |
822c5bd0 | 747 | echo -e "The packages were successfully uploaded to $FTP_ISO_URL$FTP_ISO_PATH$SVN_REVISION/." |
cc0e56be MT |
748 | else |
749 | echo -e "There was an error while uploading the packages to the ftp server." | |
712d859c | 750 | exit 1 |
cc0e56be MT |
751 | fi |
752 | ;; | |
753 | esac | |
0d0521b6 | 754 | ;; |
ca8da28e | 755 | |
cc0e56be | 756 | batch) |
c8582074 | 757 | if [ "$2" = "--background" ]; then |
15679d9f MT |
758 | batch_script |
759 | exit $? | |
760 | fi | |
27ac55bf | 761 | if [ `screen -ls | grep -q ipfire` ]; then |
712d859c MT |
762 | echo "Build is already running, sorry!" |
763 | exit 1 | |
764 | else | |
27ac55bf MT |
765 | if [ "$2" = "--rebuild" ]; then |
766 | export IPFIRE_REBUILD=1 | |
767 | echo "REBUILD!" | |
768 | else | |
769 | export IPFIRE_REBUILD=0 | |
770 | fi | |
15679d9f MT |
771 | echo -en "${BOLD}***IPFire-Batch-Build is starting...${NORMAL}" |
772 | screen -dmS ipfire $0 batch --background | |
773 | evaluate 1 | |
712d859c MT |
774 | exit 0 |
775 | fi | |
cc0e56be | 776 | ;; |
ca8da28e MT |
777 | |
778 | watch|attach) | |
15679d9f | 779 | watch_screen |
028698e8 | 780 | ;; |
ca8da28e | 781 | |
6b8cff41 | 782 | *) |
6b8cff41 MT |
783 | cat doc/make.sh-usage |
784 | ;; | |
ca8da28e | 785 | |
3ea75603 | 786 | esac |