Skip to content
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
56 changes: 56 additions & 0 deletions pkgs/development/libraries/libspng/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{ lib
, fetchFromGitHub
, stdenv
, zlib
, ninja
, meson
, pkg-config
, cmake
, libpng
}:

stdenv.mkDerivation rec {
pname = "libspng";
version = "0.7.0-rc3";

src = fetchFromGitHub {
owner = "randy408";
repo = pname;
rev = "v${version}";
sha256 = "0n91mr06sr34cqq91738251iaw21h5c4jgjpn0kqfx69ywxcl9fj";
};

doCheck = true;

mesonBuildType = "release";

mesonFlags = [
# this is required to enable testing
# https://github.com/randy408/libspng/blob/bc383951e9a6e04dbc0766f6737e873e0eedb40b/tests/README.md#testing
"-Ddev_build=true"
];

outputs = [ "out" "dev" ];

checkInputs = [
cmake
libpng
];

buildInputs = [
pkg-config
zlib
];

nativeBuildInputs = [
ninja
meson
];

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you need different build steps here https://libspng.org/docs/build/
The default build step is running make. You'll probably need to include your custom buildPhase

When you build it, can you ls into ./result and give the content of the output ? just to make sure it build correctly.

Copy link
Member Author

Choose a reason for hiding this comment

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

result
├── include
│  └── spng.h
└── lib
   ├── libspng.so -> libspng.so.0
   ├── libspng.so.0 -> libspng.so.0.7.0
   ├── libspng.so.0.7.0
   └── pkgconfig
      └── spng.pc

From what I understand the meson build hooks run automatically. Not sure if this is a debug build or a release build. Also unsure if the checkPhase runs by default or not in this case

Copy link
Contributor

Choose a reason for hiding this comment

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

I was checking in libpng, I think you also have to define manually the outputs

  outputs = [ "out" "dev" ];
  outputBin = "dev";

I think the include stuff is supposed to be part of dev

the build runs in two ways, on the build thing it talks about a cmake way and a meson way. If you remove the meson dependency, does it still build ?

If you run the build with nix build .#libspng -L -vv it should give you more verbose output and you should see if the checkphase is running.

Copy link
Member Author

Choose a reason for hiding this comment

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

If you remove the meson dependency, does it still build ?

It doesn't build without without meson or ninja

@happysalada Did a few changes. PTAL

Copy link
Contributor

Choose a reason for hiding this comment

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

Great!

does it produce two outputs result and result.dev
is the include directory correctly part of the result.dev ?
What is the output of the result ?

Copy link
Member Author

Choose a reason for hiding this comment

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

The checkPhase is still not running as far as I can tell

Copy link
Contributor

Choose a reason for hiding this comment

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

Does it even say anything in the logs ?
It should say that it's not checking.
Otherwise, you can try the doCheck = true;
If the checkPhase doesn't run then, it should say at least why in the logs.

meta = with lib; {
description = "Simple, modern libpng alternative";
homepage = "https://github.com/randy408/libspng";
license = with licenses; [ bsd2 ];
maintainers = with maintainers; [ humancalico ];
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17422,6 +17422,8 @@ with pkgs;

libspiro = callPackage ../development/libraries/libspiro {};

libspng = callPackage ../development/libraries/libspng { };

libssh = callPackage ../development/libraries/libssh { };

libssh2 = callPackage ../development/libraries/libssh2 { };
Expand Down