INSTALL REQUIREMENTS FOR LINUX (INCLUDES RASPBERY PI)

dawlane

Active Member
CX Code Contributor
Joined
Jun 21, 2017
Here's a quick guide to install the dependencies on a number of Linux distributions.
So open your favourite command line terminal.

IMPORTANT NOTE: See the end of this post.

Unbuntu 18.04/Ubuntu 19.04 (packages should be the same for Linux Mint 18/19)

Cerberus standard development files for making applications
sudo apt-get install g++ libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libopenal-dev libglu1-mesa-dev

Cerberus IDE development files for Ubuntu 18.04/Linux Mint 18 Only (Uses Qt 5.9.5)
sudo apt-get install qtmultimedia5-dev qt5-default qtwebengine5-dev

OpenSUSE 15
Cerberus standard development files for making applications
sudo zypper in gcc-c++ Mesa-libGL-devel openal-soft-devel libXcursor-devel libXrandr-devel libXinerama-devel libXi-devel

Cerberus IDE development files for OpenSUSE 15 Only (Uses Qt 5.9.4)
sudo zypper in libqt5-qtwebengine-devel libqt5-qtmultimedia-devel

Fedora 29
Cerberus standard development files for making applications
sudo dnf install gcc-c++ mesa-libGLU-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel openal-soft-devel

Cerberus IDE development files for Fedora 29 Only (Uses Qt 5.11.2) and only listed here for reference or at some stage Ted is made to work with later versions of Qt.
sudo dnf install qt5-qtwebengine-devel qt5-qtmultimedia-devel
You should download the Qt SDK and install version 5.9.2. And follow Manual Install of Ted.

Raspbery Pi:
Open Terminal window:
sudo raspi-config

Navigate to:
7 - Advanced options >> A7 - GL Driver >> G1 - GL (Full KMS) OpenGL desktop driver with full KMS

sudo apt-get -y install g++ libglu1-mesa-dev libopenal-dev libxi-dev libxrandr-dev libxinerama-dev libxcursor-dev libxxf86vm-dev libx11-dev libgl1-mesa-dev
sudo apt-get -y install libqt5webkit5-dev libqt5sensors5-dev qtlocation5-dev libxslt1-dev libsqlite3-dev libgstreamer-plugins-base0.10-dev qt5-default libicu-dev

Manual Install of Ted (latest version)
Install the compiler tool chain for your distribution e.g. g++, make etc. If you get link errors when you compile about missing dependencies, then install the development packages for those mussing dependencies.
Download and install the Qt SDK and use the Qt Installer/Maintainance tool to install the correct gcc libraries for Qt 5.9.2.
Open a terminal and type (replace qt_path with the path for the Qt binary install e.g. /home/user_name/Qt/5.9.2/gcc_64):
NOTE: Qt5 may have a different executable name for qmake. It may be called qmake-qt5 or a variation on this.
Bash:
export PATH="qt_path:qt_path/bin:$PATH"
cd path_to_cerberus/src
mkdir build-ted-Desktop && cd build-ted-Desktop
qmake CONFIG+=release ../ted/ted.pro
make
make install
IMPORTANT NOTE:
The GCC compiler that comes with later version of Linux is setup to produce Position-Independent Executable's; also known as PIE.
The file browser/manager in most distributions currently will not launch these files directly and may never will. And launching a file via the file manager may be removed entirely in future releases.

You could mostly avoid this, is by passing the -no-pie option to the back-end compiler, but you lose the benefits of a compiled PIE application.

To do this use:
For GLFW targets add #GLFW_GCC_LD_OPTS+="-no-pie" to the top of the main source file.
For C++ Tool add #CC_OPTS+="-no-pie" to the top of the main source file.

The alternative is for those distributions that support the free desktop specifications, is to add your application to the menu and create a desktop file launcher.

To create one of these that doesn't require super user privileges, but only for the current user. Follow these instructions.
For Cerberus:
Download the logo files

Extract the files and copy the files listed to the Cerberus bin directory and rename as shown.
AppIcon.svg = cerberus-file-icon.svg
Logos/Logo.svg = cerberus-app-icon.svg

You now need to open each of these up in an application that can export these to png image files. The application GIMP should suffice.
Open each svg image and export them as a 48x48 png image to the Cerberus bin directory.

You now need to the create two files below in the Cerberus root directory and give them the names in the titled boxes.
You need to set the execute permission flag for both files.
From the command line, navigate to the Cerberus installation directory (using the cd command) and type:
chmod +x *.sh; chmod +x *.desktop

How it should work.
You navigate the the Cerberus root directory and if desktop launching is allowed in the browser, you just double click the icon named Cerberus X (the desktop entry file). It runs the setup.sh script that installs:
  • A desktop entry file to .local/share/applications and updates the execute path
  • A desktop entry file to the users desktop
  • Creates or updates the .local/share/applications/mimeapps.list
  • Creates a mime entry in .local/share/mime/packages
  • Copies the icon images to ./local/share/icons/hicolor/48x48/apps
  • Installs the mime type into the mime type database
