about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYureka <yuka@yuka.dev>2023-02-19 12:48:52 +0100
committerYureka <yuka@yuka.dev>2023-04-25 18:00:12 +0200
commitb65e9775fb4dc633978ec67156415cb32df661af (patch)
tree5d5dde5b5b5af03b4c2023357befa7713db3ef01
parentc9a253ff7fd9bd62936a0129b6beba6afb65bff3 (diff)
ppp: 2.4.9 -> 2.5.0
-rw-r--r--pkgs/tools/networking/ppp/default.nix53
-rw-r--r--pkgs/tools/networking/ppp/nix-purity.patch33
-rw-r--r--pkgs/tools/networking/ppp/nonpriv.patch13
3 files changed, 18 insertions, 81 deletions
diff --git a/pkgs/tools/networking/ppp/default.nix b/pkgs/tools/networking/ppp/default.nix
index eee0dfd030680..9364d10b11712 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 <linux/ppp_defs.h>
-
-    #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 1673376f9b6f5..0000000000000
--- 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 <crypt.h>' | $(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 df6faaf8383dc..0000000000000
--- 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);
-