forked from ubports/docs.ubports.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·30 lines (28 loc) · 899 Bytes
/
build.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
#!/bin/bash
# color codes
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
PLAIN='\033[0m'
# check if virtualenv already exists
if [ -d "$HOME/ubportsdocsenv" ]; then
echo -e "${GREEN}Build environment found.${PLAIN}"
. ~/ubportsdocsenv/bin/activate
else
echo -e "${RED}No build environment found.${PLAIN}"
echo -e "${YELLOW}Installing pip and virtualenv.${PLAIN}"
sudo apt install python-pip
sudo -H pip install virtualenv
echo -e "${YELLOW}Creating a virtual environment in ${HOME}/ubportsdocsenv.${PLAIN}"
virtualenv ~/ubportsdocsenv
. ~/ubportsdocsenv/bin/activate
echo -e "${YELLOW}Installing build tools and prerequisites.${PLAIN}"
pip install -r requirements.txt
fi
echo -e "${GREEN}Building...${PLAIN}"
if [ "$(uname)" == "Linux" ]; then
sphinx-build -Wa . _build/html -j `nproc --all`
else
sphinx-build -Wa . _build/html -j `sysctl -n hw.ncpu`
fi
exit $?