Add SConstruct file for building icons, docs and manpage.
[pdftools:pdfjoin.git] / SConstruct
1 # -*- mode: python ; coding: utf-8 -*-
2 #
3 # Build requirements
4 # - docutils
5 # - inkscape
6 #
7 # For building examles
8 # Build requirements
9 # - ImageMagick
10 #
11
12 import os
13
14 ENV = {
15     'PYTHONPATH': os.environ['PYTHONPATH'],
16     'PATH': os.environ['PATH'],
17     }
18
19 env = Environment(ENV=ENV)
20 env.SConsignFile()
21
22 env.Export(['env'])
23
24 env.Command(['doc/pdfjoin.1', 'doc/pdfjoin.html'],
25             'pdfjoin.rst',
26             'python setup.py build_docs')
27
28 # create PNG projectlogo for project homepage
29 env.Command('projectlogo.png', 'projectlogo.svg',
30             'inkscape -z -f $SOURCE -e $TARGET --export-height=100')
31
32 hires_logo = env.Command('build/icons/projectlogo-hires.png', 'projectlogo.svg',
33                          'inkscape -z -f $SOURCE -e $TARGET')
34
35 icon_parts = [
36     env.Command('build/icons/project-${WIDTH}x${HEIGHT}.pnm', hires_logo,
37                 'pngtopnm $SOURCE ' \
38                 '| pnmscale -width=$WIDTH -height=$HEIGHT ' \
39                 '| ppmquant 256 > $TARGET',
40                 WIDTH=w, HEIGHT=w)
41     for w in (16, 32, 48)
42     ]
43
44 env.Command('projectlogo.ico', icon_parts,
45             'ppmtowinicon $SOURCES > $TARGET')