source: scripts/build-target.sh @ 662fbfc

clfs-1.2clfs-2.1clfs-3.0.0-systemdclfs-3.0.0-sysvinitsystemdsysvinit
Last change on this file since 662fbfc was 617118d, checked in by Jim Gifford <clfs@…>, 18 years ago

r561@server (orig r559): root | 2005-06-05 02:38:49 -0700
Fixed Directory Structure

  • Property mode set to 100755
File size: 4.6 KB
Line 
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
14set +h
15
16# Set SELF to be name of script called, minus any path...
17SELF=$(basename ${0})
18echo "Running ${SELF}"
19VERSION="2.4.4"
20DATE=$(date +'%Y%m%d')
21export 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?
30if [ "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
34fi
35
36# Get package version information
37. ${SCRIPTS}/plfs-packages
38
39# Source Functions and definitions
40. ${SCRIPTS}/build-init.sh
41
42
43set +x
44unset LD_LIBRARY_PATH
45unset LD_PRELOAD
46
47# Configure uses these if set, and will not look for a cross-compiler
48unset CC CXX
49
50export LDFLAGS="-s"
51
52# Setup PATH
53#export PATH=/bin:/sbin:/usr/bin:/usr/sbin
54export PATH=${HST_TOOLS}/bin:${HST_TOOLS}/sbin:${PATH}
55
56# If ${SRC} does not exist, create it
57test -d ${SRC} || mkdir -p ${SRC}
58
59if [ ! "${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
68fi
69
70mkdir -p ${CONFLOGS}
71mkdir -p ${BUILDLOGS}
72mkdir -p ${INSTLOGS}
73mkdir -p ${TESTLOGS}
74cd ${SRC}
75
76#scripts_dir="cross-scripts-${VERSION}"
77scripts_dir="target-scripts"
78
79# scripts for building target tools
80test "Y" = "${MULTIARCH}" &&
81{
82script_list="target-binutils.sh
83target-gcc.sh
84target-zlib-32.sh
85target-zlib-64.sh
86target-gawk.sh
87target-coreutils.sh
88target-bzip2-32.sh
89target-bzip2-64.sh
90target-gzip.sh
91target-diffutils.sh
92target-findutils.sh
93target-m4.sh
94target-bison.sh
95target-flex.sh
96target-make.sh
97target-grep.sh
98target-sed.sh
99target-gettext-32.sh
100target-gettext-64.sh
101target-ncurses-32.sh
102target-ncurses-64.sh
103target-patch.sh
104target-tar.sh
105target-bash.sh"
106} || {
107script_list="target-binutils.sh
108target-gcc.sh
109target-zlib.sh
110target-gawk.sh
111target-coreutils.sh
112target-bzip2.sh
113target-gzip.sh
114target-diffutils.sh
115target-findutils.sh
116target-m4.sh
117target-bison.sh
118target-flex.sh
119target-make.sh
120target-grep.sh
121target-sed.sh
122target-gettext.sh
123target-ncurses.sh
124target-patch.sh
125target-tar.sh
126target-bash.sh"
127}
128
129# Packages common to both BIARCH and non-BIARCH
130script_list="${script_list}
131target-e2fsprogs.sh
132target-procps.sh
133target-sysvinit.sh
134target-module-init-tools.sh
135target-nettools.sh
136target-inetutils.sh
137target-util-linux.sh
138target-strace.sh
139target-sysklogd.sh"
140
141if [ "${USE_HOTPLUG}" = "Y" ]; then
142script_list="${script_list}
143target-hotplug.sh"
144fi
145
146script_list="${script_list}
147target-dev.sh
148target-lfs-bootscripts.sh
149target-kernel.sh
150target-iana-etc.sh"
151
152#target-modutils.sh
153# Lilo bootloader
154if [ "${USE_LILO}" = "Y" ]; then
155script_list="${script_list}
156host-nasm.sh
157host-bin86.sh
158host-lilo.sh
159target-nasm.sh
160target-bin86.sh
161target-lilo.sh"
162fi
163
164# TODO: add nfs client, tcpwrappers portmap etc scripts
165#       ( to allow us to nfs mount root on target box )
166script_list="${script_list}
167target-nfsutils.sh
168target-tcp-wrappers.sh
169target-portmap.sh"
170
171script_list="${script_list}
172target-iproute2.sh
173target-final-prep-wrapper.sh"
174
175
176SCRIPTLIST=`echo "${script_list}" | \
177  sed "s@\(.*\)@${scripts_dir}/\1@"`
178
179# Check if we are resuming from a particular script
180test ! -z "${1}" &&
181{
182   SCRIPTLIST=`echo ${SCRIPTLIST} | sed "s@.*\(${1}.*\)@\1@g"`
183}
184                                                                               
185echo ' o Checking for needed sources and tarballs'
186check_tarballs ${SCRIPTLIST}
187                                                                               
188for 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   }
208done
Note: See TracBrowser for help on using the repository browser.