Re: [PATCH] doc: Allow rst2man.py as an alternative to rst2man
[notmuch-archives.git] / 28 / ba8342ef7953422bbd1581cd0478c76e1fc417
1 Return-Path: <too@guru-group.fi>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 1457E431FAF\r
6         for <notmuch@notmuchmail.org>; Fri, 18 Apr 2014 01:23:28 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id dNoY5WNX1-6g for <notmuch@notmuchmail.org>;\r
16         Fri, 18 Apr 2014 01:23:24 -0700 (PDT)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id 6A21A431FAE\r
19         for <notmuch@notmuchmail.org>; Fri, 18 Apr 2014 01:23:24 -0700 (PDT)\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)\r
21         id 348D51000C1; Fri, 18 Apr 2014 11:23:18 +0300 (EEST)\r
22 From: Tomi Ollila <tomi.ollila@iki.fi>\r
23 To: astreib@indiana.edu\r
24 Subject: [SUPPORTIVE PATCH 0.17.200] build and use statically linked\r
25         zlib-1.2.8 with notmuch\r
26 Date: Fri, 18 Apr 2014 11:23:06 +0300\r
27 Message-Id: <1397809386-23356-1-git-send-email-tomi.ollila@iki.fi>\r
28 X-Mailer: git-send-email 1.8.0\r
29 In-Reply-To: <877g6ny3iw.fsf@maritornes.cs.unb.ca>\r
30 References: <877g6ny3iw.fsf@maritornes.cs.unb.ca>\r
31 MIME-Version: 1.0\r
32 Content-Type: text/plain; charset=UTF-8\r
33 Content-Transfer-Encoding: 8bit\r
34 Cc: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org\r
35 X-BeenThere: notmuch@notmuchmail.org\r
36 X-Mailman-Version: 2.1.13\r
37 Precedence: list\r
38 List-Id: "Use and development of the notmuch mail system."\r
39         <notmuch.notmuchmail.org>\r
40 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
41         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
42 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
43 List-Post: <mailto:notmuch@notmuchmail.org>\r
44 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
45 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
47 X-List-Received-Date: Fri, 18 Apr 2014 08:23:28 -0000\r
48 \r
49 ¡¡ NOT TO BE MERGED TO NOTMUCH REPOSITORY !!\r
50 \r
51 (Due to its intrusive nature this patch is not suitable for merging.)\r
52 \r
53 Recent notmuch(*) requires zlib 1.2.5.2 or newer; systems that have older\r
54 versions of zlib installed can use this patch to use zlib 1.2.8 with\r
55 notmuch but keep the current one to be used by default.\r
56 \r
57 Note that zlib 1.2.8 will be downloaded (if not already there) and built\r
58 during ./configure time.\r
59 \r
60 (since ~ 0.17-194-g3921d23 -- Sat 2014-04-12)\r
61 ---\r
62 \r
63 HTH :)\r
64 \r
65 Tomi\r
66 \r
67  Makefile.local       |  7 ++--\r
68  compat/build-zlib.py | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++\r
69  configure            |  7 ++++\r
70  3 files changed, 108 insertions(+), 2 deletions(-)\r
71  create mode 100755 compat/build-zlib.py\r
72 \r
73 diff --git a/Makefile.local b/Makefile.local\r
74 index 877a979..1780cee 100644\r
75 --- a/Makefile.local\r
76 +++ b/Makefile.local\r
77 @@ -292,11 +292,14 @@ notmuch_client_modules = $(notmuch_client_srcs:.c=.o)\r
78  \r
79  notmuch.o: version.stamp\r
80  \r
81 +# XXX ZA used in unofficial supportive patch which uses self-built zlib XXX\r
82 +ZA=./compat/zlib-1.2.8/libz.a\r
83 +\r
84  notmuch: $(notmuch_client_modules) lib/libnotmuch.a util/libutil.a parse-time-string/libparse-time-string.a\r
85 -       $(call quiet,CXX $(CFLAGS)) $^ $(FINAL_LIBNOTMUCH_LDFLAGS) -o $@\r
86 +       $(call quiet,CXX $(CFLAGS)) $^ $(ZA) $(FINAL_LIBNOTMUCH_LDFLAGS) -o $@\r
87  \r
88  notmuch-shared: $(notmuch_client_modules) lib/$(LINKER_NAME)\r
89 -       $(call quiet,$(FINAL_NOTMUCH_LINKER) $(CFLAGS)) $(notmuch_client_modules) $(FINAL_NOTMUCH_LDFLAGS) -o $@\r
90 +       $(call quiet,$(FINAL_NOTMUCH_LINKER) $(CFLAGS)) $(notmuch_client_modules) $(ZA) $(FINAL_NOTMUCH_LDFLAGS) -o $@\r
91  \r
92  .PHONY: install\r
93  install: all install-man\r
94 diff --git a/compat/build-zlib.py b/compat/build-zlib.py\r
95 new file mode 100755\r
96 index 0000000..25e21d9\r
97 --- /dev/null\r
98 +++ b/compat/build-zlib.py\r
99 @@ -0,0 +1,96 @@\r
100 +#!/usr/bin/env python\r
101 +# -*- coding: utf-8 -*-\r
102 +# $ build-zlib.py $\r
103 +#\r
104 +# Authors: Tomi Ollila,\r
105 +# License: Public Domain\r
106 +#\r
107 +# Created: Sat 12 Apr 2014 17:51:42 EEST too\r
108 +# Last modified: Sat 12 Apr 2014 18:52:06 +0300 too\r
109 +\r
110 +# Not using string.format() for python 2.5 compatibility.\r
111 +# Not using print due to python version 2 & 3 differences.\r
112 +\r
113 +# The seemlingly extra 'pass'es work with python mode provided\r
114 +# with Emacs 24.1 and earlier (indentation!)...\r
115 +\r
116 +import sys\r
117 +import os\r
118 +try:  # Python 3\r
119 +    from urllib.request import urlopen\r
120 +except ImportError:  # Python 2\r
121 +    from urllib import urlopen\r
122 +import shutil\r
123 +import hashlib\r
124 +\r
125 +ZLIBurl='http://prdownloads.sourceforge.net/libpng/zlib-1.2.8.tar.gz?download'\r
126 +ZLIBtgz='zlib-1.2.8.tar.gz'\r
127 +ZLIBsum='36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d'\r
128 +ZLIBdir='zlib-1.2.8'\r
129 +\r
130 +\r
131 +class Die(Exception):\r
132 +    def __init__(self, *_list):\r
133 +        sys.stderr.write("\n")\r
134 +        sys.stderr.write(_list[0] % _list[1:])\r
135 +        sys.stderr.write("\n\n")\r
136 +        raise SystemExit(1)\r
137 +    pass\r
138 +\r
139 +\r
140 +def dl_zlibtgz():\r
141 +    sys.stdout.write("Downloading %s...\n" % ZLIBtgz)\r
142 +    response = urlopen(ZLIBurl)\r
143 +    # python3 throws urllib.error.HTTPError, python2 does not.\r
144 +    if response.getcode() != 200:\r
145 +        sys.stderr.write(response.read(4096))  # max 4096 octets\r
146 +        exit(1)\r
147 +    outfile = open(ZLIBtgz, 'wb')\r
148 +    shutil.copyfileobj(response, outfile)\r
149 +    pass\r
150 +\r
151 +\r
152 +def main():\r
153 +    if not os.path.isfile(ZLIBtgz):\r
154 +        dl_zlibtgz()\r
155 +        pass\r
156 +\r
157 +    sys.stdout.write("Checksumming %s...\n" % ZLIBtgz)\r
158 +    infile = open(ZLIBtgz, 'rb')\r
159 +    sha256 = hashlib.sha256()\r
160 +    while True:\r
161 +        data = infile.read(65536)\r
162 +        if not data:\r
163 +            break\r
164 +        sha256.update(data)\r
165 +        pass\r
166 +    sys.stdout.write(" Expt'd sha256 %s\n" % ZLIBsum)\r
167 +    hexdigest = sha256.hexdigest()\r
168 +    sys.stdout.write(" Actual sha256 %s\n" % hexdigest)\r
169 +    if hexdigest != ZLIBsum:\r
170 +        raise Die("File '%s' checksum mismatch", ZLIBtgz)\r
171 +    pass\r
172 +\r
173 +    target = ZLIBdir + '/libz.a'\r
174 +    if os.path.isfile(target):\r
175 +        sys.stdout.write("'%s' exists. OK.\n" % target)\r
176 +        raise SystemExit(0)\r
177 +\r
178 +    def x(*args):\r
179 +        sys.stdout.write('x ' + ' '.join(args) + '\n')\r
180 +        os.spawnvp(os.P_WAIT, args[0], args)\r
181 +        pass\r
182 +\r
183 +    sys.stdout.write('Building %s\n' % ZLIBdir)\r
184 +    x ('rm', '-rf', ZLIBdir)\r
185 +    x ('tar', '-zxf', ZLIBtgz)\r
186 +    os.chdir(ZLIBdir)\r
187 +    x ('./configure')\r
188 +    x ('make')\r
189 +    os.chdir('..')\r
190 +    if not os.path.isfile(target):\r
191 +        raise Die("Could not build '%s' for some reason!", target)\r
192 +\r
193 +if __name__ == '__main__':\r
194 +    main()\r
195 +    pass  # pylint: disable=W0107\r
196 diff --git a/configure b/configure\r
197 index f447581..4ba0403 100755\r
198 --- a/configure\r
199 +++ b/configure\r
200 @@ -342,6 +342,13 @@ fi\r
201  \r
202  printf "Checking for zlib (>= 1.2.5.2)... "\r
203  have_zlib=0\r
204 +# XXX unofficial supportive patch to use self-built zlib XXX\r
205 +printf "Checking/building zlib 1.2.8:\n"\r
206 +(cd compat; exec ../"$srcdir"/compat/build-zlib.py)\r
207 +have_zlib=1\r
208 +zlib_cflags="-I ./compat/zlib-1.2.8"\r
209 +zlib_ldflags=\r
210 +: ||\r
211  if pkg-config --atleast-version=1.2.5.2 zlib; then\r
212      printf "Yes.\n"\r
213      have_zlib=1\r
214 -- \r
215 1.8.0\r
216 \r