generated from mod-cpp/pacman
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathubuntu.sh
127 lines (107 loc) · 4.06 KB
/
ubuntu.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/bin/bash
set -e
# sudo apt install curl
# DEBIAN_FRONTEND=noninteractive bash <(curl -s https://raw.githubusercontent.com/mod-cpp/ms-pacman/main/dev/ubuntu.sh)
# 0) List WSLs wsl -l (In Terminal)
# 1) Remove old wsl --unregister Ubuntu-20.04 (OPTIONAL)
# 2) Install wsl --install --distribution Ubuntu-20.04 (Close window)
# 3) Run wsl -d Ubuntu-20.04 (In Terminal)
# 4) Script ./ubuntu.sh (Ctrl+D)
# 5) Terminate wsl -t Ubuntu-20.04 (In Terminal)
# 6) Run wsl -d Ubuntu-20.04 (In Terminal)
# 7) Run CMake
# 8) Build clean
info() {
echo -e "\x1B[36m\nMod(C++) Intermediate : $1\x1B[0m"
}
instruction() {
echo -e "\x1B[33m$1\x1B[0m"
}
confirm() {
# call with a prompt string or use a default
read -r -p "${1:-Are you sure? [y/N]} " response
case "$response" in
[yY][eE][sS]|[yY])
true
;;
*)
false
;;
esac
}
installVSCode() {
# install VSCode according to https://code.visualstudio.com/docs/setup/linux
sudo apt-get install -y wget gpg
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
rm -f packages.microsoft.gpg
sudo apt install -y apt-transport-https
sudo apt update
sudo apt install -y code
}
if grep -qi microsoft /proc/version; then
info "[WSL] Windows Subsystem for Linux detected"
RUNNING_ON_WSL=1
else
info "[Native-Ubuntu] Windows Subsystem for Linux NOT detected"
RUNNING_ON_WSL=0
fi
info "Update Ubuntu"
sudo apt update -y
sudo apt upgrade -y
if test $RUNNING_ON_WSL -eq 1
then
info "[WSL] Make wsl.conf file"
sudo echo -e "[automount]\noptions = \"metadata\"\nenabled = true\n" | sudo tee /etc/wsl.conf >/dev/null
fi
if test $RUNNING_ON_WSL -eq 0
then
confirm "[Native-Ubuntu] Install VSCode from Microsoft? [y/N]" && installVSCode
fi
info "Install MsPacMan dependencies"
# MsPacMan deps
sudo apt install -y \
build-essential \
cmake \
g++-10 \
git \
libgl1-mesa-dev \
libudev-dev \
libx11-dev \
libxcursor-dev \
libxi-dev \
libxrandr-dev \
ninja-build \
pkg-config \
tar \
unzip \
zip
sudo apt install -y autoconf libtool
sudo apt install -y mesa-common-dev libglu1-mesa-dev libfreetype6-dev libopenal-dev libsndfile1-dev
info "Install GDB for debugging"
sudo apt install -y gdb
info "Install CMake from Kitware"
# Install up-to-date CMake (https://apt.kitware.com/)
CODE_NAME=`lsb_release -cs`
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ ${CODE_NAME} main" | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null
sudo apt-get update
sudo apt-get install -y kitware-archive-keyring
sudo apt-get install -y cmake
info "Install Clang if it is possible"
# Install Clang last since it isn't strictly needed
sudo apt install -y clang
sudo apt install -y clang-12
info "MsPacMan development environment install done"
info "Next steps:"
instruction "git clone https://github.com/mod-cpp/ms-pacman.git"
instruction "cd ms-pacman/"
instruction "code ."
info "In VSCode install the recommended plugins"
info "Troubleshoot: If you don't get a prompt to install recommended plugins search for '@recommended' in the plugin panel and install them"
info "In the left panel click on the CMake icon"
info "Edit the configure target and select 'linux-gcc'"
info "Wait while the build is being configured"
info "Run MsPacMan by clicking the play button at the bottom"
info "For the tests use the test panel and run 'Reload tests' and 'Run all tests' the first time"