5 CLR
="\\0033[2J\\0033[01;01H"
11 FAILED
="${R}FAILED.${N}"
14 "${CLR}Welcome to the ${B}AROS SDK${N} installation script!\n"
17 "You are about to be asked a few ${B}questions${N}, each with a ${B}default${N} answer. This answer is written in ${B}bold${N} characters and put inside square brakets; in order to select it just press <${B}ENTER${N}>, whilst to override it write your own answer and then press <${B}ENTER${N}>.\n"
20 "Remember that in order for the installation to be successful you need a ${B}gcc${N} compiler, and related ${B}binutils${N}, able to produce ${B}i386-elf${N} executables. If you are running an x86 version of Linux, or an x86 version of any of the *BSD operating system, or an x86 version of BeOS, chances are you already have the compiler installed.\n"
23 "You can even install the SDK on a non-x86 architecture, provided that the proper crosscompiler is installed in the system.\n"
26 "If you're ready to start the installation, press <${B}ENTER${N}>\n"
28 cc
=`which gcc 2>/dev/null`
31 echo -e -n "Name of the gcc compiler to use, or path to it [${B}${cc}${N}]: "
34 if test "$cc_tmp" != ""; then
40 echo -e -n "Trying ${B}$cc_path${N}... "
41 cc_path
=`which $cc_path 2>/dev/null`
43 if test "$cc_path" != ""; then
44 cc_cpu
=`$cc_path -dumpmachine 2>/dev/null | cut -f1 -d-`
63 if test "$cc_path" == ""; then
64 echo -e "The compiler you specified doesn't seem to exist.\n"
66 echo -e "The compiler you specified has been configured for the" \
67 "${B}$cc_cpu${N} cpu which is not supported by this SDK.\n"
73 echo -e Checking where the compiler stores its own include files...
74 cc_os
=`$cc -dumpmachine 2>/dev/null | cut -f2- -d-`
75 if echo $cc_os |
grep freebsd
>/dev
/null
; then
76 cc_include
=/usr
/include
78 cc_include
=`dirname \`$cc -print-libgcc-file-name\
``/include
80 echo -e "${B}$cc_include${N}"
82 #find out where is the compiler going to search for the verious tools
83 cc_programs_path
=`gcc -print-search-dirs | grep "programs: =" | cut -c 12-`
85 tools_list
="ld nm as ar objcopy objdump objcopy ranlib strip"
87 for tool
in $tools_list; do
88 echo -e -n "Checking ${B}$tool${N}... "
90 tool1
=`which \`$cc -print-prog-name=$tool\
` 2>/dev/null`
92 if test "$tool1" != ""; then
97 echo -e "The compiler cannot access ${B}$tool${N}, or there's no ${B}$tool${N}" \
98 "installed. Make sure you have the correct binutils installed properly."
103 echo -e -n "Checking whether ${B}ld${N} supports the ELF format... "
105 ld_emu_all
="`$ld -V 2>/dev/null` none"
107 for ld_emu
in $ld_emu_all; do
115 if test "$ld_emu" != "none"; then
119 echo -e "Ld doesnt support the ELF executable format." \
120 "You need to configure the binutils so that they can work on ELF objects."
124 aros_sdk_path
=/usr
/local
/aros-sdk
127 echo -e -n "Directory in which to install the AROS SDK [${B}${aros_sdk_path}${N}]: "
128 read aros_sdk_path_tmp
130 if test "$aros_sdk_path_tmp" != ""; then
131 aros_sdk_path
=$aros_sdk_path_tmp
135 if ! test -e $aros_sdk_path; then
136 echo -e -n "The directory ${B}$aros_sdk_path${N} does not exist, "
137 echo -e -n "create it [${B}yes${N}]? "
140 if test "$answer" = "yes" -o "$answer" = ""; then
144 if test "$answer" = "no"; then
148 if ! test -d $aros_sdk_path; then
149 echo -e "${B}$aros_sdk_path${N} already exists but it's not a directory."
150 echo -e "Chose a new name or delete the existing ${B}$aros_sdk_path${N}"
159 echo -e Making directories...
160 all_dirs
="$aros_sdk_path/${cc_cpu}-aros/include $aros_sdk_path/bin $aros_sdk_path/${cc_cpu}-aros/lib/gcc-lib $aros_sdk_path/${cc_cpu}-aros/bin"
162 for dir
in $all_dirs; do
163 if ! test -d $dir; then
168 # Patch paths in env.h.
169 # For LD_NAME we can't use $aros_sdk_path/bin/${cc_cpu}-aros-ld because
170 # it would cause a recursion which creates error "Argument list too long".
171 # TODO: add a check if /usr/bin/ld really exists
172 echo -e Patching env.h...
173 sed -i -e "35 c \#define LD_NAME \"/usr/bin/ld\"" tools
/collect-aros
/env.h
174 sed -i -e "36 c \#define STRIP_NAME \"$aros_sdk_path/bin/${cc_cpu}-aros-strip\"" tools
/collect-aros
/env.h
175 sed -i -e "37 c \#define NM_NAME \"$aros_sdk_path/bin/${cc_cpu}-aros-nm -C -ul\"" tools
/collect-aros
/env.h
176 sed -i -e "38 c \#define OBJDUMP_NAME \"$aros_sdk_path/bin/${cc_cpu}-aros-objdump\"" tools
/collect-aros
/env.h
178 if ! make -s -C tools
/collect-aros \
179 COLLECT-AROS
=$aros_sdk_path/${cc_cpu}-aros/lib
/gcc-lib
/collect-aros
; then
183 echo -e Building scripts...
184 sed "s,@aros_sdk_path@,$aros_sdk_path,g; s,@ld_emu@,$ld_emu,g; s,@cc_include@,$cc_include,g; s,@cc_cpu@,$cc_cpu,g" scripts
/specs.
in > $aros_sdk_path/${cc_cpu}-aros/lib
/gcc-lib
/specs
186 sed "s,@aros_sdk_path@,$aros_sdk_path,g; s,@ld@,$ld,g; s,@nm@,$nm,g; s,@cc@,$cc,g; s,@objdump@,$objdump,g; s,@cc_cpu@,$cc_cpu,g; s,@strip@,$strip,g" scripts
/aros-gcc.
in > $aros_sdk_path/${cc_cpu}-aros/bin
/gcc
187 chmod a
+x
$aros_sdk_path/${cc_cpu}-aros/bin
/gcc
189 sed "s,@aros_sdk_path@,$aros_sdk_path,g; s,@ld@,$ld,g; s,@nm@,$nm,g; s,@cc@,$cc,g; s,@objdump@,$objdump,g; s,@cc_cpu@,$cc_cpu,g; s,@cc_programs_path@,$cc_programs_path,g" scripts
/aros-ld.
in > $aros_sdk_path/${cc_cpu}-aros/bin
/ld
190 chmod a
+x
$aros_sdk_path/${cc_cpu}-aros/bin
/ld
192 sed "s,@strip@,$strip,g" scripts
/aros-strip.
in > $aros_sdk_path/${cc_cpu}-aros/bin
/strip
193 chmod a
+x
$aros_sdk_path/${cc_cpu}-aros/bin
/strip
195 cat <<EOF > AROS-SDK-Uninstall
197 echo -e "${R}ATTENTION!${N} The AROS SDK is about to be uninstalled."
200 echo -e -n "Do you really want to proceed [${B}no${N}]? "
203 if test "\$answer" = "yes"; then
204 echo -e Uninstalling the AROS SDK...
205 rm -Rf $aros_sdk_path/${cc_cpu}-aros $aros_sdk_path/bin/i386-aros-* \$0
209 if test "\$answer" = "no" -o "\$answer" = ""; then
216 chmod a
+x AROS-SDK-Uninstall
218 echo -e Copying files...
219 ln -sf $as $aros_sdk_path/${cc_cpu}-aros/bin
/as
220 ln -sf $ar $aros_sdk_path/${cc_cpu}-aros/bin
/ar
221 ln -sf $nm $aros_sdk_path/${cc_cpu}-aros/bin
/nm
222 ln -sf $objcopy $aros_sdk_path/${cc_cpu}-aros/bin
/objcopy
223 ln -sf $objdump $aros_sdk_path/${cc_cpu}-aros/bin
/objdump
224 ln -sf $ranlib $aros_sdk_path/${cc_cpu}-aros/bin
/ranlib
226 ln -sf $aros_sdk_path/${cc_cpu}-aros/bin
/gcc
$aros_sdk_path/bin
/${cc_cpu}-aros-gcc
227 ln -sf $aros_sdk_path/${cc_cpu}-aros/bin
/ld
$aros_sdk_path/bin
/${cc_cpu}-aros-ld
228 ln -sf $aros_sdk_path/${cc_cpu}-aros/bin
/ar $aros_sdk_path/bin
/${cc_cpu}-aros-ar
229 ln -sf $aros_sdk_path/${cc_cpu}-aros/bin
/as
$aros_sdk_path/bin
/${cc_cpu}-aros-as
230 ln -sf $aros_sdk_path/${cc_cpu}-aros/bin
/nm
$aros_sdk_path/bin
/${cc_cpu}-aros-nm
231 ln -sf $aros_sdk_path/${cc_cpu}-aros/bin
/objcopy
$aros_sdk_path/bin
/${cc_cpu}-aros-objcopy
232 ln -sf $aros_sdk_path/${cc_cpu}-aros/bin
/objdump
$aros_sdk_path/bin
/${cc_cpu}-aros-objdump
233 ln -sf $aros_sdk_path/${cc_cpu}-aros/bin
/ranlib
$aros_sdk_path/bin
/${cc_cpu}-aros-ranlib
234 ln -sf $aros_sdk_path/${cc_cpu}-aros/bin
/strip
$aros_sdk_path/bin
/${cc_cpu}-aros-strip
236 cp -a $cc_cpu/lib
/* $aros_sdk_path/${cc_cpu}-aros/lib
/
237 cp -a $cc_cpu/include
/* $aros_sdk_path/${cc_cpu}-aros/include
/
239 echo -e "\nEverything done. Remember to add ${B}$aros_sdk_path/bin${N} to your ${B}PATH${N} environment variable before using the AROS SDK."