How to building a package for Debian or Ubuntu.md - tx00100xt/SeriousSamClassic GitHub Wiki

How to building a package for Debian/Ubuntu.

Introduction

This implementation of the source code provides for installation in the system, in the /usr/bin, /usr/lib, /usr/share directories.

During the launch of the game, the engine determines the place of launch, and if the launch occurred from the /usr/bin directory, it switches to the libraries search mode in the system directories. Also adds searching for game data in various directories. About the search for game data will be written below.

Otherwise, the engine considers that a local launch of the game has occurred and will look for game data in the root directory of the game. User data, such as game settings, log, saves, demos will be located in:

~/.local/share/Serious-Engine/serioussam/ - for TFE
~/.local/share/Serious-Engine/serioussamse/ - for TSE

If you start the game with the +portable key, then there will be a full portable mode and user data, such as game settings, log, saves, demos will also be located in the root directory of the game.

Naming conventions for executable files and libraries

Internal game name for Serious Sam The First Encounter is s serioussam, for Serious Sam The Second Encounter is serioussamse. These names are initially accepted in the engine and are used for example in a network game and a master server.

Location of executables, libraries, and modification libraries.

The executable files of the game are located in the '/usr/bin' directory.

/usr/bin/"internal game name"

The dedicated server and the font creation utility for the game are also located in this directory.

/usr/bin/"internal game name"-ded
/usr/bin/"internal game name"-mkfont

The game libraries will be searched in the following directories:

/usr/lib/"internal game name"/
/usr/lib64/"internal game name"/
/usr/lib/i386-linux-gnu/"internal game name"/
/usr/lib/x86_64-linux-gnu/"internal game name"/
/usr/lib/arm-linux-gnueabihf/"internal game name"/
/usr/lib/aarch64-linux-gnu/"internal game name"/
/usr/lib/riscv64-linux-gnu/"internal game name"/
/usr/lib/powerpc64-linux-gnu/"internal game name"/
/usr/lib/s390x-linux-gnu/"internal game name"/

The location of the libraries of modifications is also on the same principle.

/usr/lib/"internal game name"/Mods/"Mod name"/
/usr/lib64/"internal game name"/Mods/"Mod name"/
/usr/lib/i386-linux-gnu/"internal game name"/Mods/"Mod name"/
/usr/lib/x86_64-linux-gnu/"internal game name"/Mods/"Mod name"/
/usr/lib/arm-linux-gnueabihf/"internal game name"/Mods/"Mod name"/
/usr/lib/aarch64-linux-gnu/"internal game name"/Mods/"Mod name"/
/usr/lib/riscv64-linux-gnu/"internal game name"/Mods/"Mod name"/
/usr/lib/powerpc64-linux-gnu/"internal game name"/Mods/"Mod name"/
/usr/lib/s390x-linux-gnu/"internal game name"/Mods/"Mod name"/

Game libraries are assigned a suffix defined in file ModEXT.txt The suffix is assigned to both game libraries and mod libraries.

The game library engine must be located in the standard library search area. In one of:

/usr/lib
/usr/lib64
/usr/lib/i386-linux-gnu
/usr/lib/x86_64-linux-gnu
/usr/lib/arm-linux-gnueabihf
/usr/lib/aarch64-linux-gnu
/usr/lib/riscv64-linux-gnu
/usr/lib/powerpc64-linux-gnu
/usr/lib/s390x-linux-gnu

The game executable first loads the engine library, which loads the remaining libraries from the subdirectory with the game's internal name.

To get output names by convention, use the cmake build key -DCMAKE_INSTALL_PREFIX:PATH=/usr

In accordance with the naming convention, we get the following location of the executable files, game libraries Serious Sam The First Encounter and Serious Sam The Second Encounter for Ubuntu/Dedian x86_64:

