LP#1704090: ensure make install respects DESTDIR
authorGraham Billiau <graham@geeksinthegong.net>
Mon, 31 Jul 2017 15:00:25 +0000 (11:00 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Mon, 7 Aug 2017 14:16:19 +0000 (10:16 -0400)
This patch ensures that 'make install' uses DESTDIR consistently,
making life easier for packagers.

Signed-off-by: Graham Billiau <graham@geeksinthegong.net>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>

src/Makefile.am
src/gateway/Makefile.am

index 9f75238..a86281f 100644 (file)
@@ -68,10 +68,10 @@ install-exec-hook:
                        rm "$(DESTDIR)@sysconfdir@/$${f}.bak" ; \
                done; \
        fi
-       if [ ! -e @bindir@/osrf_control ]; then \
-               ln -s @bindir@/opensrf-perl.pl @bindir@/osrf_control; \
+       if [ ! -e "$(DESTDIR)@bindir@/osrf_control" ]; then \
+               ln -s "opensrf-perl.pl" "$(DESTDIR)@bindir@/osrf_control"; \
        fi
 
 uninstall-hook:
-       rm -f @includedir@/opensrf/apachetools.h
+       rm -f "$(DESTDIR)@includedir@/opensrf/apachetools.h"
 
index 54da170..d4f327d 100644 (file)
@@ -35,8 +35,13 @@ install-exec-local:
        $(APXS2) -c $(DEF_LDLIBS) $(AM_CFLAGS) $(AM_LDFLAGS) @srcdir@/osrf_http_translator.c apachetools.c apachetools.h libopensrf.so
        $(APXS2) -c $(DEF_LDLIBS) $(AM_CFLAGS) $(AM_LDFLAGS) @srcdir@/osrf_websocket_translator.c apachetools.c apachetools.h libopensrf.so
        $(MKDIR_P) $(DESTDIR)$(AP_LIBEXECDIR)
-       $(APXS2) -i -S LIBEXECDIR=$(DESTDIR)$(AP_LIBEXECDIR) -a @srcdir@/osrf_json_gateway.la
-       $(APXS2) -i -S LIBEXECDIR=$(DESTDIR)$(AP_LIBEXECDIR) -a @srcdir@/osrf_http_translator.la
+       if [ "$(DESTDIR)" ]; then \
+               $(APXS2) -i -S LIBEXECDIR=$(DESTDIR)$(AP_LIBEXECDIR) @srcdir@/osrf_json_gateway.la; \
+               $(APXS2) -i -S LIBEXECDIR=$(DESTDIR)$(AP_LIBEXECDIR) @srcdir@/osrf_http_translator.la; \
+       else \
+               $(APXS2) -i -S LIBEXECDIR=$(DESTDIR)$(AP_LIBEXECDIR) -a @srcdir@/osrf_json_gateway.la; \
+               $(APXS2) -i -S LIBEXECDIR=$(DESTDIR)$(AP_LIBEXECDIR) -a @srcdir@/osrf_http_translator.la; \
+       fi
        $(APXS2) -n osrf_websocket_translator -i -S LIBEXECDIR=$(DESTDIR)$(AP_LIBEXECDIR) @srcdir@/osrf_websocket_translator.la
 
 clean-local: