2
2
set -euo pipefail
3
3
IFS=$' \n\t '
4
4
5
- # set git hooks
6
- ln -s -f ../../githooks/pre-commit .git/hooks/pre-commit
7
- # set blame ignore file
8
- git config blame.ignorerevsfile .git-blame-ignore-revs
9
-
10
5
# Get number of CPU cores
11
6
CPUS=$( getconf _NPROCESSORS_ONLN 2> /dev/null || getconf NPROCESSORS_ONLN 2> /dev/null || echo 1)
12
7
@@ -17,11 +12,12 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then # Linux
17
12
# sudo is present on the system, so use it
18
13
SUDO=' sudo'
19
14
fi
20
- $SUDO apt-get update --yes
15
+ echo " Installing apt packages "
21
16
$SUDO apt-get install --yes cmake graphviz llvm clang pkg-config m4 unzip \
22
- wget curl python3-distutils python3- dev
17
+ wget curl python3-dev
23
18
# Install Doxygen
24
19
# the newest version in Ubuntu 20.04 repository is 1.8.17, but we need Doxygen 1.9 series
20
+ echo " Installing doxygen"
25
21
wget -c -q https://www.doxygen.nl/files/doxygen-1.9.7.linux.bin.tar.gz
26
22
tar xf doxygen-1.9.7.linux.bin.tar.gz
27
23
cd doxygen-1.9.7 && $SUDO make install && cd -
36
32
exit 1
37
33
fi
38
34
# Install rust compiler
35
+ echo " Installing rust compiler"
39
36
curl --proto ' =https' --tlsv1.2 https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.76
40
37
cargo install cbindgen
41
38
# Setup Poetry
39
+ echo " Installing poetry"
42
40
curl -sSL https://install.python-poetry.org | python3 - --version " 1.7.1"
43
41
if [[ " $OSTYPE " == " msys" * ]]; then # Windows
44
42
POETRY_BIN=" $APPDATA /Python/Scripts/poetry"
45
43
else
46
44
POETRY_BIN=` echo ~ /.local/bin/poetry` # expand tilde
47
45
fi
48
46
$POETRY_BIN self add ' poetry-dynamic-versioning[plugin]'
49
- $POETRY_BIN run pip install autopep8
50
47
echo " Done installing dependencies"
51
48
52
- echo " Downloading uncrustify source code"
53
- wget -c -q https://github.com/uncrustify/uncrustify/archive/refs/tags/uncrustify-0.78.1.tar.gz
54
- mkdir -p uncrustify-source
55
- tar -xzf uncrustify-0.78.1.tar.gz -C uncrustify-source --strip-components=1 # strip the root folder
56
- echo " Done downloading uncrustify source code"
57
-
58
- echo " Building uncrustify"
59
- cd uncrustify-source
60
- mkdir -p build
61
- cd build
62
- if [[ " $OSTYPE " == " msys" * ]]; then # Windows
63
- cmake ../
64
- cmake --build . -j$CPUS --config Release
65
- cp Release/uncrustify.exe ../../uncrustify.exe
66
- else
67
- cmake ../
68
- make -j$CPUS
69
- cp uncrustify ../../uncrustify
70
- fi
71
- cd ../..
72
- echo " Done building uncrustify"
73
-
74
49
echo " Downloading spidermonkey source code"
75
50
# Read the commit hash for mozilla-central from the `mozcentral.version` file
76
51
MOZCENTRAL_VERSION=$( cat mozcentral.version)
@@ -118,3 +93,35 @@ if [[ "$OSTYPE" == "darwin"* ]]; then # macOS
118
93
install_name_tool -id @rpath/$( basename ./libmozjs* ) ./libmozjs* # making it work for whatever name the libmozjs dylib is called
119
94
fi
120
95
echo " Done installing spidermonkey"
96
+
97
+ # if this is being ran in the root directory of the PythonMonkey repo, then include dev configurations
98
+ if test -f .git/hooks/pre-commit; then
99
+ # set git hooks
100
+ ln -s -f ../../githooks/pre-commit .git/hooks/pre-commit
101
+ # set blame ignore file
102
+ git config blame.ignorerevsfile .git-blame-ignore-revs
103
+ # install autopep8
104
+ $POETRY_BIN run pip install autopep8
105
+ # install uncrustify
106
+ echo " Downloading uncrustify source code"
107
+ wget -c -q https://github.com/uncrustify/uncrustify/archive/refs/tags/uncrustify-0.78.1.tar.gz
108
+ mkdir -p uncrustify-source
109
+ tar -xzf uncrustify-0.78.1.tar.gz -C uncrustify-source --strip-components=1 # strip the root folder
110
+ echo " Done downloading uncrustify source code"
111
+
112
+ echo " Building uncrustify"
113
+ cd uncrustify-source
114
+ mkdir -p build
115
+ cd build
116
+ if [[ " $OSTYPE " == " msys" * ]]; then # Windows
117
+ cmake ../
118
+ cmake --build . -j$CPUS --config Release
119
+ cp Release/uncrustify.exe ../../uncrustify.exe
120
+ else
121
+ cmake ../
122
+ make -j$CPUS
123
+ cp uncrustify ../../uncrustify
124
+ fi
125
+ cd ../..
126
+ echo " Done building uncrustify"
127
+ fi
0 commit comments