Skip to content

Commit

Permalink
[DEV-TOOLS] Installation scripts to ease off development on Linux vir…
Browse files Browse the repository at this point in the history
…tual machines
  • Loading branch information
luc-guyot-infomaniak committed May 2, 2024
1 parent 3ea935a commit d7f54a1
Show file tree
Hide file tree
Showing 2 changed files with 284 additions and 0 deletions.
52 changes: 52 additions & 0 deletions infomaniak-build-tools/linux/install_kdrive_sources.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

# Convenience script to install desktop-kDrive source code

set -e

exec 3>&1 > /tmp/kdrive_source_installer.log 2>&1

sudo apt-get install xclip git 1> /dev/null

exec >&3 2>&1 3>&-

function ssh_prompt(){
read -p "Do you already have an ssh key ? (y/n) " haveSSH
if [ "$haveSSH" == "n" ]; then
echo "We will generate a ssh key"
read -p "Enter username for ssh key: " username

read -p "Enter keyname : " keyname

ssh-keygen -t rsa -b 4096 -C "$username" -f ~/.ssh/"$keyname"

clear
echo "Your key has been pasted in your clipboard."
echo "Paste it in your github account: "
echo ""
cat ~/.ssh/"${keyname}.pub"
cat ~/.ssh/"${keyname}.pub" | xclip -sel clip

read -p "Have you done it ? (y/n) " confirm
if [ "$confirm" != "y" ]; then
echo "Operation cancelled by the user."
exit
fi
fi
}

function install_kdrive_sources() {
echo "Cloning desktop kDrive project ..." >&3

mkdir -p ${HOME}/Projects
cd ${HOME}/Projects
ssh-keyscan gitlab.infomaniak.ch >> ~/.ssh/known_hosts
git clone --recurse-submodules https://github.com/Infomaniak/desktop-kDrive.git

echo "done." >&3
}

ssh_prompt
install_kdrive_sources

echo "Sources installation completed." >&3
232 changes: 232 additions & 0 deletions infomaniak-build-tools/linux/ubuntu_23_arm64_install_kdrive_deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
#!/bin/bash

# Install desktop-kDrive dependencies for development purposes
# on Ubuntu 23.10.1 Mantic Minautor for arch. arm64

set -e

sudo apt-get install xclip 1> /dev/null

exec 3>&1 > /tmp/kdrive_env_installer.log 2>&1

function install_kdrive_dependencies(){
echo "Installing common kdrive dependencies" >&3

echo "- most common packages" >&3
sudo apt update --fix-missing
sudo apt install --yes \
wget \
curl \
pkg-config \
ninja-build \
software-properties-common \
libkf5kio-dev \
git

echo "- zlib" >&3
sudo apt update --fix-missing
sudo apt install --yes \
zlib1g \
zlib1g-dev

echo "- sqlite3 dev files" >&3
sudo apt update && sudo apt install --yes \
libsqlite3-dev

echo "- mesa-dev-common" >&3
sudo apt update && sudo apt install --yes \
mesa-common-dev

sudo apt-get install -y libxkbcommon-dev \
glib-2.0 \
libsecret-1-dev

echo "done." >&3
}

function install_cmake_packages () {
echo "Installing cmake" >&3

sudo apt update --fix-missing
sudo apt install --yes cmake extra-cmake-modules
}

function install_qt_packages() {
echo "Installing Qt packages" >&3

sudo apt update
sudo apt install --yes \
qt6-webengine-dev \
qt6-positioning-dev \
qt6-webview-dev \
qt6-tools-dev \
qt6-webengine-dev-tools \
libqt6core5compat6-dev \
libqt6svg6-dev \
linguist-qt6 \
qt6-l10n-tools \
qt6-tools-dev-tools \
qtcreator
}

function install_cppunit() {
echo "Installing cppunit" >&3

echo "- cppunit dependencies ..." >&3
sudo apt-get install -y autotools-dev
sudo apt-get install -y automake
sudo apt-get install -y libtool m4 automake

cd $HOME/Projects

echo "- cloning ..." >&3
git clone git://anongit.freedesktop.org/git/libreoffice/cppunit/ && \
cd cppunit && \

echo "- configuring ..." >&3
./autogen.sh && \
./configure && \

echo "- building ..." >&3
make

echo "- installing ..." >&3
sudo make install

echo "done." >&3
}

function install_logc4plus(){
echo "Installing log4cplus" >&3

cd /tmp

echo " - cloning ..." >&3
git clone --recurse-submodules https://github.com/log4cplus/log4cplus.git
cd log4cplus
git checkout 2.1.x

echo " - building ..." >&3
mkdir build
cd build

echo " - installing ..." >&3
cmake .. -DUNICODE=1
sudo cmake --build . --target install

rm -rf /tmp/log4cplus

echo "- done." >&3
}

function install_openssl(){
echo "Installing openssl" >&3

cd /tmp

echo "- cloning ..." >&3
git clone git://git.openssl.org/openssl.git
cd openssl
git checkout openssl-3.1

echo "- configuring ..." >&3
./Configure shared

echo "- building ..." >&3
make

echo "- installing ..." >&3
sudo make install

rm -rf /tmp/openssl

echo "- done." >&3
}

function install_poco(){
echo "Installing poco" >&3

cd /tmp

echo "- cloning ..." >&3
git clone https://github.com/pocoproject/poco.git
cd poco
git checkout poco-1.12.5

echo "- building ..." >&3
mkdir cmake-build
cd cmake-build
cmake .. -DOPENSSL_ROOT_DIR=/usr/local \
-DOPENSSL_INCLUDE_DIR=/usr/local/include \
-DOPENSSL_LIBRARIES=/usr/local/lib \
-DOPENSSL_CRYPTO_LIBRARY=/usr/local/lib/libcrypto.so \
-DOPENSSL_SSL_LIBRARY=/usr/local/lib/libssl.so

echo "- installing ..." >&3
sudo cmake --build . --target install

rm -rf /tmp/poco

echo "- done." >&3
}

function install_sentry(){
echo "Installing sentry" >&3

echo "- downloading ..." >&3
sudo apt-get install curl
sudo apt-get install libcurl4-openssl-dev

cd /tmp

git clone https://github.com/getsentry/sentry-native.git
cd sentry-native
git checkout tags/0.5.4
git submodule init
git submodule update --recursive

echo "- building ..." >&3
cmake -B build \
-DSENTRY_INTEGRATION_QT=YES \
-DCMAKE_BUILD_TYPE=RelWithDebInfo

cmake --build build --parallel

echo "- installing ..." >&3
sudo cmake --install build

rm -rf /tmp/sentry-native

echo "- done." >&3
}

function install_xxhash(){
echo "Installing xxhash" >&3

cd /tmp

echo "- cloning ..." >&3
git clone https://github.com/Cyan4973/xxHash.git
cd xxHash/cmake_unofficial

echo "- building ..." >&3
mkdir build
cd build
cmake ..
sudo cmake --build . --target install

rm -rf /tmp/xxHash

echo "- done." >&3
}

install_kdrive_dependencies
install_cmake_packages
install_qt_packages
install_logc4plus
install_openssl
install_poco
install_sentry
install_xxhash

echo "Development environment successully installed." >&3

0 comments on commit d7f54a1

Please sign in to comment.