Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add edopro package #344

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions pkgs/_sources/generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,69 @@
},
"version": "2.1.22-31"
},
"edopro": {
"cargoLocks": null,
"date": "2024-06-22",
"extract": null,
"name": "edopro",
"passthru": null,
"pinned": false,
"src": {
"deepClone": false,
"fetchSubmodules": true,
"leaveDotGit": false,
"name": null,
"owner": "edo9300",
"repo": "edopro",
"rev": "dd5c5626f50c698f0e5d9ec7b90eefb5e10093ff",
"sha256": "sha256-6EEwJD5CB0IkWvz/rGAKHhkDJb0BpXG1Ejq8exIsuOg=",
"sparseCheckout": [],
"type": "github"
},
"version": "dd5c5626f50c698f0e5d9ec7b90eefb5e10093ff"
},
"edopro-distribution": {
"cargoLocks": null,
"date": "2024-06-13",
"extract": null,
"name": "edopro-distribution",
"passthru": null,
"pinned": false,
"src": {
"deepClone": false,
"fetchSubmodules": true,
"leaveDotGit": true,
"name": null,
"owner": "ProjectIgnis",
"repo": "Distribution",
"rev": "286db345033c79cab6e36a8f06de3468008ff8cd",
"sha256": "sha256-ulolyrOw6bBySIRi1LEDwGASuUjO1OzRdmdx+VlcW+8=",
"sparseCheckout": [],
"type": "github"
},
"version": "286db345033c79cab6e36a8f06de3468008ff8cd"
},
"edopro-irrlicht": {
"cargoLocks": null,
"date": "2024-03-16",
"extract": null,
"name": "edopro-irrlicht",
"passthru": null,
"pinned": false,
"src": {
"deepClone": false,
"fetchSubmodules": false,
"leaveDotGit": false,
"name": null,
"owner": "edo9300",
"repo": "irrlicht1-8-4",
"rev": "ba76104ccb104d769cdccda014e0a3966f7c40ac",
"sha256": "sha256-xVlVt9zv7SenEYhBQSop4UnNS5g4N5aPgiqSHhhajD8=",
"sparseCheckout": [],
"type": "github"
},
"version": "ba76104ccb104d769cdccda014e0a3966f7c40ac"
},
"eglot-x": {
"cargoLocks": null,
"date": "2024-07-07",
Expand Down
39 changes: 39 additions & 0 deletions pkgs/_sources/generated.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,45 @@
sha256 = "sha256-2O0TjRhuwLd+QPUxV9tHeuWYtGoRnBa6icU7DMmxWyI=";
};
};
edopro = {
pname = "edopro";
version = "dd5c5626f50c698f0e5d9ec7b90eefb5e10093ff";
src = fetchFromGitHub {
owner = "edo9300";
repo = "edopro";
rev = "dd5c5626f50c698f0e5d9ec7b90eefb5e10093ff";
fetchSubmodules = true;
sha256 = "sha256-6EEwJD5CB0IkWvz/rGAKHhkDJb0BpXG1Ejq8exIsuOg=";
};
date = "2024-06-22";
};
edopro-distribution = {
pname = "edopro-distribution";
version = "286db345033c79cab6e36a8f06de3468008ff8cd";
src = fetchFromGitHub {
owner = "ProjectIgnis";
repo = "Distribution";
rev = "286db345033c79cab6e36a8f06de3468008ff8cd";
fetchSubmodules = true;
deepClone = false;
leaveDotGit = true;
sparseCheckout = [ ];
sha256 = "sha256-ocC1LdAGnKfNqsAHAEudn1XeG3WdFRHASIndrxTGq0g=";
};
date = "2024-06-13";
};
edopro-irrlicht = {
pname = "edopro-irrlicht";
version = "ba76104ccb104d769cdccda014e0a3966f7c40ac";
src = fetchFromGitHub {
owner = "edo9300";
repo = "irrlicht1-8-4";
rev = "ba76104ccb104d769cdccda014e0a3966f7c40ac";
fetchSubmodules = false;
sha256 = "sha256-xVlVt9zv7SenEYhBQSop4UnNS5g4N5aPgiqSHhhajD8=";
};
date = "2024-03-16";
};
eglot-x = {
pname = "eglot-x";
version = "ada0c9f32deac90038661f461966aae51707abff";
Expand Down
175 changes: 175 additions & 0 deletions pkgs/applications/edopro.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
{
stdenv,
sources,

# build deps
premake5,
writeShellScriptBin,
makeDesktopItem,
symlinkJoin,

# edopro deps
bzip2,
curl,
flac,
fmt,
freetype,
irrlicht,
libevent,
libgit2,
libjpeg,
libpng,
libvorbis,
lua5_4_compat,
nlohmann_json,
noto-fonts-cjk-sans,
openal,
sqlite,

# Irrlicht deps
wayland,
libxkbcommon,
}:
let
lua = lua5_4_compat;

irrlicht-edopro = irrlicht.overrideAttrs (old: {
inherit (sources.edopro-irrlicht) pname version src;
buildInputs = old.buildInputs ++ [
wayland
libxkbcommon
];
});

ocgcore = stdenv.mkDerivation {
inherit (sources.edopro) version src;
pname = sources.edopro.pname + "-ocgcore";

nativeBuildInputs = [ premake5 ];
buildInputs = [ lua ];

enableParallelBuilding = true;
buildFlags = [ "verbose=true config=release ocgcoreshared" ];

# nixpkgs' lua is compiled as C, but lua can also be compiled as
# C++. Due to name mangling, a C-compiled lua will not be able to
# link to a C++ project without some hoops, but edopro normally
# builds it as a C++ library, so their code isn't used to this
# edge case.
#
# Hence we need to change the included headers a bit.
postPatch = ''
sed -i 's/#include <lua.h>/#include <lua.hpp>/g' ocgcore/*.*
sed -i '/#include <lualib.h>/d' ocgcore/*.*
sed -i '/#include <lauxlib.h>/d' ocgcore/*.*
'';

preBuild = ''
cd ocgcore
premake5 gmake2 --lua-path='${lua}'
cd build
'';

installPhase = ''
mkdir -p $out/lib
cp -r ../bin/release/* $out/lib/
'';
};

font = "${noto-fonts-cjk-sans}/share/fonts/opentype/noto-cjk/NotoSansCJK-VF.otf.ttc";
edopro = stdenv.mkDerivation {
inherit (sources.edopro) pname version src;

nativeBuildInputs = [ premake5 ];

buildInputs = [
bzip2
curl
flac
fmt
freetype
irrlicht-edopro
libevent
libgit2
libjpeg
libpng
libvorbis
lua
nlohmann_json
openal
sqlite
];

# nixpkgs' gcc stack currently appears to not support LTO
postPatch = ''
sed -i '/LinkTimeOptimization/d' ./premake5.lua
'';

# Edopro normally builds irrlicht without a prefix in its include
# dir
NIX_CFLAGS_COMPILE = "-I ${irrlicht-edopro}/include/irrlicht/";

enableParallelBuilding = true;
buildFlags = [ "verbose=true config=release_x64 ygopro" ];

preBuild = ''
premake5 gmake2 \
--sound=sfml \
--no-joystick=true \
--os=linux \
--prebuilt-core='${ocgcore}/lib' \
--architecture=x64 \
--bundled-font='${font}' \
--lua-path='${lua}'

cd build
'';

installPhase = ''
mkdir -p $out/{lib,bin}
cp ../bin/x64/release/ygopro $out/bin/
cp ../bin/x64/release/*.a $out/lib
'';
};

edopro-script = writeShellScriptBin "EDOPro" ''
set -eu
EDOPRO_DIR="''${XDG_DATA_HOME:-~/.local/share}/edopro"

if [ ! -d "''${EDOPRO_DIR}" ]; then
mkdir -p "''${EDOPRO_DIR}"
cp -r ${sources.edopro-distribution.src}/*/ "''${EDOPRO_DIR}/"
find "''${EDOPRO_DIR}" -type d -exec chmod 700 {} +
find "''${EDOPRO_DIR}" -type f -exec chmod 600 {} +
fi

exec ${edopro}/bin/ygopro -C "''${EDOPRO_DIR}" $@
'';

edopro-desktop = makeDesktopItem {
name = "edopro-desktop";
desktopName = "EDOPro";
genericName = "Yu-Gi-Oh! simulator";
icon = "EDOPro";
exec = "EDOPro";
# TODO(tlater): Add mime types - can use an XML file like [this
# one](https://github.com/NixOS/nixpkgs/blob/a8b599256e0692225c2b476530d0a5b0f65e34ef/pkgs/applications/graphics/antimony/mimetype.xml)
# to create the mime types, then add the `mimeTypes` attr here to
# list the ones that associate to EDOPro.
categories = [ "Game" ];
keywords = [ "yugioh" ];
};
in
symlinkJoin {
name = "edopro-application";
paths = [
edopro
edopro-script
edopro-desktop
];

postBuild = ''
install -D ${sources.edopro-distribution.src}/textures/AppIcon.png \
$out/share/icons/hicolor/1024x1024/apps/EDOPro.png
'';
}
1 change: 1 addition & 0 deletions pkgs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ in
# Proper packages
deepfilternet = callPackage ./applications/deepfilternet.nix { };
drivestrike = callPackage ./applications/drivestrike.nix { };
edopro = callPackage ./applications/edopro.nix { };
emacs = callPackage ./applications/emacs { };
gauth = callPackage ./applications/gauth.nix { };
gcs = callPackage ./applications/gcs.nix { };
Expand Down
15 changes: 15 additions & 0 deletions pkgs/nvfetcher.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@ fetch.url = "https://app.drivestrike.com/static/yum/drivestrike.rpm"
src.git = "https://github.com/nemethf/eglot-x"
fetch.github = "nemethf/eglot-x"

[edopro]
src.git = "https://github.com/edo9300/edopro.git"
fetch.github = "edo9300/edopro"
git.fetchSubmodules = true

[edopro-distribution]
src.git = "https://github.com/ProjectIgnis/Distribution.git"
fetch.github = "ProjectIgnis/Distribution"
git.fetchSubmodules = true
git.leaveDotGit = true

[edopro-irrlicht]
src.git = "https://github.com/edo9300/irrlicht1-8-4.git"
fetch.github = "edo9300/irrlicht1-8-4"

[firefox-ui-fix]
src.github = "black7375/Firefox-UI-Fix"
fetch.github = "black7375/Firefox-UI-Fix"
Expand Down