Unverified Commit 2d867a95 authored by TomaSajt's avatar TomaSajt
Browse files

hypseus-singe: init at 2.11.3

parent b4b9c47c
Loading
Loading
Loading
Loading
+87 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,

  cmake,
  makeWrapper,
  pkg-config,

  bash,
  SDL2,
  SDL2_image,
  SDL2_ttf,
  libmpeg2,
  libvorbis,
  libzip,
  libX11,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "hypseus-singe";
  version = "2.11.3";

  src = fetchFromGitHub {
    owner = "DirtBagXon";
    repo = "hypseus-singe";
    rev = "refs/tags/v${finalAttrs.version}";
    hash = "sha256-hLl+/tJrBXo6m/cJxmn2bSLXcNLM8B6SKrM702Z8K8E=";
  };

  patches = [ ./use-shared-mpeg2.patch ];

  strictDeps = true;

  nativeBuildInputs = [
    cmake
    makeWrapper
    pkg-config
  ];

  buildInputs =
    [
      bash
      SDL2
      SDL2_image
      SDL2_ttf
      libmpeg2
      libvorbis
      libzip
    ]
    ++ lib.optionals stdenv.hostPlatform.isLinux [
      libX11
    ];

  env.NIX_CFLAGS_COMPILE = toString [
    "-I${lib.getDev SDL2_image}/include/SDL2"
    "-I${lib.getDev SDL2_ttf}/include/SDL2"
  ];

  preConfigure = ''
    cd src
  '';

  installPhase = ''
    runHook preInstall

    install -Dm755 hypseus $out/bin/hypseus.bin
    cd ../..
    install -Dm755 scripts/run.sh $out/bin/hypseus
    install -Dm755 scripts/singe.sh $out/bin/singe

    substituteInPlace $out/bin/{hypseus,singe} \
        --replace-fail "/bin/cat" "cat" \
        --replace-fail hypseus.bin $out/bin/hypseus.bin

    runHook postInstall
  '';

  meta = {
    description = "Laserdisc game emulator, the SDL2 version of Daphne and Singe";
    homepage = "https://github.com/DirtBagXon/hypseus-singe";
    license = lib.licenses.gpl3Only;
    mainProgram = "hypseus";
    maintainers = with lib.maintainers; [ tomasajt ];
    platforms = lib.platforms.all;
  };
})
+59 −0
Original line number Diff line number Diff line
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6a85063..73dbd39 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -50,13 +50,12 @@ include(GetGitRevisionDescription)
 include(InstallRequiredSystemLibraries)
 include(FindPkgConfig)
 include(ExternalProject)
-include(BuildLibMPEG2)
 
 use_cxx11( )
 
 PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
 PKG_SEARCH_MODULE(SDL2_TTF REQUIRED SDL2_ttf)
-build_libmpeg2( )
+PKG_SEARCH_MODULE(MPEG2 REQUIRED libmpeg2)
 
 message(STATUS "Target: ${CMAKE_SYSTEM_NAME} ${CMAKE_TARGET_ARCHITECTURES}")
 
@@ -110,7 +109,6 @@ add_subdirectory(timer)
 add_subdirectory(video)
 add_subdirectory(vldp)
 
-add_dependencies( vldp libmpeg2 )
 add_dependencies( ldp-out vldp )
 add_dependencies( game vldp )
 add_dependencies( sound vldp )
diff --git a/src/vldp/vldp_internal.cpp b/src/vldp/vldp_internal.cpp
index 16a74cb..2605011 100644
--- a/src/vldp/vldp_internal.cpp
+++ b/src/vldp/vldp_internal.cpp
@@ -40,9 +40,9 @@
 #include <plog/Log.h>
 
 #include <inttypes.h>
-
+extern "C" {
 #include <mpeg2.h>
-
+}
 #ifdef VLDP_DEBUG
 #define FRAMELOG "frame_report.txt"
 #endif
diff --git a/src/vldp/vldp_internal.h b/src/vldp/vldp_internal.h
index 88450e9..1ea83ef 100644
--- a/src/vldp/vldp_internal.h
+++ b/src/vldp/vldp_internal.h
@@ -26,9 +26,9 @@
 #define VLDP_INTERNAL_H
 
 #include "vldp.h" // for the VLDP_BOOL definition and SDL.h
-
+extern "C" {
 #include <mpeg2.h>
-
+}
 // this is which version of the .dat file format we are using
 #define DAT_VERSION 3