Page 2 of 2

Re: NixOS Package

Posted: Thu Sep 19, 2024 6:41 pm
by dragonlord
That's really not nice. It's a security feature to avoid file corruption and tampering. But you could disable the checks in if nothing helps:
- https://github.com/LordOfDragons/dragen ... e.cpp#L548
- https://github.com/LordOfDragons/dragen ... n.cpp#L390
You would need to disable the entire if-blocks there to avoid the file based exception.

Re: NixOS Package

Posted: Thu Sep 19, 2024 6:46 pm
by gale_username
Is there a way I could generate the manifest files separate from the main build step after the modules have been patched?

Re: NixOS Package

Posted: Fri Sep 20, 2024 9:20 am
by dragonlord
The manifest files are XML files. You can use an XML library to load, edit and save them. Most probably simpler would be using an XSLT processor to alter a specific tag content. "xsltproc" is the usual command line tool to do this.

Re: NixOS Package

Posted: Sun Sep 29, 2024 10:41 am
by dragonlord
So is it now all working as expected? Anything I should upstream or not?

Re: NixOS Package

Posted: Tue Oct 29, 2024 10:24 pm
by gale_username
I ended up not using dragengine, but got a fair amount working. Will post what I had below for others to reference:

dragengine:

Code: Select all

{
  lib,
  stdenv,
  fetchgit,
  symlinkJoin,
  scons,
  autoPatchelfHook,
  ensureNewerSourcesForZipFilesHook,
  zlib,
  libpng,
  libjpeg,
  openal,
  openvr,
  libogg,
  libvorbis,
  libtheora,
  fox,
  dragonscript,
  libevdev,
  soundtouch,
  libvpx,
  libwebp,
  libwebm,
  openxr-loader,
  liburing,
  xorg,
  libGL,
  vulkan-loader,
  libpulseaudio,
  alsa-lib,
  portaudio,
}:
stdenv.mkDerivation (finalAttrs: {
  pname = "dragengine";
  # Next release after this commit can be used once it's out.
  version = "f783fbe179d6b828102f0837526e5a9052ee0984";

  src = fetchgit {
    url = "https://github.com/LordOfDragons/dragengine.git";
    rev = finalAttrs.version;
    hash = "sha256-FlozWfQOwFTJKBTD+fFIfVQb/bFx7zwhsC7h0ejYqs8=";
    fetchLFS = true;
  };

  patches = [
    # The checks will fail, because of patchelf.
    ./disable-lib-file-size-checks.patch
  ];

  buildInputs = [
    zlib
    libpng
    libjpeg
    openal
    libogg
    libvorbis
    libtheora
    fox
    dragonscript
    libevdev
    soundtouch
    libwebp
    libwebm
    libvpx
    liburing
    openvr
    openxr-loader
    xorg.libX11
    xorg.xorgproto
    xorg.libXrender
    xorg.libXrandr
    xorg.libXi
    xorg.libXext
    xorg.libXfixes
    libGL
    vulkan-loader

    libpulseaudio
    alsa-lib
    portaudio
  ];
  nativeBuildInputs = [
    scons
    autoPatchelfHook
    ensureNewerSourcesForZipFilesHook
  ];

  # These flags are largely based on
  # https://github.com/LordOfDragons/dragengine/blob/master/.github/workflows/custom_linux.py
  sconsFlags = [
    "with_system_zlib=yes"
    "with_system_libpng=yes"
    "with_system_libapng=yes"
    "with_system_libjpeg=yes"
    "with_system_openal=yes"
    "with_openal_backends=alsa,pulseaudio,portaudio,oss"
    "with_system_libogg=yes"
    "with_system_libvorbis=yes"
    "with_system_libtheora=yes"
    "with_system_fox=yes"
    "with_system_dragonscript=yes"
    "with_system_libevdev=yes"
    "with_system_soundtouch=yes"
    "with_system_libwebp=yes"
    "with_system_libwebm=yes"
    "with_system_libvpx=yes"
    "with_system_liburing=yes"
    "with_system_openvr=yes"
    "with_system_openxr=yes"
    "with_opengl=yes"
    "with_dl=yes"
    "with_pthread=yes"
    "with_x=yes"
    # Disable game store sdks for now.
    "build_service_steamsdk=no"
    "build_service_eossdk=no"
    "build_service_modio=no"

    # Modules
    "build_audio_openal=yes"
    "build_cr_basic=yes"
    "build_graphics_opengl=yes"
    "build_image_png=yes"
    "build_image_png3d=yes"
    "build_image_jpeg=yes"
    "build_image_webp=yes"
    "build_input_x=yes"
    "build_input_w32=no"
    "build_input_beos=no"
    "build_input_macos=no"
    "build_input_android=no"
    "build_physics_bullet=yes"
    "build_script_ds=yes"
    "build_script_python=no"
    "build_script_smalltalk=no"
    "build_sound_ogg=yes"
    "build_video_theora=yes"
    "build_video_apng=yes"
    "build_guilauncher=yes"
    "build_plugin_npapi=no"
    "build_launcher_android=no"
    "build_archive_delga=yes"
    "build_vr_openvr=yes"
    "build_vr_openxr=yes"

    # IGDE
    "build_igde=yes"
    "igde_toolkit=fox"
    "build_editor_animator=yes"
    "build_editor_conversation=yes"
    "build_editor_font=yes"
    "build_editor_gamedefinition=yes"
    "build_editor_langpack=yes"
    "build_editor_particleemitter=yes"
    "build_editor_rig=yes"
    "build_editor_skin=yes"
    "build_editor_sky=yes"
    "build_editor_speechanimation=yes"
    "build_editor_synthesizer=yes"
    "build_editor_world=yes"
  ];

  CPPFLAGS = let
    includes = symlinkJoin {
      name = "dragengine-includes";
      paths = [
        zlib.dev
        libpng.dev
        libjpeg.dev
        openal
        libogg.dev
        libvorbis.dev
        libtheora.dev
        fox
        dragonscript
        libevdev
        soundtouch
        libwebp
        libwebm
        libvpx.dev
        liburing.dev
        openvr
        openxr-loader.dev
        xorg.libX11.dev
        xorg.xorgproto
        xorg.libXrender.dev
        xorg.libXrandr.dev
        xorg.libXi.dev
        xorg.libXext.dev
        xorg.libXfixes.dev
        libGL.dev
        vulkan-loader.dev
      ];
    };
  in "-I${includes}/include";

  LDFLAGS = let
    libs = symlinkJoin {
      name = "dragengine-libs ";
      paths = [
        zlib.out
        libpng.out
        libjpeg.out
        openal
        libogg.out
        libvorbis.out
        libtheora.out
        fox
        dragonscript
        libevdev
        soundtouch
        libwebp
        libwebm
        libvpx.out
        liburing.out
        openvr
        openxr-loader.out
        xorg.libX11.out
        xorg.xorgproto
        xorg.libXrender.out
        xorg.libXrandr.out
        xorg.libXi.out
        xorg.libXext.out
        xorg.libXfixes.out
        libGL.out
        vulkan-loader.out
      ];
    };
  in "-L${libs}/lib";

  enableParallelBuilding = true;

  strictDeps = true;

  meta = {
    description = "A free software game engine focusing on developing games faster, more modular and stable with true -1 day portability support";
    homepage = "https://dragondreams.ch/index.php/dragengine/";
    license = lib.licenses.mit;
    mainProgram = "delauncher";
  };
})

