kolibrios-gcc-toolchain/install.sh

167 lines
3.3 KiB
Bash
Raw Permalink Normal View History

2024-09-29 11:45:17 +02:00
#!/bin/bash
# Written by turbocat2001 (Maxim Logaev)
# Installation steps described by maxcodehack (Maxim Kuzmitsky)
# modified by Egor00f (Egor)
2024-09-29 11:45:17 +02:00
set -e
print_msg(){
echo -e "\e[34m$1\e[0m"
2024-09-29 11:45:17 +02:00
}
print_ok(){
echo -e "\e[32m$1\e[0m"
2024-09-29 11:45:17 +02:00
}
print_err(){
echo -e "\e[31m$1\e[0m"
exit
2024-09-29 11:45:17 +02:00
}
check_utils(){
printf "%s: " $1
if command -v $1 &> /dev/null
then
print_ok "ok\r"
else
print_err "no\r"
fi
2024-09-29 11:45:17 +02:00
}
2024-11-08 16:33:38 +01:00
pwd
2024-11-09 19:18:02 +01:00
DEFAULT_TOOLCHAIN_DIR="/home/autobuild/tools"
2024-11-09 18:16:13 +01:00
2024-11-09 19:18:02 +01:00
TOOLCHAIN_DIR=$DEFAULT_TOOLCHAIN_DIR
2024-11-08 16:33:38 +01:00
2024-11-09 18:16:13 +01:00
MESSAGE="Toolchain install path(default is $TOOLCHAIN_DIR): "
echo -n $MESSAGE
read INPUT
if [[ ! -z "$INPUT" ]]; then
TOOLCHAIN_DIR=$INPUT
2024-11-09 18:16:13 +01:00
fi
echo "Installing toolchain to $TOOLCHAIN_DIR"
2024-10-14 13:48:23 +02:00
2024-09-29 11:45:17 +02:00
print_msg "Checking utilities..."
2024-10-14 13:48:23 +02:00
2024-09-29 11:45:17 +02:00
check_utils wget
check_utils 7z
2024-10-14 13:48:23 +02:00
2024-11-10 12:23:36 +01:00
print_msg "Create the toolchain folders..."
2024-10-14 13:48:23 +02:00
2024-11-10 12:23:36 +01:00
sudo mkdir -p $DEFAULT_TOOLCHAIN_DIR
2024-11-08 16:38:24 +01:00
sudo mkdir -p $TOOLCHAIN_DIR
2024-10-14 13:48:23 +02:00
2024-09-29 11:45:17 +02:00
print_ok "Successfully!"
2024-10-14 13:48:23 +02:00
2024-09-29 11:45:17 +02:00
print_msg "Download the kos32-gcc toolchain..."
2024-10-14 13:48:23 +02:00
2024-11-08 16:38:24 +01:00
sudo wget http://ftp.kolibrios.org/users/Serge/new/Toolchain/x86_64-linux-kos32-5.4.0.7z -q -O $TOOLCHAIN_DIR/kos32-toolchain.7z
2024-10-14 13:48:23 +02:00
2024-09-29 11:45:17 +02:00
print_ok "Successfully!"
2024-10-14 13:48:23 +02:00
2024-09-29 11:45:17 +02:00
print_msg "Extracting files ..."
2024-10-14 13:48:23 +02:00
2024-11-08 16:33:38 +01:00
cd $TOOLCHAIN_DIR
2024-11-08 16:38:24 +01:00
sudo 7z x -y kos32-toolchain.7z
sudo rm -rf kos32-toolchain.7z
2024-10-14 13:48:23 +02:00
2024-09-29 11:45:17 +02:00
print_ok "Successfully!"
2024-10-14 13:48:23 +02:00
2024-09-29 11:45:17 +02:00
print_msg "Downloading libraries..."
2024-10-14 13:48:23 +02:00
2024-11-08 16:33:38 +01:00
cd $TOOLCHAIN_DIR/win32/mingw32
2024-11-08 16:38:24 +01:00
sudo wget http://ftp.kolibrios.org/users/Serge/new/Toolchain/sdk-28-10-16.7z -q -O sdk-28-10-16.7z
sudo 7z x -y sdk-28-10-16.7z
sudo rm -rf sdk-28-10-16.7z
2024-10-14 13:48:23 +02:00
2024-09-29 11:45:17 +02:00
print_ok "Successfully!"
2024-10-01 18:30:30 +02:00
2024-10-14 13:48:23 +02:00
print_msg "Updating libraries"
2024-10-04 13:36:16 +02:00
cd lib
sudo wget -r --no-parent -q http://builds.kolibrios.org/en_US/data/contrib/sdk/lib
2024-11-19 10:38:37 +01:00
sudo mv builds.kolibrios.org/en_US/data/contrib/sdk/lib/* ./
sudo rm -R builds.kolibrios.org
2024-10-14 13:48:23 +02:00
2024-10-01 18:30:30 +02:00
print_ok "Successfully!"
2024-09-29 11:45:17 +02:00
2024-10-14 13:48:23 +02:00
2024-09-29 11:45:17 +02:00
print_msg "Downloading libisl..."
2024-10-14 13:48:23 +02:00
2024-09-29 11:45:17 +02:00
cd /tmp
2024-10-14 13:48:23 +02:00
sudo wget http://board.kolibrios.org/download/file.php?id=8301libisl.so.10.2.2.7z -q -O /tmp/libisl.so.10.2.2.7z
2024-09-29 11:45:17 +02:00
sudo 7z x -y libisl.so.10.2.2.7z
if ! [ -d /usr/lib/x86_64-linux-gnu/ ]; then
sudo mkdir -p /usr/lib/x86_64-linux-gnu/
2024-09-29 11:45:17 +02:00
fi
sudo mv /tmp/libisl.so.10.2.2 /usr/lib/x86_64-linux-gnu/libisl.so.10.2.2
sudo ln -sf /usr/lib/x86_64-linux-gnu/libisl.so.10.2.2 /usr/lib/x86_64-linux-gnu/libisl.so.10
sudo ln -sf /usr/lib/x86_64-linux-gnu/libisl.so.10.2.2 /usr/lib/libisl.so.10
sudo chmod go-w /usr/lib/x86_64-linux-gnu/libisl.so.10
sudo chmod go-w /usr/lib/x86_64-linux-gnu/libisl.so.10.2.2
2024-10-14 13:48:23 +02:00
2024-09-29 11:45:17 +02:00
print_ok "Successfully!"
2024-10-14 13:48:23 +02:00
2024-09-29 11:45:17 +02:00
print_msg "Fixing libmpfr..."
2024-10-14 13:48:23 +02:00
2024-09-29 11:45:17 +02:00
sudo ln -sf /usr/lib/x86_64-linux-gnu/libmpfr.so.6 /usr/lib/x86_64-linux-gnu/libmpfr.so.4
sudo ln -sf /usr/lib/libmpfr.so.6 /usr/lib/libmpfr.so.4
2024-10-14 13:48:23 +02:00
2024-09-29 11:45:17 +02:00
print_ok "Successfully!"
2024-11-08 17:55:09 +01:00
2024-11-10 11:27:09 +01:00
if [ "$TOOLCHAIN_DIR" != "$DEFAULT_TOOLCHAIN_DIR" ]; then
sudo ln -sf $TOOLCHAIN_DIR/win32 $DEFAULT_TOOLCHAIN_DIR
2024-11-10 11:27:09 +01:00
fi
MESSAGE="PATH=\$PATH:$TOOLCHAIN_DIR/win32/bin"
EXPORT_MESSSAGE="export $MESSAGE"
2024-11-09 13:38:41 +01:00
if [ ! "$(id -u)" -ne 0 ]
then
2024-11-10 11:27:09 +01:00
echo $MESSAGE >> /etc/profile
2024-11-10 12:15:06 +01:00
sudo mkdir -p /etc/kos32-gcc
echo $TOOLCHAIN_DIR > /etc/kos32-gcc/install-path
2024-11-08 18:45:07 +01:00
else
if ! grep -q $EXPORT_MESSSAGE ~/.bashrc; then
print_msg "Adding '$TOOLCHAIN_DIR/win32/bin' to '~/.bashrc'"
echo '$EXPORT_MESSSAGE' >> ~/.bashrc
fi
2024-09-29 11:45:17 +02:00
fi
2024-10-14 13:48:23 +02:00
sudo chmod 775 $TOOLCHAIN_DIR/win32/bin/*
2024-11-19 10:38:37 +01:00
sudo chmod 774 $TOOLCHAIN_DIR/win32/include/*
sudo chmod -R 775 /home/autobuild/tools/win32/lib/gcc
2024-11-19 10:38:37 +01:00
sudo chmod 774 $TOOLCHAIN_DIR/win32/lib/*
2024-11-08 16:33:38 +01:00
cd "$OLDPWD"
2024-11-11 10:00:19 +01:00
export PATH=$PATH:$TOOLCHAIN_DIR/win32/bin
2024-09-29 11:45:17 +02:00
print_ok "Installation was successful!"