/usr/bin/serioussam
/usr/bin/serioussam-ded
/usr/bin/serioussam-mkfont
/usr/lib/x86_64-linux-gnu/libEngine.so
/usr/lib/x86_64-linux-gnu/serioussam/libShaders.so
/usr/lib/x86_64-linux-gnu/serioussam/libGame.so
/usr/lib/x86_64-linux-gnu/serioussam/libEntities.so
/usr/lib/x86_64-linux-gnu/serioussam/libamp11lib.so
/usr/bin/serioussamse
/usr/bin/serioussamse-ded
/usr/bin/serioussamse-mkfont
/usr/lib/x86_64-linux-gnu/libEngineMP.so
/usr/lib/x86_64-linux-gnu/serioussamse/libShaders.so
/usr/lib/x86_64-linux-gnu/serioussamse/libGameMP.so
/usr/lib/x86_64-linux-gnu/serioussamse/libEntitiesMP.so
/usr/lib/x86_64-linux-gnu/serioussamse/libamp11lib.so

For mod XPLUS:

/usr/lib/x86_64-linux-gnu/serioussam/Mods/XPLUS/libGame.so
/usr/lib/x86_64-linux-gnu/serioussam/Mods/XPLUS/libEntities.so
/usr/lib/x86_64-linux-gnu/serioussamse/Mods/XPLUS/libGameMP.so
/usr/lib/x86_64-linux-gnu/serioussamse/Mods/XPLUS/libEntitiesMP.so

For mod Serious Sam Alpha Remake (SSA):

/usr/lib/x86_64-linux-gnu/serioussam/Mods/SSA/libGame.so
/usr/lib/x86_64-linux-gnu/serioussam/Mods/SSA/libEntities.so

Location of game data, user data, and data modifications

During the launch of the game, the engine determines the launch location, and if the launch occurred from the /usr/bin directory, then the game data will be searched for the recommended paths. If the game data is not found using the recommended paths, then the search will be in the home directory, and when the game files are found, the path will be written to the configuration file (not recommended). If the game files are not found, a message box will appear.

Recommended paths for hosting game data:

/usr/share/serioussam/ - for TFE
/usr/share/serioussamse/ - for TSE

or

~/.local/share/Serious-Engine/serioussam/ - for TFE
~/.local/share/Serious-Engine/serioussamse/ - for TSE

Mod Data:

/usr/share/serioussam/Mods/"Mod name" - for TFE
/usr/share/serioussamse/Mods/"Mod name" - for TSE

or

~/.local/share/Serious-Engine/serioussam/Mods/"Mod name" - for TFE
~/.local/share/Serious-Engine/serioussamse/Mods/"Mod name" - for TSE

t is not allowed to arrange game data parts in different recommended paths. Also, if you chose your own path (which is not recommended), it must be the only one.

The file SE1_10b.gro is not included in the game data distributed on CDs or digital stores. If you chose the first recommended option, set it to:

/usr/share/serioussam/SE1_10b.gro - for TFE
/usr/share/serioussamse/SE1_10b.gro - for TSE

As an example, when creating packages and placing data, we will choose the second option of the recommended location.

Now that we know how the executable files, libraries and game data should be located, let's start compiling and building packages for Ubuntu/Dedian x86_64.

Installing dependencies

sudo apt-get install build-essential cmake flex bison nasm git wget libsdl2-dev libvorbis-dev zlib1g-dev debhelper lintian gdebi md5deep 

Getting the source code

git clone https://github.com/tx00100xt/SeriousSamClassic.git
git clone https://github.com/tx00100xt/SeriousSamAlphaRemake.git

Change CMakeLists.txt

Since you are building a package for everyone, you need to replace -march=native to mtune=generis in the CMakeLists.txt file

cd SeriousSamClassic
find . -name "CMakeLists.txt" -exec sed -i 's/-march=native/-mtune=generic/g' {} +
cd ..
cd SeriousSamAlphaRemake
find . -name "CMakeLists.txt" -exec sed -i 's/-march=native/-mtune=generic/g' {} +
cd ..

Building SamTFE, SamTSE and XPLUS

cd SeriousSamClassic
mkdir build
mkdir build-xplus
cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ..
make -j8
cd ..
cd build-xplus
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DXPLUS=TRUE ..
make -j8
cd ../../../../

Build for SeriousSamAlphaRemake

cd SeriousSamAlphaRemake/Sources
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DTFE=TRUE ..
make ecc
make -j8
cd ../../../

