[3b63c8c] | 1 | #!/bin/sh
|
---|
| 2 | # $Id$
|
---|
| 3 |
|
---|
| 4 | ###################################
|
---|
| 5 | ### FUNCTIONS ###
|
---|
| 6 | ###################################
|
---|
| 7 |
|
---|
| 8 |
|
---|
| 9 | #----------------------------#
|
---|
| 10 | host_prep_Makefiles() { # Initialization of the system
|
---|
| 11 | #----------------------------#
|
---|
| 12 | local CLFS_HOST
|
---|
| 13 |
|
---|
| 14 | echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files${R_arrow}"
|
---|
| 15 |
|
---|
| 16 | # defined here, only for ease of reading
|
---|
| 17 | CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
|
---|
| 18 | (
|
---|
| 19 | cat << EOF
|
---|
| 20 | 023-creatingtoolsdir:
|
---|
| 21 | @\$(call echo_message, Building)
|
---|
| 22 | @mkdir \$(MOUNT_PT)/tools && \\
|
---|
| 23 | rm -f /tools && \\
|
---|
| 24 | ln -s \$(MOUNT_PT)/tools /
|
---|
| 25 | @if [ ! -d \$(MOUNT_PT)/sources ]; then \\
|
---|
| 26 | mkdir \$(MOUNT_PT)/sources; \\
|
---|
| 27 | fi;
|
---|
| 28 | @chmod a+wt \$(MOUNT_PT)/sources
|
---|
| 29 | @touch \$@ && \\
|
---|
| 30 | echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
---|
| 31 | echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
| 32 |
|
---|
| 33 | 025-addinguser: 023-creatingtoolsdir
|
---|
| 34 | @\$(call echo_message, Building)
|
---|
[9485eba] | 35 | @if [ ! -d /home/\$(LUSER) ]; then \\
|
---|
| 36 | groupadd \$(LGROUP); \\
|
---|
| 37 | useradd -s /bin/bash -g \$(LGROUP) -m -k /dev/null \$(LUSER); \\
|
---|
[3b63c8c] | 38 | else \\
|
---|
[30737ea8] | 39 | touch luser-exist; \\
|
---|
[3b63c8c] | 40 | fi;
|
---|
[9485eba] | 41 | @chown \$(LUSER) \$(MOUNT_PT) && \\
|
---|
| 42 | chown \$(LUSER) \$(MOUNT_PT)/tools && \\
|
---|
| 43 | chown \$(LUSER) \$(MOUNT_PT)/sources
|
---|
[3b63c8c] | 44 | @touch \$@ && \\
|
---|
| 45 | echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
---|
| 46 | echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
| 47 |
|
---|
| 48 | 026-settingenvironment: 025-addinguser
|
---|
| 49 | @\$(call echo_message, Building)
|
---|
[9485eba] | 50 | @if [ -f /home/\$(LUSER)/.bashrc -a ! -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
---|
| 51 | mv /home/\$(LUSER)/.bashrc /home/\$(LUSER)/.bashrc.XXX; \\
|
---|
[3b63c8c] | 52 | fi;
|
---|
[9485eba] | 53 | @if [ -f /home/\$(LUSER)/.bash_profile -a ! -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
---|
| 54 | mv /home/\$(LUSER)/.bash_profile /home/\$(LUSER)/.bash_profile.XXX; \\
|
---|
[3b63c8c] | 55 | fi;
|
---|
[9485eba] | 56 | @echo "set +h" > /home/\$(LUSER)/.bashrc && \\
|
---|
| 57 | echo "umask 022" >> /home/\$(LUSER)/.bashrc && \\
|
---|
| 58 | echo "CLFS=\$(MOUNT_PT)" >> /home/\$(LUSER)/.bashrc && \\
|
---|
| 59 | echo "LC_ALL=POSIX" >> /home/\$(LUSER)/.bashrc && \\
|
---|
| 60 | echo "PATH=\$(MOUNT_PT)/cross-tools/bin:/bin:/usr/bin" >> /home/\$(LUSER)/.bashrc && \\
|
---|
| 61 | echo "export CLFS LC_ALL PATH" >> /home/\$(LUSER)/.bashrc && \\
|
---|
| 62 | echo "" >> /home/\$(LUSER)/.bashrc && \\
|
---|
| 63 | echo "unset CFLAGS" >> /home/\$(LUSER)/.bashrc && \\
|
---|
| 64 | echo "unset CXXFLAGS" >> /home/\$(LUSER)/.bashrc && \\
|
---|
| 65 | echo "" >> /home/\$(LUSER)/.bashrc && \\
|
---|
| 66 | echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/\$(LUSER)/.bashrc && \\
|
---|
| 67 | echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/\$(LUSER)/.bashrc && \\
|
---|
| 68 | echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/\$(LUSER)/.bashrc && \\
|
---|
| 69 | echo "source $JHALFSDIR/envars" >> /home/\$(LUSER)/.bashrc
|
---|
| 70 | @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bashrc && \\
|
---|
[3b63c8c] | 71 | touch envars
|
---|
| 72 | @touch \$@ && \\
|
---|
| 73 | echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
---|
| 74 | echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
| 75 |
|
---|
| 76 | 027-create-directories: 026-settingenvironment
|
---|
| 77 | @\$(call echo_message, Building)
|
---|
| 78 |
|
---|
| 79 | @mkdir -p \$(MOUNT_PT)/{bin,boot,dev,{etc/,}opt,home,lib,mnt}
|
---|
| 80 | @mkdir -p \$(MOUNT_PT)/{proc,media/{floppy,cdrom},sbin,srv,sys}
|
---|
| 81 | @mkdir -p \$(MOUNT_PT)/var/{lock,log,mail,run,spool}
|
---|
| 82 | @mkdir -p \$(MOUNT_PT)/var/{opt,cache,lib/{misc,locate},local}
|
---|
| 83 | @install -d -m 0750 \$(MOUNT_PT)/root
|
---|
| 84 | @install -d -m 1777 \$(MOUNT_PT){/var,}/tmp
|
---|
| 85 | @mkdir -p \$(MOUNT_PT)/usr/{,local/}{bin,include,lib,sbin,src}
|
---|
| 86 | @mkdir -p \$(MOUNT_PT)/usr/{,local/}share/{doc,info,locale,man}
|
---|
| 87 | @mkdir -p \$(MOUNT_PT)/usr/{,local/}share/{misc,terminfo,zoneinfo}
|
---|
| 88 | @mkdir -p \$(MOUNT_PT)/usr/{,local/}share/man/man{1,2,3,4,5,6,7,8}
|
---|
| 89 | @for dir in \$(MOUNT_PT)/usr{,/local}; do \\
|
---|
| 90 | ln -s share/{man,doc,info} \$\$dir ; \\
|
---|
| 91 | done
|
---|
| 92 |
|
---|
| 93 | @touch \$@ && \\
|
---|
| 94 | echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
---|
| 95 | echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
| 96 |
|
---|
| 97 | 028-creating-sysfile: 027-create-directories
|
---|
| 98 | @\$(call echo_message, Building)
|
---|
| 99 |
|
---|
| 100 | @touch \$(MOUNT_PT)/etc/mtab
|
---|
| 101 | @echo "root::0:0:root:/root:/bin/bash" >> \$(MOUNT_PT)/etc/passwd
|
---|
| 102 | @echo "root:x:0:" >> \$(MOUNT_PT)/etc/group
|
---|
| 103 | @echo "bin:x:1:" >> \$(MOUNT_PT)/etc/group
|
---|
| 104 | @echo "sys:x:2:" >> \$(MOUNT_PT)/etc/group
|
---|
| 105 | @echo "kmem:x:3" >> \$(MOUNT_PT)/etc/group
|
---|
| 106 | @echo "tty:x:4:" >> \$(MOUNT_PT)/etc/group
|
---|
| 107 | @echo "tape:x:5:" >> \$(MOUNT_PT)/etc/group
|
---|
| 108 | @echo "daemon:x:6:" >> \$(MOUNT_PT)/etc/group
|
---|
| 109 | @echo "floppy:x:7:" >> \$(MOUNT_PT)/etc/group
|
---|
| 110 | @echo "disk:x:8:" >> \$(MOUNT_PT)/etc/group
|
---|
| 111 | @echo "lp:x:9:" >> \$(MOUNT_PT)/etc/group
|
---|
| 112 | @echo "dialout:x:10:" >> \$(MOUNT_PT)/etc/group
|
---|
| 113 | @echo "audio:x:11:" >> \$(MOUNT_PT)/etc/group
|
---|
| 114 | @echo "video:x:12:" >> \$(MOUNT_PT)/etc/group
|
---|
| 115 | @echo "utmp:x:13:" >> \$(MOUNT_PT)/etc/group
|
---|
| 116 | @echo "usb:x:14:" >> \$(MOUNT_PT)/etc/group
|
---|
| 117 | @echo "cdrom:x:15:" >> \$(MOUNT_PT)/etc/group
|
---|
| 118 |
|
---|
| 119 | @touch \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/{btmp,lastlog,wtmp}
|
---|
| 120 | @chmod 664 \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/lastlog
|
---|
[9485eba] | 121 | @chown -R \$(LUSER) \$(MOUNT_PT)
|
---|
[3b63c8c] | 122 |
|
---|
| 123 | @touch \$@ && \\
|
---|
| 124 | echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
---|
| 125 | echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
| 126 |
|
---|
| 127 | EOF
|
---|
| 128 | ) >> $MKFILE.tmp
|
---|
| 129 | }
|
---|
| 130 |
|
---|
| 131 |
|
---|
| 132 |
|
---|
| 133 | #-----------------------------#
|
---|
| 134 | cross_tools_Makefiles() { #
|
---|
| 135 | #-----------------------------#
|
---|
| 136 | echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools${R_arrow}"
|
---|
| 137 |
|
---|
| 138 | for file in cross-tools/* ; do
|
---|
| 139 | # Keep the script file name
|
---|
| 140 | this_script=`basename $file`
|
---|
| 141 | #
|
---|
| 142 | # Skip this script...
|
---|
| 143 | case $this_script in
|
---|
| 144 | *cflags* | *variables* ) # work done in host_prep_Makefiles
|
---|
| 145 | continue; ;;
|
---|
| 146 | *) ;;
|
---|
| 147 | esac
|
---|
| 148 | #
|
---|
| 149 | # Set the dependency for the first target.
|
---|
[d39035c] | 150 | if [ -z $PREV ] ; then PREV=028-creating-sysfile ; fi
|
---|
[3b63c8c] | 151 |
|
---|
| 152 | # First append each name of the script files to a list (this will become
|
---|
| 153 | # the names of the targets in the Makefile
|
---|
| 154 | cross_tools="$cross_tools $this_script"
|
---|
| 155 |
|
---|
| 156 | # Grab the name of the target (minus the -headers or -cross in the case of gcc
|
---|
| 157 | # and binutils in chapter 5)
|
---|
| 158 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
| 159 | -e 's@-static@@' \
|
---|
| 160 | -e 's@-final@@' \
|
---|
| 161 | -e 's@-64@@' \
|
---|
| 162 | -e 's@-n32@@'`
|
---|
| 163 | case $name in
|
---|
| 164 | glibc-headers) name="glibc" ;;
|
---|
| 165 | esac
|
---|
| 166 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
| 167 | #--------------------------------------------------------------------#
|
---|
| 168 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 169 | #--------------------------------------------------------------------#
|
---|
| 170 | #
|
---|
| 171 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 172 | # as a dependency. Also call the echo_message function.
|
---|
| 173 | wrt_target "${this_script}" "$PREV"
|
---|
| 174 | #
|
---|
| 175 | # If $pkg_tarball isn't empty, we've got a package...
|
---|
| 176 | if [ "$pkg_tarball" != "" ] ; then
|
---|
[9485eba] | 177 | wrt_unpack "$pkg_tarball"
|
---|
[3b63c8c] | 178 | # If using optimizations, write the instructions
|
---|
| 179 | [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
| 180 | fi
|
---|
| 181 | #
|
---|
[9485eba] | 182 | wrt_RunAsUser "${this_script}" "${file}"
|
---|
[3b63c8c] | 183 | #
|
---|
| 184 | [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
| 185 | #
|
---|
| 186 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 187 | wrt_touch
|
---|
| 188 | #
|
---|
| 189 | #--------------------------------------------------------------------#
|
---|
| 190 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 191 | #--------------------------------------------------------------------#
|
---|
| 192 | #
|
---|
| 193 | # Keep the script file name for Makefile dependencies.
|
---|
| 194 | PREV=$this_script
|
---|
| 195 |
|
---|
| 196 | done # for file in ....
|
---|
| 197 | }
|
---|
| 198 |
|
---|
| 199 |
|
---|
| 200 |
|
---|
| 201 | #-----------------------------#
|
---|
| 202 | final_system_Makefiles() { #
|
---|
| 203 | #-----------------------------#
|
---|
[f28e4bd] | 204 | echo "${tab_}${GREEN}Processing... ${L_arrow}final system${R_arrow}"
|
---|
| 205 |
|
---|
| 206 | for file in final-system/* ; do
|
---|
[3b63c8c] | 207 | # Keep the script file name
|
---|
| 208 | this_script=`basename $file`
|
---|
| 209 |
|
---|
| 210 | # Test if the stripping phase must be skipped.
|
---|
| 211 | # Skip alsp temp-perl for iterative runs
|
---|
| 212 | case $this_script in
|
---|
| 213 | *stripping*) [[ "$STRIP" = "0" ]] && continue ;;
|
---|
| 214 | esac
|
---|
| 215 |
|
---|
| 216 | # Grab the name of the target, strip id number, XXX-script
|
---|
| 217 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
| 218 | -e 's@temp-@@' \
|
---|
| 219 | -e 's@-64bit@@' \
|
---|
| 220 | -e 's@-64@@' \
|
---|
| 221 | -e 's@64@@' \
|
---|
| 222 | -e 's@n32@@'`
|
---|
| 223 |
|
---|
| 224 | # Find the version of the command files, if it corresponds with the building of
|
---|
[f28e4bd] | 225 | # a specific package.
|
---|
[3b63c8c] | 226 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
| 227 |
|
---|
| 228 | # Append each name of the script files to a list (this will become
|
---|
| 229 | # the names of the targets in the Makefile
|
---|
[f28e4bd] | 230 | basicsystem="$basicsystem ${this_script}"
|
---|
[3b63c8c] | 231 |
|
---|
| 232 | #--------------------------------------------------------------------#
|
---|
| 233 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 234 | #--------------------------------------------------------------------#
|
---|
| 235 | #
|
---|
| 236 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 237 | # as a dependency. Also call the echo_message function.
|
---|
[f28e4bd] | 238 | wrt_target "${this_script}" "$PREV"
|
---|
[3b63c8c] | 239 | #
|
---|
| 240 | # If $pkg_tarball isn't empty, we've got a package...
|
---|
| 241 | if [ "$pkg_tarball" != "" ] ; then
|
---|
[9485eba] | 242 | wrt_unpack "$pkg_tarball"
|
---|
[3b63c8c] | 243 | # If using optimizations, write the instructions
|
---|
| 244 | [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
---|
| 245 | fi
|
---|
| 246 | #
|
---|
[9485eba] | 247 | wrt_RunAsUser "${this_script}" "${file}"
|
---|
[3b63c8c] | 248 | #
|
---|
| 249 | [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
| 250 | #
|
---|
| 251 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 252 | wrt_touch
|
---|
| 253 | #
|
---|
| 254 | #--------------------------------------------------------------------#
|
---|
| 255 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 256 | #--------------------------------------------------------------------#
|
---|
| 257 | #
|
---|
| 258 | # Keep the script file name for Makefile dependencies.
|
---|
[f28e4bd] | 259 | PREV=${this_script}
|
---|
[3b63c8c] | 260 | done # for file in final-system/* ...
|
---|
| 261 | }
|
---|
| 262 |
|
---|
| 263 |
|
---|
| 264 |
|
---|
| 265 | #-----------------------------#
|
---|
| 266 | bootscripts_Makefiles() { #
|
---|
| 267 | #-----------------------------#
|
---|
| 268 | echo "${tab_}${GREEN}Processing... ${L_arrow}bootscripts${R_arrow}"
|
---|
| 269 |
|
---|
| 270 | for file in bootscripts/* ; do
|
---|
| 271 | # Keep the script file name
|
---|
| 272 | this_script=`basename $file`
|
---|
| 273 |
|
---|
| 274 | case $this_script in
|
---|
| 275 | *udev) continue ;; # This is not a script but a commentary, we want udev-rules
|
---|
| 276 | *console*) continue ;; # Use the files that came with the bootscripts
|
---|
| 277 | *) ;;
|
---|
| 278 | esac
|
---|
| 279 |
|
---|
| 280 | # First append each name of the script files to a list (this will become
|
---|
| 281 | # the names of the targets in the Makefile
|
---|
| 282 | bootscripttools="$bootscripttools $this_script"
|
---|
| 283 |
|
---|
| 284 | # Grab the name of the target, strip id number, XXX-script
|
---|
| 285 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
| 286 | -e 's@-64bit@@' \
|
---|
| 287 | -e 's@-64@@' \
|
---|
| 288 | -e 's@64@@' \
|
---|
| 289 | -e 's@n32@@'`
|
---|
| 290 | case $name in
|
---|
| 291 | *bootscripts*) name=bootscripts-cross-lfs ;;
|
---|
| 292 | *udev-rules) name=udev-cross-lfs ;;
|
---|
| 293 | esac
|
---|
| 294 |
|
---|
| 295 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
| 296 |
|
---|
| 297 | #--------------------------------------------------------------------#
|
---|
| 298 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 299 | #--------------------------------------------------------------------#
|
---|
| 300 | #
|
---|
| 301 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 302 | # as a dependency. Also call the echo_message function.
|
---|
| 303 | wrt_target "${this_script}" "$PREV"
|
---|
| 304 | #
|
---|
| 305 | # If $pkg_tarball isn't empty, we've got a package...
|
---|
[9485eba] | 306 | [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
|
---|
[3b63c8c] | 307 | #
|
---|
[9485eba] | 308 | wrt_RunAsUser "${this_script}" "${file}"
|
---|
[3b63c8c] | 309 | #
|
---|
| 310 | [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
| 311 | #
|
---|
| 312 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 313 | wrt_touch
|
---|
| 314 | #
|
---|
| 315 | #--------------------------------------------------------------------#
|
---|
| 316 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 317 | #--------------------------------------------------------------------#
|
---|
| 318 | #
|
---|
| 319 | # Keep the script file name for Makefile dependencies.
|
---|
| 320 | PREV=$this_script
|
---|
| 321 |
|
---|
| 322 | done # for file in bootscripts/* ...
|
---|
| 323 |
|
---|
| 324 | }
|
---|
| 325 |
|
---|
| 326 |
|
---|
| 327 | #-----------------------------#
|
---|
| 328 | bootable_Makefiles() { #
|
---|
| 329 | #-----------------------------#
|
---|
| 330 | echo "${tab_}${GREEN}Processing... ${L_arrow}make bootable${R_arrow}"
|
---|
| 331 |
|
---|
| 332 | for file in bootable/* ; do
|
---|
| 333 | # Keep the script file name
|
---|
| 334 | this_script=`basename $file`
|
---|
| 335 |
|
---|
| 336 | # A little housekeeping on the scripts
|
---|
| 337 | case $this_script in
|
---|
| 338 | *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
|
---|
| 339 | *kernel) # if there is no kernel config file do not build the kernel
|
---|
| 340 | [[ -z $CONFIG ]] && continue
|
---|
| 341 | # Copy the config file to /sources with a standardized name
|
---|
| 342 | cp $CONFIG $BUILDDIR/sources/kernel-config
|
---|
| 343 | ;;
|
---|
| 344 | esac
|
---|
| 345 | #
|
---|
| 346 | # First append each name of the script files to a list (this will become
|
---|
| 347 | # the names of the targets in the Makefile
|
---|
| 348 | bootable="$bootable $this_script"
|
---|
| 349 | #
|
---|
| 350 | # Grab the name of the target, strip id number and misc words.
|
---|
| 351 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
|
---|
| 352 | case $this_script in
|
---|
| 353 | *kernel*) name=linux
|
---|
| 354 | ;;
|
---|
| 355 | esac
|
---|
| 356 |
|
---|
| 357 | pkg_tarball=$(get_package_tarball_name $name)
|
---|
| 358 |
|
---|
| 359 | #--------------------------------------------------------------------#
|
---|
| 360 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 361 | #--------------------------------------------------------------------#
|
---|
| 362 | #
|
---|
| 363 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 364 | # as a dependency. Also call the echo_message function.
|
---|
| 365 | wrt_target "${this_script}" "$PREV"
|
---|
| 366 | #
|
---|
| 367 | # If $pkg_tarball isn't empty, we've got a package...
|
---|
[9485eba] | 368 | [[ "$pkg_tarball" != "" ]] && wrt_unpack "$pkg_tarball"
|
---|
[3b63c8c] | 369 | #
|
---|
| 370 | # Select a script execution method
|
---|
| 371 | case $this_script in
|
---|
| 372 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
| 373 | wrt_copy_fstab "${this_script}"
|
---|
| 374 | else
|
---|
[9485eba] | 375 | wrt_RunAsUser "${this_script}" "${file}"
|
---|
[3b63c8c] | 376 | fi
|
---|
| 377 | ;;
|
---|
[f28e4bd] | 378 | *chowning) wrt_RunAsRoot "${this_script}" "${file}"
|
---|
[9485eba] | 379 | ;;
|
---|
[f28e4bd] | 380 | *) wrt_RunAsUser "${this_script}" "${file}"
|
---|
[3b63c8c] | 381 | ;;
|
---|
| 382 | esac
|
---|
| 383 | #
|
---|
| 384 | # Housekeeping...remove any build directory(ies) except if the package build fails.
|
---|
| 385 | [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
| 386 | #
|
---|
| 387 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 388 | wrt_touch
|
---|
| 389 | #
|
---|
| 390 | #--------------------------------------------------------------------#
|
---|
| 391 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 392 | #--------------------------------------------------------------------#
|
---|
| 393 | #
|
---|
| 394 | # Keep the script file name for Makefile dependencies.
|
---|
| 395 | PREV=$this_script
|
---|
| 396 |
|
---|
| 397 | done
|
---|
| 398 |
|
---|
| 399 | # Add SBU-disk_usage report target if required
|
---|
| 400 | if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi
|
---|
| 401 |
|
---|
| 402 | }
|
---|
| 403 |
|
---|
| 404 |
|
---|
| 405 | #-----------------------------#
|
---|
| 406 | build_Makefile() { # Construct a Makefile from the book scripts
|
---|
| 407 | #-----------------------------#
|
---|
| 408 | echo "Creating Makefile... ${BOLD}START${OFF}"
|
---|
| 409 |
|
---|
| 410 | cd $JHALFSDIR/${PROGNAME}-commands
|
---|
| 411 | # Start with a clean Makefile.tmp file
|
---|
| 412 | >$MKFILE.tmp
|
---|
| 413 |
|
---|
| 414 | host_prep_Makefiles
|
---|
| 415 | cross_tools_Makefiles # $cross_tools
|
---|
| 416 | final_system_Makefiles # $basicsystem
|
---|
| 417 | bootscripts_Makefiles # $bootscripttools
|
---|
| 418 | bootable_Makefiles # $bootable
|
---|
| 419 |
|
---|
| 420 | # Add a header, some variables and include the function file
|
---|
| 421 | # to the top of the real Makefile.
|
---|
| 422 | (
|
---|
| 423 | cat << EOF
|
---|
| 424 | $HEADER
|
---|
| 425 |
|
---|
| 426 | SRC= /sources
|
---|
| 427 | MOUNT_PT= $BUILDDIR
|
---|
| 428 | PKG_LST= $PKG_LST
|
---|
[9485eba] | 429 | LUSER= $LUSER
|
---|
| 430 | LGROUP= $LGROUP
|
---|
[3b63c8c] | 431 |
|
---|
| 432 | include makefile-functions
|
---|
| 433 |
|
---|
| 434 | EOF
|
---|
| 435 | ) > $MKFILE
|
---|
| 436 |
|
---|
| 437 | # Drop in the main target 'all:' and the chapter targets with each sub-target
|
---|
| 438 | # as a dependency.
|
---|
| 439 | (
|
---|
| 440 | cat << EOF
|
---|
[30737ea8] | 441 | all: chapter2 chapter3 chapter4 chapter5 chapter6 restore-luser-env do-housekeeping
|
---|
[3b63c8c] | 442 | @\$(call echo_finished,$VERSION)
|
---|
| 443 |
|
---|
| 444 | chapter2: 023-creatingtoolsdir 025-addinguser 026-settingenvironment 027-create-directories 028-creating-sysfile
|
---|
| 445 |
|
---|
| 446 | chapter3: chapter2 $cross_tools
|
---|
| 447 |
|
---|
| 448 | chapter4: chapter3 $basicsystem
|
---|
| 449 |
|
---|
| 450 | chapter5: chapter4 $bootscripttools
|
---|
| 451 |
|
---|
| 452 | chapter6: chapter5 $bootable
|
---|
| 453 |
|
---|
| 454 | clean-all: clean
|
---|
| 455 | rm -rf ./{clfs2-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
|
---|
| 456 |
|
---|
[f28e4bd] | 457 | clean:
|
---|
[3b63c8c] | 458 |
|
---|
| 459 | restart:
|
---|
| 460 | @echo "This feature does not exist for the CLFS makefile. (yet)"
|
---|
| 461 |
|
---|
[30737ea8] | 462 | restore-luser-env:
|
---|
[3b63c8c] | 463 | @\$(call echo_message, Building)
|
---|
[9485eba] | 464 | @if [ -f /home/\$(LUSER)/.bashrc.XXX ]; then \\
|
---|
| 465 | mv -f /home/\$(LUSER)/.bashrc.XXX /home/\$(LUSER)/.bashrc; \\
|
---|
[3b63c8c] | 466 | fi;
|
---|
[9485eba] | 467 | @if [ -f /home/\$(LUSER)/.bash_profile.XXX ]; then \\
|
---|
| 468 | mv /home/\$(LUSER)/.bash_profile.XXX /home/\$(LUSER)/.bash_profile; \\
|
---|
[3b63c8c] | 469 | fi;
|
---|
[9485eba] | 470 | @chown \$(LUSER):\$(LGROUP) /home/\$(LUSER)/.bash* && \\
|
---|
[3b63c8c] | 471 | touch \$@ && \\
|
---|
| 472 | echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
|
---|
| 473 | echo --------------------------------------------------------------------------------\$(WHITE)
|
---|
| 474 |
|
---|
| 475 | do-housekeeping:
|
---|
[30737ea8] | 476 | @-if [ ! -f luser-exist ]; then \\
|
---|
[9485eba] | 477 | userdel \$(LUSER); \\
|
---|
| 478 | rm -rf /home/\$(LUSER); \\
|
---|
[3b63c8c] | 479 | fi;
|
---|
| 480 |
|
---|
| 481 | EOF
|
---|
| 482 | ) >> $MKFILE
|
---|
| 483 |
|
---|
| 484 | # Bring over the items from the Makefile.tmp
|
---|
| 485 | cat $MKFILE.tmp >> $MKFILE
|
---|
| 486 | rm $MKFILE.tmp
|
---|
| 487 | echo "Creating Makefile... ${BOLD}DONE${OFF}"
|
---|
| 488 |
|
---|
| 489 | }
|
---|
| 490 |
|
---|