[0170229] | 1 | #!/bin/sh
|
---|
[1ce084e] | 2 | # $Id$
|
---|
[0170229] | 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 | #
|
---|
[c3c4e1d] | 134 | [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*" && echo -e '\ttrue' >> $MKFILE.tmp
|
---|
[0170229] | 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 | #
|
---|
[c3c4e1d] | 186 | [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*" && echo -e '\ttrue' >> $MKFILE.tmp
|
---|
[0170229] | 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 ;;
|
---|
[0271c0c] | 219 | *kernel) # if there is no kernel config file do not build the kernel
|
---|
[4845f38] | 220 | [[ -z $CONFIG ]] && continue
|
---|
[0271c0c] | 221 | # Copy the config file to /sources with a standardized name
|
---|
| 222 | cp -v $CONFIG $BUILDDIR/sources/kernel-config
|
---|
| 223 | sed "s|make mrproper|make mrproper\ncp /sources/kernel-config .config|" -i $file
|
---|
| 224 | # You cannot run menuconfig from within the makefile
|
---|
[4845f38] | 225 | sed 's|menuconfig|oldconfig|' -i $file
|
---|
[0271c0c] | 226 | #If defined include the keymap in the kernel
|
---|
[4845f38] | 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
|
---|
[0170229] | 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=lfs-bootscripts ;;
|
---|
| 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 | #
|
---|
[c3c4e1d] | 260 | [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
|
---|
[0170229] | 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
|
---|
[c3c4e1d] | 337 | *util-linux) wrt_unpack "$name-$vrs.tar.*"
|
---|
[7d018d1] | 338 | echo -e '\ttrue' >> $MKFILE.tmp
|
---|
| 339 | ;;
|
---|
| 340 | *) wrt_unpack2 "$name-$vrs.tar.*"
|
---|
| 341 | ;;
|
---|
[0170229] | 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}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
|
---|
[c3c4e1d] | 400 | tcl) wrt_unpack2 "$name$vrs-src.tar.*" ;;
|
---|
| 401 | *) wrt_unpack2 "$name-$vrs.tar.*" ;;
|
---|
[0170229] | 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}(minimal 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
|
---|
[c3c4e1d] | 453 | tcl) wrt_unpack3 "$name$vrs-src.tar.*" ;;
|
---|
| 454 | *) wrt_unpack3 "$name-$vrs.tar.*" ;;
|
---|
[0170229] | 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}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 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}(minimal 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 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
|
---|
[c3c4e1d] | 659 | temp-perl) wrt_unpack3 "perl-$vrs.tar.*" ;;
|
---|
| 660 | *) wrt_unpack3 "$name-$vrs.tar.*" ;;
|
---|
[0170229] | 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}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 | # A little bit of script modification
|
---|
| 710 | case $this_script in
|
---|
| 711 | *profile*) # Over-ride the book cmds, write our own simple one.
|
---|
| 712 | (
|
---|
| 713 | cat <<- EOF
|
---|
| 714 | cat > /etc/profile << "_EOF_"
|
---|
| 715 | # Begin /etc/profile
|
---|
| 716 |
|
---|
| 717 | export LC_ALL=${LC_ALL}
|
---|
| 718 | export LANG=${LANG}
|
---|
| 719 | export INPUTRC=/etc/inputrc
|
---|
| 720 |
|
---|
| 721 | # End /etc/profile
|
---|
| 722 | _EOF_
|
---|
| 723 | EOF
|
---|
| 724 | ) > $file
|
---|
| 725 | ;;
|
---|
| 726 | esac
|
---|
| 727 |
|
---|
| 728 | # Grab the name of the target, strip id number, XXX-script
|
---|
| 729 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
| 730 | -e 's@-64bit@@' \
|
---|
| 731 | -e 's@-64@@' \
|
---|
| 732 | -e 's@64@@' \
|
---|
| 733 | -e 's@n32@@'`
|
---|
| 734 | if [[ `_IS_ $name bootscripts` ]]; then name=lfs-bootscripts; fi
|
---|
| 735 |
|
---|
| 736 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 737 |
|
---|
| 738 | #--------------------------------------------------------------------#
|
---|
| 739 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 740 | #--------------------------------------------------------------------#
|
---|
| 741 | #
|
---|
| 742 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 743 | # as a dependency. Also call the echo_message function.
|
---|
| 744 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 745 | #
|
---|
| 746 | # If $vrs isn't empty, we've got a package...
|
---|
| 747 | #
|
---|
| 748 | [[ "$vrs" != "" ]] && wrt_unpack2 "$name-$vrs.tar.*"
|
---|
| 749 | #
|
---|
| 750 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
| 751 | #
|
---|
| 752 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
| 753 | #
|
---|
| 754 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 755 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 756 | #
|
---|
| 757 | #--------------------------------------------------------------------#
|
---|
| 758 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 759 | #--------------------------------------------------------------------#
|
---|
| 760 | #
|
---|
| 761 | # Keep the script file name for Makefile dependencies.
|
---|
| 762 | PREV=$this_script
|
---|
| 763 |
|
---|
| 764 | done # for file in bootscripts/* ...
|
---|
| 765 |
|
---|
| 766 | }
|
---|
| 767 |
|
---|
| 768 | #-----------------------------#
|
---|
| 769 | bm_bootscripts_Makefiles() { #
|
---|
| 770 | #-----------------------------#
|
---|
| 771 | echo "${tab_}${GREEN}Processing... ${L_arrow}(minimal boot) bootscripts${R_arrow}"
|
---|
| 772 |
|
---|
| 773 | for file in bootscripts/* ; do
|
---|
| 774 | # Keep the script file name
|
---|
| 775 | this_script=`basename $file`
|
---|
| 776 |
|
---|
| 777 | case $this_script in
|
---|
| 778 | *udev*) continue ;; # This is not a script but a commentary
|
---|
| 779 | *console*) continue ;; # Use the files that came with the bootscripts
|
---|
| 780 | *) ;;
|
---|
| 781 | esac
|
---|
| 782 |
|
---|
| 783 | # First append each name of the script files to a list (this will become
|
---|
| 784 | # the names of the targets in the Makefile
|
---|
| 785 | bootscripttools="$bootscripttools $this_script"
|
---|
| 786 |
|
---|
| 787 | # A little bit of script modification
|
---|
| 788 | case $this_script in
|
---|
| 789 | *profile*) # Over-ride the book cmds, write our own simple one.
|
---|
| 790 | (
|
---|
| 791 | cat <<- EOF
|
---|
| 792 | cat > /etc/profile << "_EOF_"
|
---|
| 793 | # Begin /etc/profile
|
---|
| 794 |
|
---|
| 795 | export LC_ALL=${LC_ALL}
|
---|
| 796 | export LANG=${LANG}
|
---|
| 797 | export INPUTRC=/etc/inputrc
|
---|
| 798 |
|
---|
| 799 | # End /etc/profile
|
---|
| 800 | _EOF_
|
---|
| 801 | EOF
|
---|
| 802 | ) > $file
|
---|
| 803 | ;;
|
---|
| 804 | esac
|
---|
| 805 |
|
---|
| 806 | # Grab the name of the target, strip id number, XXX-script
|
---|
| 807 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
| 808 | -e 's@-64bit@@' \
|
---|
| 809 | -e 's@-64@@' \
|
---|
| 810 | -e 's@64@@' \
|
---|
| 811 | -e 's@n32@@'`
|
---|
| 812 | if [[ `_IS_ $name bootscripts` ]]; then name=lfs-bootscripts; fi
|
---|
| 813 |
|
---|
| 814 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 815 |
|
---|
| 816 | #--------------------------------------------------------------------#
|
---|
| 817 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 818 | #--------------------------------------------------------------------#
|
---|
| 819 | #
|
---|
| 820 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 821 | # as a dependency. Also call the echo_message function.
|
---|
| 822 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 823 | #
|
---|
| 824 | # If $vrs isn't empty, we've got a package...
|
---|
| 825 | #
|
---|
[c3c4e1d] | 826 | [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
|
---|
[0170229] | 827 | #
|
---|
| 828 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
| 829 | #
|
---|
| 830 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
|
---|
| 831 | #
|
---|
| 832 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 833 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 834 | #
|
---|
| 835 | #--------------------------------------------------------------------#
|
---|
| 836 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 837 | #--------------------------------------------------------------------#
|
---|
| 838 | #
|
---|
| 839 | # Keep the script file name for Makefile dependencies.
|
---|
| 840 | PREV=$this_script
|
---|
| 841 |
|
---|
| 842 | done # for file in bootscripts/* ...
|
---|
| 843 |
|
---|
| 844 | }
|
---|
| 845 |
|
---|
| 846 |
|
---|
| 847 |
|
---|
| 848 | #-----------------------------#
|
---|
| 849 | bootable_Makefiles() { #
|
---|
| 850 | #-----------------------------#
|
---|
| 851 | echo "${tab_}${GREEN}Processing... ${L_arrow}make bootable${R_arrow}"
|
---|
| 852 |
|
---|
| 853 | for file in bootable/* ; do
|
---|
| 854 | # Keep the script file name
|
---|
| 855 | this_script=`basename $file`
|
---|
| 856 |
|
---|
| 857 | # A little housekeeping on the scripts
|
---|
| 858 | case $this_script in
|
---|
| 859 | *grub*) continue ;;
|
---|
| 860 | *kernel)
|
---|
[0271c0c] | 861 | # if there is no kernel config file do not build the kernel
|
---|
[4845f38] | 862 | [[ -z $CONFIG ]] && continue
|
---|
[0271c0c] | 863 | # Copy the config file to /sources with a standardized name
|
---|
| 864 | cp -v $CONFIG $BUILDDIR/sources/kernel-config
|
---|
| 865 | sed "s|make mrproper|make mrproper\ncp /sources/kernel-config .config|" -i $file
|
---|
| 866 | # You cannot run menuconfig from within the makefile
|
---|
[0170229] | 867 | sed 's|menuconfig|oldconfig|' -i $file
|
---|
[0271c0c] | 868 | # If defined include the keymap in the kernel
|
---|
[0170229] | 869 | if [[ -n "$KEYMAP" ]]; then
|
---|
| 870 | sed "s|^loadkeys -m.*>|loadkeys -m $KEYMAP >|" -i $file
|
---|
| 871 | else
|
---|
| 872 | sed '/loadkeys -m/d' -i $file
|
---|
| 873 | sed '/drivers\/char/d' -i $file
|
---|
| 874 | fi
|
---|
| 875 | ;;
|
---|
| 876 | esac
|
---|
| 877 | #
|
---|
| 878 | # First append each name of the script files to a list (this will become
|
---|
| 879 | # the names of the targets in the Makefile
|
---|
| 880 | bootabletools="$bootabletools $this_script"
|
---|
| 881 | #
|
---|
| 882 | # Grab the name of the target, strip id number and misc words.
|
---|
| 883 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
|
---|
| 884 | [[ `_IS_ $this_script "kernel"` ]] && name=linux
|
---|
| 885 |
|
---|
| 886 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 887 |
|
---|
| 888 | #--------------------------------------------------------------------#
|
---|
| 889 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 890 | #--------------------------------------------------------------------#
|
---|
| 891 | #
|
---|
| 892 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 893 | # as a dependency. Also call the echo_message function.
|
---|
| 894 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 895 | #
|
---|
| 896 | # If $vrs isn't empty, we've got a package...
|
---|
| 897 | # Insert instructions for unpacking the package and changing directories
|
---|
| 898 | #
|
---|
[c3c4e1d] | 899 | [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
|
---|
[0170229] | 900 | #
|
---|
| 901 | # Select a script execution method
|
---|
| 902 | case $this_script in
|
---|
| 903 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
| 904 | wrt_copy_fstab "${this_script}"
|
---|
| 905 | else
|
---|
| 906 | wrt_run_as_lfs "${this_script}" "${file}"
|
---|
| 907 | fi
|
---|
| 908 | ;;
|
---|
| 909 | *) wrt_run_as_lfs "${this_script}" "${file}" ;;
|
---|
| 910 | esac
|
---|
| 911 | #
|
---|
| 912 | # Housekeeping...remove any build directory(ies) except if the package build fails.
|
---|
| 913 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
| 914 | #
|
---|
| 915 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 916 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 917 | #
|
---|
| 918 | #--------------------------------------------------------------------#
|
---|
| 919 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 920 | #--------------------------------------------------------------------#
|
---|
| 921 | #
|
---|
| 922 | # Keep the script file name for Makefile dependencies.
|
---|
| 923 | PREV=$this_script
|
---|
| 924 |
|
---|
| 925 | done
|
---|
| 926 |
|
---|
| 927 | }
|
---|
| 928 |
|
---|
| 929 |
|
---|
| 930 |
|
---|
| 931 | #-----------------------------#
|
---|
| 932 | bm_bootable_Makefiles() { #
|
---|
| 933 | #-----------------------------#
|
---|
| 934 | echo "${tab_}${GREEN}Processing... ${L_arrow}(minimal boot) make bootable${R_arrow}"
|
---|
| 935 |
|
---|
| 936 | for file in bootable/* ; do
|
---|
| 937 | # Keep the script file name
|
---|
| 938 | this_script=`basename $file`
|
---|
| 939 |
|
---|
| 940 | # A little housekeeping on the scripts
|
---|
| 941 | case $this_script in
|
---|
| 942 | *grub*) continue ;;
|
---|
[c3c4e1d] | 943 | *kernel)
|
---|
[0271c0c] | 944 | # if there is no kernel config file do not build the kernel
|
---|
[4845f38] | 945 | [[ -z $CONFIG ]] && continue
|
---|
[0271c0c] | 946 | # Copy the named config file to /sources with a standardized name
|
---|
| 947 | cp -v $CONFIG $BUILDDIR/sources/kernel-config
|
---|
| 948 | sed "s|make mrproper|make mrproper\ncp ../kernel-config .config|" -i $file
|
---|
| 949 | # You cannot run menuconfig from within the makefile
|
---|
[0170229] | 950 | sed 's|menuconfig|oldconfig|' -i $file
|
---|
[0271c0c] | 951 | # If defined include the keymap in the kernel
|
---|
[0170229] | 952 | if [[ -n "$KEYMAP" ]]; then
|
---|
| 953 | sed "s|^loadkeys -m.*>|loadkeys -m $KEYMAP >|" -i $file
|
---|
| 954 | else
|
---|
| 955 | sed '/loadkeys -m/d' -i $file
|
---|
| 956 | sed '/drivers\/char/d' -i $file
|
---|
| 957 | fi
|
---|
| 958 | ;;
|
---|
| 959 | esac
|
---|
| 960 | #
|
---|
| 961 | # First append each name of the script files to a list (this will become
|
---|
| 962 | # the names of the targets in the Makefile
|
---|
| 963 | bootabletools="$bootabletools $this_script"
|
---|
| 964 | #
|
---|
| 965 | # Grab the name of the target, strip id number and misc words.
|
---|
| 966 | case $this_script in
|
---|
| 967 | *kernel) name=linux
|
---|
| 968 | ;;
|
---|
| 969 | *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
|
---|
| 970 | esac
|
---|
| 971 |
|
---|
| 972 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 973 |
|
---|
| 974 | #--------------------------------------------------------------------#
|
---|
| 975 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 976 | #--------------------------------------------------------------------#
|
---|
| 977 | #
|
---|
| 978 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 979 | # as a dependency. Also call the echo_message function.
|
---|
| 980 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 981 | #
|
---|
| 982 | # If $vrs isn't empty, we've got a package...
|
---|
| 983 | # Insert instructions for unpacking the package and changing directories
|
---|
| 984 | #
|
---|
[c3c4e1d] | 985 | [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
|
---|
[0170229] | 986 | #
|
---|
| 987 | # Select a script execution method
|
---|
| 988 | case $this_script in
|
---|
| 989 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
[a9490ab] | 990 | # Minimal boot mode has no access to original file, store in /sources
|
---|
| 991 | cp $FSTAB $BUILDDIR/sources/fstab
|
---|
[0170229] | 992 | wrt_copy_fstab2 "${this_script}"
|
---|
| 993 | else
|
---|
| 994 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
| 995 | fi
|
---|
| 996 | ;;
|
---|
| 997 | *) wrt_run_as_root2 "${this_script}" "${file}" ;;
|
---|
| 998 | esac
|
---|
| 999 | #
|
---|
| 1000 | # Housekeeping...remove any build directory(ies) except if the package build fails.
|
---|
| 1001 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
|
---|
| 1002 | #
|
---|
| 1003 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 1004 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 1005 | #
|
---|
| 1006 | #--------------------------------------------------------------------#
|
---|
| 1007 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 1008 | #--------------------------------------------------------------------#
|
---|
| 1009 | #
|
---|
| 1010 | # Keep the script file name for Makefile dependencies.
|
---|
| 1011 | PREV=$this_script
|
---|
| 1012 |
|
---|
| 1013 | done
|
---|
| 1014 |
|
---|
| 1015 | }
|
---|
| 1016 |
|
---|
| 1017 |
|
---|
| 1018 |
|
---|
| 1019 | #-----------------------------#
|
---|
| 1020 | the_end_Makefiles() { #
|
---|
| 1021 | #-----------------------------#
|
---|
| 1022 | echo "${tab_}${GREEN}Processing... ${L_arrow}THE END${R_arrow}"
|
---|
| 1023 | }
|
---|
| 1024 |
|
---|
| 1025 |
|
---|
| 1026 | #-----------------------------#
|
---|
| 1027 | build_Makefile() { # Construct a Makefile from the book scripts
|
---|
| 1028 | #-----------------------------#
|
---|
| 1029 | echo "Creating Makefile... ${BOLD}START${OFF}"
|
---|
| 1030 |
|
---|
| 1031 | cd $JHALFSDIR/${PROGNAME}-commands
|
---|
| 1032 | # Start with a clean Makefile.tmp file
|
---|
| 1033 | >$MKFILE.tmp
|
---|
| 1034 |
|
---|
| 1035 | host_prep_Makefiles
|
---|
| 1036 | cross_tools_Makefiles
|
---|
| 1037 | temptools_Makefiles
|
---|
| 1038 | if [[ $BOOTMINIMAL = "0" ]]; then
|
---|
| 1039 | chroot_Makefiles
|
---|
| 1040 | if [[ $TOOLCHAINTEST = "1" ]]; then
|
---|
| 1041 | testsuite_tools_Makefiles
|
---|
| 1042 | fi
|
---|
| 1043 | final_system_Makefiles
|
---|
| 1044 | bootscripts_Makefiles
|
---|
| 1045 | bootable_Makefiles
|
---|
| 1046 | else
|
---|
| 1047 | boot_Makefiles # This phase must die at the end of its run..
|
---|
| 1048 | if [[ $TOOLCHAINTEST = "1" ]]; then
|
---|
| 1049 | bm_testsuite_tools_Makefiles
|
---|
| 1050 | fi
|
---|
| 1051 | bm_final_system_Makefiles
|
---|
| 1052 | bm_bootscripts_Makefiles
|
---|
| 1053 | bm_bootable_Makefiles
|
---|
| 1054 | fi
|
---|
| 1055 | # the_end_Makefiles
|
---|
| 1056 |
|
---|
| 1057 |
|
---|
| 1058 | # Add a header, some variables and include the function file
|
---|
| 1059 | # to the top of the real Makefile.
|
---|
| 1060 | (
|
---|
| 1061 | cat << EOF
|
---|
| 1062 | $HEADER
|
---|
| 1063 |
|
---|
| 1064 | SRC= /sources
|
---|
| 1065 | MOUNT_PT= $BUILDDIR
|
---|
| 1066 |
|
---|
| 1067 | include makefile-functions
|
---|
| 1068 |
|
---|
| 1069 | EOF
|
---|
| 1070 | ) > $MKFILE
|
---|
| 1071 |
|
---|
| 1072 | # Add chroot commands
|
---|
| 1073 | i=1
|
---|
| 1074 | for file in chroot/*chroot* ; do
|
---|
| 1075 | chroot=`cat $file | sed -e '/#!\/bin\/sh/d' \
|
---|
| 1076 | -e '/^export/d' \
|
---|
| 1077 | -e '/^logout/d' \
|
---|
| 1078 | -e 's@ \\\@ @g' | tr -d '\n' | sed -e 's/ */ /g' \
|
---|
| 1079 | -e 's|\\$|&&|g' \
|
---|
| 1080 | -e 's|exit||g' \
|
---|
| 1081 | -e 's|$| -c|' \
|
---|
| 1082 | -e 's|"$$LFS"|$(MOUNT_PT)|'\
|
---|
| 1083 | -e 's|set -e||'`
|
---|
| 1084 | echo -e "CHROOT$i= $chroot\n" >> $MKFILE
|
---|
| 1085 | i=`expr $i + 1`
|
---|
| 1086 | done
|
---|
| 1087 |
|
---|
| 1088 | # Drop in the main target 'all:' and the chapter targets with each sub-target
|
---|
| 1089 | # as a dependency.
|
---|
| 1090 | (
|
---|
| 1091 | cat << EOF
|
---|
| 1092 | all: chapter2 chapter3 chapter4 chapter5 chapter6 chapter7 chapter8
|
---|
| 1093 | @\$(call echo_finished,$VERSION)
|
---|
| 1094 |
|
---|
| 1095 | chapter2: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingenvironment
|
---|
| 1096 |
|
---|
| 1097 | chapter3: chapter2 $cross_tools
|
---|
| 1098 |
|
---|
| 1099 | chapter4: chapter3 $temptools
|
---|
| 1100 |
|
---|
| 1101 | chapter5: chapter4 $chroottools $boottools
|
---|
| 1102 |
|
---|
| 1103 | chapter6: chapter5 $basicsystem
|
---|
| 1104 |
|
---|
| 1105 | chapter7: chapter6 $bootscripttools
|
---|
| 1106 |
|
---|
| 1107 | chapter8: chapter7 $bootabletools
|
---|
| 1108 |
|
---|
| 1109 | clean-all: clean
|
---|
| 1110 | rm -rf ./{${PROGNAME}-commands,logs,Makefile,dump-clfs-scripts.xsl,functions,packages,patches}
|
---|
| 1111 |
|
---|
| 1112 | clean: clean-chapter4 clean-chapter3 clean-chapter2
|
---|
| 1113 |
|
---|
| 1114 | clean-chapter2:
|
---|
| 1115 | -if [ ! -f user-lfs-exist ]; then \\
|
---|
| 1116 | userdel lfs; \\
|
---|
| 1117 | rm -rf /home/lfs; \\
|
---|
| 1118 | fi;
|
---|
| 1119 | rm -rf \$(MOUNT_PT)/tools
|
---|
| 1120 | rm -f /tools
|
---|
| 1121 | rm -rf \$(MOUNT_PT)/cross-tools
|
---|
| 1122 | rm -f /cross-tools
|
---|
| 1123 | rm -f envars user-lfs-exist
|
---|
| 1124 | rm -f 02* logs/02*.log
|
---|
| 1125 |
|
---|
| 1126 | clean-chapter3:
|
---|
| 1127 | rm -rf \$(MOUNT_PT)/tools/*
|
---|
| 1128 | rm -f $cross_tools restore-lfs-env sources-dir
|
---|
| 1129 | cd logs && rm -f $cross_tools && cd ..
|
---|
| 1130 |
|
---|
| 1131 | clean-chapter4:
|
---|
| 1132 | -umount \$(MOUNT_PT)/sys
|
---|
| 1133 | -umount \$(MOUNT_PT)/proc
|
---|
| 1134 | -umount \$(MOUNT_PT)/dev/shm
|
---|
| 1135 | -umount \$(MOUNT_PT)/dev/pts
|
---|
| 1136 | -umount \$(MOUNT_PT)/dev
|
---|
| 1137 | rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,lib64,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
|
---|
| 1138 | rm -f $temptools
|
---|
| 1139 | cd logs && rm -f $temptools && cd ..
|
---|
| 1140 |
|
---|
| 1141 |
|
---|
| 1142 | restore-lfs-env:
|
---|
| 1143 | @\$(call echo_message, Building)
|
---|
| 1144 | @if [ -f /home/lfs/.bashrc.XXX ]; then \\
|
---|
| 1145 | mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
|
---|
| 1146 | fi;
|
---|
| 1147 | @if [ -f /home/lfs/.bash_profile.XXX ]; then \\
|
---|
| 1148 | mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
|
---|
| 1149 | fi;
|
---|
| 1150 | @chown lfs:lfs /home/lfs/.bash* && \\
|
---|
| 1151 | touch \$@
|
---|
| 1152 |
|
---|
| 1153 | EOF
|
---|
| 1154 | ) >> $MKFILE
|
---|
| 1155 |
|
---|
| 1156 |
|
---|
| 1157 | # Bring over the items from the Makefile.tmp
|
---|
| 1158 | cat $MKFILE.tmp >> $MKFILE
|
---|
| 1159 | rm $MKFILE.tmp
|
---|
| 1160 | echo "Creating Makefile... ${BOLD}DONE${OFF}"
|
---|
| 1161 |
|
---|
| 1162 | }
|
---|
| 1163 |
|
---|