Skip to content

Commit

Permalink
{serious-sam-classic,serious-sam-classic-vulkan}: init at 1.10.6b
Browse files Browse the repository at this point in the history
Co-Authored-By: Victor Engmark <[email protected]>
  • Loading branch information
TheBrainScrambler and l0b0 committed Nov 26, 2024
1 parent f792ec7 commit 5764be8
Show file tree
Hide file tree
Showing 6 changed files with 260 additions and 0 deletions.
102 changes: 102 additions & 0 deletions pkgs/by-name/se/serious-sam-classic/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{
pname ? "serious-sam-classic",

lib,

bison,
cmake,
fetchFromGitHub,
flex,
imagemagick,
libogg,
libvorbis,
makeWrapper,
nasm,
SDL2,
stdenv,
vulkan-headers,
vulkan-loader,
zlib,
}:
let
pnameRepos = {
"serious-sam-classic-vulkan" = "SeriousSamClassic-VK";
"serious-sam-classic" = "SeriousSamClassic";
};
pnameHash = {
"serious-sam-classic-vulkan" = "sha256-nPmxGnMjaYPTnQYxbGEMGaW/6eRr1Smr5SmFRWsrdQs=";
"serious-sam-classic" = "sha256-GjV42HQuodWIHc5CFMaE6muc6lJm1eetKrUDWVXTK5I=";
};
in
stdenv.mkDerivation (finalAttrs: {
inherit pname;

version = "1.10.6b";

src = fetchFromGitHub {
owner = "tx00100xt";
repo = pnameRepos."${pname}";
rev = finalAttrs.version;
hash = pnameHash."${pname}";
};

patches = [
./tfe-fix-cmake-libdir-override.patch
./tse-fix-cmake-libdir-override.patch
./tfe-force-using-system-path.patch
./tse-force-using-system-path.patch
];

postPatch = ''
substituteInPlace SamTFE/Sources/CMakeLists.txt --replace "-march=native" "-mtune=generic"
substituteInPlace SamTSE/Sources/CMakeLists.txt --replace "-march=native" "-mtune=generic"
'';

nativeBuildInputs = [
makeWrapper
cmake
imagemagick
bison
flex
nasm
] ++ lib.optionals (pname == "serious-sam-classic-vulkan") [ vulkan-headers ];

buildInputs = [
SDL2
zlib
libogg
libvorbis
] ++ lib.optionals (pname == "serious-sam-classic-vulkan") [ vulkan-loader ];

# I've tried to use patchelf --add-needed and --add-rpath with libvorbis, didn't work
postInstall = ''
wrapProgram $out/bin/serioussam --suffix LD_LIBRARY_PATH : ${libvorbis}/lib
wrapProgram $out/bin/serioussamse --suffix LD_LIBRARY_PATH : ${libvorbis}/lib
'';

meta = {
homepage = "https://github.com/tx00100xt/${finalAttrs.src.repo}";
description = "Open source game engine version developed by Croteam for Serious Sam Classic";
longDescription = ''
Note: This package allows to run both Serious Sam: The First Encounter (serioussam)
and The Second Encounter (serioussamse).
For serioussam you must copy all the assets of the original games into
~/.local/share/Serious-Engine/serioussam for serioussam and
~/.local/share/Serious-Engine/serioussamse for serioussamse.
Look at
https://github.com/tx00100xt/${finalAttrs.src.repo}/wiki/How-to-building-a-package-for-Debian-or-Ubuntu.md#game-resources
for instructions on how to do that.
For both games you must also copy the files SE1_10b.gro and ModEXT.txt into the assets.
For serioussam:
- https://raw.githubusercontent.com/tx00100xt/${finalAttrs.src.repo}/${finalAttrs.src.rev}/SamTFE/ModEXT.txt
- https://raw.githubusercontent.com/tx00100xt/${finalAttrs.src.repo}/${finalAttrs.src.rev}/SamTFE/SE1_10b.gro
For serioussamse:
- https://raw.githubusercontent.com/tx00100xt/${finalAttrs.src.repo}/${finalAttrs.src.rev}/SamTSE/ModEXT.txt
- https://raw.githubusercontent.com/tx00100xt/${finalAttrs.src.repo}/${finalAttrs.src.rev}/SamTSE/SE1_10b.gro
'';
license = lib.licenses.gpl2Only;
platforms = lib.platforms.linux;
maintainers = [ lib.maintainers.l0b0 ];
};
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/SamTFE/Sources/CMakeLists.txt b/SamTFE/Sources/CMakeLists.txt
index 956518b..76308f2 100644
--- a/SamTFE/Sources/CMakeLists.txt
+++ b/SamTFE/Sources/CMakeLists.txt
@@ -221,10 +221,10 @@ endif (LINUX)
message(STATUS "Operating system name: ${CMAKE_OS_NAME}")

set(CMAKE_ARCH_BITS 32)
-set(CMAKE_INSTALL_LIBDIR "/usr/lib")
+#set(CMAKE_INSTALL_LIBDIR "/usr/lib")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CMAKE_ARCH_BITS 64)
- set(CMAKE_INSTALL_LIBDIR "/usr/lib64")
+ #set(CMAKE_INSTALL_LIBDIR "/usr/lib64")
endif()

message(STATUS "Arch bits: ${CMAKE_ARCH_BITS}")
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
diff --git a/SamTFE/Sources/Engine/Engine.cpp b/SamTFE/Sources/Engine/Engine.cpp
index 6febab8..5963e34 100644
--- a/SamTFE/Sources/Engine/Engine.cpp
+++ b/SamTFE/Sources/Engine/Engine.cpp
@@ -742,53 +742,8 @@
CPrintF(TRANSV("Running %d-bit version\n"), sys_iGameBits);

#ifdef PLATFORM_UNIX
-#if defined(__OpenBSD__) || defined(__FreeBSD__)
- int _isystempath = strncmp((const char *)strExePath, (const char *) "/usr/local/bin/", (size_t) 15 );
-#elif defined(__NetBSD__)
- int _isystempath = strncmp((const char *)strExePath, (const char *) "/usr/pkg/bin/", (size_t) 13 );
-#else
- int _isystempath = strncmp((const char *)strExePath, (const char *) "/usr/bin/", (size_t) 9 );
-#endif
- if( _isystempath == 0 ) {
- sys_iSysPath = 1; // using system path
- } else {
- sys_iSysPath = 0; // using standarted path
- }
-
- // get library path for mods
- _fnmModLibPath = "";
-#if defined(__OpenBSD__) || defined(__FreeBSD__)
- if( sys_iSysPath == 1 ) {
- _fnmModLibPath = "/usr/local/lib/" + strGameID + "/";
-#elif defined(__NetBSD__)
- if( sys_iSysPath == 1 ) {
- _fnmModLibPath = "/usr/pkg/lib/" + strGameID + "/";
-#else
- if( sys_iSysPath == 1 && sys_iGameBits == 64 && _pFileSystem->IsDirectory((const char *) "/usr/lib/aarch64-linux-gnu/" + strGameID)) {
- _fnmModLibPath = "/usr/lib/aarch64-linux-gnu/" + strGameID + "/";
- } else if( sys_iSysPath == 1 && sys_iGameBits == 32 && _pFileSystem->IsDirectory((const char *) "/usr/lib/arm-linux-gnueabihf/" + strGameID)) {
- _fnmModLibPath = "/usr/lib/arm-linux-gnueabihf/" + strGameID + "/";
- } else if( sys_iSysPath == 1 && sys_iGameBits == 64 && _pFileSystem->IsDirectory((const char *) "/usr/lib/riscv64-linux-gnu/" + strGameID)) {
- _fnmModLibPath = "/usr/lib/riscv64-linux-gnu/" + strGameID + "/";
- } else if( sys_iSysPath == 1 && sys_iGameBits == 64 && _pFileSystem->IsDirectory((const char *) "/usr/lib/s390x-linux-gnu/" + strGameID)) {
- _fnmModLibPath = "/usr/lib/s390x-linux-gnu/" + strGameID + "/";
- } else if( sys_iSysPath == 1 && sys_iGameBits == 64 && _pFileSystem->IsDirectory((const char *) "/usr/lib/powerpc64-linux-gnu/" + strGameID)) {
- _fnmModLibPath = "/usr/lib/powerpc64-linux-gnu/" + strGameID + "/";
- } else if( sys_iSysPath == 1 && sys_iGameBits == 64 && _pFileSystem->IsDirectory((const char *) "/usr/lib/x86_64-linux-gnu/" + strGameID)) {
- _fnmModLibPath = "/usr/lib/x86_64-linux-gnu/" + strGameID + "/";
- } else if( sys_iSysPath == 1 && sys_iGameBits == 32 && _pFileSystem->IsDirectory((const char *) "/usr/lib/i386-linux-gnu/" + strGameID)) {
- _fnmModLibPath = "/usr/lib/i386-linux-gnu/" + strGameID + "/";
- } else if( sys_iSysPath == 1 && sys_iGameBits == 64 && _pFileSystem->IsDirectory((const char *) "/usr/lib64/" + strGameID)) {
- _fnmModLibPath = "/usr/lib64/" + strGameID + "/";
- } else if( sys_iSysPath == 1 && sys_iGameBits == 32 && _pFileSystem->IsDirectory((const char *) "/usr/lib//" + strGameID)) {
- _fnmModLibPath = "/usr/lib/" + strGameID + "/";
-#endif
- } else if( sys_iSysPath == 0 ) {
- _fnmModLibPath = _fnmApplicationPath;
- } else {
- CPrintF(TRANSV("ERROR: Game libraries not ound!\n"));
- FatalError(TRANSV("Failed to search game libraries installed!\nPlease reinstall the game.\nSee the log for more details.\nGame log is here: ~/.local/share/Serious-Engine/%s/SeriousSam.log"),(const char *) strGameID);
- }
+ sys_iSysPath = 1; // using system path
+ _fnmModLibPath = _fnmApplicationPath + "lib/" + strGameID + "/";

if( sys_iSysPath == 1 ) { // search game data
CTFileName _fnm_usr_TestFile, _fnm_local_TestFile, _fnm_home_TestFile;
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/SamTSE/Sources/CMakeLists.txt b/SamTSE/Sources/CMakeLists.txt
index 956518b..76308f2 100644
--- a/SamTSE/Sources/CMakeLists.txt
+++ b/SamTSE/Sources/CMakeLists.txt
@@ -221,10 +221,10 @@ endif (LINUX)
message(STATUS "Operating system name: ${CMAKE_OS_NAME}")

set(CMAKE_ARCH_BITS 32)
-set(CMAKE_INSTALL_LIBDIR "/usr/lib")
+#set(CMAKE_INSTALL_LIBDIR "/usr/lib")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CMAKE_ARCH_BITS 64)
- set(CMAKE_INSTALL_LIBDIR "/usr/lib64")
+ #set(CMAKE_INSTALL_LIBDIR "/usr/lib64")
endif()

message(STATUS "Arch bits: ${CMAKE_ARCH_BITS}")
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
diff --git a/SamTSE/Sources/Engine/Engine.cpp b/SamTSE/Sources/Engine/Engine.cpp
index 6febab8..5963e34 100644
--- a/SamTSE/Sources/Engine/Engine.cpp
+++ b/SamTSE/Sources/Engine/Engine.cpp
@@ -742,53 +742,8 @@
CPrintF(TRANSV("Running %d-bit version\n"), sys_iGameBits);

#ifdef PLATFORM_UNIX
-#if defined(__OpenBSD__) || defined(__FreeBSD__)
- int _isystempath = strncmp((const char *)strExePath, (const char *) "/usr/local/bin/", (size_t) 15 );
-#elif defined(__NetBSD__)
- int _isystempath = strncmp((const char *)strExePath, (const char *) "/usr/pkg/bin/", (size_t) 13 );
-#else
- int _isystempath = strncmp((const char *)strExePath, (const char *) "/usr/bin/", (size_t) 9 );
-#endif
- if( _isystempath == 0 ) {
- sys_iSysPath = 1; // using system path
- } else {
- sys_iSysPath = 0; // using standarted path
- }
-
- // get library path for mods
- _fnmModLibPath = "";
-#if defined(__OpenBSD__) || defined(__FreeBSD__)
- if( sys_iSysPath == 1 ) {
- _fnmModLibPath = "/usr/local/lib/" + strGameID + "/";
-#elif defined(__NetBSD__)
- if( sys_iSysPath == 1 ) {
- _fnmModLibPath = "/usr/pkg/lib/" + strGameID + "/";
-#else
- if( sys_iSysPath == 1 && sys_iGameBits == 64 && _pFileSystem->IsDirectory((const char *) "/usr/lib/aarch64-linux-gnu/" + strGameID)) {
- _fnmModLibPath = "/usr/lib/aarch64-linux-gnu/" + strGameID + "/";
- } else if( sys_iSysPath == 1 && sys_iGameBits == 32 && _pFileSystem->IsDirectory((const char *) "/usr/lib/arm-linux-gnueabihf/" + strGameID)) {
- _fnmModLibPath = "/usr/lib/arm-linux-gnueabihf/" + strGameID + "/";
- } else if( sys_iSysPath == 1 && sys_iGameBits == 64 && _pFileSystem->IsDirectory((const char *) "/usr/lib/riscv64-linux-gnu/" + strGameID)) {
- _fnmModLibPath = "/usr/lib/riscv64-linux-gnu/" + strGameID + "/";
- } else if( sys_iSysPath == 1 && sys_iGameBits == 64 && _pFileSystem->IsDirectory((const char *) "/usr/lib/s390x-linux-gnu/" + strGameID)) {
- _fnmModLibPath = "/usr/lib/s390x-linux-gnu/" + strGameID + "/";
- } else if( sys_iSysPath == 1 && sys_iGameBits == 64 && _pFileSystem->IsDirectory((const char *) "/usr/lib/powerpc64-linux-gnu/" + strGameID)) {
- _fnmModLibPath = "/usr/lib/powerpc64-linux-gnu/" + strGameID + "/";
- } else if( sys_iSysPath == 1 && sys_iGameBits == 64 && _pFileSystem->IsDirectory((const char *) "/usr/lib/x86_64-linux-gnu/" + strGameID)) {
- _fnmModLibPath = "/usr/lib/x86_64-linux-gnu/" + strGameID + "/";
- } else if( sys_iSysPath == 1 && sys_iGameBits == 32 && _pFileSystem->IsDirectory((const char *) "/usr/lib/i386-linux-gnu/" + strGameID)) {
- _fnmModLibPath = "/usr/lib/i386-linux-gnu/" + strGameID + "/";
- } else if( sys_iSysPath == 1 && sys_iGameBits == 64 && _pFileSystem->IsDirectory((const char *) "/usr/lib64/" + strGameID)) {
- _fnmModLibPath = "/usr/lib64/" + strGameID + "/";
- } else if( sys_iSysPath == 1 && sys_iGameBits == 32 && _pFileSystem->IsDirectory((const char *) "/usr/lib//" + strGameID)) {
- _fnmModLibPath = "/usr/lib/" + strGameID + "/";
-#endif
- } else if( sys_iSysPath == 0 ) {
- _fnmModLibPath = _fnmApplicationPath;
- } else {
- CPrintF(TRANSV("ERROR: Game libraries not ound!\n"));
- FatalError(TRANSV("Failed to search game libraries installed!\nPlease reinstall the game.\nSee the log for more details.\nGame log is here: ~/.local/share/Serious-Engine/%s/SeriousSam.log"),(const char *) strGameID);
- }
+ sys_iSysPath = 1; // using system path
+ _fnmModLibPath = _fnmApplicationPath + "lib/" + strGameID + "/";

if( sys_iSysPath == 1 ) { // search game data
CTFileName _fnm_usr_TestFile, _fnm_local_TestFile, _fnm_home_TestFile;
4 changes: 4 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15762,6 +15762,10 @@ with pkgs;
stdenv = if stdenv.hostPlatform.isDarwin then overrideSDK llvmPackages.stdenv "11.0" else llvmPackages.stdenv;
};

serious-sam-classic-vulkan = callPackage ../by-name/se/serious-sam-classic/package.nix {
pname = "serious-sam-classic-vulkan";
};

super-slicer = darwin.apple_sdk_11_0.callPackage ../applications/misc/prusa-slicer/super-slicer.nix { };

super-slicer-beta = super-slicer.beta;
Expand Down

0 comments on commit 5764be8

Please sign in to comment.