Merge pull request #231599 from NickCao/udp2raw

udp2raw: build with cmake
This commit is contained in:
Nick Cao 2023-05-13 21:53:33 +08:00 committed by GitHub
commit 4d00ddf9c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,8 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, cmake
, makeWrapper
, iptables
}:
@ -16,18 +18,26 @@ stdenv.mkDerivation rec {
hash = "sha256-mchSaqw6sOJ7+dydCM8juP7QMOVUrPL4MFA79Rvyjdo=";
};
nativeBuildInputs = [ makeWrapper ];
patches = [
# Add install target to CMakeLists.txt
# https://github.com/wangyu-/udp2raw/pull/469
(fetchpatch {
url = "https://github.com/wangyu-/udp2raw/commit/4559e6d47bb69fda0fbd3fb4b7d04ddb1cf5e2ae.patch";
hash = "sha256-2csZdXmMW89tjXhN5QIK0rnMSXlFjLvwGnmieeKRX90=";
})
];
makeFlags = [ "dynamic" ];
postPatch = ''
echo 'const char *gitversion = "${version}";' > git_version.h
'';
installPhase = ''
runHook preInstall
nativeBuildInputs = [
cmake
makeWrapper
];
mkdir -p $out/bin
cp udp2raw_dynamic $out/bin/udp2raw
wrapProgram $out/bin/udp2raw --prefix PATH : "${lib.makeBinPath [ iptables ]}"
runHook postInstall
postInstall = ''
wrapProgram "$out/bin/udp2raw" --prefix PATH : "${lib.makeBinPath [ iptables ]}"
'';
meta = with lib; {