Skip to content

Commit 7adff13

Browse files
authored
Fix soft-links installation on non Darwin kernels (#83)
Following #75 , the link commands were modified from relative to absolute for the sake of macOS. This PR reverts the change to be relative for non Darwin kernels.
1 parent 8e49676 commit 7adff13

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

Makefile

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11

22
PREFIX ?= /usr/local
33

4-
# Avoid the need for 'ln -r'.
5-
ifneq ($(realpath $(PREFIX)),$(PREFIX))
6-
$(error PREFIX must be a canonical path)
7-
endif
8-
94
DESTDIR ?=
105
INSTALL = /usr/bin/install -c
116
BINDIR = $(DESTDIR)$(PREFIX)/bin
@@ -16,6 +11,13 @@ LIBRDB_INSTALL_STATIC := yes
1611

1712
UNAME := $(shell uname)
1813

14+
# Set ln flags based on OS (macOS doesn't support -r flag)
15+
ifeq ($(UNAME),Darwin)
16+
LN_FLAGS = -fs
17+
else
18+
LN_FLAGS = -fsr
19+
endif
20+
1921
ifneq (,$(filter $(UNAME),OpenBSD FreeBSD NetBSD))
2022
PKGCONFIGDIR = $(DESTDIR)$(PREFIX)/libdata/pkgconfig
2123
else
@@ -81,24 +83,24 @@ librdb-ext.pc: librdb-ext.pc.in Makefile
8183
install: all librdb.pc librdb-ext.pc
8284
$(INSTALL) -d $(BINDIR)
8385
$(INSTALL) -m 755 bin/rdb-cli $(BINDIR)/rdb-cli-$(LIBRDB_VERSION)
84-
ln -fs $(BINDIR)/rdb-cli-$(LIBRDB_VERSION) $(BINDIR)/rdb-cli
86+
ln $(LN_FLAGS) $(BINDIR)/rdb-cli-$(LIBRDB_VERSION) $(BINDIR)/rdb-cli
8587
$(INSTALL) -d $(LIBDIR)
8688

8789
ifeq ($(LIBRDB_INSTALL_SHARED),yes)
8890
$(INSTALL) -m 755 lib/librdb.so.$(LIBRDB_VERSION) $(LIBDIR)/librdb.so.$(LIBRDB_VERSION)
89-
ln -fs $(LIBDIR)/librdb.so.$(LIBRDB_VERSION) $(LIBDIR)/librdb.so
91+
ln $(LN_FLAGS) $(LIBDIR)/librdb.so.$(LIBRDB_VERSION) $(LIBDIR)/librdb.so
9092
$(INSTALL) -m 755 lib/librdb-ext.so.$(LIBRDB_VERSION) $(LIBDIR)/librdb-ext.so.$(LIBRDB_VERSION)
91-
ln -fs $(LIBDIR)/librdb-ext.so.$(LIBRDB_VERSION) $(LIBDIR)/librdb-ext.so
93+
ln $(LN_FLAGS) $(LIBDIR)/librdb-ext.so.$(LIBRDB_VERSION) $(LIBDIR)/librdb-ext.so
9294
$(INSTALL) -d $(PKGCONFIGDIR)
9395
$(INSTALL) -m 644 librdb.pc $(PKGCONFIGDIR)
9496
$(INSTALL) -m 644 librdb-ext.pc $(PKGCONFIGDIR)
9597
endif
9698

9799
ifeq ($(LIBRDB_INSTALL_STATIC),yes)
98100
$(INSTALL) -m 755 lib/librdb.a $(LIBDIR)/librdb.a.$(LIBRDB_VERSION)
99-
ln -fs $(LIBDIR)/librdb.a.$(LIBRDB_VERSION) $(LIBDIR)/librdb.a
101+
ln $(LN_FLAGS) $(LIBDIR)/librdb.a.$(LIBRDB_VERSION) $(LIBDIR)/librdb.a
100102
$(INSTALL) -m 755 lib/librdb-ext.a $(LIBDIR)/librdb-ext.a.$(LIBRDB_VERSION)
101-
ln -fs $(LIBDIR)/librdb-ext.a.$(LIBRDB_VERSION) $(LIBDIR)/librdb-ext.a
103+
ln $(LN_FLAGS) $(LIBDIR)/librdb-ext.a.$(LIBRDB_VERSION) $(LIBDIR)/librdb-ext.a
102104
endif
103105

104106
$(INSTALL) -d $(INCDIR)

0 commit comments

Comments
 (0)