Prepare and building deb package

serioussamclassic:

Create directories for the package being created.

mkdir serioussamclassic-1.10.5-1_buster13_amd64
cd serioussamclassic-1.10.5-1_buster13_amd64
mkdir {DEBIAN,usr,usr/bin,usr/share,usr/share/serioussam,usr/share/serioussamse,usr/share/applications}
mkdir {usr/lib,usr/lib/x86_64-linux-gnu,usr/lib/x86_64-linux-gnu/serioussam,usr/lib/x86_64-linux-gnu/serioussamse}
mkdir {usr/share/icons,usr/share/icons/hicolor,usr/share/icons/hicolor/32x32,usr/share/icons/hicolor/32x32/apps,,usr/share/icons/hicolor/48x48,usr/share/icons/hicolor/48x48/apps}
cd ..

Let's copy the compiled files and data files.

cd SeriousSamClassic
cp -vfr SamTFE/Sources/build/serioussam* ../serioussamclassic-1.10.5-1_buster13_amd64/usr/bin
cp -vfr SamTSE/Sources/build/serioussamse* ../serioussamclassic-1.10.5-1_buster13_amd64/usr/bin
cp -vfr SamTFE/Sources/build/Debug/libEngine.so ../serioussamclassic-1.10.5-1_buster13_amd64/usr/lib/x86_64-linux-gnu
cp -vfr SamTSE/Sources/build/Debug/libEngineMP.so ../serioussamclassic-1.10.5-1_buster13_amd64/usr/lib/x86_64-linux-gnu
cp -vfr SamTFE/Sources/build/Debug/{libShaders.so,libGame.so,libEntities.so,libamp11lib.so} ../serioussamclassic-1.10.5-1_buster13_amd64/usr/lib/x86_64-linux-gnu/serioussam
cp -vfr SamTSE/Sources/build/Debug/{libShaders.so,libGameMP.so,libEntitiesMP.so,libamp11lib.so} ../serioussamclassic-1.10.5-1_buster13_amd64/usr/lib/x86_64-linux-gnu/serioussamse
cp -vfr SamTFE/{SE1_10b.gro,ModEXT.txt} ../serioussamclassic-1.10.5-1_buster13_amd64/usr/share/serioussam
cp -vfr SamTSE/{SE1_10b.gro,ModEXT.txt} ../serioussamclassic-1.10.5-1_buster13_amd64/usr/share/serioussamse
cd ..

Now let's create the files to create the deb package.

cd serioussamclassic-1.10.5-1_buster13_amd64/DEBIAN
nano -w control
Package: serioussamclassic
Version: 1.10.5-1
Architecture: amd64
Section: games
Priority: optional
Installed-Size: 12600
Maintainer: YOUR_NAME <YOUR_EMAIL>
Homepage: https://github.com/tx00100xt/SeriousSamClassic.git
Pre-Depends:
Conflicts: serioussamclassic-vk
Recommends: mangohud
Depends: libc6 (>= 2.28), libsdl2-2.0-0 (>= 2.0.6), libstdc++6 (>= 5), zlib1g (>= 1:1.1.4), libvorbisfile3
Description: Open source game engine version developed by Croteam for Serious Sam Classic (Windows, Linux, FreeBSD, Raspberry Pi OS)
nano -w postinst
chmod 775 postinst
#!/bin/bash
set -e
if [ "$1" = "configure" ] && [ -x "`which update-menus 2>/dev/null`" ] ; then update-menus ; fi
if [ "$1" = "configure" ] && [ -x "`which update-desktop-database 2>/dev/null`" ] ; then update-desktop-database ; fi
nano -w postrm
chmod 775 postrm
#!/bin/bash
set -e
if [ -x "`which update-menus 2>/dev/null`" ] ; then update-menus ; fi
if [ -x "`which update-desktop-database 2>/dev/null`" ] ; then update-desktop-database ; fi
cd ..
cd usr/share/applications
nano -w serioussam.desktop
[Desktop Entry]
Name=Serious Sam The First Encounter
Type=Application
Comment=Linux port of Serious Sam Classic The First Encounter
Exec=serioussam
TryExec=serioussam
Icon=serioussam
Categories=Application;Game;
nano -w serioussamse.desktop
cd ../../../
[Desktop Entry]
Name=Serious Sam The Second Encounter
Type=Application
Comment=Linux port of Serious Sam Classic The Second Encounter
Exec=serioussamse
TryExec=serioussamse
Icon=serioussam
Categories=Application;Game;

