Skip to content

Instantly share code, notes, and snippets.

@marpala
Created May 12, 2020 07:33
Show Gist options
  • Save marpala/76957a07e8dd9409514cd33009ac2470 to your computer and use it in GitHub Desktop.
Save marpala/76957a07e8dd9409514cd33009ac2470 to your computer and use it in GitHub Desktop.
Scroom init
# First get the scroom repository
if [ ! -d "scroom" ]; then
# Fetch all required packages on clone too
sudo apt update
sudo apt upgrade
sudo apt install git libboost-test-dev libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libboost-thread-dev libgtest-dev google-mock libcairo2-dev libglade2-dev libglib2.0-dev libgtk2.0-dev libtiff5-dev pkg-config doxygen graphviz ccache libc6-dev
git clone --depth 200 https://gitlab.com/sep-group-2/scroom.git
cd scroom
autoreconf -i
cd ..
else
echo "Skipping scroom setup..."
fi
# Then maybe configure it
path=$(pwd)/scroom-install
if [ ! -d "./scroom/scroom-build" ] && [ ! -d "scroom-install" ]; then
mkdir scroom-install
cd scroom
mkdir scroom-build
cd scroom-build
../configure CC="ccache gcc" CXX="ccache g++" --prefix $path
cd ../..
build=1
else
echo "Skipping scroom build configuration..."
if [ "$1" == "true" ]; then
build=1
else
build=0
fi
fi
# Then maybe build it
if [ $build -eq 1 ]; then
cd ./scroom/scroom-build
make -k -j 2 install
cd ../..
else
echo "Skipping scroom build..."
fi
# Then maybe add a run shortcut
if [ ! -f "run-scroom.sh" ]; then
echo "./scroom-install/bin/scroom" > run-scroom.sh
chmod 755 run-scroom.sh
else
echo "Skipping run script..."
fi
# Then get our plugin
if [ ! -d "scroom-plugin-cpp" ]; then
# HTTPS
git clone https://gitlab.com/sep-group-2/scroom-plugin-cpp.git
cd scroom-plugin-cpp
autoreconf -i
cd ..
else
echo "Skipping plugin setup..."
fi
# Then maybe configure our plugin
if [ ! -d "./scroom-plugin-cpp/plugin-build" ]; then
cd ./scroom-plugin-cpp
mkdir plugin-build
cd plugin-build
../configure CC="ccache gcc" CXX="ccache g++" CPPFLAGS=-I$path/include/ LDFLAGS="-L$path/lib -Wl,-z,defs"
cd ../..
else
echo "Skipping plugin build configuration..."
fi
# Then maybe make a plugin build script
if [ ! -f "build-plugin.sh" ]; then
echo "cd ./scroom-plugin-cpp/plugin-build" >> build-plugin.sh
echo "make -k -j 2" >> build-plugin.sh
echo "cd ../.." >> build-plugin.sh
echo "rm -f ./scroom-install/lib/scroom/libspexample.*" >> build-plugin.sh
echo "cp ./scroom-plugin-cpp/plugin-build/plugins/example/src/.libs/* ./scroom-install/lib/scroom/" >> build-plugin.sh
echo "echo \"Done! Run scroom using the generated 'run-scroom.sh' script.\"" >> build-plugin.sh
chmod 755 build-plugin.sh
else
echo "Skipping plugin build script..."
fi
echo "Build the plugin by running the generated 'build-plugin.sh' script."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment