5 CLR
="\\0033[2J\\0033[01;01H"
11 FAILED
="${R}FAILED.${N}"
14 "${CLR}Welcome to the ${B}AROS SDK${N} installation script!\n\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\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\n"
23 "You can even install the SDK on a non-x86 architecture, provided that the proper crosscompiler is installed in the system.\n\n"
26 "If you're ready to start the installation, press <${B}ENTER${N}>\n\n"
30 cc
=`which gcc 2>/dev/null`
33 echo -en "Name of the gcc compiler to use, or path to it [${B}${cc}${N}]: "
36 if test "$cc_tmp" != ""; then
42 echo -en "Trying ${B}$cc_path${N}... "
43 cc_path
=`which $cc_path 2>/dev/null`
45 if test "$cc_path" != ""; then
46 cc_cpu
=`$cc_path -dumpmachine 2>/dev/null | cut -f1 -d-`
60 if test "$cc_path" == ""; then
61 echo -e "The compiler you specified doesn't seem to exist.\n"
63 echo -e "The compiler you specified has been configured for the" \
64 "${B}$cc_cpu${N} cpu which is not supported by this SDK.\n"
70 echo Checking where the compiler stores its own include files...
71 cc_os
=`$cc -dumpmachine 2>/dev/null | cut -f2- -d-`
72 if echo $cc_os |
grep freebsd
>/dev
/null
; then
73 cc_include
=/usr
/include
75 cc_include
=`dirname \`$cc -print-libgcc-file-name\
``/include
77 echo -e "${B}$cc_include${N}"
79 #find out where is the compiler going to search for the verious tools
80 cc_programs_path
=`gcc -print-search-dirs | grep "programs: =" | cut -c 12-`
82 tools_list
="ld nm as ar objcopy objdump objcopy ranlib strip"
84 for tool
in $tools_list; do
85 echo -en "Checking ${B}$tool${N}... "
87 tool1
=`which \`$cc -print-prog-name=$tool\
` 2>/dev/null`
89 if test "$tool1" != ""; then
94 echo -e "The compiler cannot access ${B}$tool${N}, or there's no ${B}$tool${N}" \
95 "installed. Make sure you have the correct binutils installed properly."
100 echo -en "Checking whether ${B}ld${N} supports the ELF format... "
102 ld_emu_all
="`$ld -V 2>/dev/null` none"
104 for ld_emu
in $ld_emu_all; do
112 if test "$ld_emu" != "none"; then
116 echo -e "Ld doesnt support the ELF executable format." \
117 "You need to configure the binutils so that they can work on ELF objects."
121 aros_sdk_path
=/usr
/local
/aros-sdk
124 echo -en "Directory in which to install the AROS SDK [${B}${aros_sdk_path}${N}]: "
125 read aros_sdk_path_tmp
127 if test "$aros_sdk_path_tmp" != ""; then
128 aros_sdk_path
=$aros_sdk_path_tmp
132 if ! test -a $aros_sdk_path; then
133 echo -en "The directory ${B}$aros_sdk_path${N} does not exist, "
134 echo -en "create it [${B}yes${N}]? "
137 if test "$answer" = "yes" -o "$answer" = ""; then
141 if test "$answer" = "no"; then
145 if ! test -d $aros_sdk_path; then
146 echo -e "${B}$aros_sdk_path${N} already exists but it's not a directory."
147 echo -e "Chose a new name or delete the existing ${B}$aros_sdk_path${N}"
156 echo Making directories...
157 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"
159 for dir
in $all_dirs; do
160 if ! test -d $dir; then
165 if ! make -s -C tools
/collect-aros \
166 COLLECT-AROS
=$aros_sdk_path/${cc_cpu}-aros/lib
/gcc-lib
/collect-aros
; then
170 echo Building scripts...
171 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
173 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
174 chmod a
+x
$aros_sdk_path/${cc_cpu}-aros/bin
/gcc
176 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
177 chmod a
+x
$aros_sdk_path/${cc_cpu}-aros/bin
/ld
179 sed "s,@strip@,$strip,g" scripts
/aros-strip.
in > $aros_sdk_path/${cc_cpu}-aros/bin
/strip
180 chmod a
+x
$aros_sdk_path/${cc_cpu}-aros/bin
/strip
182 cat <<EOF > AROS-SDK-Uninstall
184 echo -e "${R}ATTENTION!${N} The AROS SDK is about to be uninstalled."
187 echo -en "Do you really want to proceed [${B}no${N}]? "
190 if test "\$answer" = "yes"; then
191 echo Uninstalling the AROS SDK...
192 rm -Rf $aros_sdk_path/${cc_cpu}-aros $aros_sdk_path/bin/i386-aros-* \$0
196 if test "\$answer" = "no" -o "\$answer" = ""; then
203 chmod a
+x AROS-SDK-Uninstall
205 echo Copying files...
206 ln -sf $as $aros_sdk_path/${cc_cpu}-aros/bin
/as
207 ln -sf $ar $aros_sdk_path/${cc_cpu}-aros/bin
/ar
208 ln -sf $nm $aros_sdk_path/${cc_cpu}-aros/bin
/nm
209 ln -sf $objcopy $aros_sdk_path/${cc_cpu}-aros/bin
/objcopy
210 ln -sf $objdump $aros_sdk_path/${cc_cpu}-aros/bin
/objdump
211 ln -sf $ranlib $aros_sdk_path/${cc_cpu}-aros/bin
/ranlib
213 ln -sf $aros_sdk_path/${cc_cpu}-aros/bin
/gcc
$aros_sdk_path/bin
/${cc_cpu}-aros-gcc
214 ln -sf $aros_sdk_path/${cc_cpu}-aros/bin
/ld
$aros_sdk_path/bin
/${cc_cpu}-aros-ld
215 ln -sf $aros_sdk_path/${cc_cpu}-aros/bin
/ar $aros_sdk_path/bin
/${cc_cpu}-aros-ar
216 ln -sf $aros_sdk_path/${cc_cpu}-aros/bin
/as
$aros_sdk_path/bin
/${cc_cpu}-aros-as
217 ln -sf $aros_sdk_path/${cc_cpu}-aros/bin
/nm
$aros_sdk_path/bin
/${cc_cpu}-aros-nm
218 ln -sf $aros_sdk_path/${cc_cpu}-aros/bin
/objcopy
$aros_sdk_path/bin
/${cc_cpu}-aros-objcopy
219 ln -sf $aros_sdk_path/${cc_cpu}-aros/bin
/objdump
$aros_sdk_path/bin
/${cc_cpu}-aros-objdump
220 ln -sf $aros_sdk_path/${cc_cpu}-aros/bin
/ranlib
$aros_sdk_path/bin
/${cc_cpu}-aros-ranlib
221 ln -sf $aros_sdk_path/${cc_cpu}-aros/bin
/strip
$aros_sdk_path/bin
/${cc_cpu}-aros-strip
223 cp -a $cc_cpu/lib
/* $aros_sdk_path/${cc_cpu}-aros/lib
/
224 cp -a $cc_cpu/include
/* $aros_sdk_path/${cc_cpu}-aros/include
/
226 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."