Skip to content

Commit 1ab747a

Browse files
committed
deps.sh: skip internal deps install if using non-APT distro
1 parent c01b0b7 commit 1ab747a

File tree

2 files changed

+31
-27
lines changed

2 files changed

+31
-27
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ The versions of those dependencies should suffice out-of-the-box for at least th
8080

8181
There is a script called `scripts/deps.sh` which you can use to check if you have those dependencies installed (`deps.sh --check`), and install them in case you don't (`deps.sh --install`). The script expects dependencies to be installed either on `/usr` or `/usr/local`, giving preference to the latter if it finds anything there (so you can use a higher version of a dependency while still keeping your distro's default one).
8282

83-
**Please note that installing dependencies through the script only works on APT-based distros** (Debian, Ubuntu and derivatives) - you can still check the dependencies on any distro, but installing them requires APT. For distros with other package managers and/or distros older than the minimum ones listed above, you're on your own.
83+
**Please note that installing most dependencies through the script only works on APT-based distros** (Debian, Ubuntu and derivatives) - you can still check the dependencies on any distro and install the few ones labeled as "external" (those are fetched through `git`), but if you're on a distro with another package manager and/or a distro older than one of the minimum ones listed above, you're on your own.
8484

8585
### GCC-specific tips
8686

scripts/deps.sh

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -139,32 +139,36 @@ elif [ "${1:-}" == "--install" ]; then
139139
exit
140140
fi
141141

142-
# Install binaries and internal libs
143-
# TODO: this works on APT distros only for now
144-
echo "-- Checking internal dependencies..."
145-
PKGS=""
146-
if [ -z "$HAS_GIT" ]; then PKGS+="git "; fi
147-
if [ -z "$HAS_GCC" ] || [ -z "$HAS_GPP" ] || [ -z "$HAS_MAKE" ] || [ -z "$HAS_LD" ]; then PGKS+="build-essential "; fi
148-
if [ -z "$HAS_CMAKE" ]; then PKGS+="cmake "; fi
149-
if [ -z "$HAS_TMUX" ]; then PKGS+="tmux "; fi
150-
if [ -z "$HAS_PROTOC" ]; then PKGS+="protobuf-compiler "; fi
151-
if [ -z "$HAS_GRPC" ]; then PKGS+="protobuf-compiler-grpc "; fi
152-
if [ -z "$HAS_NINJA" ]; then PKGS+="ninja-build "; fi
153-
if [ -z "$HAS_MOLD" ]; then PKGS+="mold "; fi
154-
if [ -z "$HAS_DOXYGEN" ]; then PKGS+="doxygen "; fi
155-
if [ -z "$HAS_CLANGTIDY" ]; then PKGS+="clang-tidy "; fi
156-
if [ -z "$HAS_BOOST" ]; then PKGS+="libboost-all-dev "; fi
157-
if [ -z "$HAS_LIBSSL" ]; then PKGS+="libssl-dev "; fi
158-
if [ -z "$HAS_ZSTD" ]; then PKGS+="libzstd-dev "; fi
159-
if [ -z "$HAS_LIBCRYPTOPP" ]; then PKGS+="libcrypto++-dev "; fi
160-
if [ -z "$HAS_LIBSCRYPT" ]; then PKGS+="libscrypt-dev "; fi
161-
if [ -z "$HAS_LIBCARES" ]; then PKGS+="libc-ares-dev "; fi
162-
if [ -z "$HAS_LIBGRPC" ]; then PKGS+="libgrpc-dev "; fi
163-
if [ -z "$HAS_LIBGRPCPP" ]; then PKGS+="libgrpc++-dev "; fi
164-
if [ -z "$HAS_SECP256K1" ]; then PKGS+="libsecp256k1-dev "; fi
165-
if [ -n "$PKGS" ]; then
166-
echo "-- Installing internal dependencies..."
167-
apt-get install -y $PKGS
142+
# Install binaries and internal libs (skip if not on an APT-based distro)
143+
HAS_APT=$(check_exec apt)
144+
if [ -n "$HAS_APT" ]; then
145+
echo "-- Checking internal dependencies..."
146+
PKGS=""
147+
if [ -z "$HAS_GIT" ]; then PKGS+="git "; fi
148+
if [ -z "$HAS_GCC" ] || [ -z "$HAS_GPP" ] || [ -z "$HAS_MAKE" ] || [ -z "$HAS_LD" ]; then PGKS+="build-essential "; fi
149+
if [ -z "$HAS_CMAKE" ]; then PKGS+="cmake "; fi
150+
if [ -z "$HAS_TMUX" ]; then PKGS+="tmux "; fi
151+
if [ -z "$HAS_PROTOC" ]; then PKGS+="protobuf-compiler "; fi
152+
if [ -z "$HAS_GRPC" ]; then PKGS+="protobuf-compiler-grpc "; fi
153+
if [ -z "$HAS_NINJA" ]; then PKGS+="ninja-build "; fi
154+
if [ -z "$HAS_MOLD" ]; then PKGS+="mold "; fi
155+
if [ -z "$HAS_DOXYGEN" ]; then PKGS+="doxygen "; fi
156+
if [ -z "$HAS_CLANGTIDY" ]; then PKGS+="clang-tidy "; fi
157+
if [ -z "$HAS_BOOST" ]; then PKGS+="libboost-all-dev "; fi
158+
if [ -z "$HAS_LIBSSL" ]; then PKGS+="libssl-dev "; fi
159+
if [ -z "$HAS_ZSTD" ]; then PKGS+="libzstd-dev "; fi
160+
if [ -z "$HAS_LIBCRYPTOPP" ]; then PKGS+="libcrypto++-dev "; fi
161+
if [ -z "$HAS_LIBSCRYPT" ]; then PKGS+="libscrypt-dev "; fi
162+
if [ -z "$HAS_LIBCARES" ]; then PKGS+="libc-ares-dev "; fi
163+
if [ -z "$HAS_LIBGRPC" ]; then PKGS+="libgrpc-dev "; fi
164+
if [ -z "$HAS_LIBGRPCPP" ]; then PKGS+="libgrpc++-dev "; fi
165+
if [ -z "$HAS_SECP256K1" ]; then PKGS+="libsecp256k1-dev "; fi
166+
if [ -n "$PKGS" ]; then
167+
echo "-- Installing internal dependencies..."
168+
apt-get install -y $PKGS
169+
fi
170+
else
171+
echo "-- Skipping internal dependencies (non-APT-based distro, please install those manually)"
168172
fi
169173

170174
# Install external libs

0 commit comments

Comments
 (0)