From e5b649be930c0f21f4fa4c32d27bca3015cbadfe Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Fri, 18 Apr 2014 11:23:06 +0300 Subject: [PATCH] [SUPPORTIVE PATCH 0.17.200] build and use statically linked zlib-1.2.8 with notmuch --- 28/ba8342ef7953422bbd1581cd0478c76e1fc417 | 216 ++++++++++++++++++++++ 1 file changed, 216 insertions(+) create mode 100644 28/ba8342ef7953422bbd1581cd0478c76e1fc417 diff --git a/28/ba8342ef7953422bbd1581cd0478c76e1fc417 b/28/ba8342ef7953422bbd1581cd0478c76e1fc417 new file mode 100644 index 000000000..8c0256d3e --- /dev/null +++ b/28/ba8342ef7953422bbd1581cd0478c76e1fc417 @@ -0,0 +1,216 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 1457E431FAF + for ; Fri, 18 Apr 2014 01:23:28 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id dNoY5WNX1-6g for ; + Fri, 18 Apr 2014 01:23:24 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 6A21A431FAE + for ; Fri, 18 Apr 2014 01:23:24 -0700 (PDT) +Received: by guru.guru-group.fi (Postfix, from userid 501) + id 348D51000C1; Fri, 18 Apr 2014 11:23:18 +0300 (EEST) +From: Tomi Ollila +To: astreib@indiana.edu +Subject: [SUPPORTIVE PATCH 0.17.200] build and use statically linked + zlib-1.2.8 with notmuch +Date: Fri, 18 Apr 2014 11:23:06 +0300 +Message-Id: <1397809386-23356-1-git-send-email-tomi.ollila@iki.fi> +X-Mailer: git-send-email 1.8.0 +In-Reply-To: <877g6ny3iw.fsf@maritornes.cs.unb.ca> +References: <877g6ny3iw.fsf@maritornes.cs.unb.ca> +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Cc: Tomi Ollila , notmuch@notmuchmail.org +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Fri, 18 Apr 2014 08:23:28 -0000 + +¡¡ NOT TO BE MERGED TO NOTMUCH REPOSITORY !! + +(Due to its intrusive nature this patch is not suitable for merging.) + +Recent notmuch(*) requires zlib 1.2.5.2 or newer; systems that have older +versions of zlib installed can use this patch to use zlib 1.2.8 with +notmuch but keep the current one to be used by default. + +Note that zlib 1.2.8 will be downloaded (if not already there) and built +during ./configure time. + +(since ~ 0.17-194-g3921d23 -- Sat 2014-04-12) +--- + +HTH :) + +Tomi + + Makefile.local | 7 ++-- + compat/build-zlib.py | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + configure | 7 ++++ + 3 files changed, 108 insertions(+), 2 deletions(-) + create mode 100755 compat/build-zlib.py + +diff --git a/Makefile.local b/Makefile.local +index 877a979..1780cee 100644 +--- a/Makefile.local ++++ b/Makefile.local +@@ -292,11 +292,14 @@ notmuch_client_modules = $(notmuch_client_srcs:.c=.o) + + notmuch.o: version.stamp + ++# XXX ZA used in unofficial supportive patch which uses self-built zlib XXX ++ZA=./compat/zlib-1.2.8/libz.a ++ + notmuch: $(notmuch_client_modules) lib/libnotmuch.a util/libutil.a parse-time-string/libparse-time-string.a +- $(call quiet,CXX $(CFLAGS)) $^ $(FINAL_LIBNOTMUCH_LDFLAGS) -o $@ ++ $(call quiet,CXX $(CFLAGS)) $^ $(ZA) $(FINAL_LIBNOTMUCH_LDFLAGS) -o $@ + + notmuch-shared: $(notmuch_client_modules) lib/$(LINKER_NAME) +- $(call quiet,$(FINAL_NOTMUCH_LINKER) $(CFLAGS)) $(notmuch_client_modules) $(FINAL_NOTMUCH_LDFLAGS) -o $@ ++ $(call quiet,$(FINAL_NOTMUCH_LINKER) $(CFLAGS)) $(notmuch_client_modules) $(ZA) $(FINAL_NOTMUCH_LDFLAGS) -o $@ + + .PHONY: install + install: all install-man +diff --git a/compat/build-zlib.py b/compat/build-zlib.py +new file mode 100755 +index 0000000..25e21d9 +--- /dev/null ++++ b/compat/build-zlib.py +@@ -0,0 +1,96 @@ ++#!/usr/bin/env python ++# -*- coding: utf-8 -*- ++# $ build-zlib.py $ ++# ++# Authors: Tomi Ollila, ++# License: Public Domain ++# ++# Created: Sat 12 Apr 2014 17:51:42 EEST too ++# Last modified: Sat 12 Apr 2014 18:52:06 +0300 too ++ ++# Not using string.format() for python 2.5 compatibility. ++# Not using print due to python version 2 & 3 differences. ++ ++# The seemlingly extra 'pass'es work with python mode provided ++# with Emacs 24.1 and earlier (indentation!)... ++ ++import sys ++import os ++try: # Python 3 ++ from urllib.request import urlopen ++except ImportError: # Python 2 ++ from urllib import urlopen ++import shutil ++import hashlib ++ ++ZLIBurl='http://prdownloads.sourceforge.net/libpng/zlib-1.2.8.tar.gz?download' ++ZLIBtgz='zlib-1.2.8.tar.gz' ++ZLIBsum='36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d' ++ZLIBdir='zlib-1.2.8' ++ ++ ++class Die(Exception): ++ def __init__(self, *_list): ++ sys.stderr.write("\n") ++ sys.stderr.write(_list[0] % _list[1:]) ++ sys.stderr.write("\n\n") ++ raise SystemExit(1) ++ pass ++ ++ ++def dl_zlibtgz(): ++ sys.stdout.write("Downloading %s...\n" % ZLIBtgz) ++ response = urlopen(ZLIBurl) ++ # python3 throws urllib.error.HTTPError, python2 does not. ++ if response.getcode() != 200: ++ sys.stderr.write(response.read(4096)) # max 4096 octets ++ exit(1) ++ outfile = open(ZLIBtgz, 'wb') ++ shutil.copyfileobj(response, outfile) ++ pass ++ ++ ++def main(): ++ if not os.path.isfile(ZLIBtgz): ++ dl_zlibtgz() ++ pass ++ ++ sys.stdout.write("Checksumming %s...\n" % ZLIBtgz) ++ infile = open(ZLIBtgz, 'rb') ++ sha256 = hashlib.sha256() ++ while True: ++ data = infile.read(65536) ++ if not data: ++ break ++ sha256.update(data) ++ pass ++ sys.stdout.write(" Expt'd sha256 %s\n" % ZLIBsum) ++ hexdigest = sha256.hexdigest() ++ sys.stdout.write(" Actual sha256 %s\n" % hexdigest) ++ if hexdigest != ZLIBsum: ++ raise Die("File '%s' checksum mismatch", ZLIBtgz) ++ pass ++ ++ target = ZLIBdir + '/libz.a' ++ if os.path.isfile(target): ++ sys.stdout.write("'%s' exists. OK.\n" % target) ++ raise SystemExit(0) ++ ++ def x(*args): ++ sys.stdout.write('x ' + ' '.join(args) + '\n') ++ os.spawnvp(os.P_WAIT, args[0], args) ++ pass ++ ++ sys.stdout.write('Building %s\n' % ZLIBdir) ++ x ('rm', '-rf', ZLIBdir) ++ x ('tar', '-zxf', ZLIBtgz) ++ os.chdir(ZLIBdir) ++ x ('./configure') ++ x ('make') ++ os.chdir('..') ++ if not os.path.isfile(target): ++ raise Die("Could not build '%s' for some reason!", target) ++ ++if __name__ == '__main__': ++ main() ++ pass # pylint: disable=W0107 +diff --git a/configure b/configure +index f447581..4ba0403 100755 +--- a/configure ++++ b/configure +@@ -342,6 +342,13 @@ fi + + printf "Checking for zlib (>= 1.2.5.2)... " + have_zlib=0 ++# XXX unofficial supportive patch to use self-built zlib XXX ++printf "Checking/building zlib 1.2.8:\n" ++(cd compat; exec ../"$srcdir"/compat/build-zlib.py) ++have_zlib=1 ++zlib_cflags="-I ./compat/zlib-1.2.8" ++zlib_ldflags= ++: || + if pkg-config --atleast-version=1.2.5.2 zlib; then + printf "Yes.\n" + have_zlib=1 +-- +1.8.0 + -- 2.26.2