[buildout] extends = ../fontconfig/buildout.cfg ../xorg/buildout.cfg parts = wkhtmltopdf [wkhtmltopdf] recipe = slapos.recipe.build # here, two %s are used, first one is for directory name (eg. x86_64), and second one is for filename (eg. x86-64). url_x86-64 = http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.11.0_rc1-static-amd64.tar.bz2 url_x86 = http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.11.0_rc1-static-i386.tar.bz2 # supported architectures md5sums md5sum_x86 = d796cfb66e45673d8f6728b61f34d5e0 md5sum_x86-64 = 02a2c6963728b69b8e329dcbf1f4c7e1 # script to install. script = location = %(location)r self.failIfPathExists(location) import sys ARCH_DIR_MAP = { 'x86': 'x86', 'x86-64': 'x86_64' } WK_SUFIX_MAP = { 'x86': 'i386', 'x86-64': 'amd64' } platform = guessPlatform() url = self.options['url_' + platform] md5sum = self.options['md5sum_' + platform] extract_dir = self.extract(self.download(url, md5sum)) shutil.move(extract_dir, location) wrapper_location = os.path.join("%(location)s", "wkhtmltopdf") wrapper = open(wrapper_location, 'w') wrapper.write("""#!${dash:location}/bin/dash cd %(location)s export LD_LIBRARY_PATH=%(location)s:${libXrender:location}/lib/:${fontconfig:location}/lib/:${libX11:location}/lib/:${libXext:location}/lib/ export PATH=${fontconfig:location}/bin:$PATH exec %(location)s/wkhtmltopdf-""" + WK_SUFIX_MAP[platform]+ """ $*""") wrapper.close() os.chmod(wrapper_location, 0755)