Choose a suitable game icon for the shortcut in the menu and copy it to the prepared package

cp serioussam.png usr/share/icons/hicolor/32x32,usr/icon/hicolor/32x32/apps
cp serioussam.png usr/share/icons/hicolor/48x48,usr/icon/hicolor/48x48/apps

Let's calculate the md5 sums of the files in the package.

md5deep -rl usr > DEBIAN/md5sums

Assign file permissions

cd ../
sudo chown -R root:root serioussamclassic-1.10.5-1_buster13_amd64

Let's build a deb package.

sudo dpkg-deb --build serioussamclassic-1.10.5-1_buster13_amd64

Now let's build deb packages for modifications

serioussamclassic-xplus:

Create directories for the package being created.

mkdir serioussamclassic-xplus-1.10.5-1_buster13_amd64
cd serioussamclassic-xplus-1.10.5-1_buster13_amd64
mkdir {DEBIAN,usr,usr/lib,usr/lib/x86_64-linux-gnu}
mkdir {usr/lib/x86_64-linux-gnu/serioussam,usr/lib/x86_64-linux-gnu/serioussamse}
mkdir {usr/lib/x86_64-linux-gnu/serioussam/Mods,usr/lib/x86_64-linux-gnu/serioussam/Mods/XPLUS}
mkdir {usr/lib/x86_64-linux-gnu/serioussamse/Mods,usr/lib/x86_64-linux-gnu/serioussamse/Mods/XPLUS}
cd ..

Let's copy the compiled files and data files.

cd SeriousSamClassic
cp -vfr SamTFE/Sources/build-xplus/Debug/libGame.so ../serioussamclassic-xplus-1.10.5-1_buster13_amd64/usr/lib/x86_64-linux-gnu/serioussam/Mods/XPLUS
cp -vfr SamTFE/Sources/build-xplus/Debug/libEntities.so ../serioussamclassic-xplus-1.10.5-1_buster13_amd64/usr/lib/x86_64-linux-gnu/serioussam/Mods/XPLUS
cp -vfr SamTSE/Sources/build-xplus/Debug/libGameMP.so ../serioussamclassic-xplus-1.10.5-1_buster13_amd64/usr/lib/x86_64-linux-gnu/serioussamse/Mods/XPLUS
cp -vfr SamTSE/Sources/build-xplus/Debug/libEntitiesMP.so ../serioussamclassic-xplus-1.10.5-1_buster13_amd64/usr/lib/x86_64-linux-gnu/serioussamse/Mods/XPLUS
cd ..

Now let's create the files to create the deb package.

cd serioussamclassic-xplus-1.10.5-1_buster13_amd64/DEBIAN
nano -w control
Package: serioussamclassic-xplus
Version: 1.10.5-1
Architecture: amd64
Section: games
Priority: optional
Installed-Size: 12600
Maintainer: YOUR_NAME <YOUR_EMAIL>
Homepage: https://github.com/tx00100xt/SeriousSamClassic.git
Pre-Depends:
Recommends: mangohud
Depends: libc6 (>= 2.28), libsdl2-2.0-0 (>= 2.0.6), libstdc++6 (>= 5), zlib1g (>= 1:1.1.4), libvorbisfile3, serioussamclassic | serioussamclassic-vk
Description: Open source nodifications based on game engine version developed by Croteam for Serious Sam Classic (Windows, Linux, FreeBSD, Raspberry Pi OS)
nano -w postinst
chmod 775 postinst
#!/bin/bash
set -e
if [ "$1" = "configure" ] && [ -x "`which update-menus 2>/dev/null`" ] ; then update-menus ; fi
if [ "$1" = "configure" ] && [ -x "`which update-desktop-database 2>/dev/null`" ] ; then update-desktop-database ; fi
nano -w postrm
chmod 775 postrm
#!/bin/bash
set -e
if [ -x "`which update-menus 2>/dev/null`" ] ; then update-menus ; fi
if [ -x "`which update-desktop-database 2>/dev/null`" ] ; then update-desktop-database ; fi

