From b65e9775fb4dc633978ec67156415cb32df661af Mon Sep 17 00:00:00 2001 From: Yureka Date: Sun, 19 Feb 2023 12:48:52 +0100 Subject: [PATCH] ppp: 2.4.9 -> 2.5.0 --- pkgs/tools/networking/ppp/default.nix | 53 ++++++++-------------- pkgs/tools/networking/ppp/nix-purity.patch | 33 -------------- pkgs/tools/networking/ppp/nonpriv.patch | 13 ------ 3 files changed, 18 insertions(+), 81 deletions(-) delete mode 100644 pkgs/tools/networking/ppp/nix-purity.patch delete mode 100644 pkgs/tools/networking/ppp/nonpriv.patch diff --git a/pkgs/tools/networking/ppp/default.nix b/pkgs/tools/networking/ppp/default.nix index eee0dfd03068..9364d10b1171 100644 --- a/pkgs/tools/networking/ppp/default.nix +++ b/pkgs/tools/networking/ppp/default.nix @@ -1,9 +1,10 @@ { lib , stdenv , fetchFromGitHub -, substituteAll , libpcap , libxcrypt +, pkg-config +, autoreconfHook , openssl , bash , nixosTests @@ -11,27 +12,25 @@ }: stdenv.mkDerivation rec { - version = "2.4.9"; + version = "2.5.0"; pname = "ppp"; src = fetchFromGitHub { owner = "ppp-project"; repo = pname; - rev = "${pname}-${version}"; - sha256 = "sha256-8+nbqRNfKPLDx+wmuKSkv+BSeG72hKJI4dNqypqeEK4="; + rev = "ppp-${version}"; + sha256 = "sha256-J7udiLiJiJ1PzNxD+XYAUPXZ+ABGXt2U3hSFUWJXe94="; }; - patches = [ - (substituteAll { - src = ./nix-purity.patch; - glibc = stdenv.cc.libc.dev or stdenv.cc.libc; - openssl_dev = openssl.dev; - openssl_lib = lib.getLib openssl; - }) - # Without nonpriv.patch, pppd --version doesn't work when not run as root. - ./nonpriv.patch + configureFlags = [ + "--with-openssl=${openssl.dev}" + "--sysconfdir=/etc" ]; + nativeBuildInputs = [ + pkg-config + autoreconfHook + ]; buildInputs = [ libpcap libxcrypt @@ -39,17 +38,6 @@ stdenv.mkDerivation rec { bash ]; - # This can be removed when ppp 2.5.0 is released: - # https://github.com/ppp-project/ppp/commit/509f04959ad891d7f981f035ed461d51bd1f74b0 - propagatedBuildInputs = lib.optional stdenv.hostPlatform.isMusl (writeTextDir "include/net/ppp_defs.h" '' - #ifndef _NET_PPP_DEFS_H - #define _NET_PPP_DEFS_H 1 - - #include - - #endif /* net/ppp_defs.h */ - ''); - postPatch = '' for file in $(find -name Makefile.linux); do substituteInPlace "$file" --replace '-m 4550' '-m 550' @@ -65,20 +53,15 @@ stdenv.mkDerivation rec { NIX_LDFLAGS = "-lcrypt"; - # This can probably be removed if version > 2.4.9, as IPX support - # has been removed upstream[1]. Just check whether pkgsMusl.ppp - # still builds. - # - # [1]: https://github.com/ppp-project/ppp/commit/c2881a6b71a36d28a89166e82820dc5e711fd775 - env.NIX_CFLAGS_COMPILE = - lib.optionalString stdenv.hostPlatform.isMusl "-UIPX_CHANGE"; + installFlags = [ + "sysconfdir=$(out)/etc" + ]; - installPhase = '' - runHook preInstall + preInstall = '' mkdir -p $out/bin - make install + ''; + postInstall = '' install -D -m 755 scripts/{pon,poff,plog} $out/bin - runHook postInstall ''; postFixup = '' diff --git a/pkgs/tools/networking/ppp/nix-purity.patch b/pkgs/tools/networking/ppp/nix-purity.patch deleted file mode 100644 index 1673376f9b6f..000000000000 --- a/pkgs/tools/networking/ppp/nix-purity.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff --git a/pppd/Makefile.linux b/pppd/Makefile.linux -index 22837c5..6f6fff5 100644 ---- a/pppd/Makefile.linux -+++ b/pppd/Makefile.linux -@@ -111,8 +111,8 @@ endif - - # EAP SRP-SHA1 - ifdef USE_SRP --CFLAGS += -DUSE_SRP -DOPENSSL -I/usr/local/ssl/include --LIBS += -lsrp -L/usr/local/ssl/lib -+CFLAGS += -DUSE_SRP -DOPENSSL -I@openssl_dev@/include/openssl -+LIBS += -lsrp -L@openssl_lib@/lib - NEEDCRYPTOLIB = y - TARGETS += srp-entry - EXTRAINSTALL = $(INSTALL) -c -m 555 srp-entry $(BINDIR)/srp-entry -@@ -143,7 +143,7 @@ CFLAGS += -DHAS_SHADOW - #LIBS += -lshadow $(LIBS) - endif - --ifeq ($(shell echo '\#include ' | $(CC) -E - >/dev/null 2>&1 && echo yes),yes) -+ifneq ($(wildcard @glibc@/include/crypt.h),) - CFLAGS += -DHAVE_CRYPT_H=1 - LIBS += -lcrypt - endif -@@ -155,7 +155,7 @@ endif - - ifdef NEEDDES - ifndef USE_CRYPT --CFLAGS += -I$(shell $(CC) --print-sysroot)/usr/include/openssl -+CFLAGS += -I@openssl_dev@/include/openssl - NEEDCRYPTOLIB = y - else - CFLAGS += -DUSE_CRYPT=1 diff --git a/pkgs/tools/networking/ppp/nonpriv.patch b/pkgs/tools/networking/ppp/nonpriv.patch deleted file mode 100644 index df6faaf8383d..000000000000 --- a/pkgs/tools/networking/ppp/nonpriv.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/pppd/main.c b/pppd/main.c -index 014d614..6661d33 100644 ---- a/pppd/main.c -+++ b/pppd/main.c -@@ -334,7 +334,7 @@ main(argc, argv) - umask(umask(0777) | 022); - - uid = getuid(); -- privileged = uid == 0; -+ privileged = (uid == 0) || (geteuid() != 0); - slprintf(numbuf, sizeof(numbuf), "%d", uid); - script_setenv("ORIG_UID", numbuf, 0); -