Skip to content

Commit

Permalink
Use wget to download pre-built libzmq from github
Browse files Browse the repository at this point in the history
  • Loading branch information
pabera committed Dec 5, 2023
1 parent a32b771 commit 78eb0c4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
2 changes: 1 addition & 1 deletion documentation/developers/known-issues.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Known Issues

## Installing limzmq in Docker fails
## Installing `libzmq` in Docker fails

To speed up the Docker build process, we are distributing pre-build versions of libzmq with drafts flag at the latest version. In case the download fails because the respective architecture build does not exist, you can build the version yourself.

Expand Down
15 changes: 15 additions & 0 deletions installation/includes/02_helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@ run_with_log_frame() {
echo "#########################################################"
}

get_architecture() {
ARCH=""
if [ "$(uname -m)" = "armv7l" ]; then
ARCH="armv7"
elif [ "$(uname -m)" = "armv6l" ]; then
ARCH="armv6"
elif [ "$(uname -m)" = "aarch64" ]; then
ARCH="arm64"
else
ARCH="$(uname -m)"
fi

echo $ARCH
}

_download_file_from_google_drive() {
GD_SHARING_ID=${1}
TAR_FILENAME=${2}
Expand Down
18 changes: 9 additions & 9 deletions installation/routines/setup_jukebox_core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ GD_ID_COMPILED_PYZMQ_ARMV7=""

ZMQ_TMP_DIR="libzmq"
ZMQ_PREFIX="/usr/local"
ZMQ_VERSION="4.3.5"

JUKEBOX_PULSE_CONFIG="${HOME_PATH}"/.config/pulse/default.pa
JUKEBOX_SERVICE_NAME="${SYSTEMD_USR_PATH}/jukebox-daemon.service"
Expand Down Expand Up @@ -52,16 +53,18 @@ _jukebox_core_configure_pulseaudio() {
}

_jukebox_core_build_libzmq_with_drafts() {
LIBSODIUM_VERSION="1.0.18"
ZMQ_VERSION="4.3.4"
echo " Building libzmq with drafts support" | tee /dev/fd/3

LIBSODIUM_VERSION="1.0.18"
echo " Building libsodium v${LIBSODIUM_VERSION}" | tee /dev/fd/3
{ cd "${HOME_PATH}" && mkdir "${ZMQ_TMP_DIR}" && cd "${ZMQ_TMP_DIR}"; } || exit_on_error
wget --quiet https://github.com/jedisct1/libsodium/releases/download/${LIBSODIUM_VERSION}-RELEASE/libsodium-${LIBSODIUM_VERSION}.tar.gz
tar -zxvf libsodium-${LIBSODIUM_VERSION}.tar.gz
cd libsodium-${LIBSODIUM_VERSION} || exit_on_error
./configure
make && make install

echo " Building libzmq v${ZMQ_VERSION}" | tee /dev/fd/3
cd "${HOME}/${ZMQ_TMP_DIR}" || exit_on_error
wget https://github.com/zeromq/libzmq/releases/download/v${ZMQ_VERSION}/zeromq-${ZMQ_VERSION}.tar.gz -O libzmq.tar.gz
tar -xzf libzmq.tar.gz
Expand All @@ -71,8 +74,9 @@ _jukebox_core_build_libzmq_with_drafts() {

_jukebox_core_download_prebuilt_libzmq_with_drafts() {
local ZMQ_TAR_FILENAME="libzmq.tar.gz"
ARCH=$(get_architecture)

_download_file_from_google_drive "${LIBZMQ_GD_DOWNLOAD_ID}" "${ZMQ_TAR_FILENAME}"
wget https://github.com/pabera/libzmq/releases/download/v${ZMQ_VERSION}/libzmq5-${ARCH}-${ZMQ_VERSION}.tar.gz -O ${ZMQ_TAR_FILENAME}
tar -xzf ${ZMQ_TAR_FILENAME}
rm -f ${ZMQ_TAR_FILENAME}
sudo rsync -a ./* ${ZMQ_PREFIX}/
Expand All @@ -86,19 +90,15 @@ _jukebox_core_build_and_install_pyzmq() {
# Sources:
# https://pyzmq.readthedocs.io/en/latest/howto/draft.html
# https://github.com/MonsieurV/ZeroMQ-RPi/blob/master/README.md
echo " Build and install pyzmq with WebSockets Support" | tee /dev/fd/3
echo " Install pyzmq with WebSockets Support" | tee /dev/fd/3

if ! pip list | grep -F pyzmq >> /dev/null; then
# Download pre-compiled libzmq from Google Drive because RPi has trouble compiling it
echo " Download pre-compiled libzmq from Google Drive because RPi has trouble compiling it"

{ cd "${HOME_PATH}" && mkdir "${ZMQ_TMP_DIR}" && cd "${ZMQ_TMP_DIR}"; } || exit_on_error

# ARMv7 as default
LIBZMQ_GD_DOWNLOAD_ID=${GD_ID_COMPILED_LIBZMQ_ARMV7}
if [[ $(uname -m) == "armv6l" ]]; then
# ARMv6 as fallback
LIBZMQ_GD_DOWNLOAD_ID=${GD_ID_COMPILED_LIBZMQ_ARMV6}
_show_slow_hardware_message
fi

Expand All @@ -109,7 +109,7 @@ _jukebox_core_build_and_install_pyzmq() {
fi

ZMQ_PREFIX="${ZMQ_PREFIX}" ZMQ_DRAFT_API=1 \
pip install --no-cache-dir --no-binary "pyzmq" --pre pyzmq
pip install -v --no-binary pyzmq --pre pyzmq
else
echo " Skipping. pyzmq already installed" | tee /dev/fd/3
fi
Expand Down

0 comments on commit 78eb0c4

Please sign in to comment.