1 | #!/bin/sh
|
---|
2 | # $Id$
|
---|
3 |
|
---|
4 | ###################################
|
---|
5 | ### FUNCTIONS ###
|
---|
6 | ###################################
|
---|
7 |
|
---|
8 |
|
---|
9 |
|
---|
10 | #----------------------------#
|
---|
11 | host_prep_Makefiles() { # Initialization of the system
|
---|
12 | #----------------------------#
|
---|
13 | local LFS_HOST
|
---|
14 |
|
---|
15 | echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files${R_arrow}"
|
---|
16 |
|
---|
17 | # defined here, only for ease of reading
|
---|
18 | LFS_HOST="`echo ${MACHTYPE} | sed -e 's/unknown/cross/g' -e 's/-pc-/-cross-/g'`"
|
---|
19 | (
|
---|
20 | cat << EOF
|
---|
21 | 023-creatingtoolsdir:
|
---|
22 | @\$(call echo_message, Building)
|
---|
23 | @mkdir -v \$(MOUNT_PT)/tools && \\
|
---|
24 | rm -fv /tools && \\
|
---|
25 | ln -sv \$(MOUNT_PT)/tools /
|
---|
26 | @if [ ! -d \$(MOUNT_PT)/sources ]; then \\
|
---|
27 | mkdir \$(MOUNT_PT)/sources; \\
|
---|
28 | fi;
|
---|
29 | @chmod a+wt \$(MOUNT_PT)/sources && \\
|
---|
30 | touch \$@
|
---|
31 |
|
---|
32 | 024-creatingcrossdir: 023-creatingtoolsdir
|
---|
33 | @mkdir -v \$(MOUNT_PT)/cross-tools && \\
|
---|
34 | rm -fv /cross-tools && \\
|
---|
35 | ln -sv \$(MOUNT_PT)/cross-tools /
|
---|
36 | @touch \$@
|
---|
37 |
|
---|
38 | 025-addinguser: 024-creatingcrossdir
|
---|
39 | @\$(call echo_message, Building)
|
---|
40 | @if [ ! -d /home/lfs ]; then \\
|
---|
41 | groupadd lfs; \\
|
---|
42 | useradd -s /bin/bash -g lfs -m -k /dev/null lfs; \\
|
---|
43 | else \\
|
---|
44 | touch user-lfs-exist; \\
|
---|
45 | fi;
|
---|
46 | @chown lfs \$(MOUNT_PT) && \\
|
---|
47 | chown lfs \$(MOUNT_PT)/tools && \\
|
---|
48 | chown lfs \$(MOUNT_PT)/cross-tools && \\
|
---|
49 | chown lfs \$(MOUNT_PT)/sources && \\
|
---|
50 | touch \$@
|
---|
51 |
|
---|
52 | 026-settingenvironment: 025-addinguser
|
---|
53 | @\$(call echo_message, Building)
|
---|
54 | @if [ -f /home/lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\
|
---|
55 | mv -v /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\
|
---|
56 | fi;
|
---|
57 | @if [ -f /home/lfs/.bash_profile -a ! -f /home/lfs/.bash_profile.XXX ]; then \\
|
---|
58 | mv -v /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\
|
---|
59 | fi;
|
---|
60 | @echo "set +h" > /home/lfs/.bashrc && \\
|
---|
61 | echo "umask 022" >> /home/lfs/.bashrc && \\
|
---|
62 | echo "LFS=\$(MOUNT_PT)" >> /home/lfs/.bashrc && \\
|
---|
63 | echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\
|
---|
64 | echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\
|
---|
65 | echo "export LFS LC_ALL PATH" >> /home/lfs/.bashrc && \\
|
---|
66 | echo "" >> /home/lfs/.bashrc && \\
|
---|
67 | echo "unset CFLAGS" >> /home/lfs/.bashrc && \\
|
---|
68 | echo "unset CXXFLAGS" >> /home/lfs/.bashrc && \\
|
---|
69 | echo "" >> /home/lfs/.bashrc && \\
|
---|
70 | echo "export LFS_HOST=\"${LFS_HOST}\"" >> /home/lfs/.bashrc && \\
|
---|
71 | echo "export LFS_TARGET=\"${TARGET}\"" >> /home/lfs/.bashrc && \\
|
---|
72 | echo "export LFS_TARGET32=\"${TARGET32}\"" >> /home/lfs/.bashrc && \\
|
---|
73 | echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc
|
---|
74 | @chown lfs:lfs /home/lfs/.bashrc && \\
|
---|
75 | touch envars && \\
|
---|
76 | touch \$@
|
---|
77 | EOF
|
---|
78 | ) >> $MKFILE.tmp
|
---|
79 |
|
---|
80 | }
|
---|
81 |
|
---|
82 |
|
---|
83 |
|
---|
84 | #-----------------------------#
|
---|
85 | cross_tools_Makefiles() { #
|
---|
86 | #-----------------------------#
|
---|
87 | echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools${R_arrow}"
|
---|
88 |
|
---|
89 | for file in cross-tools/* ; do
|
---|
90 | # Keep the script file name
|
---|
91 | this_script=`basename $file`
|
---|
92 | #
|
---|
93 | # Skip this script...
|
---|
94 | case $this_script in
|
---|
95 | *cflags* | *variables* ) # work done in host_prep_Makefiles
|
---|
96 | continue; ;;
|
---|
97 | *) ;;
|
---|
98 | esac
|
---|
99 | #
|
---|
100 | # Set the dependency for the first target.
|
---|
101 | if [ -z $PREV ] ; then PREV=026-settingenvironment ; fi
|
---|
102 |
|
---|
103 | # First append each name of the script files to a list (this will become
|
---|
104 | # the names of the targets in the Makefile
|
---|
105 | cross_tools="$cross_tools $this_script"
|
---|
106 |
|
---|
107 | # Grab the name of the target (minus the -headers or -cross in the case of gcc
|
---|
108 | # and binutils in chapter 5)
|
---|
109 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
110 | -e 's@-static@@' \
|
---|
111 | -e 's@-final@@' \
|
---|
112 | -e 's@-headers@@' \
|
---|
113 | -e 's@-64@@' \
|
---|
114 | -e 's@-n32@@'`
|
---|
115 | # Adjust 'name' and patch a few scripts on the fly..
|
---|
116 | case $name in
|
---|
117 | linux-libc) name=linux-libc-headers ;;
|
---|
118 | esac
|
---|
119 | #
|
---|
120 | # Find the version of the command files, if it corresponds with the building of a specific package
|
---|
121 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
122 |
|
---|
123 |
|
---|
124 | #--------------------------------------------------------------------#
|
---|
125 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
126 | #--------------------------------------------------------------------#
|
---|
127 | #
|
---|
128 | # Drop in the name of the target on a new line, and the previous target
|
---|
129 | # as a dependency. Also call the echo_message function.
|
---|
130 | wrt_target "${this_script}" "$PREV"
|
---|
131 | #
|
---|
132 | # If $vrs isn't empty, we've got a package...
|
---|
133 | #
|
---|
134 | [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
|
---|
135 | #
|
---|
136 | wrt_run_as_su "${this_script}" "${file}"
|
---|
137 | #
|
---|
138 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
139 | #
|
---|
140 | # Include a touch of the target name so make can check if it's already been made.
|
---|
141 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
142 | #
|
---|
143 | #--------------------------------------------------------------------#
|
---|
144 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
145 | #--------------------------------------------------------------------#
|
---|
146 | #
|
---|
147 | # Keep the script file name for Makefile dependencies.
|
---|
148 | PREV=$this_script
|
---|
149 |
|
---|
150 | done # for file in ....
|
---|
151 | }
|
---|
152 |
|
---|
153 |
|
---|
154 | #-----------------------------#
|
---|
155 | temptools_Makefiles() { #
|
---|
156 | #-----------------------------#
|
---|
157 | echo "${tab_}${GREEN}Processing... ${L_arrow}temp system${R_arrow}"
|
---|
158 |
|
---|
159 | for file in temp-system/* ; do
|
---|
160 | # Keep the script file name
|
---|
161 | this_script=`basename $file`
|
---|
162 | #
|
---|
163 | # First append each name of the script files to a list (this will become
|
---|
164 | # the names of the targets in the Makefile
|
---|
165 | temptools="$temptools $this_script"
|
---|
166 |
|
---|
167 | #
|
---|
168 | # Grab the name of the target, strip id number, XXX-script
|
---|
169 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
|
---|
170 | #
|
---|
171 | # Find the version of the command files, if it corresponds with the building of a specific package
|
---|
172 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
173 |
|
---|
174 |
|
---|
175 | #--------------------------------------------------------------------#
|
---|
176 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
177 | #--------------------------------------------------------------------#
|
---|
178 | #
|
---|
179 | # Drop in the name of the target on a new line, and the previous target
|
---|
180 | # as a dependency. Also call the echo_message function.
|
---|
181 | wrt_target "${this_script}" "$PREV"
|
---|
182 | #
|
---|
183 | # If $vrs isn't empty, we've got a package...
|
---|
184 | # Insert instructions for unpacking the package and to set the PKGDIR variable.
|
---|
185 | #
|
---|
186 | [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
|
---|
187 | [[ "$vrs" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
188 | #
|
---|
189 | wrt_run_as_su "${this_script}" "${file}"
|
---|
190 | #
|
---|
191 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
192 | #
|
---|
193 | # Include a touch of the target name so make can check if it's already been made.
|
---|
194 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
195 | #
|
---|
196 | #--------------------------------------------------------------------#
|
---|
197 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
198 | #--------------------------------------------------------------------#
|
---|
199 | #
|
---|
200 | # Keep the script file name for Makefile dependencies.
|
---|
201 | PREV=$this_script
|
---|
202 | done # for file in ....
|
---|
203 | }
|
---|
204 |
|
---|
205 |
|
---|
206 | #-----------------------------#
|
---|
207 | boot_Makefiles() { #
|
---|
208 | #-----------------------------#
|
---|
209 | echo "${tab_}${GREEN}Processing... ${L_arrow}boot${R_arrow}"
|
---|
210 |
|
---|
211 | for file in boot/* ; do
|
---|
212 | # Keep the script file name
|
---|
213 | this_script=`basename $file`
|
---|
214 |
|
---|
215 | # A little housekeeping on the scripts
|
---|
216 | case $this_script in
|
---|
217 | *grub | *aboot | *colo | *silo | *arcload | *lilo ) continue ;;
|
---|
218 | *whatnext*) continue ;;
|
---|
219 | *kernel) # if there is no kernel config file do not build the kernel
|
---|
220 | [[ -z $CONFIG ]] && continue
|
---|
221 | # Copy the config file to /sources with a standardized name
|
---|
222 | cp $BOOT_CONFIG $BUILDDIR/sources/bootkernel-config
|
---|
223 | ;;
|
---|
224 | esac
|
---|
225 | #
|
---|
226 | # First append each name of the script files to a list (this will become
|
---|
227 | # the names of the targets in the Makefile
|
---|
228 | boottools="$boottools $this_script"
|
---|
229 | #
|
---|
230 | # Grab the name of the target, strip id number and misc words.
|
---|
231 | case $this_script in
|
---|
232 | *kernel) name=linux ;;
|
---|
233 | *bootscripts) name="bootscripts-cross-lfs" ;;
|
---|
234 | *udev-rules) name="udev-cross-lfs" ;;
|
---|
235 | *grub-build) name=grub ;;
|
---|
236 | *-aboot-build) name=aboot ;;
|
---|
237 | *yaboot-build) name=yaboot ;;
|
---|
238 | *colo-build) name=colo ;;
|
---|
239 | *silo-build) name=silo ;;
|
---|
240 | *arcload-build) name=arcload ;;
|
---|
241 | *lilo-build) name=lilo ;;
|
---|
242 | *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
|
---|
243 | esac
|
---|
244 |
|
---|
245 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
246 |
|
---|
247 | #--------------------------------------------------------------------#
|
---|
248 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
249 | #--------------------------------------------------------------------#
|
---|
250 | #
|
---|
251 | # Drop in the name of the target on a new line, and the previous target
|
---|
252 | # as a dependency. Also call the echo_message function.
|
---|
253 | wrt_target "${this_script}" "$PREV"
|
---|
254 | #
|
---|
255 | # If $vrs isn't empty, we've got a package...
|
---|
256 | # Insert instructions for unpacking the package and changing directories
|
---|
257 | #
|
---|
258 | [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
|
---|
259 | [[ "$vrs" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
260 | #
|
---|
261 | # Select a script execution method
|
---|
262 | case $this_script in
|
---|
263 | *changingowner*) wrt_run_as_root "${this_script}" "${file}" ;;
|
---|
264 | *devices*) wrt_run_as_root "${this_script}" "${file}" ;;
|
---|
265 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
266 | wrt_copy_fstab "${this_script}"
|
---|
267 | else
|
---|
268 | wrt_run_as_su "${this_script}" "${file}"
|
---|
269 | fi
|
---|
270 | ;;
|
---|
271 | *) wrt_run_as_su "${this_script}" "${file}" ;;
|
---|
272 | esac
|
---|
273 | #
|
---|
274 | # Housekeeping...remove any build directory(ies) except if the package build fails.
|
---|
275 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
276 | #
|
---|
277 | # Include a touch of the target name so make can check if it's already been made.
|
---|
278 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
279 | #
|
---|
280 | #--------------------------------------------------------------------#
|
---|
281 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
282 | #--------------------------------------------------------------------#
|
---|
283 | #
|
---|
284 | # Keep the script file name for Makefile dependencies.
|
---|
285 | PREV=$this_script
|
---|
286 |
|
---|
287 | done
|
---|
288 | }
|
---|
289 |
|
---|
290 |
|
---|
291 | #-----------------------------#
|
---|
292 | chroot_Makefiles() { #
|
---|
293 | #-----------------------------#
|
---|
294 | echo "${tab_}${GREEN}Processing... ${L_arrow}chroot${R_arrow}"
|
---|
295 |
|
---|
296 | for file in chroot/* ; do
|
---|
297 | # Keep the script file name
|
---|
298 | this_script=`basename $file`
|
---|
299 | #
|
---|
300 | # Skipping scripts is done now and not included in the build tree.
|
---|
301 | case $this_script in
|
---|
302 | *chroot*) continue ;;
|
---|
303 | esac
|
---|
304 |
|
---|
305 | #
|
---|
306 | # First append each name of the script files to a list (this will become
|
---|
307 | # the names of the targets in the Makefile
|
---|
308 | chroottools="$chroottools $this_script"
|
---|
309 |
|
---|
310 | # Grab the name of the target, strip id number, XXX-script
|
---|
311 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
|
---|
312 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
313 |
|
---|
314 | #--------------------------------------------------------------------#
|
---|
315 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
316 | #--------------------------------------------------------------------#
|
---|
317 | #
|
---|
318 | # Drop in the name of the target on a new line, and the previous target
|
---|
319 | # as a dependency. Also call the echo_message function.
|
---|
320 | wrt_target "${this_script}" "$PREV"
|
---|
321 | #
|
---|
322 | # If $vrs isn't empty, we've got a package...
|
---|
323 | # Insert instructions for unpacking the package and changing directories
|
---|
324 | #
|
---|
325 | if [ "$vrs" != "" ] ; then
|
---|
326 | case $this_script in
|
---|
327 | *util-linux) wrt_unpack "$name-$vrs.tar.*" ;;
|
---|
328 | *) wrt_unpack2 "$name-$vrs.tar.*" ;;
|
---|
329 | esac
|
---|
330 | [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
331 | fi
|
---|
332 | #
|
---|
333 | # Select a script execution method
|
---|
334 | case $this_script in
|
---|
335 | *kernfs) wrt_run_as_root "${this_script}" "${file}" ;;
|
---|
336 | *util-linux) wrt_run_as_su "${this_script}" "${file}" ;;
|
---|
337 | *) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
|
---|
338 | esac
|
---|
339 | #
|
---|
340 | # Housekeeping...remove the build directory(ies), except if the package build fails.
|
---|
341 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
342 | #
|
---|
343 | # Include a touch of the target name so make can check if it's already been made.
|
---|
344 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
345 | #
|
---|
346 | #--------------------------------------------------------------------#
|
---|
347 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
348 | #--------------------------------------------------------------------#
|
---|
349 | #
|
---|
350 | # Keep the script file name for Makefile dependencies.
|
---|
351 | PREV=$this_script
|
---|
352 |
|
---|
353 | done # for file in...
|
---|
354 | }
|
---|
355 |
|
---|
356 |
|
---|
357 | #-----------------------------#
|
---|
358 | testsuite_tools_Makefiles() { #
|
---|
359 | #-----------------------------#
|
---|
360 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) testsuite tools${R_arrow}"
|
---|
361 |
|
---|
362 | for file in testsuite-tools/* ; do
|
---|
363 | # Keep the script file name
|
---|
364 | this_script=`basename $file`
|
---|
365 |
|
---|
366 | # First append each name of the script files to a list (this will become
|
---|
367 | # the names of the targets in the Makefile
|
---|
368 | testsuitetools="$testsuitetools $this_script"
|
---|
369 |
|
---|
370 | # Grab the name of the target, strip id number, XXX-script
|
---|
371 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
372 | -e 's@-64bit@@' \
|
---|
373 | -e 's@-64@@' \
|
---|
374 | -e 's@64@@' \
|
---|
375 | -e 's@n32@@'`
|
---|
376 |
|
---|
377 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
378 |
|
---|
379 | #--------------------------------------------------------------------#
|
---|
380 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
381 | #--------------------------------------------------------------------#
|
---|
382 | #
|
---|
383 | # Drop in the name of the target on a new line, and the previous target
|
---|
384 | # as a dependency. Also call the echo_message function.
|
---|
385 | wrt_target "${this_script}" "$PREV"
|
---|
386 | #
|
---|
387 | case $name in
|
---|
388 | tcl) wrt_unpack2 "$name$vrs-src.tar.*" ;;
|
---|
389 | *) wrt_unpack2 "$name-$vrs.tar.*" ;;
|
---|
390 | esac
|
---|
391 | [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
392 | #
|
---|
393 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
394 | #
|
---|
395 | wrt_remove_build_dirs "${name}"
|
---|
396 | #
|
---|
397 | # Include a touch of the target name so make can check if it's already been made.
|
---|
398 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
399 | #
|
---|
400 | #--------------------------------------------------------------------#
|
---|
401 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
402 | #--------------------------------------------------------------------#
|
---|
403 | #
|
---|
404 | # Keep the script file name for Makefile dependencies.
|
---|
405 | PREV=$this_script
|
---|
406 |
|
---|
407 | done
|
---|
408 | }
|
---|
409 |
|
---|
410 |
|
---|
411 | #--------------------------------#
|
---|
412 | bm_testsuite_tools_Makefiles() { #
|
---|
413 | #--------------------------------#
|
---|
414 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) testsuite tools${R_arrow}"
|
---|
415 |
|
---|
416 | for file in testsuite-tools/* ; do
|
---|
417 | # Keep the script file name
|
---|
418 | this_script=`basename $file`
|
---|
419 |
|
---|
420 | # First append each name of the script files to a list (this will become
|
---|
421 | # the names of the targets in the Makefile
|
---|
422 | PREV=
|
---|
423 | testsuitetools="$testsuitetools $this_script"
|
---|
424 |
|
---|
425 | # Grab the name of the target, strip id number, XXX-script
|
---|
426 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
427 | -e 's@-64bit@@' \
|
---|
428 | -e 's@-64@@' \
|
---|
429 | -e 's@64@@' \
|
---|
430 | -e 's@n32@@'`
|
---|
431 |
|
---|
432 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
433 |
|
---|
434 | #--------------------------------------------------------------------#
|
---|
435 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
436 | #--------------------------------------------------------------------#
|
---|
437 | #
|
---|
438 | # Drop in the name of the target on a new line, and the previous target
|
---|
439 | # as a dependency. Also call the echo_message function.
|
---|
440 | wrt_target "${this_script}" "$PREV"
|
---|
441 | #
|
---|
442 | case $name in
|
---|
443 | tcl) wrt_unpack3 "$name$vrs-src.tar.*" ;;
|
---|
444 | *) wrt_unpack3 "$name-$vrs.tar.*" ;;
|
---|
445 | esac
|
---|
446 | [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
447 | #
|
---|
448 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
449 | #
|
---|
450 | wrt_remove_build_dirs2 "${name}"
|
---|
451 | #
|
---|
452 | # Include a touch of the target name so make can check if it's already been made.
|
---|
453 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
454 | #
|
---|
455 | #--------------------------------------------------------------------#
|
---|
456 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
457 | #--------------------------------------------------------------------#
|
---|
458 | #
|
---|
459 | # Keep the script file name for Makefile dependencies.
|
---|
460 | PREV=$this_script
|
---|
461 |
|
---|
462 | done
|
---|
463 | }
|
---|
464 |
|
---|
465 |
|
---|
466 | #-----------------------------#
|
---|
467 | final_system_Makefiles() { #
|
---|
468 | #-----------------------------#
|
---|
469 | # Set envars and scripts for iteration targets
|
---|
470 | LOGS="" # Start with an empty global LOGS envar
|
---|
471 | if [[ -z "$1" ]] ; then
|
---|
472 | local N=""
|
---|
473 | else
|
---|
474 | local N=-build_$1
|
---|
475 | local basicsystem=""
|
---|
476 | mkdir final-system$N
|
---|
477 | cp final-system/* final-system$N
|
---|
478 | for script in final-system$N/* ; do
|
---|
479 | # Overwrite existing symlinks, files, and dirs
|
---|
480 | sed -e 's/ln -sv/&f/g' \
|
---|
481 | -e 's/mv -v/&f/g' \
|
---|
482 | -e 's/mkdir -v/&p/g' -i ${script}
|
---|
483 | done
|
---|
484 | # Remove Bzip2 binaries before make install
|
---|
485 | sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i final-system$N/*-bzip2
|
---|
486 | # Fix how Module-Init-Tools do the install target
|
---|
487 | sed -e 's@make install@make INSTALL=install install@' -i final-system$N/*-module-init-tools
|
---|
488 | # Delete *old Readline libraries just after make install
|
---|
489 | sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i final-system$N/*-readline
|
---|
490 | fi
|
---|
491 |
|
---|
492 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) final system$N${R_arrow}"
|
---|
493 |
|
---|
494 | for file in final-system$N/* ; do
|
---|
495 | # Keep the script file name
|
---|
496 | this_script=`basename $file`
|
---|
497 |
|
---|
498 | # Test if the stripping phase must be skipped.
|
---|
499 | # Skip alsp temp-perl for iterative runs
|
---|
500 | case $this_script in
|
---|
501 | *stripping*) [[ "$STRIP" = "0" ]] && continue ;;
|
---|
502 | *temp-perl*) [[ -n "$N" ]] && continue ;;
|
---|
503 | esac
|
---|
504 |
|
---|
505 | # Grab the name of the target, strip id number, XXX-script
|
---|
506 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
507 | -e 's@temp-@@' \
|
---|
508 | -e 's@-64bit@@' \
|
---|
509 | -e 's@-64@@' \
|
---|
510 | -e 's@64@@' \
|
---|
511 | -e 's@n32@@'`
|
---|
512 |
|
---|
513 | # Find the version of the command files, if it corresponds with the building of
|
---|
514 | # a specific package. We need this here to can skip scripts not needed for
|
---|
515 | # iterations rebuilds
|
---|
516 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
517 |
|
---|
518 | if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
|
---|
519 | case "${this_script}" in
|
---|
520 | *stripping*) ;;
|
---|
521 | *) continue ;;
|
---|
522 | esac
|
---|
523 | fi
|
---|
524 |
|
---|
525 | # Append each name of the script files to a list (this will become
|
---|
526 | # the names of the targets in the Makefile
|
---|
527 | basicsystem="$basicsystem ${this_script}${N}"
|
---|
528 |
|
---|
529 | # Append each name of the script files to a list (this will become
|
---|
530 | # the names of the logs to be moved for each iteration)
|
---|
531 | LOGS="$LOGS ${this_script}"
|
---|
532 |
|
---|
533 | #--------------------------------------------------------------------#
|
---|
534 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
535 | #--------------------------------------------------------------------#
|
---|
536 | #
|
---|
537 | # Drop in the name of the target on a new line, and the previous target
|
---|
538 | # as a dependency. Also call the echo_message function.
|
---|
539 | wrt_target "${this_script}${N}" "$PREV"
|
---|
540 |
|
---|
541 | # If $vrs isn't empty, we've got a package...
|
---|
542 | if [ "$vrs" != "" ] ; then
|
---|
543 | FILE="$name-$vrs.tar.*"
|
---|
544 | wrt_unpack2 "$FILE"
|
---|
545 | # If the testsuites must be run, initialize the log file
|
---|
546 | case $name in
|
---|
547 | binutils | gcc | glibc )
|
---|
548 | [[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}"
|
---|
549 | ;;
|
---|
550 | * )
|
---|
551 | [[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] && wrt_test_log2 "${this_script}"
|
---|
552 | ;;
|
---|
553 | esac
|
---|
554 | # If using optimizations, write the instructions
|
---|
555 | [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
556 | fi
|
---|
557 | #
|
---|
558 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
559 | #
|
---|
560 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
561 | #
|
---|
562 | # Include a touch of the target name so make can check if it's already been made.
|
---|
563 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
564 | #
|
---|
565 | #--------------------------------------------------------------------#
|
---|
566 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
567 | #--------------------------------------------------------------------#
|
---|
568 | #
|
---|
569 | # Keep the script file name for Makefile dependencies.
|
---|
570 | PREV=${this_script}${N}
|
---|
571 | # Set system_build envar for iteration targets
|
---|
572 | system_build=$basicsystem
|
---|
573 | done # for file in final-system/* ...
|
---|
574 | }
|
---|
575 |
|
---|
576 |
|
---|
577 | #-----------------------------#
|
---|
578 | bm_final_system_Makefiles() { #
|
---|
579 | #-----------------------------#
|
---|
580 | # Set envars and scripts for iteration targets
|
---|
581 | LOGS="" # Start with an empty global LOGS envar
|
---|
582 | if [[ -z "$1" ]] ; then
|
---|
583 | local N=""
|
---|
584 | # The makesys phase was initiated in bm_testsuite_tools_makefile
|
---|
585 | [[ "$TEST" = 0 ]] && PREV=""
|
---|
586 | else
|
---|
587 | local N=-build_$1
|
---|
588 | local basicsystem=""
|
---|
589 | mkdir final-system$N
|
---|
590 | cp final-system/* final-system$N
|
---|
591 | for script in final-system$N/* ; do
|
---|
592 | # Overwrite existing symlinks, files, and dirs
|
---|
593 | sed -e 's/ln -sv/&f/g' \
|
---|
594 | -e 's/mv -v/&f/g' \
|
---|
595 | -e 's/mkdir -v/&p/g' -i ${script}
|
---|
596 | done
|
---|
597 | # Remove Bzip2 binaries before make install
|
---|
598 | sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i final-system$N/*-bzip2
|
---|
599 | # Fix how Module-Init-Tools do the install target
|
---|
600 | sed -e 's@make install@make INSTALL=install install@' -i final-system$N/*-module-init-tools
|
---|
601 | # Delete *old Readline libraries just after make install
|
---|
602 | sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i final-system$N/*-readline
|
---|
603 | fi
|
---|
604 |
|
---|
605 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system$N${R_arrow}"
|
---|
606 |
|
---|
607 | for file in final-system$N/* ; do
|
---|
608 | # Keep the script file name
|
---|
609 | this_script=`basename $file`
|
---|
610 |
|
---|
611 | # Test if the stripping phase must be skipped
|
---|
612 | # Skip alsp temp-perl for iterative runs
|
---|
613 | case $this_script in
|
---|
614 | *stripping*) [[ "$STRIP" = "0" ]] && continue ;;
|
---|
615 | *temp-perl*) [[ -n "$N" ]] && continue ;;
|
---|
616 | esac
|
---|
617 |
|
---|
618 | # Grab the name of the target, strip id number, XXX-script
|
---|
619 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
620 | -e 's@temp-@@' \
|
---|
621 | -e 's@-64bit@@' \
|
---|
622 | -e 's@-64@@' \
|
---|
623 | -e 's@64@@' \
|
---|
624 | -e 's@n32@@'`
|
---|
625 |
|
---|
626 | # Find the version of the command files, if it corresponds with the building of
|
---|
627 | # a specific package. We need this here to can skip scripts not needed for
|
---|
628 | # iterations rebuilds
|
---|
629 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
630 |
|
---|
631 | if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then
|
---|
632 | case "${this_script}" in
|
---|
633 | *stripping*) ;;
|
---|
634 | *) continue ;;
|
---|
635 | esac
|
---|
636 | fi
|
---|
637 |
|
---|
638 | # Append each name of the script files to a list (this will become
|
---|
639 | # the names of the targets in the Makefile
|
---|
640 | basicsystem="$basicsystem ${this_script}${N}"
|
---|
641 |
|
---|
642 | # Append each name of the script files to a list (this will become
|
---|
643 | # the names of the logs to be moved for each iteration)
|
---|
644 | LOGS="$LOGS ${this_script}"
|
---|
645 |
|
---|
646 | #--------------------------------------------------------------------#
|
---|
647 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
648 | #--------------------------------------------------------------------#
|
---|
649 | #
|
---|
650 | # Drop in the name of the target on a new line, and the previous target
|
---|
651 | # as a dependency. Also call the echo_message function.
|
---|
652 | wrt_target "${this_script}${N}" "$PREV"
|
---|
653 |
|
---|
654 | # If $vrs isn't empty, we've got a package...
|
---|
655 | if [ "$vrs" != "" ] ; then
|
---|
656 | FILE="$name-$vrs.tar.*"
|
---|
657 | wrt_unpack3 "$FILE"
|
---|
658 | # If the testsuites must be run, initialize the log file
|
---|
659 | case $name in
|
---|
660 | binutils | gcc | glibc )
|
---|
661 | [[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}"
|
---|
662 | ;;
|
---|
663 | * )
|
---|
664 | [[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] && wrt_test_log2 "${this_script}"
|
---|
665 | ;;
|
---|
666 | esac
|
---|
667 | # If using optimizations, write the instructions
|
---|
668 | [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
669 | fi
|
---|
670 | #
|
---|
671 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
672 | #
|
---|
673 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
|
---|
674 | #
|
---|
675 | # Include a touch of the target name so make can check if it's already been made.
|
---|
676 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
677 | #
|
---|
678 | #--------------------------------------------------------------------#
|
---|
679 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
680 | #--------------------------------------------------------------------#
|
---|
681 | #
|
---|
682 | # Keep the script file name for Makefile dependencies.
|
---|
683 | PREV=${this_script}${N}
|
---|
684 | # Set system_build envar for iteration targets
|
---|
685 | system_build=$basicsystem
|
---|
686 | done # for file in final-system/* ...
|
---|
687 | }
|
---|
688 |
|
---|
689 |
|
---|
690 | #-----------------------------#
|
---|
691 | bootscripts_Makefiles() { #
|
---|
692 | #-----------------------------#
|
---|
693 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) bootscripts${R_arrow}"
|
---|
694 |
|
---|
695 | for file in bootscripts/* ; do
|
---|
696 | # Keep the script file name
|
---|
697 | this_script=`basename $file`
|
---|
698 |
|
---|
699 | case $this_script in
|
---|
700 | *udev) continue ;; # This is not a script but a commentary, we want udev-rules
|
---|
701 | *console*) continue ;; # Use the files that came with the bootscripts
|
---|
702 | *) ;;
|
---|
703 | esac
|
---|
704 |
|
---|
705 | # First append each name of the script files to a list (this will become
|
---|
706 | # the names of the targets in the Makefile
|
---|
707 | bootscripttools="$bootscripttools $this_script"
|
---|
708 |
|
---|
709 | # Grab the name of the target, strip id number, XXX-script
|
---|
710 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
711 | -e 's@-64bit@@' \
|
---|
712 | -e 's@-64@@' \
|
---|
713 | -e 's@64@@' \
|
---|
714 | -e 's@n32@@'`
|
---|
715 | case $name in
|
---|
716 | *bootscripts*) name=bootscripts-cross-lfs ;;
|
---|
717 | *udev-rules) name=udev-cross-lfs ;;
|
---|
718 | esac
|
---|
719 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
720 |
|
---|
721 | #--------------------------------------------------------------------#
|
---|
722 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
723 | #--------------------------------------------------------------------#
|
---|
724 | #
|
---|
725 | # Drop in the name of the target on a new line, and the previous target
|
---|
726 | # as a dependency. Also call the echo_message function.
|
---|
727 | wrt_target "${this_script}" "$PREV"
|
---|
728 | #
|
---|
729 | # If $vrs isn't empty, we've got a package...
|
---|
730 | #
|
---|
731 | [[ "$vrs" != "" ]] && wrt_unpack2 "$name-$vrs.tar.*"
|
---|
732 | #
|
---|
733 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
734 | #
|
---|
735 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
736 | #
|
---|
737 | # Include a touch of the target name so make can check if it's already been made.
|
---|
738 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
739 | #
|
---|
740 | #--------------------------------------------------------------------#
|
---|
741 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
742 | #--------------------------------------------------------------------#
|
---|
743 | #
|
---|
744 | # Keep the script file name for Makefile dependencies.
|
---|
745 | PREV=$this_script
|
---|
746 |
|
---|
747 | done # for file in bootscripts/* ...
|
---|
748 |
|
---|
749 | }
|
---|
750 |
|
---|
751 | #-----------------------------#
|
---|
752 | bm_bootscripts_Makefiles() { #
|
---|
753 | #-----------------------------#
|
---|
754 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) bootscripts${R_arrow}"
|
---|
755 |
|
---|
756 | for file in bootscripts/* ; do
|
---|
757 | # Keep the script file name
|
---|
758 | this_script=`basename $file`
|
---|
759 |
|
---|
760 | case $this_script in
|
---|
761 | *udev*) continue ;; # This is not a script but a commentary
|
---|
762 | *console*) continue ;; # Use the files that came with the bootscripts
|
---|
763 | *) ;;
|
---|
764 | esac
|
---|
765 |
|
---|
766 | # First append each name of the script files to a list (this will become
|
---|
767 | # the names of the targets in the Makefile
|
---|
768 | bootscripttools="$bootscripttools $this_script"
|
---|
769 |
|
---|
770 | # Grab the name of the target, strip id number, XXX-script
|
---|
771 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
772 | -e 's@-64bit@@' \
|
---|
773 | -e 's@-64@@' \
|
---|
774 | -e 's@64@@' \
|
---|
775 | -e 's@n32@@'`
|
---|
776 | case $name in
|
---|
777 | *bootscripts*) name=bootscripts-cross-lfs
|
---|
778 | ;;
|
---|
779 | esac
|
---|
780 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
781 |
|
---|
782 | #--------------------------------------------------------------------#
|
---|
783 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
784 | #--------------------------------------------------------------------#
|
---|
785 | #
|
---|
786 | # Drop in the name of the target on a new line, and the previous target
|
---|
787 | # as a dependency. Also call the echo_message function.
|
---|
788 | wrt_target "${this_script}" "$PREV"
|
---|
789 | #
|
---|
790 | # If $vrs isn't empty, we've got a package...
|
---|
791 | #
|
---|
792 | [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
|
---|
793 | #
|
---|
794 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
795 | #
|
---|
796 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
|
---|
797 | #
|
---|
798 | # Include a touch of the target name so make can check if it's already been made.
|
---|
799 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
800 | #
|
---|
801 | #--------------------------------------------------------------------#
|
---|
802 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
803 | #--------------------------------------------------------------------#
|
---|
804 | #
|
---|
805 | # Keep the script file name for Makefile dependencies.
|
---|
806 | PREV=$this_script
|
---|
807 |
|
---|
808 | done # for file in bootscripts/* ...
|
---|
809 |
|
---|
810 | }
|
---|
811 |
|
---|
812 |
|
---|
813 |
|
---|
814 | #-----------------------------#
|
---|
815 | bootable_Makefiles() { #
|
---|
816 | #-----------------------------#
|
---|
817 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) make bootable${R_arrow}"
|
---|
818 |
|
---|
819 | for file in {bootable,the-end}/* ; do
|
---|
820 | # Keep the script file name
|
---|
821 | this_script=`basename $file`
|
---|
822 |
|
---|
823 | # A little housekeeping on the scripts
|
---|
824 | case $this_script in
|
---|
825 | *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
|
---|
826 | *kernel) # if there is no kernel config file do not build the kernel
|
---|
827 | [[ -z $CONFIG ]] && continue
|
---|
828 | # Copy the config file to /sources with a standardized name
|
---|
829 | cp $CONFIG $BUILDDIR/sources/kernel-config
|
---|
830 | ;;
|
---|
831 | esac
|
---|
832 | #
|
---|
833 | # First append each name of the script files to a list (this will become
|
---|
834 | # the names of the targets in the Makefile
|
---|
835 | bootabletools="$bootabletools $this_script"
|
---|
836 | #
|
---|
837 | # Grab the name of the target, strip id number and misc words.
|
---|
838 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
|
---|
839 | case $this_script in
|
---|
840 | *kernel*) name=linux
|
---|
841 | ;;
|
---|
842 | esac
|
---|
843 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
844 |
|
---|
845 | #--------------------------------------------------------------------#
|
---|
846 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
847 | #--------------------------------------------------------------------#
|
---|
848 | #
|
---|
849 | # Drop in the name of the target on a new line, and the previous target
|
---|
850 | # as a dependency. Also call the echo_message function.
|
---|
851 | wrt_target "${this_script}" "$PREV"
|
---|
852 | #
|
---|
853 | # If $vrs isn't empty, we've got a package...
|
---|
854 | # Insert instructions for unpacking the package and changing directories
|
---|
855 | #
|
---|
856 | [[ "$vrs" != "" ]] && wrt_unpack2 "$name-$vrs.tar.*"
|
---|
857 | #
|
---|
858 | # Select a script execution method
|
---|
859 | case $this_script in
|
---|
860 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
861 | wrt_copy_fstab "${this_script}"
|
---|
862 | else
|
---|
863 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
864 | fi
|
---|
865 | ;;
|
---|
866 | *) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
|
---|
867 | esac
|
---|
868 | #
|
---|
869 | # Housekeeping...remove any build directory(ies) except if the package build fails.
|
---|
870 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
871 | #
|
---|
872 | # Include a touch of the target name so make can check if it's already been made.
|
---|
873 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
874 | #
|
---|
875 | #--------------------------------------------------------------------#
|
---|
876 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
877 | #--------------------------------------------------------------------#
|
---|
878 | #
|
---|
879 | # Keep the script file name for Makefile dependencies.
|
---|
880 | PREV=$this_script
|
---|
881 |
|
---|
882 | done
|
---|
883 |
|
---|
884 | # Add SBU-disk_usage report target if required
|
---|
885 | if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi
|
---|
886 |
|
---|
887 | }
|
---|
888 |
|
---|
889 |
|
---|
890 |
|
---|
891 | #-----------------------------#
|
---|
892 | bm_bootable_Makefiles() { #
|
---|
893 | #-----------------------------#
|
---|
894 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) make bootable${R_arrow}"
|
---|
895 |
|
---|
896 | for file in {bootable,the-end}/* ; do
|
---|
897 | # Keep the script file name
|
---|
898 | this_script=`basename $file`
|
---|
899 |
|
---|
900 | # A little housekeeping on the scripts
|
---|
901 | case $this_script in
|
---|
902 | *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
|
---|
903 | *kernel) # if there is no kernel config file do not build the kernel
|
---|
904 | [[ -z $CONFIG ]] && continue
|
---|
905 | # Copy the named config file to /sources with a standardized name
|
---|
906 | cp $CONFIG $BUILDDIR/sources/kernel-config
|
---|
907 | ;;
|
---|
908 | esac
|
---|
909 | #
|
---|
910 | # First append each name of the script files to a list (this will become
|
---|
911 | # the names of the targets in the Makefile
|
---|
912 | bootabletools="$bootabletools $this_script"
|
---|
913 | #
|
---|
914 | # Grab the name of the target, strip id number and misc words.
|
---|
915 | case $this_script in
|
---|
916 | *kernel) name=linux
|
---|
917 | ;;
|
---|
918 | *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
|
---|
919 | esac
|
---|
920 |
|
---|
921 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
922 |
|
---|
923 | #--------------------------------------------------------------------#
|
---|
924 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
925 | #--------------------------------------------------------------------#
|
---|
926 | #
|
---|
927 | # Drop in the name of the target on a new line, and the previous target
|
---|
928 | # as a dependency. Also call the echo_message function.
|
---|
929 | wrt_target "${this_script}" "$PREV"
|
---|
930 | #
|
---|
931 | # If $vrs isn't empty, we've got a package...
|
---|
932 | # Insert instructions for unpacking the package and changing directories
|
---|
933 | #
|
---|
934 | [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
|
---|
935 | #
|
---|
936 | # Select a script execution method
|
---|
937 | case $this_script in
|
---|
938 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
939 | # Minimal boot mode has no access to original file, store in /sources
|
---|
940 | cp $FSTAB $BUILDDIR/sources/fstab
|
---|
941 | wrt_copy_fstab2 "${this_script}"
|
---|
942 | else
|
---|
943 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
944 | fi
|
---|
945 | ;;
|
---|
946 | *) wrt_run_as_root2 "${this_script}" "${file}" ;;
|
---|
947 | esac
|
---|
948 | #
|
---|
949 | # Housekeeping...remove any build directory(ies) except if the package build fails.
|
---|
950 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
|
---|
951 | #
|
---|
952 | # Include a touch of the target name so make can check if it's already been made.
|
---|
953 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
954 | #
|
---|
955 | #--------------------------------------------------------------------#
|
---|
956 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
957 | #--------------------------------------------------------------------#
|
---|
958 | #
|
---|
959 | # Keep the script file name for Makefile dependencies.
|
---|
960 | PREV=$this_script
|
---|
961 |
|
---|
962 | done
|
---|
963 |
|
---|
964 | # Add SBU-disk_usage report target if required
|
---|
965 | if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi
|
---|
966 |
|
---|
967 | }
|
---|
968 |
|
---|
969 |
|
---|
970 | #-----------------------------#
|
---|
971 | build_Makefile() { # Construct a Makefile from the book scripts
|
---|
972 | #-----------------------------#
|
---|
973 | echo "Creating Makefile... ${BOLD}START${OFF}"
|
---|
974 |
|
---|
975 | cd $JHALFSDIR/${PROGNAME}-commands
|
---|
976 | # Start with a clean Makefile.tmp file
|
---|
977 | >$MKFILE.tmp
|
---|
978 |
|
---|
979 | host_prep_Makefiles
|
---|
980 | cross_tools_Makefiles # $cross_tools
|
---|
981 | temptools_Makefiles # $temptools
|
---|
982 | if [[ $METHOD = "chroot" ]]; then
|
---|
983 | chroot_Makefiles # $chroottools
|
---|
984 | if [[ ! $TEST = "0" ]]; then
|
---|
985 | testsuite_tools_Makefiles # $testsuitetools
|
---|
986 | fi
|
---|
987 | final_system_Makefiles # $basicsystem
|
---|
988 | # Add the iterations targets, if needed
|
---|
989 | [[ "$COMPARE" != "0" ]] && wrt_compare_targets
|
---|
990 | bootscripts_Makefiles # $bootscripttools
|
---|
991 | bootable_Makefiles # $bootabletools
|
---|
992 | else
|
---|
993 | boot_Makefiles # $boottools
|
---|
994 | if [[ ! $TEST = "0" ]]; then
|
---|
995 | bm_testsuite_tools_Makefiles # $testsuitetools
|
---|
996 | fi
|
---|
997 | bm_final_system_Makefiles # $basicsystem
|
---|
998 | # Add the iterations targets, if needed
|
---|
999 | [[ "$COMPARE" != "0" ]] && wrt_compare_targets
|
---|
1000 | bm_bootscripts_Makefiles # $bootscipttools
|
---|
1001 | bm_bootable_Makefiles # $bootabletoosl
|
---|
1002 | fi
|
---|
1003 | # the_end_Makefiles
|
---|
1004 |
|
---|
1005 |
|
---|
1006 | # Add a header, some variables and include the function file
|
---|
1007 | # to the top of the real Makefile.
|
---|
1008 | (
|
---|
1009 | cat << EOF
|
---|
1010 | $HEADER
|
---|
1011 |
|
---|
1012 | SRC= /sources
|
---|
1013 | MOUNT_PT= $BUILDDIR
|
---|
1014 | PKG_LST= $PKG_LST
|
---|
1015 |
|
---|
1016 | include makefile-functions
|
---|
1017 |
|
---|
1018 | EOF
|
---|
1019 | ) > $MKFILE
|
---|
1020 |
|
---|
1021 | # Add chroot commands
|
---|
1022 | if [ "$METHOD" = "chroot" ] ; then
|
---|
1023 | chroot=`cat chroot/*chroot* | sed -e '/#!\/tools\/bin\/bash/d' \
|
---|
1024 | -e '/^export/d' \
|
---|
1025 | -e '/^logout/d' \
|
---|
1026 | -e 's@ \\\@ @g' | tr -d '\n' | sed -e 's/ */ /g' \
|
---|
1027 | -e 's|\\$|&&|g' \
|
---|
1028 | -e 's|exit||g' \
|
---|
1029 | -e 's|$| -c|' \
|
---|
1030 | -e 's|"$$LFS"|$(MOUNT_PT)|'\
|
---|
1031 | -e 's|set -e||'`
|
---|
1032 | echo -e "CHROOT1= $chroot\n" >> $MKFILE
|
---|
1033 | fi
|
---|
1034 |
|
---|
1035 | # Drop in the main target 'all:' and the chapter targets with each sub-target
|
---|
1036 | # as a dependency.
|
---|
1037 | if [[ "${METHOD}" = "chroot" ]]; then
|
---|
1038 | (
|
---|
1039 | cat << EOF
|
---|
1040 | all: chapter2 chapter3 chapter4 chapter5 chapter6 chapter7 chapter8 do-housekeeping
|
---|
1041 | @\$(call echo_finished,$VERSION)
|
---|
1042 |
|
---|
1043 | chapter2: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingenvironment
|
---|
1044 |
|
---|
1045 | chapter3: chapter2 $cross_tools
|
---|
1046 |
|
---|
1047 | chapter4: chapter3 $temptools
|
---|
1048 |
|
---|
1049 | chapter5: chapter4 $chroottools $testsuitetools
|
---|
1050 |
|
---|
1051 | chapter6: chapter5 $basicsystem
|
---|
1052 |
|
---|
1053 | chapter7: chapter6 $bootscripttools
|
---|
1054 |
|
---|
1055 | chapter8: chapter7 $bootabletools
|
---|
1056 |
|
---|
1057 | clean-all: clean
|
---|
1058 | rm -rf ./{clfs-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
|
---|
1059 |
|
---|
1060 | clean: clean-chapter4 clean-chapter3 clean-chapter2
|
---|
1061 |
|
---|
1062 | clean-chapter2:
|
---|
1063 | -if [ ! -f user-lfs-exist ]; then \\
|
---|
1064 | userdel lfs; \\
|
---|
1065 | rm -rf /home/lfs; \\
|
---|
1066 | fi;
|
---|
1067 | rm -rf \$(MOUNT_PT)/tools
|
---|
1068 | rm -f /tools
|
---|
1069 | rm -rf \$(MOUNT_PT)/cross-tools
|
---|
1070 | rm -f /cross-tools
|
---|
1071 | rm -f envars user-lfs-exist
|
---|
1072 | rm -f 02* logs/02*.log
|
---|
1073 |
|
---|
1074 | clean-chapter3:
|
---|
1075 | rm -rf \$(MOUNT_PT)/tools/*
|
---|
1076 | rm -f $cross_tools restore-lfs-env sources-dir
|
---|
1077 | cd logs && rm -f $cross_tools && cd ..
|
---|
1078 |
|
---|
1079 | clean-chapter4:
|
---|
1080 | -umount \$(MOUNT_PT)/sys
|
---|
1081 | -umount \$(MOUNT_PT)/proc
|
---|
1082 | -umount \$(MOUNT_PT)/dev/shm
|
---|
1083 | -umount \$(MOUNT_PT)/dev/pts
|
---|
1084 | -umount \$(MOUNT_PT)/dev
|
---|
1085 | rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,lib64,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
|
---|
1086 | rm -f $temptools
|
---|
1087 | cd logs && rm -f $temptools && cd ..
|
---|
1088 |
|
---|
1089 |
|
---|
1090 | restore-lfs-env:
|
---|
1091 | @\$(call echo_message, Building)
|
---|
1092 | @if [ -f /home/lfs/.bashrc.XXX ]; then \\
|
---|
1093 | mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
|
---|
1094 | fi;
|
---|
1095 | @if [ -f /home/lfs/.bash_profile.XXX ]; then \\
|
---|
1096 | mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
|
---|
1097 | fi;
|
---|
1098 | @chown lfs:lfs /home/lfs/.bash* && \\
|
---|
1099 | touch \$@
|
---|
1100 |
|
---|
1101 | do-housekeeping:
|
---|
1102 | -umount \$(MOUNT_PT)/dev/pts
|
---|
1103 | -umount \$(MOUNT_PT)/dev/shm
|
---|
1104 | -umount \$(MOUNT_PT)/dev
|
---|
1105 | -umount \$(MOUNT_PT)/sys
|
---|
1106 | -umount \$(MOUNT_PT)/proc
|
---|
1107 | -if [ ! -f user-lfs-exist ]; then \\
|
---|
1108 | userdel lfs; \\
|
---|
1109 | rm -rf /home/lfs; \\
|
---|
1110 | fi;
|
---|
1111 |
|
---|
1112 | EOF
|
---|
1113 | ) >> $MKFILE
|
---|
1114 | fi
|
---|
1115 |
|
---|
1116 |
|
---|
1117 | if [[ "${METHOD}" = "boot" ]]; then
|
---|
1118 | (
|
---|
1119 | cat << EOF
|
---|
1120 |
|
---|
1121 | all: makeboot
|
---|
1122 |
|
---|
1123 | makeboot: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingenvironment \
|
---|
1124 | $cross_tools\
|
---|
1125 | $temptools \
|
---|
1126 | $chroottools \
|
---|
1127 | $boottools
|
---|
1128 | @\$(call echo_boot_finished,$VERSION)
|
---|
1129 |
|
---|
1130 | makesys: $testsuitetools $basicsystem $bootscripttools $bootabletools
|
---|
1131 | @\$(call echo_finished,$VERSION)
|
---|
1132 |
|
---|
1133 |
|
---|
1134 | clean-all: clean
|
---|
1135 | rm -rf ./{clfs-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
|
---|
1136 |
|
---|
1137 | clean: clean-makesys clean-makeboot clean-jhalfs
|
---|
1138 |
|
---|
1139 | clean-jhalfs:
|
---|
1140 | -if [ ! -f user-lfs-exist ]; then \\
|
---|
1141 | userdel lfs; \\
|
---|
1142 | rm -rf /home/lfs; \\
|
---|
1143 | fi;
|
---|
1144 | rm -rf \$(MOUNT_PT)/tools
|
---|
1145 | rm -f /tools
|
---|
1146 | rm -rf \$(MOUNT_PT)/cross-tools
|
---|
1147 | rm -f /cross-tools
|
---|
1148 | rm -f envars user-lfs-exist
|
---|
1149 | rm -f 02* logs/02*.log
|
---|
1150 |
|
---|
1151 | clean-makeboot:
|
---|
1152 | rm -rf /tools/*
|
---|
1153 | rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools
|
---|
1154 | rm -f restore-lfs-env sources-dir
|
---|
1155 | cd logs && rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools && cd ..
|
---|
1156 |
|
---|
1157 | clean-makesys:
|
---|
1158 | -umount \$(MOUNT_PT)/sys
|
---|
1159 | -umount \$(MOUNT_PT)/proc
|
---|
1160 | -umount \$(MOUNT_PT)/dev/shm
|
---|
1161 | -umount \$(MOUNT_PT)/dev/pts
|
---|
1162 | -umount \$(MOUNT_PT)/dev
|
---|
1163 | rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,lib64,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
|
---|
1164 | rm -f $basicsystem
|
---|
1165 | rm -f $bootscripttools
|
---|
1166 | rm -f $bootabletools
|
---|
1167 | cd logs && rm -f $basicsystem && rm -f $bootscripttools && rm -f $bootabletools && cd ..
|
---|
1168 |
|
---|
1169 |
|
---|
1170 | restore-lfs-env:
|
---|
1171 | @\$(call echo_message, Building)
|
---|
1172 | @if [ -f /home/lfs/.bashrc.XXX ]; then \\
|
---|
1173 | mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
|
---|
1174 | fi;
|
---|
1175 | @if [ -f /home/lfs/.bash_profile.XXX ]; then \\
|
---|
1176 | mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
|
---|
1177 | fi;
|
---|
1178 | @chown lfs:lfs /home/lfs/.bash* && \\
|
---|
1179 | touch \$@
|
---|
1180 |
|
---|
1181 |
|
---|
1182 | EOF
|
---|
1183 | ) >> $MKFILE
|
---|
1184 | fi
|
---|
1185 |
|
---|
1186 | # Bring over the items from the Makefile.tmp
|
---|
1187 | cat $MKFILE.tmp >> $MKFILE
|
---|
1188 | rm $MKFILE.tmp
|
---|
1189 | echo "Creating Makefile... ${BOLD}DONE${OFF}"
|
---|
1190 |
|
---|
1191 | }
|
---|
1192 |
|
---|