Included wkhtmltopdf component
[slapos.git] / component / wkhtmltopdf / buildout.cfg
1 [buildout]
2
3 extends = 
4   ../fontconfig/buildout.cfg
5   ../xorg/buildout.cfg
6
7 parts =
8   wkhtmltopdf
9
10 [wkhtmltopdf]
11 recipe = slapos.recipe.build
12
13 # here, two %s are used, first one is for directory name (eg. x86_64), and second one is for filename (eg. x86-64).
14 url_x86-64 = http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.11.0_rc1-static-amd64.tar.bz2
15 url_x86 = http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.11.0_rc1-static-i386.tar.bz2
16
17 # supported architectures md5sums
18 md5sum_x86 = d796cfb66e45673d8f6728b61f34d5e0
19 md5sum_x86-64 = 02a2c6963728b69b8e329dcbf1f4c7e1
20
21 # script to install.
22 script =
23   location = %(location)r
24   self.failIfPathExists(location)
25   import sys
26   ARCH_DIR_MAP = { 'x86': 'x86', 'x86-64': 'x86_64' }
27   WK_SUFIX_MAP = { 'x86': 'i386', 'x86-64': 'amd64' }
28   platform = guessPlatform()
29   url = self.options['url_' + platform]
30   md5sum = self.options['md5sum_' + platform]
31   extract_dir = self.extract(self.download(url, md5sum))
32   shutil.move(extract_dir, location)
33   wrapper_location = os.path.join("%(location)s", "wkhtmltopdf")
34   wrapper = open(wrapper_location, 'w')
35   wrapper.write("""#!${dash:location}/bin/dash
36   cd %(location)s
37   export LD_LIBRARY_PATH=%(location)s:${libXrender:location}/lib/:${fontconfig:location}/lib/:${libX11:location}/lib/:${libXext:location}/lib/
38   export PATH=${fontconfig:location}/bin:$PATH
39   exec %(location)s/wkhtmltopdf-""" + WK_SUFIX_MAP[platform]+ """ $*""")
40   wrapper.close()
41   os.chmod(wrapper_location, 0777)