| [617118d] | 1 | #!/bin/bash
|
|---|
| 2 |
|
|---|
| 3 | # build-native.sh
|
|---|
| 4 | #
|
|---|
| 5 | # Script to finish build for target natively
|
|---|
| 6 | #
|
|---|
| 7 | # Authors: Ryan Oliver <ryan.oliver@pha.com.au
|
|---|
| 8 | # Finn Thain
|
|---|
| 9 | #
|
|---|
| 10 | # $LastChangedBy$
|
|---|
| 11 | # $LastChangedDate$
|
|---|
| 12 | # $LastChangedRevision$
|
|---|
| 13 |
|
|---|
| 14 | set +h
|
|---|
| 15 |
|
|---|
| 16 | # Set SELF to be name of script called, minus any path...
|
|---|
| 17 | SELF=$(basename ${0})
|
|---|
| 18 | echo "Running ${SELF}"
|
|---|
| 19 | VERSION="3.0.1"
|
|---|
| 20 | DATE=$(date +'%Y%m%d')
|
|---|
| 21 | export DATE
|
|---|
| 22 |
|
|---|
| 23 | # Read in build configuration information
|
|---|
| 24 | # plfs-config should reside in the same directory as this script.
|
|---|
| 25 | # We need to use dirname to determine where to find it as SCRIPTS
|
|---|
| 26 | # env var is not set yet (set in plfs-config itself)
|
|---|
| 27 | . `dirname ${0}`/plfs-config
|
|---|
| 28 |
|
|---|
| 29 | # Sanity check, are ${LFS}, ${HST_TOOLS} and ${TGT_TOOLS} set?
|
|---|
| 30 | if [ "X${LFS}" = "X" -o "X${HST_TOOLS}" = "X" -o "X${TGT_TOOLS}" = "X" ]; then
|
|---|
| 31 | echo "Error: Not all required environment vars have been set." 1>&2
|
|---|
| 32 | echo " Check plfs-config" 1>&2
|
|---|
| 33 | exit 1
|
|---|
| 34 | fi
|
|---|
| 35 |
|
|---|
| 36 | export LFS=""
|
|---|
| 37 |
|
|---|
| 38 | # Get package version information
|
|---|
| 39 | . ${SCRIPTS}/plfs-packages
|
|---|
| 40 |
|
|---|
| 41 | # Source Functions and definitions
|
|---|
| 42 | . ${SCRIPTS}/build-init.sh
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 | set +x
|
|---|
| 46 | unset LD_LIBRARY_PATH
|
|---|
| 47 | unset LD_PRELOAD
|
|---|
| 48 |
|
|---|
| 49 | # Configure uses these if set, and will not look for a cross-compiler
|
|---|
| 50 | unset CC CXX
|
|---|
| 51 |
|
|---|
| 52 | export LDFLAGS="-s"
|
|---|
| 53 |
|
|---|
| 54 | # Setup PATH
|
|---|
| 55 | export PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
|---|
| 56 | export PATH=${PATH}:${TGT_TOOLS}/bin:${TGT_TOOLS}/sbin
|
|---|
| 57 |
|
|---|
| 58 | # If ${SRC} does not exist, create it
|
|---|
| 59 | test -d ${SRC} || mkdir -p ${SRC}
|
|---|
| 60 |
|
|---|
| 61 | mkdir -p ${CONFLOGS}
|
|---|
| 62 | mkdir -p ${BUILDLOGS}
|
|---|
| 63 | mkdir -p ${INSTLOGS}
|
|---|
| 64 | mkdir -p ${TESTLOGS}
|
|---|
| 65 | cd ${SRC}
|
|---|
| 66 |
|
|---|
| 67 | #scripts_dir="cross-scripts-${VERSION}"
|
|---|
| 68 | scripts_dir="native-scripts"
|
|---|
| 69 |
|
|---|
| 70 | # scripts for building target tools
|
|---|
| 71 | test "Y" = "${MULTIARCH}" &&
|
|---|
| 72 | {
|
|---|
| 73 | script_list="temp-tcl-32.sh
|
|---|
| 74 | temp-tcl-64.sh
|
|---|
| 75 | temp-expect-32.sh
|
|---|
| 76 | temp-expect-64.sh
|
|---|
| 77 | temp-dejagnu.sh
|
|---|
| 78 | temp-texinfo.sh
|
|---|
| 79 | temp-perl-32.sh
|
|---|
| 80 | temp-perl-64.sh
|
|---|
| 81 | copy-kern-hdrs.sh
|
|---|
| 82 | native-glibc-32.sh
|
|---|
| 83 | native-glibc-64.sh"
|
|---|
| 84 | } || {
|
|---|
| 85 | script_list="temp-tcl.sh
|
|---|
| 86 | temp-expect.sh
|
|---|
| 87 | temp-dejagnu.sh
|
|---|
| 88 | temp-texinfo.sh
|
|---|
| 89 | temp-perl.sh
|
|---|
| 90 | copy-kern-hdrs.sh
|
|---|
| 91 | native-glibc.sh"
|
|---|
| 92 | }
|
|---|
| 93 |
|
|---|
| 94 | script_list="${script_list}
|
|---|
| 95 | temp-binutils.sh
|
|---|
| 96 | specs-mod.sh
|
|---|
| 97 | native-binutils.sh
|
|---|
| 98 | native-gcc.sh"
|
|---|
| 99 |
|
|---|
| 100 | test Y = "${MULTIARCH}" &&
|
|---|
| 101 | {
|
|---|
| 102 | script_list="${script_list}
|
|---|
| 103 | native-zlib-32.sh
|
|---|
| 104 | native-zlib-64.sh"
|
|---|
| 105 | } || {
|
|---|
| 106 | script_list="${script_list}
|
|---|
| 107 | native-zlib.sh"
|
|---|
| 108 | }
|
|---|
| 109 |
|
|---|
| 110 | script_list="${script_list}
|
|---|
| [5baad6a] | 111 | native-mktemp.sh
|
|---|
| [617118d] | 112 | native-findutils.sh
|
|---|
| 113 | native-gawk.sh"
|
|---|
| 114 |
|
|---|
| 115 | test Y = "${MULTIARCH}" &&
|
|---|
| 116 | {
|
|---|
| 117 | script_list="${script_list}
|
|---|
| 118 | native-ncurses-32.sh
|
|---|
| 119 | native-ncurses-64.sh"
|
|---|
| 120 | } || {
|
|---|
| 121 | script_list="${script_list}
|
|---|
| 122 | native-ncurses.sh"
|
|---|
| 123 | }
|
|---|
| 124 |
|
|---|
| 125 | test Y = "${USE_READLINE}" &&
|
|---|
| 126 | {
|
|---|
| 127 | test Y = "${MULTIARCH}" &&
|
|---|
| 128 | {
|
|---|
| 129 | script_list="${script_list}
|
|---|
| 130 | native-readline-32.sh
|
|---|
| 131 | native-readline-64.sh"
|
|---|
| 132 | } || {
|
|---|
| 133 | script_list="${script_list}
|
|---|
| 134 | native-readline.sh"
|
|---|
| 135 | }
|
|---|
| 136 | }
|
|---|
| 137 |
|
|---|
| 138 | script_list="${script_list}
|
|---|
| 139 | native-vim.sh
|
|---|
| 140 | native-m4.sh
|
|---|
| 141 | native-bison.sh
|
|---|
| 142 | native-less.sh
|
|---|
| 143 | native-groff.sh
|
|---|
| 144 | native-coreutils.sh
|
|---|
| 145 | native-sed.sh"
|
|---|
| 146 |
|
|---|
| 147 | test Y = "${MULTIARCH}" &&
|
|---|
| 148 | {
|
|---|
| 149 | script_list="${script_list}
|
|---|
| 150 | native-flex-32.sh
|
|---|
| 151 | native-flex-64.sh
|
|---|
| 152 | native-gettext-32.sh
|
|---|
| 153 | native-gettext-64.sh
|
|---|
| 154 | native-nettools.sh
|
|---|
| 155 | native-inetutils.sh
|
|---|
| 156 | native-iproute2.sh
|
|---|
| 157 | native-perl-32.sh
|
|---|
| 158 | native-perl-64.sh
|
|---|
| 159 | native-texinfo.sh
|
|---|
| 160 | native-autoconf.sh
|
|---|
| 161 | native-automake.sh
|
|---|
| 162 | native-bash.sh
|
|---|
| 163 | native-file-32.sh
|
|---|
| 164 | native-file-64.sh"
|
|---|
| 165 | } || {
|
|---|
| 166 | script_list="${script_list}
|
|---|
| 167 | native-flex.sh
|
|---|
| 168 | native-gettext.sh
|
|---|
| 169 | native-nettools.sh
|
|---|
| 170 | native-inetutils.sh
|
|---|
| 171 | native-iproute2.sh
|
|---|
| 172 | native-perl.sh
|
|---|
| 173 | native-texinfo.sh
|
|---|
| 174 | native-autoconf.sh
|
|---|
| 175 | native-automake.sh
|
|---|
| 176 | native-bash.sh
|
|---|
| 177 | native-file.sh"
|
|---|
| 178 | }
|
|---|
| 179 |
|
|---|
| 180 | # ARGH libtool.. gonna have to do some
|
|---|
| 181 | # thinking about how to handle this for bi-arch...
|
|---|
| 182 | test Y = "${MULTIARCH}" &&
|
|---|
| 183 | {
|
|---|
| 184 | script_list="${script_list}
|
|---|
| 185 | native-libtool-32.sh
|
|---|
| 186 | native-libtool-64.sh"
|
|---|
| 187 | } || {
|
|---|
| 188 | script_list="${script_list}
|
|---|
| 189 | native-libtool.sh"
|
|---|
| 190 | }
|
|---|
| 191 |
|
|---|
| 192 | test Y = "${MULTIARCH}" &&
|
|---|
| 193 | {
|
|---|
| 194 | script_list="${script_list}
|
|---|
| 195 | native-bzip2-32.sh
|
|---|
| 196 | native-bzip2-64.sh"
|
|---|
| 197 | } || {
|
|---|
| 198 | script_list="${script_list}
|
|---|
| 199 | native-bzip2.sh"
|
|---|
| 200 | }
|
|---|
| 201 |
|
|---|
| 202 | script_list="${script_list}
|
|---|
| 203 | native-diffutils.sh
|
|---|
| 204 | native-ed.sh
|
|---|
| 205 | native-kbd.sh
|
|---|
| 206 | native-e2fsprogs.sh
|
|---|
| 207 | native-grep.sh
|
|---|
| 208 | native-gzip.sh
|
|---|
| 209 | native-man.sh
|
|---|
| 210 | native-make.sh
|
|---|
| 211 | native-module-init-tools.sh
|
|---|
| 212 | native-patch.sh
|
|---|
| 213 | native-procinfo.sh"
|
|---|
| 214 |
|
|---|
| 215 | test Y = "${MULTIARCH}" &&
|
|---|
| 216 | {
|
|---|
| 217 | script_list="${script_list}
|
|---|
| 218 | native-procps-32.sh
|
|---|
| 219 | native-procps-64.sh
|
|---|
| 220 | native-shadow-32.sh
|
|---|
| 221 | native-shadow-64.sh"
|
|---|
| 222 | } || {
|
|---|
| 223 | script_list="${script_list}
|
|---|
| 224 | native-procps.sh
|
|---|
| 225 | native-shadow.sh"
|
|---|
| 226 | }
|
|---|
| 227 |
|
|---|
| 228 | script_list="${script_list}
|
|---|
| 229 | native-sysklogd.sh
|
|---|
| 230 | native-sysvinit.sh
|
|---|
| 231 | native-tar.sh
|
|---|
| 232 | native-util-linux.sh
|
|---|
| 233 | native-dev.sh"
|
|---|
| 234 |
|
|---|
| 235 | # Final setup of profile/bashrc scripts etc
|
|---|
| 236 | script_list="${script_list}
|
|---|
| 237 | post-lfs-configuration.sh"
|
|---|
| 238 |
|
|---|
| 239 | SCRIPTLIST=`echo "${script_list}" | \
|
|---|
| 240 | sed "s@\(.*\)@${scripts_dir}/\1@"`
|
|---|
| 241 |
|
|---|
| 242 | # Check if we are resuming from a particular script
|
|---|
| 243 | test ! -z "${1}" &&
|
|---|
| 244 | {
|
|---|
| 245 | SCRIPTLIST=`echo ${SCRIPTLIST} | sed "s@.*\(${1}.*\)@\1@g"`
|
|---|
| 246 | }
|
|---|
| 247 |
|
|---|
| 248 | echo ' o Checking for needed sources and tarballs'
|
|---|
| 249 | check_tarballs ${SCRIPTLIST}
|
|---|
| 250 |
|
|---|
| 251 | for script in ${SCRIPTLIST}; do
|
|---|
| 252 | echo "Running ${SCRIPTS}/${script}"
|
|---|
| 253 | # HACK: export SELF to be the script we are running
|
|---|
| 254 | # (keeps logfile output correct)
|
|---|
| 255 | export SELF=${script}
|
|---|
| 256 | ${SCRIPTS}/${script}
|
|---|
| 257 |
|
|---|
| 258 | test 0 = ${?} ||
|
|---|
| 259 | {
|
|---|
| 260 | echo
|
|---|
| 261 | echo "Failed script was ${script}"
|
|---|
| 262 | echo "Please fix the error above from"
|
|---|
| 263 | echo " ${SCRIPTS}/${script}"
|
|---|
| 264 | echo "and rerun the build with the command"
|
|---|
| 265 | echo
|
|---|
| 266 | echo " ${0} $script"
|
|---|
| 267 | echo
|
|---|
| 268 | echo "to resume the build."
|
|---|
| 269 | exit 1
|
|---|
| 270 | }
|
|---|
| 271 | done
|
|---|