-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add odin with system raylib and add nixpkgs-master
Add nixpkgs-master to flake inputs Rename test branch to custom Add odin with a patch to use raylib from the system (can remove patch if odin pr closes (odin-lang/Odin#4619)
- Loading branch information
1 parent
c56e74f
commit 7aa06cd
Showing
6 changed files
with
249 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
diff --git a/vendor/raylib/raygui.odin b/vendor/raylib/raygui.odin | ||
index a15467ae8..89c1483a0 100644 | ||
--- a/vendor/raylib/raygui.odin | ||
+++ b/vendor/raylib/raygui.odin | ||
@@ -2,28 +2,8 @@ package raylib | ||
|
||
import "core:c" | ||
|
||
-RAYGUI_SHARED :: #config(RAYGUI_SHARED, false) | ||
- | ||
-when ODIN_OS == .Windows { | ||
- foreign import lib { | ||
- "windows/rayguidll.lib" when RAYGUI_SHARED else "windows/raygui.lib", | ||
- } | ||
-} else when ODIN_OS == .Linux { | ||
- foreign import lib { | ||
- "linux/libraygui.so" when RAYGUI_SHARED else "linux/libraygui.a", | ||
- } | ||
-} else when ODIN_OS == .Darwin { | ||
- when ODIN_ARCH == .arm64 { | ||
- foreign import lib { | ||
- "macos-arm64/libraygui.dylib" when RAYGUI_SHARED else "macos-arm64/libraygui.a", | ||
- } | ||
- } else { | ||
- foreign import lib { | ||
- "macos/libraygui.dylib" when RAYGUI_SHARED else "macos/libraygui.a", | ||
- } | ||
- } | ||
-} else { | ||
- foreign import lib "system:raygui" | ||
+foreign import lib { | ||
+ "system:raygui", | ||
} | ||
|
||
RAYGUI_VERSION :: "4.0" | ||
diff --git a/vendor/raylib/raylib.odin b/vendor/raylib/raylib.odin | ||
index a5be660c6..6d1f4d0d9 100644 | ||
--- a/vendor/raylib/raylib.odin | ||
+++ b/vendor/raylib/raylib.odin | ||
@@ -99,36 +99,10 @@ MAX_TEXT_BUFFER_LENGTH :: #config(RAYLIB_MAX_TEXT_BUFFER_LENGTH, 1024) | ||
|
||
#assert(size_of(rune) == size_of(c.int)) | ||
|
||
-RAYLIB_SHARED :: #config(RAYLIB_SHARED, false) | ||
- | ||
-when ODIN_OS == .Windows { | ||
- @(extra_linker_flags="/NODEFAULTLIB:" + ("msvcrt" when RAYLIB_SHARED else "libcmt")) | ||
- foreign import lib { | ||
- "windows/raylibdll.lib" when RAYLIB_SHARED else "windows/raylib.lib" , | ||
- "system:Winmm.lib", | ||
- "system:Gdi32.lib", | ||
- "system:User32.lib", | ||
- "system:Shell32.lib", | ||
- } | ||
-} else when ODIN_OS == .Linux { | ||
- foreign import lib { | ||
- // Note(bumbread): I'm not sure why in `linux/` folder there are | ||
- // multiple copies of raylib.so, but since these bindings are for | ||
- // particular version of the library, I better specify it. Ideally, | ||
- // though, it's best specified in terms of major (.so.4) | ||
- "linux/libraylib.so.550" when RAYLIB_SHARED else "linux/libraylib.a", | ||
- "system:dl", | ||
- "system:pthread", | ||
- } | ||
-} else when ODIN_OS == .Darwin { | ||
- foreign import lib { | ||
- "macos/libraylib.550.dylib" when RAYLIB_SHARED else "macos/libraylib.a", | ||
- "system:Cocoa.framework", | ||
- "system:OpenGL.framework", | ||
- "system:IOKit.framework", | ||
- } | ||
-} else { | ||
- foreign import lib "system:raylib" | ||
+foreign import lib { | ||
+ "system:raylib", | ||
+ "system:dl", | ||
+ "system:pthread", | ||
} | ||
|
||
VERSION_MAJOR :: 5 | ||
diff --git a/vendor/raylib/rlgl/rlgl.odin b/vendor/raylib/rlgl/rlgl.odin | ||
index 9d4682294..f39ea2035 100644 | ||
--- a/vendor/raylib/rlgl/rlgl.odin | ||
+++ b/vendor/raylib/rlgl/rlgl.odin | ||
@@ -112,43 +112,10 @@ import rl "../." | ||
|
||
VERSION :: "5.0" | ||
|
||
-RAYLIB_SHARED :: #config(RAYLIB_SHARED, false) | ||
- | ||
-// Note: We pull in the full raylib library. If you want a truly stand-alone rlgl, then: | ||
-// - Compile a separate rlgl library and use that in the foreign import blocks below. | ||
-// - Remove the `import rl "../."` line | ||
-// - Copy the code from raylib.odin for any types we alias from that package (see PixelFormat etc) | ||
- | ||
-when ODIN_OS == .Windows { | ||
- @(extra_linker_flags="/NODEFAULTLIB:" + ("msvcrt" when RAYLIB_SHARED else "libcmt")) | ||
- foreign import lib { | ||
- "../windows/raylibdll.lib" when RAYLIB_SHARED else "../windows/raylib.lib" , | ||
- "system:Winmm.lib", | ||
- "system:Gdi32.lib", | ||
- "system:User32.lib", | ||
- "system:Shell32.lib", | ||
- } | ||
-} else when ODIN_OS == .Linux { | ||
- foreign import lib { | ||
- // Note(bumbread): I'm not sure why in `linux/` folder there are | ||
- // multiple copies of raylib.so, but since these bindings are for | ||
- // particular version of the library, I better specify it. Ideally, | ||
- // though, it's best specified in terms of major (.so.4) | ||
- "../linux/libraylib.so.500" when RAYLIB_SHARED else "../linux/libraylib.a", | ||
- "system:dl", | ||
- "system:pthread", | ||
- } | ||
-} else when ODIN_OS == .Darwin { | ||
- foreign import lib { | ||
- "../macos" + | ||
- ("-arm64" when ODIN_ARCH == .arm64 else "") + | ||
- "/libraylib" + (".500.dylib" when RAYLIB_SHARED else ".a"), | ||
- "system:Cocoa.framework", | ||
- "system:OpenGL.framework", | ||
- "system:IOKit.framework", | ||
- } | ||
-} else { | ||
- foreign import lib "system:raylib" | ||
+foreign import lib { | ||
+ "system:raygui", | ||
+ "system:dl", | ||
+ "system:pthread", | ||
} | ||
|
||
GRAPHICS_API_OPENGL_11 :: false |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
fetchFromGitHub, | ||
lib, | ||
llvmPackages, | ||
makeBinaryWrapper, | ||
which, | ||
}: let | ||
inherit (llvmPackages) stdenv; | ||
in | ||
stdenv.mkDerivation { | ||
pname = "odin"; | ||
version = "2024-12-06"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "odin-lang"; | ||
repo = "Odin"; | ||
rev = "dev-2024-12"; | ||
hash = "sha256-BkPdVzgbEc3S4eSi5TbFKPzkRGkaJTILN/g9o8hfdEw="; | ||
}; | ||
|
||
patches = [./odin-system-raylib.patch]; | ||
|
||
dontConfigure = true; | ||
LLVM_CONFIG = "${llvmPackages.llvm.dev}/bin/llvm-config"; | ||
|
||
buildFlags = ["release"]; | ||
|
||
nativeBuildInputs = [ | ||
makeBinaryWrapper | ||
which | ||
]; | ||
|
||
postPatch = '' | ||
patchShebangs build_odin.sh | ||
''; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p $out/bin | ||
cp odin $out/bin/odin | ||
mkdir -p $out/share | ||
cp -r {base,core,shared} $out/share | ||
mkdir -p $out/share/vendor/raylib | ||
cp -r vendor/raylib/{rlgl,*.odin} $out/share/vendor/raylib | ||
# make -C "$out/share/vendor/cgltf/src/" | ||
# make -C "$out/share/vendor/stb/src/" | ||
# make -C "$out/share/vendor/miniaudio/src/" | ||
wrapProgram $out/bin/odin \ | ||
--set-default ODIN_ROOT $out/share \ | ||
--prefix PATH : ${ | ||
lib.makeBinPath ( | ||
with llvmPackages; [ | ||
bintools | ||
llvm | ||
clang | ||
lld | ||
] | ||
) | ||
} | ||
runHook postInstall | ||
''; | ||
} |