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

srb2: init at 2.2.8 #105087

Closed
wants to merge 1 commit into from
Closed

srb2: init at 2.2.8 #105087

wants to merge 1 commit into from

Conversation

zeratax
Copy link
Contributor

@zeratax zeratax commented Nov 26, 2020

Motivation for this change

added Sonic Robo Blast 2 to my best abilties with what I saw from their CI and wiki:
https://github.com/STJr/SRB2/blob/master/.travis.yml
http://wiki.srb2.org/wiki/Source_code_compiling/CMake

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

pkgs/games/srb2/default.nix Outdated Show resolved Hide resolved
pkgs/games/srb2/default.nix Outdated Show resolved Hide resolved
pkgs/games/srb2/default.nix Outdated Show resolved Hide resolved
@zeratax zeratax changed the title srb2: init at 2.28 srb2: init at 2.2.8 Nov 26, 2020
@zeratax
Copy link
Contributor Author

zeratax commented Dec 9, 2020

I created a nur package if anyone wants to try this https://github.com/ZerataX/nur-packages/blob/master/pkgs/srb2/default.nix

Copy link
Contributor

@rmcgibbo rmcgibbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ srb2 
Compiled for SDL version: 2.0.14
Linked with SDL version: 2.0.14
Setting up SRB2...


Sonic Robo Blast 2
Copyright (C) 1998-2020 by Sonic Team Junior

This program comes with ABSOLUTELY NO WARRANTY.

This is free software, and you are welcome to redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
See the 'LICENSE.txt' file for details.

Sonic the Hedgehog and related characters are trademarks of SEGA.
We do not claim ownership of SEGA's intellectual property used
in this program.

M_StartupLocale...
Looking for WADs in: SRB2WADDIR,.,/usr/local/share/games/SRB2,/usr/local/games/SRB2,/usr/share/games/SRB2,/usr/games/SRB2,HOME, in:/usr/local/games, in:/usr/games, in:/usr/local

I_Error(): srb2.pk3 not found! Expected in /home/mcgibbon/.cache/nixpkgs-review/pr-105087, ss file: /home/mcgibbon/.cache/nixpkgs-review/pr-105087/srb2.pk3

I_ShutdownGraphics(): graphics never started
I_ShutdownSystem(): end of logstream.
Shutdown tty console

Doesn't seem to boot on my machine (x86_64-linux)

@zeratax
Copy link
Contributor Author

zeratax commented Apr 5, 2021

@rmcgibbo hmm I can't replicate that at all?

I_Error(): srb2.pk3 not found! Expected in /home/mcgibbon/.cache/nixpkgs-review/pr-105087, ss file: /home/mcgibbon/.cache/nixpkgs-review/pr-105087/srb2.pk3

seems weird to me especially since this file just gets downloaded and then unzipped with 7zip? not sure what could go wrong there?

pkgs/games/srb2/default.nix Outdated Show resolved Hide resolved
pkgs/games/srb2/default.nix Outdated Show resolved Hide resolved
pkgs/games/srb2/default.nix Outdated Show resolved Hide resolved
pkgs/games/srb2/default.nix Outdated Show resolved Hide resolved
pkgs/games/srb2/default.nix Outdated Show resolved Hide resolved
@SuperSandro2000
Copy link
Member

@rmcgibbo hmm I can't replicate that at all?

I_Error(): srb2.pk3 not found! Expected in /home/mcgibbon/.cache/nixpkgs-review/pr-105087, ss file: /home/mcgibbon/.cache/nixpkgs-review/pr-105087/srb2.pk3

seems weird to me especially since this file just gets downloaded and then unzipped with 7zip? not sure what could go wrong there?

It looks for the file at the wrong directories, to be exact not in the nix store. This needs to be patched.

@zeratax
Copy link
Contributor Author

zeratax commented Apr 7, 2021

