depot/third_party/nixpkgs/pkgs/development/skaware-packages/sdnotify-wrapper/default.nix
Default email 92b3d6365d Project import generated by Copybara.
GitOrigin-RevId: 412b9917cea092f3d39f9cd5dead4effd5bc4053
2022-10-30 16:09:59 +01:00

37 lines
967 B
Nix

{ stdenv, lib, runCommandCC, skawarePackages }:
with skawarePackages;
let
# From https://skarnet.org/software/misc/sdnotify-wrapper.c,
# which is unversioned.
src = ./sdnotify-wrapper.c;
in runCommandCC "sdnotify-wrapper" {
outputs = [ "bin" "doc" "out" ];
meta = {
homepage = "https://skarnet.org/software/misc/sdnotify-wrapper.c";
description = "Use systemd sd_notify without having to link against libsystemd";
platforms = lib.platforms.linux;
license = lib.licenses.isc;
maintainers = with lib.maintainers; [ Profpatsch ];
};
} ''
mkdir -p $bin/bin
mkdir $out
# the -lskarnet has to come at the end to support static builds
$CC \
-o $bin/bin/sdnotify-wrapper \
-I${skalibs.dev}/include \
-L${skalibs.lib}/lib \
${src} \
-lskarnet
mkdir -p $doc/share/doc/sdnotify-wrapper
# copy the documentation comment
sed -ne '/Usage:/,/*\//p' ${src} > $doc/share/doc/sdnotify-wrapper/README
''