about summary refs log tree commit diff
path: root/pkgs/tools/security/chntpw
diff options
context:
space:
mode:
authorroblabla <unfiltered@roblab.la>2022-04-21 11:03:39 +0200
committerroblabla <unfiltered@roblab.la>2022-04-23 15:13:23 +0200
commitb48f2c7ed39820484bb59273b37207596c326023 (patch)
tree178f5a314e1a6df7dc006ec18f4ef314c061daa0 /pkgs/tools/security/chntpw
parentacf9b5a3484747b54dd335ff64a2412c03bd1f20 (diff)
chntpw: Fix build on macos
This fixes the macos build by patching the makefile to remove the
explicit calls to gcc, letting it use whatever CC is the default.

It further removes the static builds entirely. This is technically a
breaking change, but I doubt it'll have a practical impact to any users.
Diffstat (limited to 'pkgs/tools/security/chntpw')
-rw-r--r--pkgs/tools/security/chntpw/00-chntpw-build-arch-autodetect.patch33
-rw-r--r--pkgs/tools/security/chntpw/01-chntpw-install-target.patch20
-rw-r--r--pkgs/tools/security/chntpw/default.nix3
3 files changed, 26 insertions, 30 deletions
diff --git a/pkgs/tools/security/chntpw/00-chntpw-build-arch-autodetect.patch b/pkgs/tools/security/chntpw/00-chntpw-build-arch-autodetect.patch
index 9c379adb7dfbc..cd130affa6c48 100644
--- a/pkgs/tools/security/chntpw/00-chntpw-build-arch-autodetect.patch
+++ b/pkgs/tools/security/chntpw/00-chntpw-build-arch-autodetect.patch
@@ -1,10 +1,15 @@
-diff -urN chntpw-140201.orig/Makefile chntpw-140201/Makefile
---- chntpw-140201.orig/Makefile	2014-02-01 20:54:37.000000000 +0400
-+++ chntpw-140201/Makefile	2014-08-03 20:26:56.497161881 +0400
-@@ -12,14 +12,13 @@
- 
- CC=gcc
+--- chntpw-140201.orig/Makefile	2014-02-01 17:54:37.000000000 +0100
++++ chntpw-140201/Makefile	2022-04-21 00:14:45.000000000 +0200
+@@ -6,24 +6,7 @@
+ # See INSTALL for more info.
+ #
  
+-#SSLPATH=/usr/local/ssl
+-OSSLPATH=/usr
+-OSSLINC=$(OSSLPATH)/include
+-
+-CC=gcc
+-
 -# Force 32 bit
 -CFLAGS= -DUSEOPENSSL -g -I. -I$(OSSLINC) -Wall -m32 
 -OSSLLIB=$(OSSLPATH)/lib
@@ -13,13 +18,11 @@ diff -urN chntpw-140201.orig/Makefile chntpw-140201/Makefile
 -#CFLAGS= -DUSEOPENSSL -g -I. -I$(OSSLINC) -Wall
 -#OSSLLIB=$(OSSLPATH)/lib64
 -
-+ifeq      '$(shell gcc -dumpmachine)' 'x86_64-unknown-linux-gnu'
-+  CFLAGS= -DUSEOPENSSL -g -I. -I$(OSSLINC) -Wall
-+  OSSLLIB=$(OSSLPATH)/lib64
-+else ifeq '$(shell gcc -dumpmachine)' 'i686-unknown-linux-gnu'
-+  CFLAGS= -DUSEOPENSSL -g -I. -I$(OSSLINC) -Wall -m32 
-+  OSSLLIB=$(OSSLPATH)/lib
-+endif
+-
+-# This is to link with whatever we have, SSL crypto lib we put in static
+-#LIBS=-L$(OSSLLIB) $(OSSLLIB)/libcrypto.a
+-LIBS=-L$(OSSLLIB)
++CFLAGS= -DUSEOPENSSL -g -I. -Wall
+ 
  
- # This is to link with whatever we have, SSL crypto lib we put in static
- #LIBS=-L$(OSSLLIB) $(OSSLLIB)/libcrypto.a
+ all: chntpw chntpw.static cpnt reged reged.static samusrgrp samusrgrp.static sampasswd sampasswd.static
diff --git a/pkgs/tools/security/chntpw/01-chntpw-install-target.patch b/pkgs/tools/security/chntpw/01-chntpw-install-target.patch
index d3163a026f915..67c62273aeb65 100644
--- a/pkgs/tools/security/chntpw/01-chntpw-install-target.patch
+++ b/pkgs/tools/security/chntpw/01-chntpw-install-target.patch
@@ -1,20 +1,14 @@
-diff -urN chntpw-140201.orig/Makefile chntpw-140201/Makefile
---- chntpw-140201.orig/Makefile	2014-08-03 20:26:56.497161881 +0400
-+++ chntpw-140201/Makefile	2014-08-04 12:57:16.563818342 +0400
-@@ -10,6 +10,8 @@
- OSSLPATH=/usr
- OSSLINC=$(OSSLPATH)/include
+--- chntpw-140201/Makefile	2022-04-21 00:14:45.000000000 +0200
++++ chntpw-140201.new/Makefile	2022-04-21 09:15:42.000000000 +0200
+@@ -6,10 +6,16 @@
+ # See INSTALL for more info.
+ #
  
 +PREFIX ?= /usr
 +
- CC=gcc
+ CFLAGS= -DUSEOPENSSL -g -I. -Wall
  
- ifeq      '$(shell gcc -dumpmachine)' 'x86_64-unknown-linux-gnu'
-@@ -24,8 +26,12 @@
- #LIBS=-L$(OSSLLIB) $(OSSLLIB)/libcrypto.a
- LIBS=-L$(OSSLLIB)
- 
-+BINARIES := chntpw chntpw.static cpnt reged reged.static samusrgrp samusrgrp.static sampasswd sampasswd.static
++BINARIES := chntpw cpnt reged samusrgrp sampasswd
  
 -all: chntpw chntpw.static cpnt reged reged.static samusrgrp samusrgrp.static sampasswd sampasswd.static
 +all: $(BINARIES)
diff --git a/pkgs/tools/security/chntpw/default.nix b/pkgs/tools/security/chntpw/default.nix
index 5bda55c418aaa..50ece95108e39 100644
--- a/pkgs/tools/security/chntpw/default.nix
+++ b/pkgs/tools/security/chntpw/default.nix
@@ -11,7 +11,6 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ unzip ];
-  buildInputs = lib.optionals stdenv.isLinux [ stdenv.glibc.out stdenv.glibc.static ];
 
   patches = [
     ./00-chntpw-build-arch-autodetect.patch
@@ -27,6 +26,6 @@ stdenv.mkDerivation rec {
     description = "An utility to reset the password of any user that has a valid local account on a Windows system";
     maintainers = with lib.maintainers; [ deepfire ];
     license = licenses.gpl2;
-    platforms = with lib.platforms; linux;
+    platforms = lib.platforms.unix;
   };
 }