Fix: GNU 'install' utility is not compatible with Solaris version.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Thu, 02 Jun 2016 21:55:33 +0300
changeset 801 2657c198b9e2
parent 800 3af8147163dc
child 802 d8ba282954cd
Fix: GNU 'install' utility is not compatible with Solaris version.
Makefile
--- a/Makefile	Thu Jun 02 19:28:46 2016 +0300
+++ b/Makefile	Thu Jun 02 21:55:33 2016 +0300
@@ -23,14 +23,24 @@
   $(error HOME env var not set!)
 endif
 
+uname-s := $(shell uname -s)
+
 host_os = linux
-ifneq '' '$(COMSPEC)'
+ifneq '' '$(filter CYGWIN%,$(uname-s))'
   host_os = cygwin
 endif
+ifeq 'SunOS' '$(uname-s)'
+  host_os = solaris
+endif
 
 ################################################################
 # Build tool definition/switches.
 
+INSTALL_DATA := install -m 640
+ifeq '$(host_os)' 'solaris'
+  INSTALL_DATA := ginstall -m 640
+endif
+
 RST2HTML = rst2html
 ifeq '$(host_os)' 'cygwin'
   RST2HTML = rst2html.py
@@ -72,7 +82,7 @@
 install:
 	for item in $(OVERRIDDEN_ITEMS); do \
 		if [ -f $$item ]; then \
-			install -m 640 $$item $(HOME)/$$item; \
+			$(INSTALL_DATA) $$item $(HOME)/$$item; \
 		fi; \
 		if [ -d $$item ]; then \
 			for file in `find $$item`; do \
@@ -80,7 +90,7 @@
 					mkdir -p $(HOME)/$$file; \
 					continue; \
 				fi; \
-				install -m 640 $$file $(HOME)/$$file; \
+				$(INSTALL_DATA) $$file $(HOME)/$$file; \
 			done; \
 		fi; \
 	done
@@ -98,7 +108,7 @@
 	mkdir -p ~/.screenshot
 	for item in $(IFNONEXIST_ITEMS); do \
 		if [ -f $$item -a ! -f $(HOME)/$$item ]; then \
-			install -m 640 $$item $(HOME)/$$item; \
+			$(INSTALL_DATA) $$item $(HOME)/$$item; \
 		fi; \
 		if [ -d $$item ]; then \
 			for file in `find $$item`; do \
@@ -107,7 +117,7 @@
 					continue; \
 				fi; \
 				if [ ! -f $(HOME)/$$file ]; then \
-					install -m 640 $$file $(HOME)/$$file; \
+					$(INSTALL_DATA) $$file $(HOME)/$$file; \
 				fi; \
 			done; \
 		fi; \
@@ -125,7 +135,7 @@
 	if [ $$vmajor -gt 4 -o '(' $$vmajor -eq 4 -a $$vminor -ge 8 ')' ]; then \
 		mkdir -p $(HOME)/.config/mc $(HOME)/.local/share/mc/; \
 		umask 0117; \
-		install -m 640 .local/share/mc/bashrc $(HOME)/.local/share/mc/; \
+		$(INSTALL_DATA) .local/share/mc/bashrc $(HOME)/.local/share/mc/; \
 		cat .config/mc/mc.ext /etc/mc/mc.ext > $(HOME)/.config/mc/mc.ext; \
 		{ \
 			echo 'default/*'; \
@@ -134,16 +144,16 @@
 		} >>$(HOME)/.config/mc/mc.ext; \
 	else \
 		mkdir -p $(HOME)/.mc; \
-		install -m 640 .local/share/mc/bashrc $(HOME)/.mc; \
-		install -m 640 .config/mc/mc.ext $(HOME)/.mc/bindings; \
+		$(INSTALL_DATA) .local/share/mc/bashrc $(HOME)/.mc; \
+		$(INSTALL_DATA) .config/mc/mc.ext $(HOME)/.mc/bindings; \
 	fi
 	if command -v file 1>/dev/null; then \
-		install -m 640 .magic $(HOME); \
+		$(INSTALL_DATA) .magic $(HOME); \
 		cd $(HOME); \
 		file --compile -m .magic; \
 	fi
 	mkdir -p $(HOME)/.local/share/applications/
-	install -m 640 .local/share/applications/mimeapps.list $(HOME)/.local/share/applications/
+	$(INSTALL_DATA) .local/share/applications/mimeapps.list $(HOME)/.local/share/applications/
 
 .PHONY: uninstall
 uninstall: