Last active
April 24, 2022 14:44
-
-
Save superherointj/e8b1774770e20f91b0f1fc32349b729b to your computer and use it in GitHub Desktop.
reason-sdl2.nix => SOLVED => BUILDING FINE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ buildDunePackage, cacert, dune-configurator, fetchFromGitHub, fetchurl, gnused, lib, libGL, libGLU, python3Packages, reason, revery-ui, SDL2, stdenv, writeShellScript, xorg }: | |
let libglad = | |
stdenv.mkDerivation { | |
name = "glad-output-generator-c"; | |
outputHashMode = "recursive"; | |
outputHashAlgo = "sha256"; | |
outputHash = "sha256-5NhLnlqTlN8f5Jplv9ZIKzYdCJe5EVzHL4pr3MLctQE="; | |
builder = writeShellScript "builder.sh" '' | |
${python3Packages.glad}/bin/glad --generator c --out-path $out | |
# Remove line #3 that has moving date. | |
${gnused}/bin/sed -i '3s/.*//' $out/include/glad/glad.h | |
${gnused}/bin/sed -i '3s/.*//' $out/src/glad.c | |
''; | |
SSL_CERT_FILE = "${cacert.out}/etc/ssl/certs/ca-bundle.crt"; | |
}; | |
stb_image = fetchurl { | |
url = "https://raw.githubusercontent.com/nothings/stb/5ba0baaa269b3fd681828e0e3b3ac0f1472eaf40/stb_image.h"; | |
sha256 = "sha256-kfQ14PxqYgAYuHi5hZx03/YNKARvh+ZJGRrW81qYxyI="; | |
}; | |
in | |
buildDunePackage rec { | |
pname = "reason-sdl2"; | |
inherit (revery-ui) version src; | |
postPatch = '' | |
SOURCE_ROOT=$(mktemp -d) | |
cd $SOURCE_ROOT | |
export cur__root="." | |
cp -r ${src}/packages/reason-sdl2/src/* . | |
cp ${src}/reason-sdl2.opam . | |
cp ${stb_image.out} stb_image.h | |
substituteInPlace sdl2_wrapper.cpp \ | |
--replace "case SDL_PANEVENT:" \ | |
"/* case SDL_PANEVENT:" \ | |
--replace "case SDL_DROPTEXT:" \ | |
"*/ case SDL_DROPTEXT:" | |
substituteInPlace sdl2_wrapper.cpp \ | |
--replace "case SDL_WINDOWEVENT_FULLSCREEN:" \ | |
"/* case SDL_WINDOWEVENT_FULLSCREEN:" \ | |
--replace "case SDL_WINDOWEVENT_RESTORED:" \ | |
"*/ case SDL_WINDOWEVENT_RESTORED:" | |
''; | |
SDL2_LIB_PATH=''${(SDL2.override { withStatic = true; }).out}/lib''; | |
SDL2_INCLUDE_PATH="${SDL2.dev}/include/SDL2"; | |
#ANGLE_LIB_PATH=""; # This environment variable likely shouldn't be empty. | |
nativeBuildInputs = [ | |
reason | |
]; | |
buildInputs = [ | |
dune-configurator | |
libGL | |
libglad | |
libGLU | |
SDL2.dev | |
(SDL2.override { withStatic = true; }).out | |
] ++ (with xorg; [ | |
libpthreadstubs | |
libXcursor | |
libXi | |
libXinerama | |
libXrandr | |
libXxf86vm | |
]); | |
# ccopt(libFilePath) # Library to be found yet. | |
meta = with lib; { | |
description = "Ocaml/Reason bindings for SDL2"; | |
homepage = "https://github.com/revery-ui/reason-sdl2"; | |
downloadpage = "https://github.com/revery-ui/revery/tree/master/packages/reason-sdl2/src"; | |
maintainers = with maintainers; [ superherointj ]; | |
license = licenses.mit; | |
}; | |
} |
Found solution:
SDL2_LIB_PATH=''${(SDL2.override { withStatic = true; }).out}/lib'';
SDL2_INCLUDE_PATH="${SDL2.dev}/include/SDL2";
buildInputs = [
(SDL2.override { withStatic = true; }).out
SDL2.dev
];
The error that was blocking here was lack of:
export cur__root="$SOURCE_ROOT"
So I'm now unstuck (from that error).
Need to figure out path issues now.
Current error is:
substitute(): ERROR: file 'sdl2_wrapper.cpp' does not exist
Path issue.
It is building fine!!! Nevermind!!!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Error seems to come from:
https://github.com/revery-ui/revery/blob/master/packages/reason-sdl2/src/config/discover.re