Skip to content

Commit

Permalink
miniupnpc: support pkgsStatic
Browse files Browse the repository at this point in the history
  • Loading branch information
nagy committed Jul 7, 2024
1 parent e154a13 commit b97cd22
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions pkgs/tools/networking/miniupnpc/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{ lib
, stdenv
, fetchFromGitHub
, cmake
{
lib,
stdenv,
fetchFromGitHub,
cmake,
}:

stdenv.mkDerivation rec {
Expand All @@ -19,20 +20,17 @@ stdenv.mkDerivation rec {

nativeBuildInputs = [ cmake ];

doCheck = !stdenv.isFreeBSD;
cmakeFlags = [
(lib.cmakeBool "UPNPC_BUILD_SHARED" (!stdenv.hostPlatform.isStatic))
(lib.cmakeBool "UPNPC_BUILD_STATIC" stdenv.hostPlatform.isStatic)
];

makeFlags = [ "PREFIX=$(out)" ];
doCheck = !stdenv.isFreeBSD;

postInstall = ''
chmod +x $out/lib/libminiupnpc${stdenv.hostPlatform.extensions.sharedLibrary}
# for some reason cmake does not install binaries and manpages
# https://github.com/miniupnp/miniupnp/issues/637
mkdir -p $out/bin
cp -a upnpc-static $out/bin/upnpc
cp -a ../external-ip.sh $out/bin/external-ip
mkdir -p $out/share/man
cp -a ../man3 $out/share/man
mv $out/bin/upnpc-* $out/bin/upnpc
mv $out/bin/upnp-listdevices-* $out/bin/upnp-listdevices
mv $out/bin/external-ip.sh $out/bin/external-ip
'';

meta = with lib; {
Expand Down

0 comments on commit b97cd22

Please sign in to comment.