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