Debian Codegraph @

setup.sh

raw symbols SCIP
1 #!/bin/bash
2 #
3 # Copyright(C) 2023-2026 Sutou Kouhei <[email protected]>
4 #
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
9 #
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
19 set -eux
20
21 if type sudo > /dev/null 2>&1; then
22 SUDO=sudo
23 else
24 SUDO=
25 fi
26
27 function setup_with_apt () {
28 if [ -f /etc/debian_version ]; then
29 ${SUDO} apt update
30 ${SUDO} apt install -y -V lsb-release wget
31
32 wget https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
33 ${SUDO} apt install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
34 rm apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
35 ${SUDO} apt update
36 fi
37
38 if type lsb_release > /dev/null 2>&1; then
39 distribution=$(lsb_release --id --short | tr 'A-Z' 'a-z')
40 code_name=$(lsb_release --codename --short)
41 else
42 distribution=unknown
43 code_name=unknown
44 fi
45
46 package_names=()
47 case "${distribution}-${code_name}" in
48 debian-*|ubuntu-*)
49 package_names+=(
50 ccache
51 cmake
52 doxygen
53 g++
54 gcc
55 gettext
56 git
57 graphviz
58 libarrow-compute-dev
59 libarrow-dev
60 libedit-dev
61 liblz4-dev
62 libmecab-dev
63 libmsgpack-dev
64 libsimdjson-dev
65 libstemmer-dev
66 libxxhash-dev
67 libzstd-dev
68 ninja-build
69 pkg-config
70 python3-pip
71 rapidjson-dev
72 zlib1g-dev
73 )
74 if [ "${distribution}-${code_name}" != "ubuntu-jammy" ]; then
75 package_names+=(
76 doxygen-awesome-css
77 )
78 fi
79 if [ "${distribution}-${code_name}" != "ubuntu-noble" ]; then
80 package_names+=(
81 libfaiss-dev
82 )
83 fi
84 case "${distribution}-${code_name}" in
85 ubuntu-jammy|ubuntu-noble)
86 :
87 ;;
88 *)
89 package_names+=(
90 libjsoncons-dev
91 )
92 ;;
93 esac
94 ;;
95 esac
96
97 case "${distribution}-${code_name}" in
98 debian-*|ubuntu-*)
99 ${SUDO} apt install -y -V "${package_names[@]}"
100 ;;
101 esac
102 }
103
104 function setup_with_dnf () {
105 os=$(cut -d: -f4 /etc/system-release-cpe)
106 case ${os} in
107 amazon)
108 os=amazon-linux
109 version=$(cut -d: -f6 /etc/system-release-cpe)
110 ;;
111 *) # For AlmaLinux
112 version=$(cut -d: -f5 /etc/system-release-cpe | sed -e 's/\.[0-9]$//')
113 ;;
114 esac
115
116 package_names=(
117 arrow-compute-devel
118 cmake
119 intltool
120 libedit-devel
121 libevent-devel
122 libstemmer-devel
123 libzstd-devel
124 lz4-devel
125 ninja-build
126 openssl-devel
127 pkgconfig
128 ruby
129 tar
130 wget
131 xxhash-devel
132 zlib-devel
133 )
134 case "${os}" in
135 almalinux)
136 ${SUDO} dnf install -y epel-release "dnf-command(config-manager)"
137 case "${version}" in
138 8)
139 ${SUDO} dnf config-manager --set-enabled powertools
140 ;;
141 *)
142 ${SUDO} dnf config-manager --set-enabled crb
143 package_names+=(
144 blas-devel
145 lapack-devel
146 )
147 ;;
148 esac
149
150 package_names+=(
151 ccache
152 doxygen
153 graphviz
154 mecab-devel
155 msgpack-devel
156 simdjson-devel
157 )
158 ;;
159 amazon-linux)
160 ;;
161 *)
162 echo "This OS setup is not supported."
163 exit 1
164 ;;
165 esac
166
167 ${SUDO} dnf update -y
168 ${SUDO} dnf install -y \
169 https://apache.jfrog.io/artifactory/arrow/${os}/${version}/apache-arrow-release-latest.rpm
170 ${SUDO} dnf groupinstall -y "Development Tools"
171 ${SUDO} dnf install -y "${package_names[@]}"
172 }
173
174 if [ -f /etc/debian_version ]; then
175 setup_with_apt
176 elif type dnf > /dev/null 2>&1; then
177 setup_with_dnf
178 elif type brew > /dev/null 2>&1; then
179 brew bundle --file="$(dirname "${0}")/Brewfile"
180 mecabrc="$(brew --prefix)/etc/mecabrc"
181 if [ ! -f "${mecabrc}" ]; then
182 echo "dicdir = $(brew --prefix)/lib/mecab/dic/ipadic" > "${mecabrc}"
183 fi
184 else
185 echo "This OS setup is not supported."
186 exit 1
187 fi