When finished, the IDE start and you should have a desktop icon, a menu icon under the programming category, icons and launch associated with Cerberus source files. If not, just log out and back in for the changes to take affect.

If there is no way to launch from a file browser, open a terminal and navigate to the Cerberus root directory and execute the setup.sh file directly with:./setup.sh

You can remove the basic set up by using the setup.sh file via the command line and passing uninstall as a parameter.

setup.sh:
#!/bin/bash

# A SIMPLE SETUP SCRIPT FOR CERBERUS X ON LINUX DISTRIBUTIONS THAT SUPPORT THE FREE DESKTOP SPECIFICATIONS

# Set come constants
# GET THIS SCRIPST DIRECTORY
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
APP_ICON_FILE="cerberus-app-icon"
MIME_ICON_FILE="cerberus-file-icon"
DESKTOP_NAME="com.krautapps.cerberus.desktop"

# These are for the mime type entry
MIME_COMMENT="Cerberus-X File"
MIME_GLOB="*.cxs"

# Default locations in the users home directory
USER_APP_DIR="$HOME/.local/share/applications"
USER_ICON_DIR="$HOME/.local/share/icons/hicolor"
USER_MIME_DIR="$HOME/.local/share/mime"
USER_SCALABLE_DIR="$HOME/.local/share/icons/hicolor/scalable"

MIME_FILE_TYPE="application/x-CerberusX"

# Maksure that the executable permission is set for the desktop entry file
chmod +x "$DIR/$DESKTOP_NAME"

# message function
function msg(){
    echo "$1"
    echo
}

function update(){
    # Check and run each database tool
    if hash "$1" 2>/dev/null; then
        echo "Running $1 $2"
        $1 "$2"
    fi
}

function install(){
# Set up the launchers for the menu and desktop
msg "Updating MimeType and Icon for $DIR/$DESKTOP_NAME"
sed -i "s,^MimeType=.*,MimeType="$MIME_FILE_TYPE\;,g"" "$DIR/$DESKTOP_NAME"
sed -i "s,^Icon=.*,Icon="$APP_ICON_FILE,g"" "$DIR/$DESKTOP_NAME"

msg "Making directory $USER_APP_DIR"
mkdir -p "$USER_APP_DIR"

msg "copying $DIR/$DESKTOP_NAME to $USER_APP_DIR/$DESKTOP_NAME"
cp "$DIR/$DESKTOP_NAME" "$USER_APP_DIR/$DESKTOP_NAME"

msg "Updating Exec for $USER_APP_DIR/$DESKTOP_NAME"
sed -i "s,Exec=.*,Exec="$DIR/Cerberus",g" "$USER_APP_DIR/$DESKTOP_NAME"

if [ -d "$HOME/Desktop" ]; then
    msg "copying $USER_APP_DIR/$DESKTOP_NAME to $HOME/Desktop/$DESKTOP_NAME"
    cp "$USER_APP_DIR/$DESKTOP_NAME" "$HOME/Desktop/$DESKTOP_NAME"
fi

# Copy over the icons
msg "Making directory $USER_ICON_DIR"
mkdir -p "$USER_ICON_DIR/48x48/apps"
mkdir -p "$USER_SCALABLE_DIR/apps"
mkdir -p "$USER_SCALABLE_DIR/mimetypes"

# PNG
msg "$DIR/bin/$APP_ICON_FILE.png to $USER_ICON_DIR/48x48/apps/$APP_ICON_FILE.png"
cp "$DIR/bin/$APP_ICON_FILE.png" "$USER_ICON_DIR/48x48/apps/$APP_ICON_FILE.png"

msg "copying $DIR/bin/$MIME_ICON_FILE.png to $USER_ICON_DIR/48x48/apps/$MIME_ICON_FILE.png"
cp "$DIR/bin/$MIME_ICON_FILE.png" "$USER_ICON_DIR/48x48/apps/$MIME_ICON_FILE.png"

# SVG
msg "$DIR/bin/$APP_ICON_FILE.svg to $USER_SCALABLE_DIR/apps/$APP_ICON_FILE.svg"
cp "$DIR/bin/$APP_ICON_FILE.svg" "$USER_SCALABLE_DIR/apps/$APP_ICON_FILE.svg"

msg "copying $DIR/bin/$MIME_ICON_FILE.svg to $USER_SCALABLE_DIR/mimetypes/$MIME_ICON_FILE.svg"
cp "$DIR/bin/$MIME_ICON_FILE.svg" "$USER_SCALABLE_DIR/mimetypes/$MIME_ICON_FILE.svg"

# Add a mime xml file
msg "Making directory $USER_MIME_DIR/packages"
mkdir -p "$USER_MIME_DIR/packages"

# NOTE: cat not have any tab character in front of the EOT block.
msg "Adding mime file type package"
cat<<EOT > "$USER_MIME_DIR/packages/user-extension-cerberusx.xml"
<?xml version="1.0"?>
    <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
        <mime-type type="$MIME_FILE_TYPE">
        <icon name="$MIME_ICON_FILE"/>
        <comment>$MIME_COMMENT</comment>
        <comment xml:lang="en">$MIME_COMMENT</comment>
        <glob pattern="$MIME_GLOB"/>
    </mime-type>
</mime-info>
EOT

# Check and update or create the mimeapps.list file
# NOTE: cat not have any tab character in front of the EOT block.
if [ ! -f "$USER_APP_DIR/mimeapps.list" ]; then
msg "Adding new mimapps.list"
cat <<EOT > "$USER_APP_DIR/mimeapps.list"
[Default Applications]
$MIME_FILE_TYPE=$DESKTOP_NAME

[Added Associations]
$MIME_FILE_TYPE=$DESKTOP_NAME;
EOT
else
    if ! grep -q $DESKTOP_NAME "$USER_APP_DIR/mimeapps.list"; then
        msg "Adding [Default Applications] mime types to mimeapps.list"
        sed -i "/^\[Default Applications\]/a $MIME_FILE_TYPE=$DESKTOP_NAME" "$USER_APP_DIR/mimeapps.list"

        if ! grep -q "$USER_APP_DIR/mimeapps.list" -e "\[Added Associations\]"; then
            msg "Adding [Added Associations]  mime types to mimeapps.list"
            echo >> "$USER_APP_DIR/mimeapps.list"
            echo "[Added Associations]" >> "$USER_APP_DIR/mimeapps.list"
        fi
        sed -i "/^\[Added Associations\]/a $MIME_FILE_TYPE=$DESKTOP_NAME;" "$USER_APP_DIR/mimeapps.list"
    fi
fi

# Update any database
update update-mime-database "$USER_MIME_DIR"
}

