summaryrefslogtreecommitdiff
path: root/system/build/dpkg/floss/install-dependencies
blob: f8539777f04a678b75b3306b263abe937eeadd7c (plain)
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
#!/bin/bash

DRY_RUN=""
if [ $# -gt 0 ]; then
    if [ "$1" == "--dry-run" ]; then
        DRY_RUN="echo "
    fi
fi

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PARENT_DIR="$(echo ${SCRIPT_DIR} | rev | cut -d '/' -f 2- | rev )"

TMP_DIR=$(mktemp -d)
OUT_DIR="${TMP_DIR}/out"

trap ctrl_c INT

function ctrl_c() {
    echo -n "Cleaning up..."
    rm -rf "${TMP_DIR}"
    echo "Done."
    exit 1
}

# APT dependencies
APT_REQUIRED="git curl wget flatbuffers-compiler flex g++-multilib gcc-multilib generate-ninja \
gnupg gperf libc++-dev libdbus-1-dev libevent-dev libflatbuffers-dev libflatbuffers1 \
libgl1-mesa-dev libglib2.0-dev liblz4-tool libncurses5 libnss3-dev libprotobuf-dev libre2-9 \
libssl-dev libtinyxml2-dev libx11-dev libxml2-utils ninja-build openssl protobuf-compiler unzip \
x11proto-core-dev xsltproc zip zlib1g-dev libc++abi-dev cmake debmake ninja-build libgtest-dev \
libgmock-dev"

${DRY_RUN} sudo apt install ${APT_REQUIRED}

# Install rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
${DRY_RUN} rustup update

${DRY_RUN} cargo install cxxbridge-cmd || ctrl_c
${DRY_RUN} cargo install cargo-proc-macro || ctrl_c

echo "Building and installing modp-b64..."
# dir name is different than package name :'(
${DRY_RUN} pushd "${PARENT_DIR}/modp_b64/"
${DRY_RUN} ./gen-src-pkg.sh "${OUT_DIR}" || crtl_c
${DRY_RUN} sudo dpkg -i "${OUT_DIR}"/modp-b64*.deb || ctrl_c
${DRY_RUN} popd

echo "Building and installing libchrome..."
${DRY_RUN} pushd "${PARENT_DIR}/libchrome/"
${DRY_RUN} ./gen-src-pkg.sh "${OUT_DIR}" || crtl_c
${DRY_RUN} sudo dpkg -i "${OUT_DIR}"/libchrome*.deb || ctrl_c
${DRY_RUN} popd

HAS_EXPORT="$(cat \$HOME/.bashrc|grep '.cargo/bin')"
if [ "${HAS_EXPORT}" == "" ]; then
    ${DRY_RUN} echo "export PATH=\$PATH:\$HOME/.cargo/bin" >> ~/.bashrc
fi

HAS_EXPORT="$(cat \$HOME/.bashrc|grep '$HOME/bin')"
if [ "${HAS_EXPORT}" == "" ]; then
    ${DRY_RUN} echo "export PATH=\$PATH:\$HOME/bin" >> ~/.bashrc
fi

# Put the GN binary in the bin...it isn't the right spot, but avoids adding a second directory
# to the environmental PATH
${DRY_RUN} mkdir -p ~/bin
${DRY_RUN} wget -O ~/bin/gn wget http://commondatastorage.googleapis.com/chromeos-localmirror/distfiles/gn-3e43fac03281e2f5e5ae5f27c8e9a6bb45966ea9.bin
${DRY_RUN} chmod +x ~/bin/gn

rm -rf "${TMP_DIR}"
echo "DONE"