-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdotfiles_install_tools_react_native.sh
More file actions
179 lines (168 loc) · 4.96 KB
/
Copy pathdotfiles_install_tools_react_native.sh
File metadata and controls
179 lines (168 loc) · 4.96 KB
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# Script to setp up React Native environment
# Copyright (C) 2018, 2020 Upperstream Software.
# Provided under the ISC License. See LICENSE.txt file for details.
# $(...) notation to invoke a subshell is not universal
# shellcheck disable=SC2006
react_native_describe_module() {
cat <<-EOF
react_native:
install React Native development tools
EOF
}
install_exp() {
case "$os" in
OpenBSD)
echo "$0: Warning: Installing exp on OpenBSD is not supported." 1>&2
;;
*)
$acquire_root_privilege npm install -g exp
;;
esac
}
install_watchman_prerequisites() {
case "$os" in
Linux)
case "$distribution" in
Arch)
install m4 autoconf automake pkg-config clang
;;
CentOS)
install m4 libtool autoconf pkgconfig gcc-c++ && \
install openssl-devel
;;
Debian|Devuan|Ubuntu)
install m4 libtool autoconf pkg-config && \
install libssl-dev
;;
esac
;;
OpenBSD)
install_package autoconf-2.69p2 automake-1.15.1 m4 gmake bash libtool
;;
esac
}
autogen_watchman() {
case "$os" in
Linux)
./autogen.sh
;;
OpenBSD)
AUTOCONF_VERSION=2.69 AUTOMAKE_VERSION=1.15 M4=gm4 bash ./autogen.sh
;;
esac
}
install_watchman() {
install_watchman_prerequisites && \
case "$os" in
Darwin|FreeBSD|NetBSD)
install watchman
;;
Linux)
if [ ! -d /tmp/watchman-4.9.0 ]; then
tar -zxf `download_distfile watchman-4.9.0.tar.gz https://github.com/facebook/watchman/archive/v4.9.0.tar.gz` -C /tmp
fi && \
(cd /tmp/watchman-* && \
autogen_watchman && \
./configure --without-python --without-pcre && \
make && $sudo make install) && \
rm -rf /tmp/watchman-*
;;
OpenBSD)
echo "$0: Warning: Installing Watchman on OpenBSD is not supported." 1>&2; return 0
if [ ! -d /tmp/watchman-4.9.0 ]; then
tar -zxf `download_distfile watchman-4.9.0.tar.gz https://github.com/facebook/watchman/archive/v4.9.0.tar.gz` -C /tmp
fi && \
(cd /tmp/watchman-* && \
autogen_watchman && \
CC=cc CXX=c++ ./configure --without-python --without-pcre && \
gmake && $sudo gmake install) && \
rm -rf /tmp/watchman-*
;;
esac
}
install_xde_prerequisites() {
case "$os" in
Linux)
case "$distribution" in
CentOS)
install_package --enablerepo=epel fuse-sshfs && \
{ grep fuse /etc/group > /dev/null || $sudo groupadd fuse; } && \
$sudo usermod -a -G fuse `whoami` && \
install gtk2 xdg-utils zenity
;;
Debian|Devuan|Ubuntu)
install fuse && \
$sudo modprobe fuse && \
{ grep fuse /etc/group > /dev/null || $sudo groupadd fuse; } && \
$sudo usermod -a -G fuse `whoami` && \
install libgtk2.0 libnspr4 desktop-file-utils xdg-utils zenity
;;
esac
;;
OpenBSD)
echo "$0: Warning: watchman does not support $os." 1>&2
return 0
if [ ! -d /tmp/watchman-4.9.0 ]; then
tar -zxvf `download_distfile watchman-4.9.0.tar.gz https://github.com/facebook/watchman/archive/v4.9.0.tar.gz` -C /tmp
fi && \
(cd /tmp/watchman-4.9.0 && \
if [ ! -f .dotfiles.patched ]; then
patch -p1 <<-EOF
diff -u watchman-4.9.0_orig/log.cpp watchman-4.9.0/log.cpp
--- watchman-4.9.0_orig/log.cpp Sun Jan 7 20:08:18 2018
+++ watchman-4.9.0/log.cpp Sun Jan 7 20:03:51 2018
@@ -17,7 +17,9 @@
#else
static thread_local std::string thread_name_str;
#endif
+#if (defined(HAVE_BACKTRACE) && defined(HAVE_BACKTRACE_SYMBOLS)) || defined(_WIN32)
static constexpr size_t kMaxFrames = 64;
+#endif
namespace {
template <typename String>
EOF
test $? -eq 0 && touch .dotfiles.patched
fi && \
autogen_watchman && \
CC=cc CXX=c++ CPPFLAGS='-Dva_list=__va_list' ./configure --without-python --without-pcre && \
AUTOCONF_VERSION=2.69 AUTOMAKE_VERSION=1.15 gmake && $sudo gmake install) && \
rm -rf /tmp/watchman-*
esac
}
install_xde() {
install_xde_prerequisites && \
case "$os" in
Darwin)
install_package -c expo-xde
;;
Linux)
if [ ! -f `echo /tmp/xde-*.AppImage | cut -f1 -d' '` ]; then
download https://github.com/expo/xde/releases/download/v2.22.1/xde-2.22.1-x86_64.AppImage > $HOME/.local/bin/xde-2.22.1-x86_64.AppImage && \
chmod +x $HOME/.local/bin/xde-*.AppImage
fi
;;
*)
echo "$0: Warning: XDE does not support $os." 1>&2
;;
esac
}
install_tools_react_native() {
if ! has node; then
. $dotfiles_dir/dotfiles_install_tools_nodejs.sh && install_tools_nodejs || report_error
fi
cat <<-EOF
-----------------------------------------
Installing tools for React Native
-----------------------------------------
EOF
acquire_root_privilege=""
has create-react-native-app || \
$acquire_root_privilege npm install -g create-react-native-app || report_error
has react-native || $acquire_root_privilege npm install -g react-native-cli || report_error
has exp || install_exp || report_error
has watchman || install_watchman || report_error
if [ $with_x11 -eq 1 ]; then
test -f `echo $HOME/.local/bin/xde-*-x86_64.AppImage | cut -f1 -d' '` || \
install_xde || report_error
fi
}