depot/third_party/nixpkgs/pkgs/os-specific/linux/sdnotify-wrapper/default.nix
Default email 3a4df29a92 Project import generated by Copybara.
GitOrigin-RevId: 3d7435c638baffaa826b85459df0fff47f12317d
2022-06-16 19:23:12 +02:00

38 lines
996 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 = {
broken = stdenv.isDarwin;
homepage = "https://skarnet.org/software/misc/sdnotify-wrapper.c";
description = "Use systemd sd_notify without having to link against libsystemd";
platforms = lib.platforms.all;
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
''