nixpkgs/pkgs/by-name/sp/sparrow3d/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

99 lines
1.9 KiB
Nix

{ lib
, stdenv
, copyPkgconfigItems
, fetchFromGitHub
, makePkgconfigItem
, pkg-config
, SDL
, SDL_image
, SDL_mixer
, SDL_net
, SDL_ttf
}:
stdenv.mkDerivation (finalAttrs: {
pname = "sparrow3d";
version = "unstable-2020-10-06";
outputs = [ "out" "dev" ];
src = fetchFromGitHub {
owner = "theZiz";
repo = "sparrow3d";
rev = "2033349d7adeba34bda2c442e1fec22377471134";
hash = "sha256-28j5nbTYBrMN8BQ6XrTlO1D8Viw+RiT3MAl99BAbhR4=";
};
pkgconfigItems = [
(makePkgconfigItem rec {
name = "sparrow3d";
inherit (finalAttrs) version;
inherit (finalAttrs.meta) description;
cflags = [ "-isystem${variables.includedir}" ];
libs = [
"-L${variables.libdir}"
"-lsparrow3d"
"-lsparrowNet"
"-lsparrowSound"
];
variables = rec {
prefix = "@dev@";
exec_prefix = "@out@";
includedir = "${prefix}/include";
libdir = "${exec_prefix}/lib";
};
})
];
nativeBuildInputs = [
copyPkgconfigItems
pkg-config
];
propagatedBuildInputs = [
SDL.dev
SDL_image
SDL_ttf
SDL_mixer
SDL_net
];
postConfigure = ''
NIX_CFLAGS_COMPILE=$(pkg-config --cflags SDL_image SDL_ttf SDL_mixer SDL_net)
'';
buildFlags = [ "dynamic" ];
installPhase = ''
runHook preInstall
mkdir -p $out/lib
cp libsparrow{3d,Net,Sound}.so $out/lib
mkdir -p $dev/include
cp sparrow*.h $dev/include
runHook postInstall
'';
doCheck = true;
checkPhase = ''
runHook preCheck
make all_no_static
./testfile.sh
runHook postCheck
'';
meta = {
homepage = "https://github.com/theZiz/sparrow3d";
description = "A software renderer for different open handhelds like the gp2x, wiz, caanoo and pandora";
license = lib.licenses.lgpl21;
maintainers = with lib.maintainers; [ colinsane ];
platforms = lib.platforms.linux;
};
})