depot/third_party/nixpkgs/pkgs/tools/security/rhash/dont-fail-ln.patch
Default email fa5436e0a7 Project import generated by Copybara.
GitOrigin-RevId: e8057b67ebf307f01bdcc8fba94d94f75039d1f6
2024-06-05 17:53:02 +02:00

59 lines
2.1 KiB
Diff

From 9ef90b958b7ae50aeeb5c269468034d73d6e2efe Mon Sep 17 00:00:00 2001
From: Aleksey Kravchenko <rhash.admin@gmail.com>
Date: Mon, 31 Jul 2023 02:48:15 +0300
Subject: [PATCH] Fix #238: Build on *BSD
---
configure | 3 ++-
librhash/Makefile | 8 ++++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/configure b/configure
index dae76d5..39ef8c1 100755
--- a/configure
+++ b/configure
@@ -567,6 +567,7 @@ qnx() { test "$OS_LC" = "qnx"; }
sunos() { test "$OS_LC" = "sunos"; }
wine() { test "$OS_LC" = "wine"; }
win32() { cygwin || mingw32 || mingw64 || msys || wine; }
+bsd() { dragonfly || freebsd || netbsd || openbsd ; }
posix_make() { aix || bsdos || hpux || irix || qnx || sunos; }
#####################################################################
@@ -713,7 +714,7 @@ if win32; then
elif darwin; then
SHARED_EXT=".${RHASH_VERSION_MAJOR}.dylib"
SOLINK_EXT=".dylib"
-elif linux; then
+elif linux || bsd; then
# use the full library version for the library file extension
SHARED_EXT=".so.${RHASH_VERSION}"
fi
diff --git a/librhash/Makefile b/librhash/Makefile
index d48e06e..e8ee862 100644
--- a/librhash/Makefile
+++ b/librhash/Makefile
@@ -27,9 +27,9 @@ install-lib-static: $(LIBRHASH_STATIC)
install-lib-shared: $(LIBRHASH_SHARED) $(EXTRA_INSTALL_LIBSHARED)
$(INSTALL) -d $(SO_DIR)
$(INSTALL_SHARED) $(LIBRHASH_SHARED) $(SO_DIR)/
- test "x$(LIBRHASH_SO_MAJ)" != "x$(LIBRHASH_SHARED)" && \
+ test "x$(LIBRHASH_SO_MAJ)" != "x$(LIBRHASH_SHARED)" || ( \
rm -f $(LIBDIR)/$(LIBRHASH_SO_MAJ) && \
- ln -s $(LIBRHASH_SHARED) $(LIBDIR)/$(LIBRHASH_SO_MAJ)
+ ln -s $(LIBRHASH_SHARED) $(LIBDIR)/$(LIBRHASH_SO_MAJ) )
install-implib:
$(INSTALL) -d $(LIBDIR)
@@ -175,9 +175,9 @@ $(EXPORTS_FILE): $(LIB_HEADERS)
$(LIB_HEADERS) | grep -v "$(EXPORTS_SKIP)" > $@
$(LIBRHASH_SOLINK):
- test "x$(LIBRHASH_SO_MAJ)" != "x$(LIBRHASH_SHARED)" && \
+ test "x$(LIBRHASH_SO_MAJ)" = "x$(LIBRHASH_SHARED)" || ( \
rm -f $(LIBRHASH_SO_MAJ) && \
- ln -s $(LIBRHASH_SHARED) $(LIBRHASH_SO_MAJ)
+ ln -s $(LIBRHASH_SHARED) $(LIBRHASH_SO_MAJ) )
rm -f $(LIBRHASH_SOLINK)
ln -s $(LIBRHASH_SO_MAJ) $(LIBRHASH_SOLINK)