Let's calculate the md5 sums of the files in the package.

cd ../
md5deep -rl usr > DEBIAN/md5sums

Assign file permissions

cd ../
sudo chown -R root:root serioussamclassic-xplus-1.10.5-1_buster13_amd64

Let's build a deb package.

sudo dpkg-deb --build serioussamclassic-xplus-1.10.5-1_buster13_amd64

serioussamclassic-alpha:

Create directories for the package being created.

mkdir serioussamclassic-alpha-1.5.1-1_buster13_amd64
cd serioussamclassic-alpha-1.5.1-1_buster13_amd64
mkdir {DEBIAN,usr,usr/lib,usr/lib/x86_64-linux-gnu,usr/lib/x86_64-linux-gnu/serioussam}
mkdir {usr/lib/x86_64-linux-gnu/serioussam/Mods,usr/lib/x86_64-linux-gnu/serioussam/Mods/SSA}
cd ..

Let's copy the compiled files and data files.

cp -vfr SeriousSamAlphaRemake/Sources/build/Debug/*.so serioussamclassic-alpha-1.5.1-1_buster13_amd64/usr/lib/x86_64-linux-gnu/serioussam/Mods/SSA

Since the Alpha Remake modification contains mp3 files, you need to create a symbolic link to library amp11lib.

cd serioussamclassic-alpha-1.5.1-1_buster13_amd64/usr/lib/x86_64-linux-gnu/serioussam/Mods/SSA
ln -sf ../../libamp11lib.so libamp11lib.so
cd ../../../../../../../

Now let's create the files to create the deb package.

cd serioussamclassic-alpha-1.5.1-1_buster13_amd64/DEBIAN
nano -w control
Package: serioussamclassic-alpha
Version: 1.5.1-1
Architecture: amd64
Section: games
Priority: optional
Installed-Size: 12600
Maintainer: YOUR_NAME <YOUR_EMAIL>
Homepage: https://github.com/tx00100xt/SeriousSamAlphaRemake.git
Pre-Depends:
Recommends: mangohud
Depends: libc6 (>= 2.28), libsdl2-2.0-0 (>= 2.0.6), libstdc++6 (>= 5), zlib1g (>= 1:1.1.4), libvorbisfile3, serioussamclassic | serioussamclassic-vk
Description: Open source nodifications based on game engine version developed by Croteam for Serious Sam Classic (Windows, Linux, FreeBSD, Raspberry Pi OS)
nano -w postinst
chmod 775 postinst
#!/bin/bash
set -e
if [ "$1" = "configure" ] && [ -x "`which update-menus 2>/dev/null`" ] ; then update-menus ; fi
if [ "$1" = "configure" ] && [ -x "`which update-desktop-database 2>/dev/null`" ] ; then update-desktop-database ; fi
nano -w postrm
chmod 775 postrm
#!/bin/bash
set -e
if [ -x "`which update-menus 2>/dev/null`" ] ; then update-menus ; fi
if [ -x "`which update-desktop-database 2>/dev/null`" ] ; then update-desktop-database ; fi

Let's calculate the md5 sums of the files in the package.

cd ../
md5deep -rl usr > DEBIAN/md5sums

Assign file permissions

cd ../
sudo chown -R root:root serioussamclassic-alpha-1.5.1-1_buster13_amd64

Let's build a deb package.

sudo dpkg-deb --build serioussamclassic-alpha-1.5.1-1_buster13_amd64

You can use gdebi-gtk to install the package.

gdebi

Modifications resources

Getting Aplha Remake Data

wget https://archive.org/download/serious-sam-alpha-remake-data/SeriousSamAlphaRemake_v1.5.tar.xz
tar xJvf SeriousSamAlphaRemake_v1.5.tar.xz -C SeriousSamClassic/SamTFE

or

for var in a b c d; do wget https://github.com/tx00100xt/serioussam-mods/raw/main/SamTFE-SSA/SeriousSamAlphaRemake_v1.5.tar.xz.parta$var; done; cat SeriousSamAlphaRemake_v1.5.tar.xz.part* > SeriousSamAlphaRemake_v1.5.tar.xz
tar -xJvpf SeriousSamAlphaRemake_v1.5.tar.xz 
mkdir ~/.local/share/Serious-Engine/serioussam/Mods
cp -vfr Mods/* ~/.local/share/Serious-Engine/serioussam/Mods
rm -rf Mods

Getting XPLUS Data

wget https://archive.org/download/sam-tfe-xplus/SamTFE-XPLUS.tar.xz

wget https://archive.org/download/sam-tse-xplus/SamTSE-XPLUS.tar.xz

or

for var in a b c; do wget https://github.com/tx00100xt/serioussam-mods/raw/main/SamTFE-XPLUS/SamTFE-XPLUS.tar.xz.parta$var; done; cat SamTFE-XPLUS.tar.xz.part* > SamTFE-XPLUS.tar.xz

for var in a b c; do wget https://github.com/tx00100xt/serioussam-mods/raw/main/SamTSE-XPLUS/SamTSE-XPLUS.tar.xz.parta$var; done; cat SamTSE-XPLUS.tar.xz.part* > SamTSE-XPLUS.tar.xz
tar -xJvpf SamTFE-XPLUS.tar.xz
cp -vfr Mods/* ~/.local/share/Serious-Engine/serioussam/Mods
rm -rf Mods
tar -xJvpf SamTSE-XPLUS.tar.xz
mkdir ~/.local/share/Serious-Engine/serioussamse/Mods
cp -vfr Mods/* ~/.local/share/Serious-Engine/serioussamse/Mods
rm -rf Mods

Game resources

To start the game, you'll need the original resurces of a licensed copy of Serious Sam: The First Encounter and Serious Sam: The Second Encounter.

Steam version.

If you have a digital copy of the game on Steam then the resources can be found in ~/.local/share/Steam/steamapps/common/Serious Sam Classic The Second Encounter/ (the default Steam game installation directory on Linux).

rsync --progress -rh "$HOME/.local/share/Steam/steamapps/common/Serious Sam Classic The First Encounter/" "$HOME/.local/share/Serious-Engine/serioussam"
rsync --progress -rh "$HOME/.local/share/Steam/steamapps/common/Serious Sam Classic The Second Encounter/" "$HOME/.local/share/Serious-Engine/serioussamse"

GOG version.

If you bought a digital on GOG, you can unpack the resources with the innoextract CLI tool. To install innoextract via your package manager, run:

sudo apt-get install innoextract

Copy files "setup_serious_sam_the_first_encounter_2.0.0.10.exe" and "setup_serious_sam_the_second_encounter_2.1.0.8.exe" to a home directory and run the following commands:

cd ~/.
innoextract --gog setup_serious_sam_the_first_encounter_2.0.0.10.exe
rm -rf app/Bin
cp -vfr app/* ~/.local/share/Serious-Engine/serioussam
rm setup_serious_sam_the_first_encounter_2.0.0.10.exe
rm -rf app
rm -rf tmp
innoextract --gog setup_serious_sam_the_second_encounter_2.1.0.8.exe
rm -rf app/Bin
cp -vfr app/* ~/.local/share/Serious-Engine/serioussamse
rm setup_serious_sam_the_first_encounter_2.0.0.10.exe
rm -rf app
rm -rf tmp
rm -rf commonappdata

Physical version.

If you bought a physical copy of the game and you have an ISO of your disk, you can unpack the resources with the any archive manager. Game resources are located in the Install directory of the disk. Just copy all content from there to directories ~/.local/share/Serious-Engine/serioussam and ~/.local/share/Serious-Engine/serioussamse, respectively, for games Serious Sam: The First Encounter and Serious Sam: The Second Encounter.

Launching the game.

To start the game type in consolet:

serioussam

or

serioussamse

You can also use the launch of the game through the menu. After installing the packages and copying all the data, you can check what we got.

alpha2

⚠️ **GitHub.com Fallback** ⚠️