disable-lib-file-size-checks.patch:

Code: Select all

diff --git a/src/deigde/deigde/src/module/igdeEditorModuleDefinition.cpp b/src/deigde/deigde/src/module/igdeEditorModuleDefinition.cpp
index 908bcb906..4d7a1404c 100644
--- a/src/deigde/deigde/src/module/igdeEditorModuleDefinition.cpp
+++ b/src/deigde/deigde/src/module/igdeEditorModuleDefinition.cpp
@@ -386,11 +386,11 @@ void igdeEditorModuleDefinition::pVerify(){
 	}
 	
 	// check that the file size matches the one specified
-	if( fs.st_size != pLibSize ){
-		pErrorCode = eecLibFileSizeMismatch;
-		pCanLoad = false;
-		return;
-	}
+	// if( fs.st_size != pLibSize ){
+	// 	pErrorCode = eecLibFileSizeMismatch;
+	// 	pCanLoad = false;
+	// 	return;
+	// }
 	
 	// check that the sha1 sum is the same
 	
diff --git a/src/dragengine/src/systems/modules/deLibraryModule.cpp b/src/dragengine/src/systems/modules/deLibraryModule.cpp
index f551b0a67..9045f3af4 100644
--- a/src/dragengine/src/systems/modules/deLibraryModule.cpp
+++ b/src/dragengine/src/systems/modules/deLibraryModule.cpp
@@ -544,10 +544,10 @@ bool deLibraryModule::pVerifyLibrary( const char* filename ){
 	}
 	
 	// check that the file size matches the one specified
