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

SDL_gpu: init at 20190124 #63608

Merged
merged 1 commit into from Jul 12, 2019
Merged

SDL_gpu: init at 20190124 #63608

merged 1 commit into from Jul 12, 2019

Conversation

pmiddend
Copy link
Contributor

Motivation for this change

I'm using this package with SDL2.

Notes:

  • The library is supposed to work with SDL1 and SDL2. I've only packaged the SDL2 version right now. I'm hoping if somebody still uses SDL1, the derivation will be extended accordingly.
  • I'm aware of the strange sed command in the patchPhase. Replacing all of the OUTPUT_DIR variables isn't necessary and would have broken the build as far as I can ascertain.
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • 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 nix-review --run "nix-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)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@pmiddend
Copy link
Contributor Author

@GrahamcOfBorg build SDL_gpu

@pmiddend
Copy link
Contributor Author

Anyone up for a review?

Copy link
Member

@aanderse aanderse left a comment

Choose a reason for hiding this comment

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

Sure. I have only done a cosmetic review so far but I'll look in more depth when I get a chance.

You did a great job. Just a few conventions I would recommend to follow. Thanks for your contribution.

pkgs/development/libraries/SDL_gpu/default.nix Outdated Show resolved Hide resolved
pkgs/development/libraries/SDL_gpu/default.nix Outdated Show resolved Hide resolved
pkgs/development/libraries/SDL_gpu/default.nix Outdated Show resolved Hide resolved
pkgs/development/libraries/SDL_gpu/default.nix Outdated Show resolved Hide resolved
@pmiddend
Copy link
Contributor Author

pmiddend commented Jul 2, 2019

@aanderse Thanks for the initial review. I've fixed those issues.

@aanderse
Copy link
Member

aanderse commented Jul 2, 2019

@pmiddend Any time. Can you please give me an example of how you tested this? I tried to build the demos folder but ran into some issues.

@pmiddend
Copy link
Contributor Author

pmiddend commented Jul 3, 2019

@aanders What I just did:

  • Enable the demos via the CMake flag
  • Install the demos in postInstall via:
  postInstall = ''
    mkdir $out/bin
    cp demos/*-demo $out/bin
  '';
  • nix-build the derivation
  • cd into the demos folder from a checked-out copy
  • run, for example, the simple-shader-example

Now, this isn't an ideal test. Do you think that I should package the demos somehow? If so, I'd have to install the demos and the accompanying data folder.

@aanderse
Copy link
Member

aanderse commented Jul 5, 2019

@pmiddend How would I go about compiling the following file?

#include <SDL_gpu.h>
int main() { return 0; }

Presumably you have a default.nix file you use with nix-shell?

@pmiddend
Copy link
Contributor Author

pmiddend commented Jul 8, 2019

@aanderse My use-case is slightly more complex, as I use this library in a cython module (i.e. I'm not using it from C directly). However, the following derivation compiles the file you mentioned (assuming your local nixpkgs repo lies below /home/aanderse/nixpkgs of course :D)

let pkgs = import /home/aanderse/nixpkgs {};
in pkgs.stdenv.mkDerivation {
  name = "aanderse-test";
  src = ./.;
  buildInputs = [ pkgs.SDL2 pkgs.SDL_gpu ];
  phases = [ "unpackPhase" "buildPhase" "installPhase" ];
  buildPhase = ''
    gcc test.cpp -o aanderse-test -I${pkgs.SDL2.dev}/include/SDL2 -I${pkgs.SDL_gpu}/include/SDL2
  '';
  installPhase = ''
    mkdir -p $out/bin
    cp aanderse-test $out/bin
  '';
}

Copy link
Member

@aanderse aanderse left a comment

Choose a reason for hiding this comment

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

@pmiddend Oh... I just assumed the package would install some pkgconfig files or something. But no, you're just directly linking and including. OK.

pkgs/development/libraries/SDL_gpu/default.nix Outdated Show resolved Hide resolved
@pmiddend
Copy link
Contributor Author

@aanderse Yeah I'd have loved that, too, but the author just hasn't provided pkgbuild files (yet).

Copy link
Member

@aanderse aanderse left a comment

Choose a reason for hiding this comment

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

Sure, no problem. Thanks for choosing to contribute to nixpkgs!

@aanderse aanderse merged commit 2519fe3 into NixOS:master Jul 12, 2019
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

2 participants