.
1 #!/usr/bin/python
2 """
3 Copyright (C) 2013 2014 Johan Mattsson
4
5 This library is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 3 of the
8 License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14 """
15
16 import build
17 from translations import compile_translations
18 import configfile
19 from run import run
20 import version
21 from optparse import OptionParser
22
23 parser = OptionParser()
24 parser.add_option("-p", "--prefix", dest="prefix", help="install prefix", metavar="PREFIX")
25 parser.add_option("-d", "--dest", dest="dest", help="install to this directory", metavar="DEST")
26 parser.add_option("-c", "--cc", dest="cc", help="select the C compiler", metavar="CC")
27 parser.add_option("-f", "--cflags", dest="cflags", help="set compiler flags", metavar="CFLAGS")
28 parser.add_option("-l", "--ldflags", dest="ldflags", help="set linker flags", metavar="LDFLAGS")
29 parser.add_option("-v", "--valac", dest="valac", help="select vala compiler", metavar="VALAC")
30 parser.add_option("-n", "--nogtk", dest="nogtk", help="do not compile the gtk application", metavar="NOGTK", default=False)
31
32 (options, args) = parser.parse_args()
33
34 if not options.prefix:
35 options.prefix = "/opt/local"
36 if not options.cc:
37 options.cc = "gcc"
38 if not options.cflags:
39 options.cflags = ""
40 if not options.ldflags:
41 options.ldflags = ""
42 if not options.valac:
43 options.valac = "valac"
44
45 prefix = options.prefix
46 valac = options.valac
47 valaflags = "--pkg gdk-pixbuf-2.0 --pkg gtk+-2.0"
48 cc = options.cc
49 cflags = options.cflags + " " + "$(pkg-config --cflags gdk-pixbuf-2.0)"
50 ldflags = options.ldflags + " " + "$(pkg-config --libs gdk-pixbuf-2.0)"
51
52 library_cflags = "-fno-common -fPIC " + cflags
53 library_ldflags = options.ldflags + " " + """-dynamiclib -Wl,-headerpad_max_install_names,-undefined,dynamic_lookup,-compatibility_version,1.0,-current_version,1.0,-install_name,""" + prefix + """/lib/libbirdfont.dylib"""
54
55 xml_library_cflags = "-fno-common -fPIC " + cflags
56 xml_library_ldflags = options.ldflags + " " + """-dynamiclib -Wl,-headerpad_max_install_names,-undefined,dynamic_lookup,-compatibility_version,1.0,-current_version,1.0,-install_name,""" + prefix + """/lib/libbirdxml.dylib"""
57
58 configfile.write_config (prefix)
59 compile_translations()
60 build.libbirdxml(prefix, cc, xml_library_cflags, xml_library_ldflags, valac, valaflags, "libbirdxml." + version.LIBBIRDXML_SO_VERSION + ".dylib", False)
61 build.libbirdfont(prefix, cc, library_cflags, library_ldflags, valac, valaflags, "libbirdfont." + version.SO_VERSION + ".dylib", False)
62 build.birdfont_import(prefix, cc, cflags, ldflags, valac, valaflags, False)
63
64 if not options.nogtk:
65 build.birdfont_gtk(prefix, cc, cflags, ldflags, valac, valaflags, False)
66
67 print ("Done")
68