IT'S ALIVE

This commit is contained in:
mtgmonkey
2025-12-16 17:11:10 +01:00
parent 0ef5d0590d
commit 9ee1bc6a7e
14 changed files with 18674 additions and 28108 deletions

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
result
dist-newstyle
cabal.project.local

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "rgfw"]
path = include/RGFW
url = https://github.com/ColleagueRiley/RGFW

29
LICENSE Normal file
View File

@@ -0,0 +1,29 @@
Copyright (c) 2025, andromeda
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

13
cabal.project Normal file
View File

@@ -0,0 +1,13 @@
packages:
./
source-repository-package
type: git
location: https://github.com/well-typed/hs-bindgen.git
tag: 933d11d771ff13b6a3b851cb0ec9bc3632626f2f
subdir: hs-bindgen-runtime
source-repository-package
type: git
location: https://github.com/well-typed/hs-bindgen.git
tag: 933d11d771ff13b6a3b851cb0ec9bc3632626f2f
subdir: c-expr-runtime

8
flake.lock generated
View File

@@ -25,17 +25,17 @@
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1765785261, "lastModified": 1765888948,
"narHash": "sha256-VIoBzgKQCgxJLQQMQ5r3cYpkxlKOTJIexeCCBu+TO4Q=", "narHash": "sha256-rgGAUQVfJ0sKXm9bzh7XIJUHh/JkEsz/LX6k8aCKeD4=",
"owner": "well-typed", "owner": "well-typed",
"repo": "hs-bindgen", "repo": "hs-bindgen",
"rev": "e2af56a0e9f7aebed6104bb1181aa465f2050d29", "rev": "fd74e8fa4216eccd67069ec9d8637b57000ffc83",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "well-typed", "owner": "well-typed",
"ref": "dom/1415/bug-report",
"repo": "hs-bindgen", "repo": "hs-bindgen",
"rev": "fd74e8fa4216eccd67069ec9d8637b57000ffc83",
"type": "github" "type": "github"
} }
}, },

View File

@@ -1,8 +1,8 @@
{ {
inputs = { inputs = {
nixpkgs.url = "nixpkgs/nixpkgs-unstable"; nixpkgs.url = "nixpkgs/nixpkgs-unstable";
# hs-bindgen.url = "github:well-typed/hs-bindgen"; hs-bindgen.url = "github:well-typed/hs-bindgen/fd74e8fa4216eccd67069ec9d8637b57000ffc83";
hs-bindgen.url = "github:well-typed/hs-bindgen/dom/1415/bug-report"; self.submodules = true;
}; };
outputs = { outputs = {
nixpkgs, nixpkgs,
@@ -10,40 +10,68 @@
self, self,
... ...
}: let }: let
version = "0.3.0";
package = {
mkDerivation,
base,
bindings-DSL,
c-expr-runtime,
gl,
hs-bindgen-runtime,
lib,
libGL,
libX11,
xcursor,
xi,
xrandr,
}:
mkDerivation {
pname = "hs-rgfw";
inherit version;
src = ./.;
libraryHaskellDepends = [
base
bindings-DSL
c-expr-runtime
hs-bindgen-runtime
];
libraryPkgconfigDepends = [
gl
libGL
libX11
xcursor
xi
xrandr
];
homepage = "https://git.mtgmonkey.net/Andromeda/hs-rgfw";
license = lib.licenses.bsd3;
platforms = ["x86_64-linux"];
};
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system}; pkgs = import nixpkgs {
inherit system;
overlays = [
hs-bindgen.overlays.libclangBindings
hs-bindgen.overlays.hsBindgen
];
};
in { in {
devShells.${system} = { devShells.${system} = {
default = pkgs.mkShell { default = pkgs.mkShell {
stdenv = pkgs.clangStdenv; stdenv = pkgs.clangStdenv;
packages = [ packages = [
pkgs.pkg-config
pkgs.xorg.libX11
pkgs.xorg.libXcursor
pkgs.xorg.libXrandr
pkgs.xorg.libXi
pkgs.libGL
pkgs.clang pkgs.clang
hs-bindgen.packages.${system}.default pkgs.cabal-install
]; ];
shellHook = '' inputsFrom = [
# template self.packages.${system}.default
# export BINDGEN_EXTRA_CLANG_ARGS="$BINDGEN_EXTRA_CLANG_ARGS " ];
};
# c flags from Nix };
export BINDGEN_EXTRA_CLANG_ARGS="$BINDGEN_EXTRA_CLANG_ARGS $(cat ${pkgs.clang}/nix-support/cc-cflags) $(cat ${pkgs.clang}/nix-support/libc-cflags) $NIX_CFLAGS_COMPILE" packages.${system} = {
default = pkgs.haskellPackages.callPackage package {
# pkg-config for libraries xcursor = pkgs.xorg.libXcursor;
export BINDGEN_EXTRA_CLANG_ARGS="$BINDGEN_EXTRA_CLANG_ARGS $(pkg-config --cflags --libs x11 xrandr xcursor xi gl)" xi = pkgs.xorg.libXi;
# add local headers
export BINDGEN_EXTRA_CLANG_ARGS="$BINDGEN_EXTRA_CLANG_ARGS -isystem $PWD/lib"
# no global include
# export BINDGEN_BUILTIN_INCLUDE_DIR=disable
echo $BINDGEN_EXTRA_CLANG_ARGS
'';
}; };
}; };
}; };

36
hs-rgfw.cabal Normal file
View File

@@ -0,0 +1,36 @@
cabal-version: 3.0
name: hs-rgfw
version: 0.3.0
homepage: https://git.mtgmonkey.net/Andromeda/hs-rgfw
license: BSD-3-Clause
license-file: LICENSE
author: andromeda
maintainer: @andromeda:tchncs.de
category: Development
build-type: Simple
common warnings
ghc-options:
-Wall
common pkgconfig
pkgconfig-depends:
gl,
x11,
xcursor,
xrandr,
xi
common default-language
default-language: Haskell2010
library
import:
warnings,
pkgconfig,
default-language
exposed-modules:
Generated
build-depends:
base >=4.18,
bindings-DSL <1000,
c-expr-runtime <1000,
hs-bindgen-runtime <1000
hs-source-dirs: lib
include-dirs: include/RGFW

1
include/RGFW Submodule

Submodule include/RGFW added at e23298e46f

4564
lib/Generated.hs Normal file

File diff suppressed because it is too large Load Diff

4483
lib/Generated/FunPtr.hs Normal file

File diff suppressed because it is too large Load Diff

4741
lib/Generated/Safe.hs Normal file

File diff suppressed because it is too large Load Diff

4741
lib/Generated/Unsafe.hs Normal file

File diff suppressed because it is too large Load Diff

14034
lib/RGFW.h

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff