SMP wieder aktiviert (Zumindest versucht)
[people/pmueller/ipfire-2.x.git] / make.sh
CommitLineData
e8faff20
MT
1#!/bin/bash\r
2#\r
3############################################################################\r
4# #\r
5# This file is part of the IPCop Firewall. #\r
6# #\r
7# IPCop is free software; you can redistribute it and/or modify #\r
8# it under the terms of the GNU General Public License as published by #\r
9# the Free Software Foundation; either version 2 of the License, or #\r
10# (at your option) any later version. #\r
11# #\r
12# IPCop is distributed in the hope that it will be useful, #\r
13# but WITHOUT ANY WARRANTY; without even the implied warranty of #\r
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #\r
15# GNU General Public License for more details. #\r
16# #\r
17# You should have received a copy of the GNU General Public License #\r
18# along with IPCop; if not, write to the Free Software #\r
19# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #\r
20# #\r
21# Copyright (C) 2001 Mark Wormgoor <mark@wormgoor.com>. #\r
22# #\r
23# (c) 2001 Eric S. Johansson <esj@harvee.billerica.ma.us> Check for Bash #\r
24# (c) 2002 Thorsten Fischer <frosch@cs.tu-berlin.de> MD5Sum checking #\r
25# #\r
26############################################################################\r
27#\r
28# $Id: make.sh,v 1.129.2.145 2006/02/01 07:04:09 gespinasse Exp $\r
29#\r
30\r
31 NAME="IPFire" # Software name\r
32 SNAME="ipfire" # Short name\r
33 VERSION="1.4" # Version number\r
34 PREVIOUSTAG=IPCOP_v1_4_10_FINAL\r
35 SLOGAN="We save your network" # Software slogan\r
36 CONFIG_ROOT=/var/ipfire # Configuration rootdir\r
37 NICE=10\r
38 MAX_RETRIES=3 # prefetch/check loop\r
39 KVER=`grep --max-count=1 VER lfs/linux | awk '{ print $3 }'`\r
40 MACHINE=`uname -m`\r
41\r
42 # Debian specific settings\r
43 if [ ! -e /etc/debian_version ]; then\r
44 FULLPATH=`which $0`\r
45 else\r
46 if [ -x /usr/bin/realpath ]; then\r
47 FULLPATH=`/usr/bin/realpath $0`\r
48 else\r
49 echo "ERROR: Need to do apt-get install realpath"\r
50 exit 1\r
51 fi\r
52 fi\r
53\r
54\r
55 PWD=`pwd`\r
56 BASENAME=`basename $0`\r
57 BASEDIR=`echo $FULLPATH | sed "s/\/$BASENAME//g"`\r
58 LOGFILE=$BASEDIR/log/_build.preparation.log\r
59 export BASEDIR LOGFILE\r
60 DIR_CHK=$BASEDIR/cache/check\r
61 mkdir $BASEDIR/log/ 2>/dev/null\r
62\r
63 if [ 'x86_64' = $MACHINE -o 'i686' = $MACHINE -o 'i586' = $MACHINE -o 'i486' = $MACHINE -o 'i386' = $MACHINE ]; then\r
64 echo "`date -u '+%b %e %T'`: Machine is ix86 (or equivalent)" | tee -a $LOGFILE\r
65 MACHINE=i386\r
66 BUILDTARGET=i386-pc-linux-gnu\r
67 CFLAGS="-O2 -mcpu=i386 -march=i386 -pipe -fomit-frame-pointer"\r
68 CXXFLAGS="-O2 -mcpu=i386 -march=i386 -pipe -fomit-frame-pointer"\r
69 elif [ 'alpha' = $MACHINE ]; then\r
70 echo "`date -u '+%b %e %T'`: Machine is Alpha AXP" | tee -a $LOGFILE\r
71 BUILDTARGET=alpha-unknown-linux-gnu\r
72 CFLAGS="-O2 -mcpu=ev4 -mieee -pipe"\r
73 CXXFLAGS="-O2 -mcpu=ev4 -mieee -pipe"\r
74 else\r
75 echo "`date -u '+%b %e %T'`: Can't determine your architecture - $MACHINE" | tee -a $LOGFILE\r
76 exit 1\r
77 fi\r
78\r
79# Define immediately\r
80stdumount() {\r
81 umount $BASEDIR/build/dev/pts 2>/dev/null;\r
82 umount $BASEDIR/build/proc 2>/dev/null;\r
83 umount $BASEDIR/build/install/mnt 2>/dev/null;\r
84 umount $BASEDIR/build/usr/src/cache 2>/dev/null;\r
85 umount $BASEDIR/build/usr/src/ccache 2>/dev/null;\r
86 umount $BASEDIR/build/usr/src/config 2>/dev/null;\r
87 umount $BASEDIR/build/usr/src/doc 2>/dev/null;\r
88 umount $BASEDIR/build/usr/src/html 2>/dev/null;\r
89 umount $BASEDIR/build/usr/src/langs 2>/dev/null;\r
90 umount $BASEDIR/build/usr/src/lfs 2>/dev/null;\r
91 umount $BASEDIR/build/usr/src/log 2>/dev/null;\r
92 umount $BASEDIR/build/usr/src/src 2>/dev/null;\r
93}\r
94\r
95exiterror() {\r
96 stdumount\r
97 for i in `seq 0 7`; do\r
98 if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then\r
99 losetup -d /dev/loop${i} 2>/dev/null\r
100 fi;\r
101 done\r
102 echo "ERROR: $*"\r
103 echo " Check $LOGFILE for errors if applicable"\r
104 exit 1\r
105}\r
106\r
107entershell() {\r
108 if [ ! -e $BASEDIR/build/usr/src/lfs/ ]; then\r
109 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/"\r
110 fi\r
111 echo "Entering to a shell inside LFS chroot, go out with exit"\r
112 chroot $LFS /tools/bin/env -i HOME=/root TERM=$TERM PS1='\u:\w\$ ' \\r
113 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \\r
114 VERSION=$VERSION CONFIG_ROOT=$CONFIG_ROOT \\r
115 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \\r
116 CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" \\r
117 CCACHE_DIR=/usr/src/ccache \\r
118 CCACHE_HASHDIR=1 \\r
119 KVER=$KVER \\r
120 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \\r
121 KGCC="ccache /usr/bin/gcc" \\r
122 /tools/bin/bash\r
123 if [ $? -ne 0 ]; then\r
124 exiterror "chroot error"\r
125 else\r
126 stdumount\r
127 fi\r
128}\r
129\r
130prepareenv() {\r
131 ############################################################################\r
132 # #\r
133 # Are we running the right shell? #\r
134 # #\r
135 ############################################################################\r
136 if [ ! "$BASH" ]; then\r
137 exiterror "BASH environment variable is not set. You're probably running the wrong shell."\r
138 fi\r
139\r
140 if [ -z "${BASH_VERSION}" ]; then\r
141 exiterror "Not running BASH shell."\r
142 fi\r
143\r
144\r
145 ############################################################################\r
146 # #\r
147 # Trap on emergency exit #\r
148 # #\r
149 ############################################################################\r
150 trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGKILL SIGSTOP SIGQUIT\r
151\r
152\r
153 ############################################################################\r
154 # #\r
155 # Resetting our nice level #\r
156 # #\r
157 ############################################################################\r
158 echo "`date -u '+%b %e %T'`: Resetting our nice level to $NICE" | tee -a $LOGFILE\r
159 renice $NICE $$ > /dev/null\r
160 if [ `nice` != "$NICE" ]; then\r
161 exiterror "Failed to set correct nice level"\r
162 fi\r
163\r
164 ############################################################################\r
165 # #\r
166 # Checking if running as root user #\r
167 # #\r
168 ############################################################################\r
169 echo "`date -u '+%b %e %T'`: Checking if we're running as root user" | tee -a $LOGFILE\r
170 if [ `id -u` != 0 ]; then\r
171 exiterror "Not building as root"\r
172 fi\r
173\r
174\r
175 ############################################################################\r
176 # #\r
177 # Checking for necessary temporary space #\r
178 # #\r
179 ############################################################################\r
180 echo "`date -u '+%b %e %T'`: Checking for necessary space on disk $BASE_DEV" | tee -a $LOGFILE\r
181 BASE_DEV=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $1 }'`\r
182 BASE_ASPACE=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $4 }'`\r
183 if (( 2202000 > $BASE_ASPACE )); then\r
184 BASE_USPACE=`du -skx $BASEDIR | awk '{print $1}'`\r
185 if (( 2202000 - $BASE_USPACE > $BASE_ASPACE )); then\r
186 exiterror "Not enough temporary space available, need at least 2.1GB on $BASE_DEV"\r
187 fi\r
188 fi\r
189\r
190 ############################################################################\r
191 # #\r
192 # Building Linux From Scratch system #\r
193 # #\r
194 ############################################################################\r
195 echo "`date -u '+%b %e %T'`: Building Linux From Scratch system" | tee -a $LOGFILE\r
196\r
197 # Set umask\r
198 umask 022\r
199\r
200 # Set LFS Directory\r
201 LFS=$BASEDIR/build\r
202\r
203 # Check /tools symlink\r
204 if [ -h /tools ]; then\r
205 rm -f /tools\r
206 fi\r
207 if [ ! -a /tools ]; then\r
208 ln -s $BASEDIR/build/tools /\r
209 fi\r
210 if [ ! -h /tools ]; then\r
211 exiterror "Could not create /tools symbolic link."\r
212 fi\r
213\r
214 # Setup environment\r
215 set +h\r
216 LC_ALL=POSIX\r
217 export LFS LC_ALL CFLAGS CXXFLAGS\r
218 unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD\r
219\r
220 # Make some extra directories\r
221 mkdir -p $BASEDIR/build/{tools,etc,usr/src} 2>/dev/null\r
222 mkdir -p $BASEDIR/{cache,ccache} 2>/dev/null\r
223 mkdir -p $BASEDIR/build/dev/pts $BASEDIR/build/proc $BASEDIR/build/usr/src/{cache,config,doc,html,langs,lfs,log,src,ccache}\r
224\r
225 # Make all sources and proc available under lfs build\r
226 mount --bind /dev/pts $BASEDIR/build/dev/pts\r
227 mount --bind /proc $BASEDIR/build/proc\r
228 mount --bind $BASEDIR/cache $BASEDIR/build/usr/src/cache\r
229 mount --bind $BASEDIR/ccache $BASEDIR/build/usr/src/ccache\r
230 mount --bind $BASEDIR/config $BASEDIR/build/usr/src/config\r
231 mount --bind $BASEDIR/doc $BASEDIR/build/usr/src/doc\r
232 mount --bind $BASEDIR/html $BASEDIR/build/usr/src/html\r
233 mount --bind $BASEDIR/langs $BASEDIR/build/usr/src/langs\r
234 mount --bind $BASEDIR/lfs $BASEDIR/build/usr/src/lfs\r
235 mount --bind $BASEDIR/log $BASEDIR/build/usr/src/log\r
236 mount --bind $BASEDIR/src $BASEDIR/build/usr/src/src\r
237\r
238 # Run LFS static binary creation scripts one by one\r
239 export CCACHE_DIR=$BASEDIR/ccache\r
240 export CCACHE_HASHDIR=1\r
241\r
242 # Remove pre-install list of installed files in case user erase some files before rebuild\r
243 rm -f $BASEDIR/build/usr/src/lsalr 2>/dev/null\r
244}\r
245\r
246\r
247############################################################################\r
248# #\r
249# Necessary shell functions #\r
250# #\r
251############################################################################\r
252lfsmake1() {\r
253 if [ -f $BASEDIR/lfs/$1 ]; then\r
254 echo "`date -u '+%b %e %T'`: Building $*" | tee -a $LOGFILE\r
255 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1\r
256 if [ $? -ne 0 ]; then\r
257 exiterror "Download error in $1"\r
258 fi\r
259 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1\r
260 if [ $? -ne 0 ]; then\r
261 exiterror "md5sum error in $1, check file in cache or signature"\r
262 fi\r
263 cd $BASEDIR/lfs && make -f $* BUILDTARGET=$BUILDTARGET \\r
264 MACHINE=$MACHINE \\r
265 LFS_BASEDIR=$BASEDIR \\r
266 ROOT=$LFS \\r
267 KVER=$KVER \\r
268 install >> $LOGFILE 2>&1\r
269 if [ $? -ne 0 ]; then\r
270 exiterror "Building $*";\r
271 fi\r
272 else\r
273 exiterror "No such file or directory: $BASEDIR/$1"\r
274 fi\r
275 return 0\r
276}\r
277\r
278lfsmake2() {\r
279 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then\r
280 echo "`date -u '+%b %e %T'`: Building $*" | tee -a $LOGFILE\r
281 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1\r
282 if [ $? -ne 0 ]; then\r
283 exiterror "Download error in $1"\r
284 fi\r
285 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1\r
286 if [ $? -ne 0 ]; then\r
287 exiterror "md5sum error in $1, check file in cache or signature"\r
288 fi\r
289 chroot $LFS /tools/bin/env -i HOME=/root \\r
290 TERM=$TERM PS1='\u:\w\$ ' \\r
291 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \\r
292 VERSION=$VERSION \\r
293 CONFIG_ROOT=$CONFIG_ROOT \\r
294 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \\r
295 CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" \\r
296 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \\r
297 KVER=$KVER \\r
298 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \\r
299 /tools/bin/bash -x -c "cd /usr/src/lfs && \\r
300 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1\r
301 if [ $? -ne 0 ]; then\r
302 exiterror "Building $*"\r
303 fi\r
304 else\r
305 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"\r
306 fi\r
307 return 0\r
308}\r
309\r
310ipcopmake() {\r
311 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then\r
312 echo "`date -u '+%b %e %T'`: Building $*" | tee -a $LOGFILE\r
313 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1\r
314 if [ $? -ne 0 ]; then\r
315 exiterror "Download error in $1"\r
316 fi\r
317 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1\r
318 if [ $? -ne 0 ]; then\r
319 exiterror "md5sum error in $1, check file in cache or signature"\r
320 fi\r
321 chroot $LFS /tools/bin/env -i HOME=/root \\r
322 TERM=$TERM PS1='\u:\w\$ ' \\r
323 PATH=/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \\r
324 VERSION=$VERSION \\r
325 CONFIG_ROOT=$CONFIG_ROOT \\r
326 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \\r
327 CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" \\r
328 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \\r
329 KVER=$KVER \\r
330 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \\r
331 /bin/bash -x -c "cd /usr/src/lfs && \\r
332 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1\r
333 if [ $? -ne 0 ]; then\r
334 exiterror "Building $*"\r
335 fi\r
336 else\r
337 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"\r
338 fi\r
339 return 0\r
340}\r
341\r
342\r
343installmake() {\r
344 if [ -f $BASEDIR/build/usr/src/lfs/$1 ]; then\r
345 echo "`date -u '+%b %e %T'`: Building $*" | tee -a $LOGFILE\r
346 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t " download >> $LOGFILE 2>&1\r
347 if [ $? -ne 0 ]; then\r
348 exiterror "Download error in $1"\r
349 fi\r
350 cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR MESSAGE="$1\t md5sum" md5 >> $LOGFILE 2>&1\r
351 if [ $? -ne 0 ]; then\r
352 exiterror "md5sum error in $1, check file in cache or signature"\r
353 fi\r
354 chroot $LFS /tools/bin/env -i HOME=/root \\r
355 TERM=$TERM PS1='\u:\w\$ ' \\r
356 PATH=/usr/local/bin:/opt/$MACHINE-uClibc/usr/bin:/bin:/usr/bin:/sbin:/usr/sbin \\r
357 VERSION=$VERSION \\r
358 CONFIG_ROOT=$CONFIG_ROOT \\r
359 LFS_PASS="install" \\r
360 NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \\r
361 CFLAGS="-Os" CXXFLAGS="-Os" \\r
362 CCACHE_DIR=/usr/src/ccache CCACHE_HASHDIR=1 \\r
363 KVER=$KVER \\r
364 BUILDTARGET="$BUILDTARGET" MACHINE="$MACHINE" \\r
365 /bin/bash -x -c "cd /usr/src/lfs && \\r
366 make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1\r
367 if [ $? -ne 0 ]; then\r
368 exiterror "Building $*"\r
369 fi\r
370 else\r
371 exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/$1"\r
372 fi\r
373 return 0\r
374}\r
375\r
376buildtoolchain() {\r
377 LOGFILE="$BASEDIR/log/_build.toolchain.log"\r
378 export LOGFILE\r
379 echo -ne "`date -u '+%b %e %T'`: Stage1 toolchain build \n" | tee -a $LOGFILE\r
380 # Build sed now, as we use some extensions\r
381 ORG_PATH=$PATH\r
382 NATIVEGCC=`gcc --version | grep GCC | awk {'print $3'}`\r
383 export NATIVEGCC GCCmajor=${NATIVEGCC:0:1} GCCminor=${NATIVEGCC:2:1} GCCrelease=${NATIVEGCC:4:1}\r
384 lfsmake1 ccache\r
385 lfsmake1 sed LFS_PASS=1\r
386 lfsmake1 m4 LFS_PASS=1\r
387 lfsmake1 bison LFS_PASS=1\r
388 lfsmake1 flex LFS_PASS=1\r
389 lfsmake1 binutils LFS_PASS=1\r
390 lfsmake1 gcc LFS_PASS=1\r
391 export PATH=$BASEDIR/build/usr/local/bin:$BASEDIR/build/tools/bin:$PATH\r
392 \r
393 lfsmake1 linux\r
394 lfsmake1 tcl\r
395 lfsmake1 expect\r
396 lfsmake1 glibc\r
397 lfsmake1 dejagnu\r
398 lfsmake1 gcc LFS_PASS=2\r
399 lfsmake1 binutils LFS_PASS=2\r
400 lfsmake1 gawk\r
401 lfsmake1 coreutils\r
402 lfsmake1 bzip2\r
403 lfsmake1 gzip\r
404 lfsmake1 diffutils\r
405 lfsmake1 findutils\r
406 lfsmake1 make\r
407 lfsmake1 grep\r
408 lfsmake1 sed LFS_PASS=2\r
409 lfsmake1 m4 LFS_PASS=2\r
410 lfsmake1 bison LFS_PASS=2\r
411 lfsmake1 flex LFS_PASS=2\r
412 lfsmake1 gettext\r
413 lfsmake1 ncurses\r
414 lfsmake1 patch\r
415 lfsmake1 tar\r
416 lfsmake1 texinfo\r
417 lfsmake1 bash\r
418 lfsmake1 util-linux\r
419 lfsmake1 perl\r
420 export PATH=$ORG_PATH\r
421}\r
422\r
423buildbase() {\r
424 LOGFILE="$BASEDIR/log/_build.base.log"\r
425 export LOGFILE\r
426 echo -ne "`date -u '+%b %e %T'`: Stage2 linux base build \n" | tee -a $LOGFILE\r
427 # Run LFS dynamic binary creation scripts one by one\r
428 lfsmake2 stage2\r
429 lfsmake2 makedev\r
430 lfsmake2 linux\r
431 lfsmake2 man-pages\r
432 lfsmake2 glibc\r
433 lfsmake2 binutils\r
434 lfsmake2 gcc\r
435 lfsmake2 coreutils\r
436 lfsmake2 zlib\r
437 lfsmake2 mktemp\r
438 lfsmake2 iana-etc\r
439 lfsmake2 findutils\r
440 lfsmake2 gawk\r
441 lfsmake2 ncurses\r
442 lfsmake2 vim\r
443 lfsmake2 m4\r
444 lfsmake2 bison\r
445 lfsmake2 less\r
446 lfsmake2 groff\r
447 lfsmake2 sed\r
448 lfsmake2 flex\r
449 lfsmake2 gettext\r
450 lfsmake2 net-tools\r
451 lfsmake2 inetutils\r
452 lfsmake2 perl\r
453 lfsmake2 texinfo\r
454 lfsmake2 autoconf\r
455 lfsmake2 automake\r
456 lfsmake2 bash\r
457 lfsmake2 file\r
458 lfsmake2 libtool\r
459 lfsmake2 bzip2\r
460 lfsmake2 diffutils\r
461 lfsmake2 ed\r
462 lfsmake2 kbd\r
463 lfsmake2 e2fsprogs\r
464 lfsmake2 grep\r
465 if [ 'i386' = $MACHINE ]; then \r
466 lfsmake2 grub\r
467 elif [ 'alpha' = $MACHINE ]; then \r
468 lfsmake2 aboot\r
469 fi\r
470 lfsmake2 gzip\r
471 lfsmake2 man\r
472 lfsmake2 make\r
473 lfsmake2 modutils\r
474 lfsmake2 patch\r
475 lfsmake2 procinfo\r
476 lfsmake2 procps\r
477 lfsmake2 psmisc\r
478 lfsmake2 shadow\r
479 lfsmake2 sysklogd\r
480 lfsmake2 sysvinit\r
481 lfsmake2 tar\r
482 lfsmake2 util-linux\r
483}\r
484\r
485buildipcop() {\r
486 # Run IPCop make scripts one by one\r
487 LOGFILE="$BASEDIR/log/_build.ipcop.log"\r
488 export LOGFILE\r
489 echo -ne "`date -u '+%b %e %T'`: Stage3 $NAME build \n" | tee -a $LOGFILE\r
490\r
491 # Build these first as some of the kernel packages below rely on \r
492 # these for some of their client program functionality \r
493 ipcopmake configroot\r
494 ipcopmake dhcp\r
495 ipcopmake dhcpcd\r
496 ipcopmake libusb\r
497 ipcopmake libpcap\r
498 ipcopmake linux-atm\r
499 ipcopmake ppp\r
500 ipcopmake rp-pppoe\r
501 ipcopmake unzip\r
502 # Do SMP now\r
503 if [ 'i386' = $MACHINE ]; then \r
504 # abuse the SMP flag, and make an minimal installer kernel first\r
505 # so that the boot floppy always works.....\r
506 ipcopmake linux LFS_PASS=ipcop SMP=installer\r
507 ipcopmake linux LFS_PASS=ipcop SMP=1\r
508 ipcopmake 3cp4218 SMP=1\r
509 ipcopmake amedyn SMP=1\r
510 ipcopmake cxacru SMP=1\r
511 ipcopmake eagle SMP=1\r
512\r
513 # These are here because they have i386 only binary libraries\r
514 # included in the package.\r
515 ipcopmake cnx_pci SMP=1\r
516 ipcopmake fcdsl SMP=1\r
517 ipcopmake fcdsl2 SMP=1\r
518 ipcopmake fcdslsl SMP=1\r
519 ipcopmake fcdslusb SMP=1\r
520 ipcopmake fcdslslusb SMP=1\r
521 ipcopmake pulsar SMP=1\r
522 ipcopmake unicorn SMP=1\r
523 fi\r
524\r
525 ipcopmake linux LFS_PASS=ipcop\r
526 ipcopmake 3cp4218 \r
527 ipcopmake amedyn \r
528 ipcopmake cxacru \r
529 ipcopmake eciadsl \r
530 ipcopmake eagle \r
531 ipcopmake speedtouch \r
532 if [ 'i386' = $MACHINE ]; then \r
533 # These are here because they have i386 only binary libraries\r
534 # included in the package.\r
535 ipcopmake cnx_pci \r
536 ipcopmake fcdsl \r
537 ipcopmake fcdsl2 \r
538 ipcopmake fcdslsl \r
539 ipcopmake fcdslusb \r
540 ipcopmake fcdslslusb \r
541 ipcopmake pulsar \r
542 ipcopmake unicorn \r
543 fi\r
544\r
545 ipcopmake pcmcia-cs\r
546 ipcopmake expat\r
547 ipcopmake gdbm\r
548 ipcopmake gmp\r
549 ipcopmake openssl\r
550 ipcopmake python\r
551 ipcopmake libnet\r
552 ipcopmake libpng\r
553 ipcopmake gd\r
554 ipcopmake popt\r
555 ipcopmake slang\r
556 ipcopmake newt\r
557 ipcopmake libcap\r
558 ipcopmake pciutils\r
559 ipcopmake pcre\r
560 ipcopmake apache\r
561 ipcopmake arping\r
562 ipcopmake beep\r
563 ipcopmake bind\r
564 ipcopmake capi4k-utils\r
565 ipcopmake cdrtools\r
566 ipcopmake dnsmasq\r
567 ipcopmake dosfstools\r
568 ipcopmake ethtool\r
569 ipcopmake ez-ipupdate\r
570 ipcopmake fcron\r
571 ipcopmake perl-GD\r
572 ipcopmake gnupg\r
573 ipcopmake hdparm\r
574 ipcopmake ibod\r
575 ipcopmake initscripts\r
576 ipcopmake iptables\r
577 ipcopmake ipac-ng\r
578 ipcopmake ipaddr\r
579 ipcopmake iproute2\r
580 ipcopmake iptstate\r
581 ipcopmake iputils\r
582 ipcopmake isapnptools\r
583 ipcopmake isdn4k-utils\r
584 ipcopmake kudzu\r
585 ipcopmake logrotate\r
586 ipcopmake logwatch\r
587 ipcopmake mingetty\r
588 ipcopmake misc-progs\r
589 ipcopmake mtools\r
590 ipcopmake nano\r
591 ipcopmake nash\r
592 ipcopmake nasm\r
593 ipcopmake URI\r
594 ipcopmake HTML-Tagset\r
595 ipcopmake HTML-Parser\r
596 ipcopmake Compress-Zlib\r
597 ipcopmake Digest\r
598 ipcopmake Digest-SHA1\r
599 ipcopmake Digest-HMAC\r
600 ipcopmake libwww-perl\r
601 ipcopmake Net-DNS\r
602 ipcopmake Net-IPv4Addr\r
603 ipcopmake Net_SSLeay\r
604 ipcopmake noip_updater\r
605 ipcopmake ntp\r
606 ipcopmake oinkmaster\r
607 ipcopmake openssh\r
608 ipcopmake openswan\r
609 ipcopmake pptpclient\r
610 ipcopmake rrdtool\r
611 ipcopmake setserial\r
612 ipcopmake setup\r
613 ipcopmake snort\r
614 #ipcopmake speedycgi\r
615 ipcopmake squid\r
616 ipcopmake squid-graph\r
617 ipcopmake tcpdump\r
618 ipcopmake traceroute\r
619 ipcopmake vlan\r
620 ipcopmake wireless\r
621 ipcopmake libsafe\r
622 ipcopmake 3c5x9setup\r
623 ipcopmake stund\r
624 ipcopmake lpd\r
625 ipcopmake xampp\r
626 ipcopmake pam\r
627}\r
628\r
629buildinstaller() {\r
630 # Run installer scripts one by one\r
631 LOGFILE="$BASEDIR/log/_build.installer.log"\r
632 export LOGFILE\r
633 echo -ne "`date -u '+%b %e %T'`: Stage4 installer build \n" | tee -a $LOGFILE\r
634 if [ 'i386' = $MACHINE ]; then \r
635 ipcopmake syslinux\r
636 ipcopmake as86\r
637 ipcopmake mbr\r
638 ipcopmake uClibc\r
639 fi\r
640 installmake busybox\r
641 installmake sysvinit\r
642 installmake e2fsprogs\r
643 installmake misc-progs\r
644 installmake slang\r
645 installmake util-linux\r
646 installmake newt\r
647 installmake pciutils\r
648 installmake pcmcia-cs\r
649 installmake kbd\r
650 installmake installer\r
651 installmake scsi.img\r
652 installmake driver.img\r
653 installmake initrd\r
654 installmake boot.img\r
655}\r
656\r
657buildpackages() {\r
658 LOGFILE="$BASEDIR/log/_build.packages.log"\r
659 export LOGFILE\r
660 echo "... see detailed log in _build.*.log files" >> $LOGFILE\r
661 echo -ne "`date -u '+%b %e %T'`: Stage5 packages build \n" | tee -a $LOGFILE\r
662 # Strip files\r
663 echo "`date -u '+%b %e %T'`: Stripping files" | tee -a $LOGFILE\r
664 find $LFS/lib $LFS/usr/lib $LFS/usr/share/rrdtool-* $LFS/install ! -type l \( -name '*.so' -o -name '*.so[\.0-9]*' \) \\r
665 ! -name 'libc.so' ! -name 'libpthread.so' ! -name 'libcrypto.so.0.9.7.sha1' \\r
666 -exec $LFS/tools/bin/strip --strip-all {} \; >> $LOGFILE 2>&1\r
667 # add -ls before -exec if you want to verify what files are stripped\r
668\r
669 find $LFS/{,s}bin $LFS/usr/{,s}bin $LFS/usr/local/{,s}bin ! -type l \\r
670 -exec file {} \; | grep " ELF " | cut -f1 -d ':' | xargs $LFS/tools/bin/strip --strip-all >> $LOGFILE 2>&1\r
671 # there add -v to strip to verify\r
672\r
673 if [ 'i386' = $MACHINE ]; then\r
674 # Create fcdsl packages\r
675 echo "`date -u '+%b %e %T'`: Building fcdsl tgz" | tee -a $LOGFILE\r
676 cp $LFS/install/images/fcdsl/license.txt $LFS >> $LOGFILE 2>&1\r
677 touch $LFS/var/run/{need-depmod-$KVER,need-depmod-$KVER-smp}\r
678 cd $LFS && tar cvfz $LFS/install/images/$SNAME-fcdsl-$VERSION.$MACHINE.tgz \\r
679 lib/modules/$KVER/misc/fcdsl*.o.gz \\r
680 lib/modules/$KVER-smp/misc/fcdsl*.o.gz \\r
681 usr/lib/isdn/{fds?base.bin,fd?ubase.frm} \\r
682 etc/fcdsl/fcdsl*.conf \\r
683 etc/drdsl/{drdsl,drdsl.ini} \\r
684 license.txt \\r
685 var/run/{need-depmod-$KVER,need-depmod-$KVER-smp} >> $LOGFILE 2>&1\r
686 rm -f $LFS/license.txt >> $LOGFILE 2>&1\r
687 cd $BASEDIR\r
688 fi\r
689\r
690 # Create update for this version\r
691# echo "`date -u '+%b %e %T'`: Building update $VERSION tgz" | tee -a $LOGFILE\r
692# tar -cz -C $BASEDIR/build --files-from=$BASEDIR/updates/$VERSION/ROOTFILES.$MACHINE-$VERSION -f $BASEDIR/updates/$VERSION/patch.tar.gz --exclude='#*'; \r
693# chmod 755 $BASEDIR/updates/$VERSION/setup\r
694# tar -cz -C $BASEDIR/updates/$VERSION -f $LFS/install/images/$SNAME-update-$VERSION.$MACHINE.tgz patch.tar.gz setup information\r
695# rm -f $LFS/var/run/{need-depmod-$KVER,need-depmod-$KVER-smp}\r
696 \r
697 # Generating list of packages used\r
698 echo "`date -u '+%b %e %T'`: Generating packages list from logs" | tee -a $LOGFILE\r
699 rm -f $BASEDIR/doc/packages-list\r
700 for i in `ls -1tr $BASEDIR/log/[^_]*`; do\r
701 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then\r
702 echo "* `basename $i`" >>$BASEDIR/doc/packages-list\r
703 fi\r
704 done\r
705 echo "!!! List of softwares used to build $NAME Version:$VERSION" > $BASEDIR/doc/packages-list.txt\r
706 grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|ipcop$\|setup$\|stage2$\|smp$\|tools$\|tools1$\|tools2$' \\r
707 $BASEDIR/doc/packages-list | sort >> $BASEDIR/doc/packages-list.txt\r
708 rm -f $BASEDIR/doc/packages-list\r
709 # packages-list.txt is ready to be displayed for wiki page IPCopSoftwares\r
710\r
711 # Create ISO for CDRom and USB-superfloppy\r
712 ipcopmake cdrom\r
713 cp $LFS/install/images/{*.iso,*.tgz} $BASEDIR >> $LOGFILE 2>&1\r
714\r
715 # Cleanup\r
716 stdumount\r
717 rm -rf $BASEDIR/build/tmp/*\r
718\r
719 # Generating total list of files\r
720 echo "`date -u '+%b %e %T'`: Generating files list from logs" | tee -a $LOGFILE\r
721 rm -f $BASEDIR/log/FILES\r
722 for i in `ls -1tr $BASEDIR/log/[^_]*`; do\r
723 if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then\r
724 echo "##" >>$BASEDIR/log/FILES\r
725 echo "## `basename $i`" >>$BASEDIR/log/FILES\r
726 echo "##" >>$BASEDIR/log/FILES\r
727 cat $i | sed "s%^\./%#%" | sort >> $BASEDIR/log/FILES\r
728 fi\r
729 done\r
730\r
731 cd $PWD\r
732\r
733}\r
734\r
735# See what we're supposed to do\r
736case "$1" in \r
737build)\r
738 BUILDMACHINE=`uname -m`\r
739 PACKAGE=`ls -v -r $BASEDIR/cache/$SNAME-1.4.*-toolchain-$BUILDMACHINE.tar.gz 2> /dev/null | head -n 1`\r
740 #only restore on a clean disk\r
741 if [ ! -f log/perl-*-tools ]; then\r
742 if [ ! -n "$PACKAGE" ]; then\r
743 echo "`date -u '+%b %e %T'`: Full toolchain compilation" | tee -a $LOGFILE\r
744 prepareenv\r
745 buildtoolchain\r
746 else\r
747 PACKAGENAME=${PACKAGE%.tar.gz}\r
748 echo "`date -u '+%b %e %T'`: Restore from $PACKAGE" | tee -a $LOGFILE\r
749 if [ `md5sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.md5 | awk '{print $1}'` ]; then\r
750 tar zxf $PACKAGE\r
751 prepareenv\r
752 else\r
753 exiterror "$PACKAGENAME md5 did not match, check downloaded package"\r
754 fi\r
755 fi\r
756 else\r
757 echo "`date -u '+%b %e %T'`: Using installed toolchain" | tee -a $LOGFILE\r
758 prepareenv\r
759 fi\r
760 buildbase\r
761 buildipcop\r
762 buildinstaller\r
763 buildpackages\r
764 ;;\r
765shell)\r
766 # enter a shell inside LFS chroot\r
767 # may be used to changed kernel settings\r
768 prepareenv\r
769 entershell\r
770 ;;\r
771changelog)\r
772 echo "Building doc/Changelog from CVS"\r
773 # cv2cl script come from http://www.red-bean.com/cvs2cl/\r
774 if [ ! -s $BASEDIR/doc/CVS/Tag ]; then\r
775 BRANCHOPTS=""\r
776 else\r
777 BRANCH=`cat $BASEDIR/doc/CVS/Tag`\r
778 BRANCH=${BRANCH:1}\r
779 BRANCHOPTS="--follow-only $BRANCH"\r
780 fi\r
781 \r
782 $BASEDIR/tools/cvs2cl.pl --gmt --show-dead $BRANCHOPTS -f $BASEDIR/doc/ChangeLog\r
783 rm -f $BASEDIR/doc/ChangeLog.bak\r
784 echo\r
785 echo "Commit the change now to update CVS"\r
786 ;;\r
787check)\r
788 echo "Checking sources files availability on the web"\r
789 if [ ! -d $DIR_CHK ]; then\r
790 mkdir -p $DIR_CHK\r
791 fi\r
792 FINISHED=0\r
793 cd $BASEDIR/lfs\r
794 for c in `seq $MAX_RETRIES`; do\r
795 if (( FINISHED==1 )); then\r
796 break\r
797 fi\r
798 FINISHED=1\r
799 cd $BASEDIR/lfs\r
800 for i in *; do\r
801 if [ -f "$i" -a "$i" != "Config" ]; then\r
802 make -s -f $i MACHINE=$MACHINE LFS_BASEDIR=$BASEDIR ROOT=$BASEDIR/build \\r
803 MESSAGE="$i\t ($c/$MAX_RETRIES)" check\r
804 if [ $? -ne 0 ]; then\r
805 echo "Check : wget error in lfs/$i"\r
806 FINISHED=0\r
807 fi\r
808 fi\r
809 done\r
810 done\r
811 cd -\r
812 ;;\r
813checkclean)\r
814 echo "Erasing sources files availability tags"\r
815 rm -rf $DIR_CHK/*\r
816 ;;\r
817clean)\r
818 for i in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do\r
819 $LOSETUP -d $i 2>/dev/null\r
820 done\r
821 for i in `mount | grep $BASEDIR | cut -d " " -f 1`; do\r
822 umount $i\r
823 done\r
824 stdumount\r
825 for i in `seq 0 7`; do\r
826 if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then\r
827 umount /dev/loop${i} 2>/dev/null;\r
828 losetup -d /dev/loop${i} 2>/dev/null;\r
829 fi;\r
830 done\r
831 rm -rf $BASEDIR/build\r
832 rm -rf $BASEDIR/cdrom\r
833 rm -rf $BASEDIR/log\r
834 rm -f $BASEDIR/updates/$VERSION/patch.tar.gz;\r
835 if [ -h /tools ]; then\r
836 rm -f /tools\r
837 fi\r
838 ;;\r
839dist)\r
840 echo "Building source package from CVS, list of changed files, MD5 of release files"\r
841 if [ ! -s $BASEDIR/doc/CVS/Tag ]; then\r
842 BRANCH=""\r
843 BRANCHOPTS="-D `date +'%Y-%m-%d'`"\r
844 else\r
845 BRANCH=`cat $BASEDIR/doc/CVS/Tag`\r
846 BRANCH=${BRANCH:1}\r
847 BRANCHOPTS="-r $BRANCH"\r
848 fi\r
849\r
850 rm -rf $BASEDIR/build/tmp/$SNAME-$VERSION $BASEDIR/doc/release.txt\r
851 cd $BASEDIR/build/tmp\r
852 # build sources tgz\r
853 echo "Export tree $BRANCH $SNAME-$VERSION"\r
854 cvs -z3 -d `cat $BASEDIR/CVS/Root` export $BRANCHOPTS ipcop\r
855 if [ $? -eq 0 ]; then\r
856 mv ipcop $SNAME-$VERSION\r
857 tar cfz $BASEDIR/$SNAME-sources-$VERSION.tgz $SNAME-$VERSION\r
858 cd $BASEDIR\r
859\r
860 if [ ! -d $BASEDIR/build/tmp/$PREVIOUSTAG ]; then\r
861 # export previous version to be compared with actual, this help to check wich files need to go in update\r
862 cd $BASEDIR/build/tmp\r
863 echo "Export tree $PREVIOUSTAG"\r
864 cvs -z3 -d `cat $BASEDIR/CVS/Root` export -r $PREVIOUSTAG ipcop\r
865 mv ipcop $PREVIOUSTAG\r
866 fi\r
867 if [ -d $BASEDIR/build/tmp/$PREVIOUSTAG -o -d $BASEDIR/build/tmp/$SNAME-$VERSION ]; then\r
868 cd $BASEDIR/build/tmp\r
869 echo "diff $PREVIOUSTAG <> $BRANCH $SNAME-$VERSION >doc/updated-sources.txt"\r
870 diff -rq $PREVIOUSTAG $SNAME-$VERSION > $BASEDIR/doc/updated-sources.txt\r
871 mv $BASEDIR/doc/updated-sources.txt $BASEDIR/doc/updated-sources.bak\r
872 sed -e "s+Files $PREVIOUSTAG\/++" \\r
873 -e "s+ and .*$++" \\r
874 -e "s+src/rc.d+etc/rc.d+" \\r
875 -e "s+^langs/+var/ipcop/langs/+" \\r
876 -e "s+html/cgi-bin+home/httpd/cgi-bin+" $BASEDIR/doc/updated-sources.bak \\r
877 > $BASEDIR/doc/updated-sources.txt\r
878 rm -f $BASEDIR/doc/updated-sources.bak\r
879 fi\r
880 fi\r
881 ;;\r
882newupdate)\r
883 # create structure for $VERSION update\r
884 if [ ! -f "updates/$VERSION" ]; then\r
885 mkdir -p updates/$VERSION\r
886 cd updates/$VERSION\r
887 touch information\r
888 echo 'etc/issue' > ROOTFILES.alpha-$VERSION\r
889 echo 'etc/issue' > ROOTFILES.i386-$VERSION\r
890 echo 'patch.tar.gz' > .cvsignore\r
891 sed -e "s+^UPGRADEVERSION.*$+UPGRADEVERSION=$VERSION+" $BASEDIR/src/scripts/updatesetup > setup\r
892 chmod 755 setup\r
893 cd ..\r
894 echo "Adding directory $VERSION to cvs"\r
895 cvs add $VERSION\r
896 echo "Adding files to cvs"\r
897 cvs add $VERSION/ROOTFILES.alpha-$VERSION \\r
898 $VERSION/ROOTFILES.i386-$VERSION \\r
899 $VERSION/information \\r
900 $VERSION/setup \\r
901 $VERSION/.cvsignore\r
902 else\r
903 echo "update/$VERSION already exist"\r
904 fi\r
905 cd -\r
906 exit 0\r
907 ;;\r
908prefetch)\r
909 if [ ! -d $BASEDIR/cache ]; then\r
910 mkdir $BASEDIR/cache\r
911 fi\r
912 mkdir -p $BASEDIR/log\r
913 echo "`date -u '+%b %e %T'`:Preload all source files" | tee -a $LOGFILE\r
914 FINISHED=0\r
915 cd $BASEDIR/lfs\r
916 for c in `seq $MAX_RETRIES`; do\r
917 if (( FINISHED==1 )); then \r
918 break\r
919 fi\r
920 FINISHED=1\r
921 cd $BASEDIR/lfs\r
922 for i in *; do\r
923 if [ -f "$i" -a "$i" != "Config" ]; then\r
924 make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t ($c/$MAX_RETRIES)" download >> $LOGFILE 2>&1\r
925 if [ $? -ne 0 ]; then\r
926 echo "Prefetch : wget error in lfs/$i"\r
927 FINISHED=0\r
928 else\r
929 if [ $c -eq 1 ]; then\r
930 echo "Prefetch : lfs/$i files loaded"\r
931 fi\r
932 fi\r
933 fi\r
934 done\r
935 done\r
936 echo "Prefetch : verifying md5sum"\r
937 ERROR=0\r
938 for i in *; do\r
939 if [ -f "$i" -a "$i" != "Config" ]; then\r
940 make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t " md5 >> $LOGFILE 2>&1\r
941 if [ $? -ne 0 ]; then\r
942 echo "md5 difference in lfs/$i"\r
943 ERROR=1\r
944 fi\r
945 fi\r
946 done\r
947 if [ $ERROR -eq 0 ]; then\r
948 echo "Prefetch : all files md5sum match"\r
949 fi\r
950 cd -\r
951 ;;\r
952rootfiles)\r
953 PREVIOUSVERSION=`echo $PREVIOUSTAG | sed -e 's/IPCOP_v//' -e 's/_FINAL//' -e 's/_/\./g'`\r
954 # make md5 list of actual build\r
955 # some packages include a timestamp (kernel/perl/python/vim and more), so md5 vary at each build\r
956 # anyway, it is sometime usable after a patch or a minor upgrade to know wich files include in update\r
957 if [ ! -f "$BASEDIR/build/install/cdrom/$SNAME-$VERSION.tgz" ]; then\r
958 echo "need cdrom be build to read include files list, use ./make.sh build before."\r
959 else\r
960 tar tzf $BASEDIR/build/install/cdrom/$SNAME-$VERSION.tgz > $BASEDIR/updates/$VERSION/FILES.tmp\r
961 cd $BASEDIR/build\r
962 rm -f $BASEDIR/updates/$VERSION/FILES-$MACHINE-$VERSION.md5\r
963 for line in `cat $BASEDIR/updates/$VERSION/FILES.tmp`; do\r
964 if [ -f "$line" -a ! -L "$line" ]; then\r
965 md5sum "$line" >> $BASEDIR/updates/$VERSION/FILES-$MACHINE-$VERSION.md5\r
966 fi\r
967 done\r
968 diff $BASEDIR/updates/$PREVIOUSVERSION/FILES-$MACHINE-$PREVIOUSVERSION.md5 \\r
969 $BASEDIR/updates/$VERSION/FILES-$MACHINE-$VERSION.md5 \\r
970 > $BASEDIR/updates/$VERSION/FILES-$MACHINE.diff\r
971 awk '$1==">" {print $3}' $BASEDIR/updates/$VERSION/FILES-$MACHINE.diff \\r
972 > $BASEDIR/updates/$VERSION/ROOTFILES.add.$MACHINE\r
973 awk '$1=="<" {print $3}' $BASEDIR/updates/$VERSION/FILES-$MACHINE.diff \\r
974 > $BASEDIR/updates/$VERSION/ROOTFILES.remove.$MACHINE.tmp\r
975 rm -f $BASEDIR/updates/$VERSION/ROOTFILES.remove.$MACHINE\r
976 for line in `cat $BASEDIR/updates/$VERSION/ROOTFILES.remove.$MACHINE.tmp`; do\r
977 # a file is only removed when not in add file\r
978 if ( ! grep -q "^$line$" $BASEDIR/updates/$VERSION/ROOTFILES.add.$MACHINE ); then\r
979 echo $line >> $BASEDIR/updates/$VERSION/ROOTFILES.remove.$MACHINE\r
980 fi\r
981 done\r
982 rm -f $BASEDIR/updates/$VERSION/{FILES.tmp,FILES-*.diff,ROOTFILES.remove.*.tmp}\r
983 fi\r
984 exit 0\r
985 ;;\r
986toolchain)\r
987 prepareenv\r
988 buildtoolchain\r
989 BUILDMACHINE=`uname -m`\r
990 echo "`date -u '+%b %e %T'`: Create toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE\r
991 cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \\r
992 build/{bin,etc,usr/bin,usr/local} \\r
993 build/tools/{bin,etc,*-linux-gnu,include,lib,libexec,sbin,share,var} \\r
994 log >> $LOGFILE\r
995 md5sum cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.tar.gz \\r
996 > cache/$SNAME-$VERSION-toolchain-$BUILDMACHINE.md5\r
997 stdumount\r
998 ;;\r
999gettoolchain)\r
1000 BUILDMACHINE=`uname -m`\r
1001 # arbitrary name to be updated in case of new toolchain package upload\r
1002 PACKAGE=$SNAME-1.4.11-toolchain-$BUILDMACHINE\r
1003 URL_SFNET=`grep URL_SFNET lfs/Config | awk '{ print $3 }'`\r
1004 echo "`date -u '+%b %e %T'`: Load toolchain tar.gz for $BUILDMACHINE" | tee -a $LOGFILE\r
1005 cd $BASEDIR/cache\r
1006 wget -c $URL_SFNET/ipcop/$PACKAGE.tar.gz $URL_SFNET/ipcop/$PACKAGE.md5\r
1007 if [ $? -ne 0 ]; then\r
1008 echo "`date -u '+%b %e %T'`: error downloading toolchain for $BUILDMACHINE machine" | tee -a $LOGFILE\r
1009 else\r
1010 if [ "`md5sum $PACKAGE.tar.gz | awk '{print $1}'`" = "`cat $PACKAGE.md5 | awk '{print $1}'`" ]; then\r
1011 echo "`date -u '+%b %e %T'`: toolchain md5 ok" | tee -a $LOGFILE\r
1012 else\r
1013 exiterror "$PACKAGE.md5 did not match, check downloaded package"\r
1014 fi\r
1015 fi\r
1016 ;;\r
1017*)\r
1018 echo "Usage: $0 {build|changelog|check|checkclean|clean|dist|gettoolchain|newupdate|prefetch|rootfiles|shell|toolchain}"\r
1019 cat doc/make.sh-usage\r
1020 exit 1\r
1021 ;;\r
1022esac\r