-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathconfigure
executable file
·127 lines (104 loc) · 5.14 KB
/
configure
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
source $HOME/.profile
source build-config
distro=`lsb_release -is`
mkdir -p /tmp/etopa-configure
bold=$(TERM=xterm-256color tput bold)
italic=$(TERM=xterm-256color tput sitm)
underline=$(TERM=xterm-256color tput smul)
normal=$(TERM=xterm-256color tput sgr0)
if [ $distro == "Fedora" ] || [ $distro == "CentOS" ]; then
sudo dnf -y groupinstall "Development Tools"
sudo dnf -y install python java-latest-openjdk-devel musl-gcc curl git openssl-devel pkg-config unzip clang
# # removed: gcc-arm-linux-gnu perl-FindBin perl-File-Compare
# installed=`sudo dnf list installed`
# if ! grep -q "aarch64-linux-gnu-gcc" <<< "$installed"; then
# sudo dnf -y install gcc-aarch64-linux-gnu
# fi
elif [ $distro == "Debian" ] || [ $distro == "Ubuntu" ]; then
sudo apt update
sudo apt -y install build-essential default-jdk musl-tools curl git libssl-dev pkg-config unzip clang
# removed: gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf libfindbin-libs-perl
else
echo "${underline}Unsupported distribution, assuming packages already installed:${normal}"
echo "${bold}Fedora:${normal}"
echo " ${italic}sudo dnf groupinstall \"Development Tools\""
echo " sudo dnf install python java-latest-openjdk-devel gcc-aarch64-linux-gnu gcc-arm-linux-gnu musl-gcc curl git openssl-devel pkg-config unzip perl-FindBin perl-File-Compare clang${normal}"
echo "${bold}Debian:${normal}"
echo -e " ${italic}sudo apt install build-essential default-jdk gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf musl-tools curl git libssl-dev pkg-config unzip libfindbin-libs-perl clang{normal}\n"
fi
if ! command -v rustup &> /dev/null; then
curl --proto '=https' --tlsv1.2 -sSf -o /tmp/etopa-configure/rustup.sh https://sh.rustup.rs
chmod +x /tmp/etopa-configure/rustup.sh
/tmp/etopa-configure/rustup.sh -y
rm /tmp/etopa-configure/rustup.sh
fi
if [ -z "$ANDROID_HOME" ]; then
echo -e '\nexport ANDROID_HOME="$HOME/.android/sdk"' >> $HOME/.profile
fi
if [ -z "$ANDROID_SDK_ROOT" ]; then
echo -e '\nexport ANDROID_SDK_ROOT="$ANDROID_HOME"' >> $HOME/.profile
fi
if [ -z "$ANDROID_NDK_ROOT" ]; then
echo -e '\nexport ANDROID_NDK_ROOT="$ANDROID_HOME/ndk"' >> $HOME/.profile
fi
source $HOME/.profile
rustup update
targets=`rustup target list`
if ! [[ $targets == *"x86_64-unknown-linux-musl (installed)"* ]]; then
rustup target add x86_64-unknown-linux-musl
fi
if ! [[ $targets == *"aarch64-linux-android (installed)"* ]]; then
rustup target add aarch64-linux-android
fi
if ! [[ $targets == *"armv7-linux-androideabi (installed)"* ]]; then
rustup target add armv7-linux-androideabi
fi
if ! [[ $targets == *"x86_64-linux-android (installed)"* ]]; then
rustup target add x86_64-linux-android
fi
if ! [[ $targets == *"i686-linux-android (installed)"* ]]; then
rustup target add i686-linux-android
fi
if ! [[ $targets == *"wasm32-unknown-unknown (installed)"* ]]; then
rustup target add wasm32-unknown-unknown
fi
cargo install cargo-license cargo-edit
cargo install wasm-pack
if ! [ $? -eq 0 ]; then
rm $HOME/.cargo/bin/wasm-pack
cargo install wasm-pack
fi
if ! [ -f "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" ]; then
mkdir -p $ANDROID_HOME/cmdline-tools
curl -o /tmp/etopa-configure/android-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip
unzip /tmp/etopa-configure/android-tools.zip -d /tmp/etopa-configure
mv /tmp/etopa-configure/cmdline-tools $ANDROID_HOME/cmdline-tools/latest
rm /tmp/etopa-configure/android-tools.zip
fi
SDK_MANAGER=$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager
if [[ ! -z "${ANDROID_SDK_MANAGER}" ]] && [[ "${ANDROID_SDK_MANAGER}" == */sdkmanager ]]; then
SDK_MANAGER="${ANDROID_SDK_MANAGER}"
fi
yes | $SDK_MANAGER --licenses
yes | $SDK_MANAGER "build-tools;${BUILDTOOLS_VERSION}" "platforms;android-${ANDROID_PLATFORM}" "ndk;${NDK_VERSION}"
if ! [ -f "$ANDROID_HOME/debug.keystore" ]; then
keytool -genkey -v -keystore $ANDROID_HOME/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Android Debug,O=Android,C=US"
else
echo android | keytool -list -keystore $ANDROID_HOME/debug.keystore > /dev/null 2>&1
if ! [ $? -eq 0 ]; then
keytool -genkey -v -keystore $ANDROID_HOME/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Android Debug,O=Android,C=US"
fi
fi
if ! [ -f "$ANDROID_HOME/bundletool-${BUNDLETOOL_VERSION}.jar" ]; then
curl -L -o $ANDROID_HOME/bundletool-${BUNDLETOOL_VERSION}.jar https://github.com/google/bundletool/releases/download/${BUNDLETOOL_VERSION}/bundletool-all-${BUNDLETOOL_VERSION}.jar
fi
if ! [ -f "/usr/local/bin/minify-${MINIFY_VERSION}" ]; then
(cd /tmp/etopa-configure/ && curl -L https://github.com/tdewolff/minify/releases/download/${MINIFY_VERSION}/minify_linux_amd64.tar.gz | tar -xz minify && sudo mv minify /usr/local/bin/minify-${MINIFY_VERSION})
sudo chmod +x /usr/local/bin/minify-${MINIFY_VERSION}
fi
rm -rf /tmp/etopa-configure
echo -e "Successfully configured\n"
echo "${bold}${underline}Please execute the following command to complete the configuration:"
echo "${normal}${bold}source $HOME/.profile${normal}"