function remove(){
    if [ -f "$1" ]; then
        echo "Removing $1"
        rm "$1"
    fi
}

function uninstall(){
    # Remove the icons
    remove "$USER_ICON_DIR/48x48/apps/$APP_ICON_FILE.png"
    remove "$USER_ICON_DIR/48x48/apps/$MIME_ICON_FILE.png"
    remove "$USER_SCALABLE_DIR/apps/$APP_ICON_FILE.svg"
    remove "$USER_SCALABLE_DIR/mimetypes/$MIME_ICON_FILE.svg"

    # Remove the desktop entry files
    remove "$USER_APP_DIR/$DESKTOP_NAME"
    remove "$HOME/Desktop/$DESKTOP_NAME"

    # Remove the MIME association
    remove "$USER_MIME_DIR/packages/user-extension-cerberusx.xml"

    # Remove any related info in the mimeapp.list
    if [ -f "$USER_APP_DIR/mimeapps.list" ]; then
        sed -i "/$DESKTOP_NAME/d" "$USER_APP_DIR/mimeapps.list"
    fi
    echo ""
    update update-mime-database "$USER_MIME_DIR" "$USER_APP_DIR/mimeapps.list"
}

# Stub.
if [ "$1" = "uninstall"  ]; then
    echo "Un-installing"
    uninstall
else
    echo "Installing"
    install
fi
com.krautapps.cerberus.desktop:
#!/usr/bin/env xdg-open

[Desktop Entry]

Version=1.0
Type=Application
Encoding=UTF-8
Terminal=false
Exec=bash -c '_PWD="$PWD"; cd "`echo $0 | sed s/com.krautapps.cerberus.desktop$//`"; ./setup.sh; ./Cerberus %F; cd "_PWD"' %k
Icon=cerberus-app-icon
Name=Cerberus X
MimeType=application/x-CerberusX;
Categories=Development
Comment[en_GB.UTF-8]=Cerberus X Integrated Development Environment
GenericName[en_GB.UTF-8]=Create Games for HTML5 web browsers, PC desktop, Abdobe Flash and Android.
Name[en_GB]=Cerberus X
 
Last edited:

magic

Active Member
3rd Party Module Dev
3rd Party Tool Dev
Joined
Mar 5, 2018
Its look really complicated. Thank you.
 

rickychus

Member
Joined
Sep 26, 2017
Great, it will help those who are starting to use Linux. This goes directly to my "TXT" linux file.

It is not complicated, just open the command console "CTRL + Alt + T" and paste the line command that corresponds to the version of your linux and wait for it to download and install everything.

The friend dawnlane does not miss any detail, perhaps that's why it seems complicated but it is not.

Thank you.-
 

rickychus

Member
Joined
Sep 26, 2017
Hello,
I wanted to share with you... I was able to compile without problems CerberusX with the help of this tutorial that made dawlane (OS Lubuntu 18.04 32bis).
Everything went well, nothing exploded, not for now. :)
regards.-
 
Top Bottom