@SuperSandro2000
So I think I basically now understand how these files are found, mainly here
https://github.com/STJr/SRB2/blob/master/src/sdl/i_system.c#L2805
and the locations are defined here:
https://github.com/STJr/SRB2/blob/master/src/sdl/i_system.c#L148-L154

So I would remove the check for the cwd and remove every but 1 definition for the nix store?

I am just not sure how to most elegantly patch this? with a normal patch file i don't know where the location in the nix store will be?

@SuperSandro2000
Copy link
Member

So I would remove the check for the cwd and remove every but 1 definition for the nix store?

where the srb2.pk3 file is located.

I am just not sure how to most elegantly patch this? with a normal patch file i don't know where the location in the nix store will be?

Take a look how it is done in this package with substituteAll and @MPV@

@zeratax zeratax force-pushed the SRB2 branch 2 times, most recently from 6e1e45d to fb5cc8c Compare April 9, 2021 19:42
@zeratax
Copy link
Contributor Author

zeratax commented Apr 9, 2021

my current solution isn't exactly elegant, but I don't know how else to access $out with substituteAll
https://github.com/NixOS/nixpkgs/blob/f7751733d651a0eb1e705a1e14ce2e6b8adf2369/pkgs/games/srb2/default.nix#L71
I think using patchPhase makes it difficult to properly override patches? but using prePatchPhase or postPatchPhase wouldn't work for me.

Open to suggestions @SuperSandro2000

@SuperSandro2000
Copy link
Member

SuperSandro2000 commented Apr 12, 2021

postPatchPhase wouldn't work for me.

The name of the phase is postPatch or prePatch.

@zeratax
Copy link
Contributor Author

zeratax commented Apr 23, 2021

@SuperSandro2000 right sorry I did that but it doesn't work

@SuperSandro2000
Copy link
Member

As long as you are overwriting patchPhase it does not.

@zeratax
Copy link
Contributor Author

zeratax commented Apr 24, 2021

does not what? postPatch nor prePatch won't build for me, only patchPhase allows me to set this.
My current version builds and works?

@zeratax
Copy link
Contributor Author

zeratax commented Apr 30, 2021

@SuperSandro2000 Instead of changing the patch file i just changed the src file after it's patched.

patches = [
./wadlocation.patch
];
postPatch = ''
substituteInPlace src/sdl/i_system.c \
--replace '@wadlocation@' $out
'';

@stale
Copy link

stale bot commented Oct 30, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Oct 30, 2021
@zeratax
Copy link
Contributor Author

zeratax commented Oct 30, 2021

still waiting for someone to review this.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Oct 30, 2021
];

cmakeFlags = [
"-DSRB2_ASSET_DIRECTORY=/build/source/assets"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't hardcode /build/.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"-DSRB2_ASSET_DIRECTORY=/build/source/assets"
"-DSRB2_ASSET_DIRECTORY=${src}/assets"


in stdenv.mkDerivation rec {
pname = "srb2";
version = "2.2.8";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version = "2.2.8";
version = "2.2.10";

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the sha too.

];

cmakeFlags = [
"-DSRB2_ASSET_DIRECTORY=/build/source/assets"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"-DSRB2_ASSET_DIRECTORY=/build/source/assets"
"-DSRB2_ASSET_DIRECTORY=${src}/assets"

Comment on lines +77 to +78
7z x ${assets} -o"/build/source/assets" -aos
7z x ${assets_optional} -o"/build/source/assets" -aos
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
7z x ${assets} -o"/build/source/assets" -aos
7z x ${assets_optional} -o"/build/source/assets" -aos
7z x ${assets} -o"${src}/assets" -aos
7z x ${assets_optional} -o" ${src}/assets" -aos

];

postPatch = ''
substituteInPlace src/sdl/i_system.c \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
substituteInPlace src/sdl/i_system.c \
substituteInPlace ${src}/sdl/i_system.c \

@viric viric mentioned this pull request May 12, 2022
13 tasks
@fgaz
Copy link
Member

fgaz commented Jun 6, 2022

Merged in in #172761

@fgaz fgaz closed this Jun 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants