[PATCH v2 05/10] install: check for non-SysV version (Solaris support)
authorBlake Jones <blakej@foo.net>
Mon, 5 Nov 2012 19:01:58 +0000 (11:01 +1600)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:50:21 +0000 (09:50 -0800)
42/e0a90fb812619f08e539baa41b3b2e1e97e124 [new file with mode: 0644]

diff --git a/42/e0a90fb812619f08e539baa41b3b2e1e97e124 b/42/e0a90fb812619f08e539baa41b3b2e1e97e124
new file mode 100644 (file)
index 0000000..d0aadc7
--- /dev/null
@@ -0,0 +1,223 @@
+Return-Path: <blakej@foo.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id A9B9E429E2F\r
+       for <notmuch@notmuchmail.org>; Mon,  5 Nov 2012 11:02:28 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id gxMQYNq-j+BZ for <notmuch@notmuchmail.org>;\r
+       Mon,  5 Nov 2012 11:02:26 -0800 (PST)\r
+Received: from foo.net (70-36-235-136.dsl.static.sonic.net [70.36.235.136])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 0A33B429E32\r
+       for <notmuch@notmuchmail.org>; Mon,  5 Nov 2012 11:02:23 -0800 (PST)\r
+Received: from foo.net (localhost [127.0.0.1])\r
+       by foo.net (8.14.5+Sun/8.14.5) with ESMTP id qA5J2Mv1019113;\r
+       Mon, 5 Nov 2012 11:02:22 -0800 (PST)\r
+Received: (from blakej@localhost)\r
+       by foo.net (8.14.5+Sun/8.14.5/Submit) id qA5J2McW019112;\r
+       Mon, 5 Nov 2012 11:02:22 -0800 (PST)\r
+From: Blake Jones <blakej@foo.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 05/10] install: check for non-SysV version (Solaris\r
+ support)\r
+Date: Mon,  5 Nov 2012 11:01:58 -0800\r
+Message-Id: <1352142123-18286-6-git-send-email-blakej@foo.net>\r
+X-Mailer: git-send-email 1.7.3.2\r
+In-Reply-To: <1352142123-18286-1-git-send-email-blakej@foo.net>\r
+References: <1352142123-18286-1-git-send-email-blakej@foo.net>\r
+X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2\r
+       (foo.net [127.0.0.1]); Mon, 05 Nov 2012 11:02:22 -0800 (PST)\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 05 Nov 2012 19:02:29 -0000\r
+\r
+Solaris ships a program called "install" in /usr/sbin, which performs a\r
+task that's fairly similar to the GNU and BSD "install" programs but\r
+which uses very different command line arguments.  In particular, if it\r
+is invoked without "-c", "-f", or "-n", it will search the target\r
+directory for a file with the same name as the one being installed, and\r
+it will only install the file if it finds a matching name.  More\r
+excitingly, if it doesn't find a match, it will look in /bin, /usr/bin,\r
+/etc, /lib, and /usr/lib and try to do the same there.\r
+\r
+The standard workaround for this is to use GNU install.\r
+It is available via the standard Solaris packaging system (in\r
+"file/gnu-coreutils"), and installs itself as /usr/bin/ginstall.\r
+\r
+This patch adds a check to "configure" to see if "install" behaves in a\r
+way that's compatible with GNU and BSD install, and if not, it uses a\r
+program called "ginstall" instead.  It also modifies "configure" to set\r
+the $(INSTALL) variable, and changes various Makefiles to use it.\r
+---\r
+ Makefile.local            |    2 +-\r
+ completion/Makefile.local |    4 ++--\r
+ configure                 |   19 +++++++++++++++++++\r
+ emacs/Makefile.local      |    6 +++---\r
+ lib/Makefile.local        |    4 ++--\r
+ man/Makefile.local        |    6 +++---\r
+ vim/Makefile              |    6 ++----\r
+ 7 files changed, 32 insertions(+), 15 deletions(-)\r
+\r
+diff --git a/Makefile.local b/Makefile.local\r
+index 2b91946..7ccb1cd 100644\r
+--- a/Makefile.local\r
++++ b/Makefile.local\r
+@@ -286,7 +286,7 @@ notmuch-shared: $(notmuch_client_modules) lib/$(LINKER_NAME)\r
+ .PHONY: install\r
+ install: all install-man\r
+       mkdir -p "$(DESTDIR)$(prefix)/bin/"\r
+-      install notmuch-shared "$(DESTDIR)$(prefix)/bin/notmuch"\r
++      $(INSTALL) notmuch-shared "$(DESTDIR)$(prefix)/bin/notmuch"\r
+ ifeq ($(MAKECMDGOALS), install)\r
+       @echo ""\r
+       @echo "Notmuch is now installed to $(DESTDIR)$(prefix)"\r
+diff --git a/completion/Makefile.local b/completion/Makefile.local\r
+index dfc1271..a648a78 100644\r
+--- a/completion/Makefile.local\r
++++ b/completion/Makefile.local\r
+@@ -14,9 +14,9 @@ install-$(dir):\r
+       @echo $@\r
+ ifeq ($(WITH_BASH),1)\r
+       mkdir -p "$(DESTDIR)$(bash_completion_dir)"\r
+-      install -m0644 $(bash_script) "$(DESTDIR)$(bash_completion_dir)/notmuch"\r
++      $(INSTALL) -m0644 $(bash_script) "$(DESTDIR)$(bash_completion_dir)/notmuch"\r
+ endif\r
+ ifeq ($(WITH_ZSH),1)\r
+       mkdir -p "$(DESTDIR)$(zsh_completion_dir)"\r
+-      install -m0644 $(zsh_script) "$(DESTDIR)$(zsh_completion_dir)/_notmuch"\r
++      $(INSTALL) -m0644 $(zsh_script) "$(DESTDIR)$(zsh_completion_dir)/_notmuch"\r
+ endif\r
+diff --git a/configure b/configure\r
+index c9da667..d9a101f 100755\r
+--- a/configure\r
++++ b/configure\r
+@@ -591,6 +591,21 @@ for flag in -Wmissing-declarations; do\r
+ done\r
+ printf "\n\t${WARN_CFLAGS}\n"\r
+ \r
++INSTALL="install"\r
++printf "Checking for working \"install\" program... "\r
++mkdir _tmp_\r
++cd _tmp_\r
++echo 1 > 1\r
++mkdir dest\r
++if install 1 dest > /dev/null 2>&1 ; then\r
++      printf "\"install\" works fine.\n"\r
++else\r
++      INSTALL="ginstall"\r
++      printf "using \"ginstall\".\n"\r
++fi\r
++cd ..\r
++rm -rf _tmp_\r
++\r
+ rm -f minimal minimal.c\r
+ \r
+ cat <<EOF\r
+@@ -777,4 +792,8 @@ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)    \\\r
+                    -DSTD_ASCTIME=\$(STD_ASCTIME)\r
+ CONFIGURE_LDFLAGS =  \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(XAPIAN_LDFLAGS) \\\r
+                    \$(LIBNSL_LDFLAGS)\r
++\r
++# Which "install" program to use\r
++INSTALL = ${INSTALL}\r
++\r
+ EOF\r
+diff --git a/emacs/Makefile.local b/emacs/Makefile.local\r
+index fb82247..ee778cb 100644\r
+--- a/emacs/Makefile.local\r
++++ b/emacs/Makefile.local\r
+@@ -36,11 +36,11 @@ endif\r
+ .PHONY: install-emacs\r
+ install-emacs:\r
+       mkdir -p "$(DESTDIR)$(emacslispdir)"\r
+-      install -m0644 $(emacs_sources) "$(DESTDIR)$(emacslispdir)"\r
++      $(INSTALL) -m0644 $(emacs_sources) "$(DESTDIR)$(emacslispdir)"\r
+ ifeq ($(HAVE_EMACS),1)\r
+-      install -m0644 $(emacs_bytecode) "$(DESTDIR)$(emacslispdir)"\r
++      $(INSTALL) -m0644 $(emacs_bytecode) "$(DESTDIR)$(emacslispdir)"\r
+ endif\r
+       mkdir -p "$(DESTDIR)$(emacsetcdir)"\r
+-      install -m0644 $(emacs_images) "$(DESTDIR)$(emacsetcdir)"\r
++      $(INSTALL) -m0644 $(emacs_images) "$(DESTDIR)$(emacsetcdir)"\r
+ \r
+ CLEAN := $(CLEAN) $(emacs_bytecode)\r
+diff --git a/lib/Makefile.local b/lib/Makefile.local\r
+index 7785944..0c6b258 100644\r
+--- a/lib/Makefile.local\r
++++ b/lib/Makefile.local\r
+@@ -89,11 +89,11 @@ install: install-$(dir)\r
+ \r
+ install-$(dir): $(dir)/$(LIBNAME)\r
+       mkdir -p "$(DESTDIR)$(libdir)/"\r
+-      install -m0644 "$(lib)/$(LIBNAME)" "$(DESTDIR)$(libdir)/"\r
++      $(INSTALL) -m0644 "$(lib)/$(LIBNAME)" "$(DESTDIR)$(libdir)/"\r
+       ln -sf $(LIBNAME) "$(DESTDIR)$(libdir)/$(SONAME)"\r
+       ln -sf $(LIBNAME) "$(DESTDIR)$(libdir)/$(LINKER_NAME)"\r
+       mkdir -p "$(DESTDIR)$(includedir)"\r
+-      install -m0644 "$(srcdir)/$(lib)/notmuch.h" "$(DESTDIR)$(includedir)/"\r
++      $(INSTALL) -m0644 "$(srcdir)/$(lib)/notmuch.h" "$(DESTDIR)$(includedir)/"\r
+       $(LIBRARY_INSTALL_POST_COMMAND)\r
+ \r
+ SRCS  := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)\r
+diff --git a/man/Makefile.local b/man/Makefile.local\r
+index 72e2a18..07dcf4c 100644\r
+--- a/man/Makefile.local\r
++++ b/man/Makefile.local\r
+@@ -38,9 +38,9 @@ install-man: $(COMPRESSED_MAN)\r
+       mkdir -p "$(DESTDIR)$(mandir)/man1"\r
+       mkdir -p "$(DESTDIR)$(mandir)/man5"\r
+       mkdir -p "$(DESTDIR)$(mandir)/man7"\r
+-      install -m0644 $(MAN1_GZ) $(DESTDIR)/$(mandir)/man1\r
+-      install -m0644 $(MAN5_GZ) $(DESTDIR)/$(mandir)/man5\r
+-      install -m0644 $(MAN7_GZ) $(DESTDIR)/$(mandir)/man7\r
++      $(INSTALL) -m0644 $(MAN1_GZ) $(DESTDIR)/$(mandir)/man1\r
++      $(INSTALL) -m0644 $(MAN5_GZ) $(DESTDIR)/$(mandir)/man5\r
++      $(INSTALL) -m0644 $(MAN7_GZ) $(DESTDIR)/$(mandir)/man7\r
+       cd $(DESTDIR)/$(mandir)/man1 && ln -sf notmuch.1.gz notmuch-setup.1.gz\r
+ \r
+ update-man-versions: $(MAN_SOURCE)\r
+diff --git a/vim/Makefile b/vim/Makefile\r
+index f17bebf..7ceba7a 100644\r
+--- a/vim/Makefile\r
++++ b/vim/Makefile\r
+@@ -5,8 +5,6 @@ files = plugin/notmuch.vim \\r
+ prefix = $(HOME)/.vim\r
+ destdir = $(prefix)/plugin\r
+ \r
+-INSTALL = install -D -m644\r
+-\r
+ all: help\r
+ \r
+ help:\r
+@@ -17,7 +15,7 @@ help:\r
+       @echo "    make symlink     - create symlinks in ~/.vim (useful for development)"\r
+ \r
+ install:\r
+-      @for x in $(files); do $(INSTALL) $(CURDIR)/$$x $(prefix)/$$x; done\r
++      @for x in $(files); do $(INSTALL) -D -m644 $(CURDIR)/$$x $(prefix)/$$x; done\r
+ \r
+-link symlink: INSTALL = ln -fs\r
+ link symlink: install\r
++      @for x in $(files); do ln -fs $(CURDIR)/$$x $(prefix)/$$x; done\r
+-- \r
+1.7.3.2\r
+\r