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