1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # build-target.sh
|
---|
4 | #
|
---|
5 | # Script for cross building target native tools
|
---|
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="2.4.4"
|
---|
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 | # Get package version information
|
---|
37 | . ${SCRIPTS}/plfs-packages
|
---|
38 |
|
---|
39 | # Source Functions and definitions
|
---|
40 | . ${SCRIPTS}/build-init.sh
|
---|
41 |
|
---|
42 |
|
---|
43 | set +x
|
---|
44 | unset LD_LIBRARY_PATH
|
---|
45 | unset LD_PRELOAD
|
---|
46 |
|
---|
47 | # Configure uses these if set, and will not look for a cross-compiler
|
---|
48 | unset CC CXX
|
---|
49 |
|
---|
50 | export LDFLAGS="-s"
|
---|
51 |
|
---|
52 | # Setup PATH
|
---|
53 | #export PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
---|
54 | export PATH=${HST_TOOLS}/bin:${HST_TOOLS}/sbin:${PATH}
|
---|
55 |
|
---|
56 | # If ${SRC} does not exist, create it
|
---|
57 | test -d ${SRC} || mkdir -p ${SRC}
|
---|
58 |
|
---|
59 | if [ ! "${USE_SYSROOT}" = "Y" ]; then
|
---|
60 |
|
---|
61 | # If ${LFS}${TGT_TOOLS} directory doesn't exist, create it
|
---|
62 | test -d ${LFS}${TGT_TOOLS} || mkdir -p ${LFS}${TGT_TOOLS}
|
---|
63 |
|
---|
64 | # Create ${TGT_TOOLS} symlink
|
---|
65 | if [ ! -d `dirname ${TGT_TOOLS}` ]; then mkdir -p `dirname ${TGT_TOOLS}` ; fi
|
---|
66 | ln -sf ${LFS}${TGT_TOOLS} `dirname ${TGT_TOOLS}`
|
---|
67 |
|
---|
68 | fi
|
---|
69 |
|
---|
70 | mkdir -p ${CONFLOGS}
|
---|
71 | mkdir -p ${BUILDLOGS}
|
---|
72 | mkdir -p ${INSTLOGS}
|
---|
73 | mkdir -p ${TESTLOGS}
|
---|
74 | cd ${SRC}
|
---|
75 |
|
---|
76 | #scripts_dir="cross-scripts-${VERSION}"
|
---|
77 | scripts_dir="target-scripts"
|
---|
78 |
|
---|
79 | # scripts for building target tools
|
---|
80 | test "Y" = "${MULTIARCH}" &&
|
---|
81 | {
|
---|
82 | script_list="target-binutils.sh
|
---|
83 | target-gcc.sh
|
---|
84 | target-zlib-32.sh
|
---|
85 | target-zlib-64.sh
|
---|
86 | target-gawk.sh
|
---|
87 | target-coreutils.sh
|
---|
88 | target-bzip2-32.sh
|
---|
89 | target-bzip2-64.sh
|
---|
90 | target-gzip.sh
|
---|
91 | target-diffutils.sh
|
---|
92 | target-findutils.sh
|
---|
93 | target-m4.sh
|
---|
94 | target-bison.sh
|
---|
95 | target-flex.sh
|
---|
96 | target-make.sh
|
---|
97 | target-grep.sh
|
---|
98 | target-sed.sh
|
---|
99 | target-gettext-32.sh
|
---|
100 | target-gettext-64.sh
|
---|
101 | target-ncurses-32.sh
|
---|
102 | target-ncurses-64.sh
|
---|
103 | target-patch.sh
|
---|
104 | target-tar.sh
|
---|
105 | target-bash.sh"
|
---|
106 | } || {
|
---|
107 | script_list="target-binutils.sh
|
---|
108 | target-gcc.sh
|
---|
109 | target-zlib.sh
|
---|
110 | target-gawk.sh
|
---|
111 | target-coreutils.sh
|
---|
112 | target-bzip2.sh
|
---|
113 | target-gzip.sh
|
---|
114 | target-diffutils.sh
|
---|
115 | target-findutils.sh
|
---|
116 | target-m4.sh
|
---|
117 | target-bison.sh
|
---|
118 | target-flex.sh
|
---|
119 | target-make.sh
|
---|
120 | target-grep.sh
|
---|
121 | target-sed.sh
|
---|
122 | target-gettext.sh
|
---|
123 | target-ncurses.sh
|
---|
124 | target-patch.sh
|
---|
125 | target-tar.sh
|
---|
126 | target-bash.sh"
|
---|
127 | }
|
---|
128 |
|
---|
129 | # Packages common to both BIARCH and non-BIARCH
|
---|
130 | script_list="${script_list}
|
---|
131 | target-e2fsprogs.sh
|
---|
132 | target-procps.sh
|
---|
133 | target-sysvinit.sh
|
---|
134 | target-module-init-tools.sh
|
---|
135 | target-nettools.sh
|
---|
136 | target-inetutils.sh
|
---|
137 | target-util-linux.sh
|
---|
138 | target-strace.sh
|
---|
139 | target-sysklogd.sh"
|
---|
140 |
|
---|
141 | if [ "${USE_HOTPLUG}" = "Y" ]; then
|
---|
142 | script_list="${script_list}
|
---|
143 | target-hotplug.sh"
|
---|
144 | fi
|
---|
145 |
|
---|
146 | script_list="${script_list}
|
---|
147 | target-dev.sh
|
---|
148 | target-lfs-bootscripts.sh
|
---|
149 | target-kernel.sh
|
---|
150 | target-iana-etc.sh"
|
---|
151 |
|
---|
152 | #target-modutils.sh
|
---|
153 | # Lilo bootloader
|
---|
154 | if [ "${USE_LILO}" = "Y" ]; then
|
---|
155 | script_list="${script_list}
|
---|
156 | host-nasm.sh
|
---|
157 | host-bin86.sh
|
---|
158 | host-lilo.sh
|
---|
159 | target-nasm.sh
|
---|
160 | target-bin86.sh
|
---|
161 | target-lilo.sh"
|
---|
162 | fi
|
---|
163 |
|
---|
164 | # TODO: add nfs client, tcpwrappers portmap etc scripts
|
---|
165 | # ( to allow us to nfs mount root on target box )
|
---|
166 | script_list="${script_list}
|
---|
167 | target-nfsutils.sh
|
---|
168 | target-tcp-wrappers.sh
|
---|
169 | target-portmap.sh"
|
---|
170 |
|
---|
171 | script_list="${script_list}
|
---|
172 | target-iproute2.sh
|
---|
173 | target-final-prep-wrapper.sh"
|
---|
174 |
|
---|
175 |
|
---|
176 | SCRIPTLIST=`echo "${script_list}" | \
|
---|
177 | sed "s@\(.*\)@${scripts_dir}/\1@"`
|
---|
178 |
|
---|
179 | # Check if we are resuming from a particular script
|
---|
180 | test ! -z "${1}" &&
|
---|
181 | {
|
---|
182 | SCRIPTLIST=`echo ${SCRIPTLIST} | sed "s@.*\(${1}.*\)@\1@g"`
|
---|
183 | }
|
---|
184 |
|
---|
185 | echo ' o Checking for needed sources and tarballs'
|
---|
186 | check_tarballs ${SCRIPTLIST}
|
---|
187 |
|
---|
188 | for script in ${SCRIPTLIST}; do
|
---|
189 | echo "Running ${SCRIPTS}/${script}"
|
---|
190 | # HACK: export SELF to be the script we are running
|
---|
191 | # (keeps logfile output correct)
|
---|
192 | export SELF=${script}
|
---|
193 | ${SCRIPTS}/${script}
|
---|
194 |
|
---|
195 | test 0 = ${?} ||
|
---|
196 | {
|
---|
197 | echo
|
---|
198 | echo "Failed script was ${script}"
|
---|
199 | echo "Please fix the error above from"
|
---|
200 | echo " ${SCRIPTS}/${script}"
|
---|
201 | echo "and rerun the build with the command"
|
---|
202 | echo
|
---|
203 | echo " ${0} $script"
|
---|
204 | echo
|
---|
205 | echo "to resume the build."
|
---|
206 | exit 1
|
---|
207 | }
|
---|
208 | done
|
---|