-	if( fs.st_size != pLibFileSize ){
-		SetErrorCode( eecLibFileSizeMismatch );
-		return false;
-	}
+	// if( fs.st_size != pLibFileSize ){
+	// 	SetErrorCode( eecLibFileSizeMismatch );
+	// 	return false;
+	// }
 #endif
 	
 	// check that the sha1 sum is the same

dragonscript:

Code: Select all

{
  lib,
  stdenv,
  fetchgit,
  scons,
  

}:
stdenv.mkDerivation (finalAttrs: {
  pname = "dragonscript";
  # Need changes that aren't in a release yet for dragengine.
  version = "cfe9e5fad17bb7cf309ec24ac01794f27dd89b86";

  src = fetchgit {
    url = "https://github.com/LordOfDragons/dragonscript";
    rev = finalAttrs.version;
    hash = "sha256-3XOY0qavZbFTv7257MQmX5U14BcUZQTORQ+zxqrRdmI=";
  };
  nativeBuildInputs = [scons];

  meta = {
    description = "DragonScript Script Language";
    homepage = "https://lordofdragons.github.io/dragonscript/";
    license = lib.licenses.lgpl3;
  };
})

libwebm:

Code: Select all

{
  lib,
  stdenv,
  fetchgit,
  cmake,
}:
stdenv.mkDerivation rec {
  pname = "libwebm";
  version = "1.0.0.31";
  src = fetchgit {
    url = "https://chromium.googlesource.com/webm/libwebm";
    rev = "libwebm-${version}";
    hash = "sha256-+ayX33rcX/jkewsW8WrGalTe9X44qFBHOrIYTteOQzc=";
  };
  nativeBuildInputs = [
    cmake
  ];
  cmakeFlags = [
    "-DENABLE_WEBM_PARSER=ON"
  ];
  meta.license = lib.licenses.bsd3;
}


Re: NixOS Package

Posted: Wed Oct 30, 2024 3:31 pm
by dragonlord
gale_username wrote: Tue Oct 29, 2024 10:24 pm I ended up not using dragengine, but got a fair amount working...
Can you quickly explain the reasons for not using it so I can improve in the future?

Re: NixOS Package

Posted: Wed Oct 30, 2024 10:40 pm
by gale_username
I wasn't planning on using it much, so the extra effort to get it working wasn't worth it.

Re: NixOS Package

Posted: Thu Oct 31, 2024 1:17 pm
by dragonlord
gale_username wrote: Wed Oct 30, 2024 10:40 pm I wasn't planning on using it much, so the extra effort to get it working wasn't worth it.
I see. I guess NixOS is quite special in the way packaging works to cause that many troubles.