summary refs log tree commit diff
path: root/pkgs/tools/security/rhash
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2017-06-13 21:37:24 +0200
committerDaiderd Jordan <daiderd@gmail.com>2017-06-13 22:09:12 +0200
commit30412f99304e51e8c27aa5be6d413d17c1da0ece (patch)
treeaaee6c982a083a880339c823c689caba92b6b732 /pkgs/tools/security/rhash
parent9079f94df7530b2794a0aa0c032db3e3340cf2b9 (diff)
downloadnixpkgs-30412f99304e51e8c27aa5be6d413d17c1da0ece.tar
nixpkgs-30412f99304e51e8c27aa5be6d413d17c1da0ece.tar.gz
nixpkgs-30412f99304e51e8c27aa5be6d413d17c1da0ece.tar.bz2
nixpkgs-30412f99304e51e8c27aa5be6d413d17c1da0ece.tar.lz
nixpkgs-30412f99304e51e8c27aa5be6d413d17c1da0ece.tar.xz
nixpkgs-30412f99304e51e8c27aa5be6d413d17c1da0ece.tar.zst
nixpkgs-30412f99304e51e8c27aa5be6d413d17c1da0ece.zip
rhash: fix darwin build
Fixes cmake update to 3.8.2, d74d871f52512a1f827d2dc165db685f499ce5f0
Diffstat (limited to 'pkgs/tools/security/rhash')
-rw-r--r--pkgs/tools/security/rhash/darwin.patch38
-rw-r--r--pkgs/tools/security/rhash/default.nix4
2 files changed, 41 insertions, 1 deletions
diff --git a/pkgs/tools/security/rhash/darwin.patch b/pkgs/tools/security/rhash/darwin.patch
new file mode 100644
index 00000000000..76ad8fe9abd
--- /dev/null
+++ b/pkgs/tools/security/rhash/darwin.patch
@@ -0,0 +1,38 @@
+diff --git a/Makefile b/Makefile
+index e40dbc3..e198b93 100644
+--- a/Makefile
++++ b/Makefile
+@@ -17,7 +17,7 @@ ALLCFLAGS = -pipe $(CFLAGS) $(ADDCFLAGS) \
+   -Wbad-function-cast -Wmissing-prototypes -Wmissing-declarations
+ LDLIBRHASH = -Llibrhash -lrhash
+ ALLLDFLAGS = $(LDLIBRHASH) $(LDFLAGS) $(ADDLDFLAGS)
+-SHAREDLIB  = librhash/librhash.so.0
++SHAREDLIB  = librhash/librhash.0.dylib
+ SHRDLFLAGS = $(LDFLAGS) $(ADDLDFLAGS)
+ HEADERS = calc_sums.h hash_print.h common_func.h hash_update.h file_mask.h file_set.h find_file.h hash_check.h output.h parse_cmdline.h rhash_main.h win_utils.h version.h
+ SOURCES = calc_sums.c hash_print.c common_func.c hash_update.c file_mask.c file_set.c find_file.c hash_check.c output.c parse_cmdline.c rhash_main.c win_utils.c
+diff --git a/librhash/Makefile b/librhash/Makefile
+index 2f9bcc9..0c5aaad 100644
+--- a/librhash/Makefile
++++ b/librhash/Makefile
+@@ -28,8 +28,8 @@ PREFIX  = /usr/local
+ INCDIR  = $(PREFIX)/include
+ LIBDIR  = $(PREFIX)/lib
+ LIBRARY = librhash.a
+-SONAME  = librhash.so.0
+-SOLINK  = librhash.so
++SONAME  = librhash.0.dylib
++SOLINK  = librhash.dylib
+ TEST_TARGET = test_hashes
+ TEST_SHARED = test_shared
+ # Set variables according to GNU coding standard
+@@ -182,8 +182,7 @@ test-dll: $(DLLNAME) test_hashes.o
+ 
+ # shared and static libraries
+ $(SONAME): $(SOURCES)
+-	sed -n '1s/.*/{ global:/p; s/^RHASH_API.* \([a-z0-9_]\+\)(.*/  \1;/p; $$s/.*/local: *; };/p' $(SO_HEADERS) > exports.sym
+-	$(CC) -fpic $(ALLCFLAGS) -shared $(SOURCES) -Wl,--version-script,exports.sym,-soname,$(SONAME) $(LIBLDFLAGS) -o $@
++	$(CC) -fpic $(ALLCFLAGS) -dynamiclib $(SOURCES) $(LIBLDFLAGS) -Wl,-install_name,$(PREFIX)/lib/$@ -o $@
+ 	ln -s $(SONAME) $(SOLINK)
+ # use 'nm -Cg --defined-only $@' to view exported symbols
+ 
diff --git a/pkgs/tools/security/rhash/default.nix b/pkgs/tools/security/rhash/default.nix
index 35fab64ffc8..e33c680b457 100644
--- a/pkgs/tools/security/rhash/default.nix
+++ b/pkgs/tools/security/rhash/default.nix
@@ -10,13 +10,15 @@ stdenv.mkDerivation rec {
     sha256 = "0nii6p4m2x8rkaf8r6smgfwb1q4hpf117kkg64yr6gyqgdchnljv";
   };
 
+  patches = stdenv.lib.optional stdenv.isDarwin ./darwin.patch;
+
   installFlags = [ "DESTDIR=$(out)" "PREFIX=/" ];
 
   # we build the static library because of two makefile bugs
   # * .h files installed for static library target only
   # * .so.0 -> .so link only created in the static library install target
   buildPhase = ''
-    make lib-shared lib-static build-shared
+    make lib-shared lib-static build-shared CC=cc PREFIX=$out
   '';
 
   # we don't actually want the static library, so we remove it after it