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 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
131 | #
|
---|
132 | # If $vrs isn't empty, we've got a package...
|
---|
133 | #
|
---|
134 | [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*" && echo -e '\ttrue' >> $MKFILE.tmp
|
---|
135 | #
|
---|
136 | wrt_run_as_lfs "${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 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
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.*" && echo -e '\ttrue' >> $MKFILE.tmp
|
---|
187 | #
|
---|
188 | wrt_run_as_lfs "${this_script}" "${file}"
|
---|
189 | #
|
---|
190 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
191 | #
|
---|
192 | # Include a touch of the target name so make can check if it's already been made.
|
---|
193 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
194 | #
|
---|
195 | #--------------------------------------------------------------------#
|
---|
196 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
197 | #--------------------------------------------------------------------#
|
---|
198 | #
|
---|
199 | # Keep the script file name for Makefile dependencies.
|
---|
200 | PREV=$this_script
|
---|
201 | done # for file in ....
|
---|
202 | }
|
---|
203 |
|
---|
204 |
|
---|
205 | #-----------------------------#
|
---|
206 | boot_Makefiles() { #
|
---|
207 | #-----------------------------#
|
---|
208 | echo "${tab_}${GREEN}Processing... ${L_arrow}boot${R_arrow}"
|
---|
209 |
|
---|
210 | for file in boot/* ; do
|
---|
211 | # Keep the script file name
|
---|
212 | this_script=`basename $file`
|
---|
213 |
|
---|
214 | # A little housekeeping on the scripts
|
---|
215 | case $this_script in
|
---|
216 | *grub*) continue ;;
|
---|
217 | *whatnext*) continue ;;
|
---|
218 | *settingenvironment*) sed 's@PS1=@set +h\nPS1=@' -i $file ;;
|
---|
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 | # sed "s|make mrproper|make mrproper\ncp /sources/bootkernel-config .config|" -i $file
|
---|
224 | # You cannot run menuconfig from within the makefile
|
---|
225 | # sed 's|menuconfig|oldconfig|' -i $file
|
---|
226 | #If defined include the keymap in the kernel
|
---|
227 | # if [[ -n "$KEYMAP" ]]; then
|
---|
228 | # sed "s|^loadkeys -m.*>|loadkeys -m $KEYMAP >|" -i $file
|
---|
229 | # else
|
---|
230 | # sed '/loadkeys -m/d' -i $file
|
---|
231 | # sed '/drivers\/char/d' -i $file
|
---|
232 | # fi
|
---|
233 | ;;
|
---|
234 | esac
|
---|
235 | #
|
---|
236 | # First append each name of the script files to a list (this will become
|
---|
237 | # the names of the targets in the Makefile
|
---|
238 | boottools="$boottools $this_script"
|
---|
239 | #
|
---|
240 | # Grab the name of the target, strip id number and misc words.
|
---|
241 | case $this_script in
|
---|
242 | *kernel) name=linux ;;
|
---|
243 | *bootscripts) name="bootscripts-cross-lfs" ;;
|
---|
244 | *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
|
---|
245 | esac
|
---|
246 |
|
---|
247 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
248 |
|
---|
249 | #--------------------------------------------------------------------#
|
---|
250 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
251 | #--------------------------------------------------------------------#
|
---|
252 | #
|
---|
253 | # Drop in the name of the target on a new line, and the previous target
|
---|
254 | # as a dependency. Also call the echo_message function.
|
---|
255 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
256 | #
|
---|
257 | # If $vrs isn't empty, we've got a package...
|
---|
258 | # Insert instructions for unpacking the package and changing directories
|
---|
259 | #
|
---|
260 | [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
|
---|
261 | #
|
---|
262 | # Select a script execution method
|
---|
263 | case $this_script in
|
---|
264 | *changingowner*) wrt_run_as_root "${this_script}" "${file}" ;;
|
---|
265 | *devices*) wrt_run_as_root "${this_script}" "${file}" ;;
|
---|
266 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
267 | wrt_copy_fstab "${this_script}"
|
---|
268 | else
|
---|
269 | wrt_run_as_lfs "${this_script}" "${file}"
|
---|
270 | fi
|
---|
271 | ;;
|
---|
272 | *) wrt_run_as_lfs "${this_script}" "${file}" ;;
|
---|
273 | esac
|
---|
274 | #
|
---|
275 | # Housekeeping...remove any build directory(ies) except if the package build fails.
|
---|
276 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
277 | #
|
---|
278 | # Include a touch of the target name so make can check if it's already been made.
|
---|
279 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
280 | #
|
---|
281 | #--------------------------------------------------------------------#
|
---|
282 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
283 | #--------------------------------------------------------------------#
|
---|
284 | #
|
---|
285 | # Keep the script file name for Makefile dependencies.
|
---|
286 | PREV=$this_script
|
---|
287 |
|
---|
288 | done
|
---|
289 | # This will force the Makefile to exit and not allow it to be restarted with
|
---|
290 | # the command <make>, The user will have to issue the cmd <make chapterXX>
|
---|
291 | echo -e "\t@\$(call echo_boot_finished,$VERSION) && \\" >> $MKFILE.tmp
|
---|
292 | echo -e "\tfalse" >> $MKFILE.tmp
|
---|
293 | }
|
---|
294 |
|
---|
295 |
|
---|
296 | #-----------------------------#
|
---|
297 | chroot_Makefiles() { #
|
---|
298 | #-----------------------------#
|
---|
299 | echo "${tab_}${GREEN}Processing... ${L_arrow}chroot${R_arrow}"
|
---|
300 |
|
---|
301 | for file in chroot/* ; do
|
---|
302 | # Keep the script file name
|
---|
303 | this_script=`basename $file`
|
---|
304 | #
|
---|
305 | # Skipping scripts is done now and not included in the build tree.
|
---|
306 | [[ `_IS_ $this_script chroot` ]] && continue
|
---|
307 |
|
---|
308 | #
|
---|
309 | # First append each name of the script files to a list (this will become
|
---|
310 | # the names of the targets in the Makefile
|
---|
311 | chroottools="$chroottools $this_script"
|
---|
312 |
|
---|
313 | #
|
---|
314 | # A little housekeeping on the script contents
|
---|
315 | case $this_script in
|
---|
316 | *kernfs*) sed '/exit/d' -i $file ;;
|
---|
317 | *pwdgroup*) sed '/exec/d' -i $file ;;
|
---|
318 | esac
|
---|
319 | #
|
---|
320 | # Grab the name of the target, strip id number, XXX-script
|
---|
321 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
|
---|
322 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
323 |
|
---|
324 | #--------------------------------------------------------------------#
|
---|
325 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
326 | #--------------------------------------------------------------------#
|
---|
327 | #
|
---|
328 | # Drop in the name of the target on a new line, and the previous target
|
---|
329 | # as a dependency. Also call the echo_message function.
|
---|
330 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
331 | #
|
---|
332 | # If $vrs isn't empty, we've got a package...
|
---|
333 | # Insert instructions for unpacking the package and changing directories
|
---|
334 | #
|
---|
335 | if [ "$vrs" != "" ] ; then
|
---|
336 | case $this_script in
|
---|
337 | *util-linux) wrt_unpack "$name-$vrs.tar.*"
|
---|
338 | echo -e '\ttrue' >> $MKFILE.tmp
|
---|
339 | ;;
|
---|
340 | *) wrt_unpack2 "$name-$vrs.tar.*"
|
---|
341 | ;;
|
---|
342 | esac
|
---|
343 | fi
|
---|
344 | #
|
---|
345 | # Select a script execution method
|
---|
346 | case $this_script in
|
---|
347 | *kernfs) wrt_run_as_root "${this_script}" "${file}" ;;
|
---|
348 | *util-linux) wrt_run_as_lfs "${this_script}" "${file}" ;;
|
---|
349 | *) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
|
---|
350 | esac
|
---|
351 | #
|
---|
352 | # Housekeeping...remove the build directory(ies), except if the package build fails.
|
---|
353 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
354 | #
|
---|
355 | # Include a touch of the target name so make can check if it's already been made.
|
---|
356 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
357 | #
|
---|
358 | #--------------------------------------------------------------------#
|
---|
359 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
360 | #--------------------------------------------------------------------#
|
---|
361 | #
|
---|
362 | # Keep the script file name for Makefile dependencies.
|
---|
363 | PREV=$this_script
|
---|
364 |
|
---|
365 | done # for file in...
|
---|
366 | }
|
---|
367 |
|
---|
368 |
|
---|
369 | #-----------------------------#
|
---|
370 | testsuite_tools_Makefiles() { #
|
---|
371 | #-----------------------------#
|
---|
372 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) testsuite tools${R_arrow}"
|
---|
373 |
|
---|
374 | for file in testsuite-tools/* ; do
|
---|
375 | # Keep the script file name
|
---|
376 | this_script=`basename $file`
|
---|
377 |
|
---|
378 | # First append each name of the script files to a list (this will become
|
---|
379 | # the names of the targets in the Makefile
|
---|
380 | testsuitetools="$testsuitetools $this_script"
|
---|
381 |
|
---|
382 | # Grab the name of the target, strip id number, XXX-script
|
---|
383 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
384 | -e 's@-64bit@@' \
|
---|
385 | -e 's@-64@@' \
|
---|
386 | -e 's@64@@' \
|
---|
387 | -e 's@n32@@'`
|
---|
388 |
|
---|
389 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
390 |
|
---|
391 | #--------------------------------------------------------------------#
|
---|
392 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
393 | #--------------------------------------------------------------------#
|
---|
394 | #
|
---|
395 | # Drop in the name of the target on a new line, and the previous target
|
---|
396 | # as a dependency. Also call the echo_message function.
|
---|
397 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
398 | #
|
---|
399 | case $name in
|
---|
400 | tcl) wrt_unpack2 "$name$vrs-src.tar.*" ;;
|
---|
401 | *) wrt_unpack2 "$name-$vrs.tar.*" ;;
|
---|
402 | esac
|
---|
403 | #
|
---|
404 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
405 | #
|
---|
406 | wrt_remove_build_dirs "${name}"
|
---|
407 | #
|
---|
408 | # Include a touch of the target name so make can check if it's already been made.
|
---|
409 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
410 | #
|
---|
411 | #--------------------------------------------------------------------#
|
---|
412 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
413 | #--------------------------------------------------------------------#
|
---|
414 | #
|
---|
415 | # Keep the script file name for Makefile dependencies.
|
---|
416 | PREV=$this_script
|
---|
417 |
|
---|
418 | done
|
---|
419 | }
|
---|
420 |
|
---|
421 |
|
---|
422 | #--------------------------------#
|
---|
423 | bm_testsuite_tools_Makefiles() { #
|
---|
424 | #--------------------------------#
|
---|
425 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) testsuite tools${R_arrow}"
|
---|
426 |
|
---|
427 | for file in testsuite-tools/* ; do
|
---|
428 | # Keep the script file name
|
---|
429 | this_script=`basename $file`
|
---|
430 |
|
---|
431 | # First append each name of the script files to a list (this will become
|
---|
432 | # the names of the targets in the Makefile
|
---|
433 | testsuitetools="$testsuitetools $this_script"
|
---|
434 |
|
---|
435 | # Grab the name of the target, strip id number, XXX-script
|
---|
436 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
437 | -e 's@-64bit@@' \
|
---|
438 | -e 's@-64@@' \
|
---|
439 | -e 's@64@@' \
|
---|
440 | -e 's@n32@@'`
|
---|
441 |
|
---|
442 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
443 |
|
---|
444 | #--------------------------------------------------------------------#
|
---|
445 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
446 | #--------------------------------------------------------------------#
|
---|
447 | #
|
---|
448 | # Drop in the name of the target on a new line, and the previous target
|
---|
449 | # as a dependency. Also call the echo_message function.
|
---|
450 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
451 | #
|
---|
452 | case $name in
|
---|
453 | tcl) wrt_unpack3 "$name$vrs-src.tar.*" ;;
|
---|
454 | *) wrt_unpack3 "$name-$vrs.tar.*" ;;
|
---|
455 | esac
|
---|
456 | #
|
---|
457 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
458 | #
|
---|
459 | wrt_remove_build_dirs2 "${name}"
|
---|
460 | #
|
---|
461 | # Include a touch of the target name so make can check if it's already been made.
|
---|
462 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
463 | #
|
---|
464 | #--------------------------------------------------------------------#
|
---|
465 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
466 | #--------------------------------------------------------------------#
|
---|
467 | #
|
---|
468 | # Keep the script file name for Makefile dependencies.
|
---|
469 | PREV=$this_script
|
---|
470 |
|
---|
471 | done
|
---|
472 | }
|
---|
473 |
|
---|
474 |
|
---|
475 | #-----------------------------#
|
---|
476 | final_system_Makefiles() { #
|
---|
477 | #-----------------------------#
|
---|
478 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) final system${R_arrow}"
|
---|
479 |
|
---|
480 | for file in final-system/* ; do
|
---|
481 | # Keep the script file name
|
---|
482 | this_script=`basename $file`
|
---|
483 |
|
---|
484 | # Skipping scripts is done now so they are not included in the Makefile.
|
---|
485 | case $this_script in
|
---|
486 | *stripping*) continue ;;
|
---|
487 | *grub*) continue ;;
|
---|
488 | esac
|
---|
489 | #
|
---|
490 | # First append each name of the script files to a list (this will become
|
---|
491 | # the names of the targets in the Makefile
|
---|
492 | basicsystem="$basicsystem $this_script"
|
---|
493 | #
|
---|
494 | # A little customizing via sed scripts first..
|
---|
495 | if [[ $TEST = "0" ]]; then
|
---|
496 | # Drop any package checks..
|
---|
497 | sed -e '/make check/d' -e '/make test/d' -i $file
|
---|
498 | fi
|
---|
499 | case $this_script_BLOCKED in
|
---|
500 | *coreutils*) sed 's@set -e@set -e; set +h@' -i $file ;;
|
---|
501 | *groff*) sed "s@\*\*EDITME.*EDITME\*\*@$PAGE@" -i $file ;;
|
---|
502 | *vim*) sed '/vim -c/d' -i $file ;;
|
---|
503 | *bash*) sed '/exec /d' -i $file ;;
|
---|
504 | *shadow*) sed -e '/grpconv/d' -e '/pwconv/d' -e '/passwd root/d' -i $file
|
---|
505 | sed '/sed -i libtool/d' -i $file
|
---|
506 | sed '/search_path/d' -i $file
|
---|
507 | ;;
|
---|
508 | *glibc*) sed '/tzselect/d' -i $file
|
---|
509 | sed "s@\*\*EDITME.*EDITME\*\*@$TIMEZONE@" -i $file
|
---|
510 | # Manipulate glibc's test to work with Makefile
|
---|
511 | sed -e 's/glibc-check-log.*//' \
|
---|
512 | -e 's@make -k check >@make -k check >glibc-check-log 2>\&1 || true\ngrep Error glibc-check-log || true@' -i $file
|
---|
513 | ;;
|
---|
514 | *binutils*) sed '/expect /d' -i $file
|
---|
515 | if [[ $TOOLCHAINTEST = "0" ]]; then
|
---|
516 | sed '/make check/d' -i $file
|
---|
517 | fi
|
---|
518 | ;;
|
---|
519 | *gcc*) # Ignore all gcc testing for now..
|
---|
520 | sed -e '/make -k check/d' -i $file
|
---|
521 | sed -e '/test_summary/d' -i $file
|
---|
522 | ;;
|
---|
523 | *texinfo*) # This sucks as a way to trim a script
|
---|
524 | sed -e '/cd \/usr/d' \
|
---|
525 | -e '/rm dir/d' \
|
---|
526 | -e '/for f in/d' \
|
---|
527 | -e '/do inst/d' \
|
---|
528 | -e '/done/d' -i $file
|
---|
529 | ;;
|
---|
530 | esac
|
---|
531 |
|
---|
532 | # Grab the name of the target, strip id number, XXX-script
|
---|
533 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
534 | -e 's@temp-@@' \
|
---|
535 | -e 's@-64bit@@' \
|
---|
536 | -e 's@-64@@' \
|
---|
537 | -e 's@64@@' \
|
---|
538 | -e 's@n32@@'`
|
---|
539 |
|
---|
540 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
541 |
|
---|
542 | #--------------------------------------------------------------------#
|
---|
543 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
544 | #--------------------------------------------------------------------#
|
---|
545 | #
|
---|
546 | # Drop in the name of the target on a new line, and the previous target
|
---|
547 | # as a dependency. Also call the echo_message function.
|
---|
548 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
549 |
|
---|
550 | # If $vrs isn't empty, we've got a package...
|
---|
551 | if [ "$vrs" != "" ] ; then
|
---|
552 | case $name in
|
---|
553 | temp-perl) wrt_unpack2 "perl-$vrs.tar.*" ;;
|
---|
554 | *) wrt_unpack2 "$name-$vrs.tar.*" ;;
|
---|
555 | esac
|
---|
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
|
---|
571 |
|
---|
572 | done # for file in final-system/* ...
|
---|
573 | }
|
---|
574 |
|
---|
575 |
|
---|
576 | #-----------------------------#
|
---|
577 | bm_final_system_Makefiles() { #
|
---|
578 | #-----------------------------#
|
---|
579 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system${R_arrow}"
|
---|
580 |
|
---|
581 | for file in final-system/* ; do
|
---|
582 | # Keep the script file name
|
---|
583 | this_script=`basename $file`
|
---|
584 |
|
---|
585 | # Skipping scripts is done now so they are not included in the Makefile.
|
---|
586 | case $this_script in
|
---|
587 | *stripping*) continue ;;
|
---|
588 | *grub*) continue ;;
|
---|
589 | esac
|
---|
590 |
|
---|
591 | # First append each name of the script files to a list (this will become
|
---|
592 | # the names of the targets in the Makefile
|
---|
593 | basicsystem="$basicsystem $this_script"
|
---|
594 |
|
---|
595 | #
|
---|
596 | # A little customizing via sed scripts first..
|
---|
597 | if [[ $TEST = "0" ]]; then
|
---|
598 | # Drop any package checks..
|
---|
599 | sed -e '/make check/d' -e '/make test/d' -i $file
|
---|
600 | fi
|
---|
601 | case $this_script_BLOCKED in
|
---|
602 | *coreutils*) sed 's@set -e@set -e; set +h@' -i $file ;;
|
---|
603 | *groff*) sed "s@\*\*EDITME.*EDITME\*\*@$PAGE@" -i $file ;;
|
---|
604 | *vim*) sed '/vim -c/d' -i $file ;;
|
---|
605 | *bash*) sed '/exec /d' -i $file ;;
|
---|
606 | *shadow*) sed -e '/grpconv/d' \
|
---|
607 | -e '/pwconv/d' \
|
---|
608 | -e '/passwd root/d' -i $file
|
---|
609 | sed '/sed -i libtool/d' -i $file
|
---|
610 | sed '/search_path/d' -i $file
|
---|
611 | ;;
|
---|
612 | *psmisc*) # Build fails on creation of this link. <pidof> installed in sysvinit
|
---|
613 | sed -e 's/^ln -s/#ln -s/' -i $file
|
---|
614 | ;;
|
---|
615 | *glibc*) sed '/tzselect/d' -i $file
|
---|
616 | sed "s@\*\*EDITME.*EDITME\*\*@$TIMEZONE@" -i $file
|
---|
617 | # Manipulate glibc's test to work with Makefile
|
---|
618 | sed -e 's/glibc-check-log.*//' -e 's@make -k check >@make -k check >glibc-check-log 2>\&1 || true\ngrep Error glibc-check-log || true@' -i $file
|
---|
619 | ;;
|
---|
620 | *binutils*) sed '/expect /d' -i $file
|
---|
621 | if [[ $TOOLCHAINTEST = "0" ]]; then
|
---|
622 | sed '/make check/d' -i $file
|
---|
623 | fi
|
---|
624 | ;;
|
---|
625 | *gcc*) # Ignore all gcc testing for now..
|
---|
626 | sed -e '/make -k check/d' -i $file
|
---|
627 | sed -e '/test_summary/d' -i $file
|
---|
628 | ;;
|
---|
629 | *texinfo*) # This sucks as a way to trim a script
|
---|
630 | sed -e '/cd \/usr/d' \
|
---|
631 | -e '/rm dir/d' \
|
---|
632 | -e '/for f in/d' \
|
---|
633 | -e '/do inst/d' \
|
---|
634 | -e '/done/d' -i $file
|
---|
635 | ;;
|
---|
636 | esac
|
---|
637 |
|
---|
638 | # Grab the name of the target, strip id number, XXX-script
|
---|
639 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
640 | -e 's@temp-@@' \
|
---|
641 | -e 's@-64bit@@' \
|
---|
642 | -e 's@-64@@' \
|
---|
643 | -e 's@64@@' \
|
---|
644 | -e 's@n32@@'`
|
---|
645 |
|
---|
646 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
647 |
|
---|
648 | #--------------------------------------------------------------------#
|
---|
649 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
650 | #--------------------------------------------------------------------#
|
---|
651 | #
|
---|
652 | # Drop in the name of the target on a new line, and the previous target
|
---|
653 | # as a dependency. Also call the echo_message function.
|
---|
654 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
655 |
|
---|
656 | # If $vrs isn't empty, we've got a package...
|
---|
657 | if [ "$vrs" != "" ] ; then
|
---|
658 | case $name in
|
---|
659 | temp-perl) wrt_unpack3 "perl-$vrs.tar.*" ;;
|
---|
660 | *) wrt_unpack3 "$name-$vrs.tar.*" ;;
|
---|
661 | esac
|
---|
662 | #
|
---|
663 | # Export a few 'config' vars..
|
---|
664 | case $this_script in
|
---|
665 | *glibc*) # For glibc we can set then TIMEZONE envar.
|
---|
666 | echo -e '\t@echo "export TIMEZONE=$(TIMEZONE)" >> envars' >> $MKFILE.tmp ;;
|
---|
667 | *groff*) # For Groff we need to set PAGE envar.
|
---|
668 | echo -e '\t@echo "export PAGE=$(PAGE)" >> envars' >> $MKFILE.tmp ;;
|
---|
669 | esac
|
---|
670 | fi
|
---|
671 | #
|
---|
672 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
673 | #
|
---|
674 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
|
---|
675 | #
|
---|
676 | # Include a touch of the target name so make can check if it's already been made.
|
---|
677 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
678 | #
|
---|
679 | #--------------------------------------------------------------------#
|
---|
680 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
681 | #--------------------------------------------------------------------#
|
---|
682 | #
|
---|
683 | # Keep the script file name for Makefile dependencies.
|
---|
684 | PREV=$this_script
|
---|
685 |
|
---|
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
|
---|
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 | if [[ `_IS_ $name bootscripts` ]]; then name=bootscripts-cross-lfs; fi
|
---|
716 |
|
---|
717 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
718 |
|
---|
719 | #--------------------------------------------------------------------#
|
---|
720 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
721 | #--------------------------------------------------------------------#
|
---|
722 | #
|
---|
723 | # Drop in the name of the target on a new line, and the previous target
|
---|
724 | # as a dependency. Also call the echo_message function.
|
---|
725 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
726 | #
|
---|
727 | # If $vrs isn't empty, we've got a package...
|
---|
728 | #
|
---|
729 | [[ "$vrs" != "" ]] && wrt_unpack2 "$name-$vrs.tar.*"
|
---|
730 | #
|
---|
731 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
732 | #
|
---|
733 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
734 | #
|
---|
735 | # Include a touch of the target name so make can check if it's already been made.
|
---|
736 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
737 | #
|
---|
738 | #--------------------------------------------------------------------#
|
---|
739 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
740 | #--------------------------------------------------------------------#
|
---|
741 | #
|
---|
742 | # Keep the script file name for Makefile dependencies.
|
---|
743 | PREV=$this_script
|
---|
744 |
|
---|
745 | done # for file in bootscripts/* ...
|
---|
746 |
|
---|
747 | }
|
---|
748 |
|
---|
749 | #-----------------------------#
|
---|
750 | bm_bootscripts_Makefiles() { #
|
---|
751 | #-----------------------------#
|
---|
752 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) bootscripts${R_arrow}"
|
---|
753 |
|
---|
754 | for file in bootscripts/* ; do
|
---|
755 | # Keep the script file name
|
---|
756 | this_script=`basename $file`
|
---|
757 |
|
---|
758 | case $this_script in
|
---|
759 | *udev*) continue ;; # This is not a script but a commentary
|
---|
760 | *console*) continue ;; # Use the files that came with the bootscripts
|
---|
761 | *) ;;
|
---|
762 | esac
|
---|
763 |
|
---|
764 | # First append each name of the script files to a list (this will become
|
---|
765 | # the names of the targets in the Makefile
|
---|
766 | bootscripttools="$bootscripttools $this_script"
|
---|
767 |
|
---|
768 | # Grab the name of the target, strip id number, XXX-script
|
---|
769 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
770 | -e 's@-64bit@@' \
|
---|
771 | -e 's@-64@@' \
|
---|
772 | -e 's@64@@' \
|
---|
773 | -e 's@n32@@'`
|
---|
774 | if [[ `_IS_ $name bootscripts` ]]; then name=lfs-bootscripts; fi
|
---|
775 |
|
---|
776 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
777 |
|
---|
778 | #--------------------------------------------------------------------#
|
---|
779 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
780 | #--------------------------------------------------------------------#
|
---|
781 | #
|
---|
782 | # Drop in the name of the target on a new line, and the previous target
|
---|
783 | # as a dependency. Also call the echo_message function.
|
---|
784 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
785 | #
|
---|
786 | # If $vrs isn't empty, we've got a package...
|
---|
787 | #
|
---|
788 | [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
|
---|
789 | #
|
---|
790 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
791 | #
|
---|
792 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
|
---|
793 | #
|
---|
794 | # Include a touch of the target name so make can check if it's already been made.
|
---|
795 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
796 | #
|
---|
797 | #--------------------------------------------------------------------#
|
---|
798 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
799 | #--------------------------------------------------------------------#
|
---|
800 | #
|
---|
801 | # Keep the script file name for Makefile dependencies.
|
---|
802 | PREV=$this_script
|
---|
803 |
|
---|
804 | done # for file in bootscripts/* ...
|
---|
805 |
|
---|
806 | }
|
---|
807 |
|
---|
808 |
|
---|
809 |
|
---|
810 | #-----------------------------#
|
---|
811 | bootable_Makefiles() { #
|
---|
812 | #-----------------------------#
|
---|
813 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) make bootable${R_arrow}"
|
---|
814 |
|
---|
815 | for file in bootable/* ; do
|
---|
816 | # Keep the script file name
|
---|
817 | this_script=`basename $file`
|
---|
818 |
|
---|
819 | # A little housekeeping on the scripts
|
---|
820 | case $this_script in
|
---|
821 | *grub*) continue ;;
|
---|
822 | *kernel) # if there is no kernel config file do not build the kernel
|
---|
823 | [[ -z $CONFIG ]] && continue
|
---|
824 | # Copy the config file to /sources with a standardized name
|
---|
825 | cp $CONFIG $BUILDDIR/sources/kernel-config
|
---|
826 | ;;
|
---|
827 | esac
|
---|
828 | #
|
---|
829 | # First append each name of the script files to a list (this will become
|
---|
830 | # the names of the targets in the Makefile
|
---|
831 | bootabletools="$bootabletools $this_script"
|
---|
832 | #
|
---|
833 | # Grab the name of the target, strip id number and misc words.
|
---|
834 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
|
---|
835 | [[ `_IS_ $this_script "kernel"` ]] && name=linux
|
---|
836 |
|
---|
837 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
838 |
|
---|
839 | #--------------------------------------------------------------------#
|
---|
840 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
841 | #--------------------------------------------------------------------#
|
---|
842 | #
|
---|
843 | # Drop in the name of the target on a new line, and the previous target
|
---|
844 | # as a dependency. Also call the echo_message function.
|
---|
845 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
846 | #
|
---|
847 | # If $vrs isn't empty, we've got a package...
|
---|
848 | # Insert instructions for unpacking the package and changing directories
|
---|
849 | #
|
---|
850 | [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
|
---|
851 | #
|
---|
852 | # Select a script execution method
|
---|
853 | case $this_script in
|
---|
854 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
855 | wrt_copy_fstab "${this_script}"
|
---|
856 | else
|
---|
857 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
858 | fi
|
---|
859 | ;;
|
---|
860 | *) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
|
---|
861 | esac
|
---|
862 | #
|
---|
863 | # Housekeeping...remove any build directory(ies) except if the package build fails.
|
---|
864 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
865 | #
|
---|
866 | # Include a touch of the target name so make can check if it's already been made.
|
---|
867 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
868 | #
|
---|
869 | #--------------------------------------------------------------------#
|
---|
870 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
871 | #--------------------------------------------------------------------#
|
---|
872 | #
|
---|
873 | # Keep the script file name for Makefile dependencies.
|
---|
874 | PREV=$this_script
|
---|
875 |
|
---|
876 | done
|
---|
877 |
|
---|
878 | }
|
---|
879 |
|
---|
880 |
|
---|
881 |
|
---|
882 | #-----------------------------#
|
---|
883 | bm_bootable_Makefiles() { #
|
---|
884 | #-----------------------------#
|
---|
885 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) make bootable${R_arrow}"
|
---|
886 |
|
---|
887 | for file in bootable/* ; do
|
---|
888 | # Keep the script file name
|
---|
889 | this_script=`basename $file`
|
---|
890 |
|
---|
891 | # A little housekeeping on the scripts
|
---|
892 | case $this_script in
|
---|
893 | *grub*) continue ;;
|
---|
894 | *kernel) # if there is no kernel config file do not build the kernel
|
---|
895 | [[ -z $CONFIG ]] && continue
|
---|
896 | # Copy the named config file to /sources with a standardized name
|
---|
897 | cp $CONFIG $BUILDDIR/sources/kernel-config
|
---|
898 | ;;
|
---|
899 | esac
|
---|
900 | #
|
---|
901 | # First append each name of the script files to a list (this will become
|
---|
902 | # the names of the targets in the Makefile
|
---|
903 | bootabletools="$bootabletools $this_script"
|
---|
904 | #
|
---|
905 | # Grab the name of the target, strip id number and misc words.
|
---|
906 | case $this_script in
|
---|
907 | *kernel) name=linux
|
---|
908 | ;;
|
---|
909 | *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
|
---|
910 | esac
|
---|
911 |
|
---|
912 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
913 |
|
---|
914 | #--------------------------------------------------------------------#
|
---|
915 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
916 | #--------------------------------------------------------------------#
|
---|
917 | #
|
---|
918 | # Drop in the name of the target on a new line, and the previous target
|
---|
919 | # as a dependency. Also call the echo_message function.
|
---|
920 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
921 | #
|
---|
922 | # If $vrs isn't empty, we've got a package...
|
---|
923 | # Insert instructions for unpacking the package and changing directories
|
---|
924 | #
|
---|
925 | [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
|
---|
926 | #
|
---|
927 | # Select a script execution method
|
---|
928 | case $this_script in
|
---|
929 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
930 | # Minimal boot mode has no access to original file, store in /sources
|
---|
931 | cp $FSTAB $BUILDDIR/sources/fstab
|
---|
932 | wrt_copy_fstab2 "${this_script}"
|
---|
933 | else
|
---|
934 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
935 | fi
|
---|
936 | ;;
|
---|
937 | *) wrt_run_as_root2 "${this_script}" "${file}" ;;
|
---|
938 | esac
|
---|
939 | #
|
---|
940 | # Housekeeping...remove any build directory(ies) except if the package build fails.
|
---|
941 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
|
---|
942 | #
|
---|
943 | # Include a touch of the target name so make can check if it's already been made.
|
---|
944 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
945 | #
|
---|
946 | #--------------------------------------------------------------------#
|
---|
947 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
948 | #--------------------------------------------------------------------#
|
---|
949 | #
|
---|
950 | # Keep the script file name for Makefile dependencies.
|
---|
951 | PREV=$this_script
|
---|
952 |
|
---|
953 | done
|
---|
954 |
|
---|
955 | }
|
---|
956 |
|
---|
957 |
|
---|
958 |
|
---|
959 | #-----------------------------#
|
---|
960 | the_end_Makefiles() { #
|
---|
961 | #-----------------------------#
|
---|
962 | echo "${tab_}${GREEN}Processing... ${L_arrow}THE END${R_arrow}"
|
---|
963 | }
|
---|
964 |
|
---|
965 |
|
---|
966 | #-----------------------------#
|
---|
967 | build_Makefile() { # Construct a Makefile from the book scripts
|
---|
968 | #-----------------------------#
|
---|
969 | echo "Creating Makefile... ${BOLD}START${OFF}"
|
---|
970 |
|
---|
971 | cd $JHALFSDIR/${PROGNAME}-commands
|
---|
972 | # Start with a clean Makefile.tmp file
|
---|
973 | >$MKFILE.tmp
|
---|
974 |
|
---|
975 | host_prep_Makefiles
|
---|
976 | cross_tools_Makefiles
|
---|
977 | temptools_Makefiles
|
---|
978 | if [[ $METHOD = "chroot" ]]; then
|
---|
979 | chroot_Makefiles
|
---|
980 | if [[ $TOOLCHAINTEST = "1" ]]; then
|
---|
981 | testsuite_tools_Makefiles
|
---|
982 | fi
|
---|
983 | final_system_Makefiles
|
---|
984 | bootscripts_Makefiles
|
---|
985 | bootable_Makefiles
|
---|
986 | else
|
---|
987 | boot_Makefiles # This phase must die at the end of its run..
|
---|
988 | if [[ $TOOLCHAINTEST = "1" ]]; then
|
---|
989 | bm_testsuite_tools_Makefiles
|
---|
990 | fi
|
---|
991 | bm_final_system_Makefiles
|
---|
992 | bm_bootscripts_Makefiles
|
---|
993 | bm_bootable_Makefiles
|
---|
994 | fi
|
---|
995 | # the_end_Makefiles
|
---|
996 |
|
---|
997 |
|
---|
998 | # Add a header, some variables and include the function file
|
---|
999 | # to the top of the real Makefile.
|
---|
1000 | (
|
---|
1001 | cat << EOF
|
---|
1002 | $HEADER
|
---|
1003 |
|
---|
1004 | SRC= /sources
|
---|
1005 | MOUNT_PT= $BUILDDIR
|
---|
1006 |
|
---|
1007 | include makefile-functions
|
---|
1008 |
|
---|
1009 | EOF
|
---|
1010 | ) > $MKFILE
|
---|
1011 |
|
---|
1012 | # Add chroot commands
|
---|
1013 | if [ "$METHOD" = "chroot" ] ; then
|
---|
1014 | chroot=`cat chroot/*chroot* | sed -e '/#!\/tools\/bin\/bash/d' \
|
---|
1015 | -e '/^export/d' \
|
---|
1016 | -e '/^logout/d' \
|
---|
1017 | -e 's@ \\\@ @g' | tr -d '\n' | sed -e 's/ */ /g' \
|
---|
1018 | -e 's|\\$|&&|g' \
|
---|
1019 | -e 's|exit||g' \
|
---|
1020 | -e 's|$| -c|' \
|
---|
1021 | -e 's|"$$LFS"|$(MOUNT_PT)|'\
|
---|
1022 | -e 's|set -e||'`
|
---|
1023 | echo -e "CHROOT1= $chroot\n" >> $MKFILE
|
---|
1024 | fi
|
---|
1025 |
|
---|
1026 | # Drop in the main target 'all:' and the chapter targets with each sub-target
|
---|
1027 | # as a dependency.
|
---|
1028 | (
|
---|
1029 | cat << EOF
|
---|
1030 | all: chapter2 chapter3 chapter4 chapter5 chapter6 chapter7 chapter8
|
---|
1031 | @\$(call echo_finished,$VERSION)
|
---|
1032 |
|
---|
1033 | chapter2: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingenvironment
|
---|
1034 |
|
---|
1035 | chapter3: chapter2 $cross_tools
|
---|
1036 |
|
---|
1037 | chapter4: chapter3 $temptools
|
---|
1038 |
|
---|
1039 | chapter5: chapter4 $chroottools $boottools
|
---|
1040 |
|
---|
1041 | chapter6: chapter5 $basicsystem
|
---|
1042 |
|
---|
1043 | chapter7: chapter6 $bootscripttools
|
---|
1044 |
|
---|
1045 | chapter8: chapter7 $bootabletools
|
---|
1046 |
|
---|
1047 | clean-all: clean
|
---|
1048 | rm -rf ./{${PROGNAME}-commands,logs,Makefile,dump-clfs-scripts.xsl,functions,packages,patches}
|
---|
1049 |
|
---|
1050 | clean: clean-chapter4 clean-chapter3 clean-chapter2
|
---|
1051 |
|
---|
1052 | clean-chapter2:
|
---|
1053 | -if [ ! -f user-lfs-exist ]; then \\
|
---|
1054 | userdel lfs; \\
|
---|
1055 | rm -rf /home/lfs; \\
|
---|
1056 | fi;
|
---|
1057 | rm -rf \$(MOUNT_PT)/tools
|
---|
1058 | rm -f /tools
|
---|
1059 | rm -rf \$(MOUNT_PT)/cross-tools
|
---|
1060 | rm -f /cross-tools
|
---|
1061 | rm -f envars user-lfs-exist
|
---|
1062 | rm -f 02* logs/02*.log
|
---|
1063 |
|
---|
1064 | clean-chapter3:
|
---|
1065 | rm -rf \$(MOUNT_PT)/tools/*
|
---|
1066 | rm -f $cross_tools restore-lfs-env sources-dir
|
---|
1067 | cd logs && rm -f $cross_tools && cd ..
|
---|
1068 |
|
---|
1069 | clean-chapter4:
|
---|
1070 | -umount \$(MOUNT_PT)/sys
|
---|
1071 | -umount \$(MOUNT_PT)/proc
|
---|
1072 | -umount \$(MOUNT_PT)/dev/shm
|
---|
1073 | -umount \$(MOUNT_PT)/dev/pts
|
---|
1074 | -umount \$(MOUNT_PT)/dev
|
---|
1075 | rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,lib64,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
|
---|
1076 | rm -f $temptools
|
---|
1077 | cd logs && rm -f $temptools && cd ..
|
---|
1078 |
|
---|
1079 |
|
---|
1080 | restore-lfs-env:
|
---|
1081 | @\$(call echo_message, Building)
|
---|
1082 | @if [ -f /home/lfs/.bashrc.XXX ]; then \\
|
---|
1083 | mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
|
---|
1084 | fi;
|
---|
1085 | @if [ -f /home/lfs/.bash_profile.XXX ]; then \\
|
---|
1086 | mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
|
---|
1087 | fi;
|
---|
1088 | @chown lfs:lfs /home/lfs/.bash* && \\
|
---|
1089 | touch \$@
|
---|
1090 |
|
---|
1091 | EOF
|
---|
1092 | ) >> $MKFILE
|
---|
1093 |
|
---|
1094 |
|
---|
1095 | # Bring over the items from the Makefile.tmp
|
---|
1096 | cat $MKFILE.tmp >> $MKFILE
|
---|
1097 | rm $MKFILE.tmp
|
---|
1098 | echo "Creating Makefile... ${BOLD}DONE${OFF}"
|
---|
1099 |
|
---|
1100 | }
|
---|
1101 |
|
---|