The Birdfont Source Code


All Repositories / birdfont.git / blob – RSS feed

dodo.py

This file is a part of the Birdfont project.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git

Revisions

View the latest version of dodo.py.
Remove roboto bf font
1 """ 2 Copyright (C) 2012 2013 2014 2015 Eduardo Naufel Schettino and Johan Mattsson 3 4 This program is free software: you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation, either version 3 of the License, or 7 (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 """ 17 18 import os 19 import glob 20 import subprocess 21 import sys 22 23 from optparse import OptionParser 24 from doit.tools import run_once 25 from doit.action import CmdAction 26 from scripts.bavala import Vala 27 from scripts import version 28 from scripts.translations import compile_translations 29 from scripts import config 30 31 DOIT_CONFIG = { 32 'default_tasks': [ 33 'build', 34 'libbirdgems', 35 'libbirdxml', 36 'libbirdfont', 37 'birdfont', 38 'birdfont_autotrace', 39 'birdfont_export', 40 'birdfont_import', 41 'compile_translations', 42 'man' 43 ], 44 } 45 46 # external Vala libs 47 LIBS = [ 48 'sqlite3', 49 'glib-2.0', 50 'gio-2.0', 51 'fontconfig', 52 'cairo', 53 'gdk-pixbuf-2.0', 54 'webkitgtk-3.0', 55 config.GEE, 56 'libnotify' 57 ] 58 59 if not config.POSIXVALA: 60 LIBBIRD_XML_LIBS = [ 61 'glib-2.0', 62 'posix' 63 ] 64 else: 65 LIBBIRD_XML_LIBS = [ 66 'posix', 67 'posixtypes' 68 ] 69 70 LIBBIRD_LIBS = [ 71 'glib-2.0' 72 ] 73 74 def task_build (): 75 if not os.path.exists ("build/configured"): 76 print ("Project is not configured") 77 exit (1) 78 79 subprocess.check_output ('mkdir -p build', shell=True) 80 subprocess.check_output ('touch build/installed', shell=True) 81 82 return { 83 'actions': ['echo "Build"'], 84 } 85 86 def task_pkg_flags(): 87 """get compiler flags for libs/pkgs """ 88 for pkg in LIBS: 89 cmd = 'pkg-config --cflags --libs {pkg}' 90 91 yield { 92 'name': pkg, 93 'actions': [CmdAction(cmd.format(pkg=pkg), save_out='out')], 94 'uptodate': [run_once], 95 } 96 97 98 valac_options = [ 99 '--thread', 100 '--enable-experimental-non-null', 101 '--enable-experimental', 102 '--target-glib=2.34', # see bug 0000004 103 '--define=LINUX' 104 ] 105 106 107 if "bsd" in sys.platform: 108 LIBBIRDXML_SO_VERSION='${LIBbirdxml_VERSION}' 109 else: 110 LIBBIRDXML_SO_VERSION=version.LIBBIRDXML_SO_VERSION 111 112 libbirdxml = Vala(src='libbirdxml', build='build', library='birdxml', so_version=LIBBIRDXML_SO_VERSION, pkg_libs=LIBBIRD_XML_LIBS) 113 def task_libbirdxml(): 114 115 if config.POSIXVALA == True: 116 yield libbirdxml.gen_c(valac_options + ['--profile posix']) 117 else: 118 yield libbirdxml.gen_c(valac_options) 119 120 yield libbirdxml.gen_o(['-fPIC']) 121 yield libbirdxml.gen_so() 122 yield libbirdxml.gen_ln() 123 124 125 if "bsd" in sys.platform: 126 LIBBIRDGEMS_SO_VERSION='${LIBbirdgems_VERSION}' 127 else: 128 LIBBIRDGEMS_SO_VERSION=version.LIBBIRDGEMS_SO_VERSION 129 130 libbirdgems = Vala(src='libbirdgems', build='build', library='birdgems', so_version=LIBBIRDGEMS_SO_VERSION, pkg_libs=LIBBIRD_LIBS, vala_deps=[]) 131 def task_libbirdgems(): 132 yield libbirdgems.gen_c(valac_options) 133 yield libbirdgems.gen_o(['-fPIC']) 134 yield libbirdgems.gen_so('-shared -L ./build -l m') 135 yield libbirdgems.gen_ln() 136 137 if "bsd" in sys.platform: 138 SO_VERSION='${LIBbirdfont_VERSION}' 139 else: 140 SO_VERSION=version.SO_VERSION 141 142 libbird = Vala(src='libbirdfont', build='build', library='birdfont', so_version=SO_VERSION, pkg_libs=LIBS, vala_deps=[libbirdgems, libbirdxml]) 143 def task_libbirdfont(): 144 yield libbird.gen_c(valac_options) 145 yield libbird.gen_o(['-fPIC -I./build/', """-D 'GETTEXT_PACKAGE="birdfont"'"""]) 146 yield libbird.gen_so('-L ./build -l birdxml -L ./build -l birdgems') 147 yield libbird.gen_ln() 148 149 150 def task_birdfont(): 151 bird = Vala(src='birdfont', build='build', pkg_libs=LIBS, vala_deps=[libbird, libbirdxml, libbirdgems]) 152 yield bird.gen_c(valac_options) 153 yield bird.gen_bin(["""-D 'GETTEXT_PACKAGE="birdfont"' """]) 154 155 156 def task_birdfont_autotrace(): 157 exp = Vala(src='birdfont-autotrace', build='build', pkg_libs=LIBS, vala_deps=[libbird, libbirdxml, libbirdgems]) 158 yield exp.gen_c(valac_options) 159 yield exp.gen_bin(["""-D 'GETTEXT_PACKAGE="birdfont"' """]) 160 161 162 def task_birdfont_export(): 163 exp = Vala(src='birdfont-export', build='build', pkg_libs=LIBS, vala_deps=[libbird, libbirdxml, libbirdgems]) 164 yield exp.gen_c(valac_options) 165 yield exp.gen_bin(["""-D 'GETTEXT_PACKAGE="birdfont"' """]) 166 167 168 def task_birdfont_import(): 169 exp = Vala(src='birdfont-import', build='build', pkg_libs=LIBS, vala_deps=[libbird, libbirdxml, libbirdgems]) 170 yield exp.gen_c(valac_options) 171 yield exp.gen_bin(["""-D 'GETTEXT_PACKAGE="birdfont"' """]) 172 173 174 def task_compile_translations (): 175 """translate po files""" 176 return { 177 'actions': [compile_translations] 178 } 179 180 def task_man(): 181 """gzip linux man pages""" 182 for name in ("birdfont.1", "birdfont-export.1", 183 "birdfont-import.1", "birdfont-autotrace.1"): 184 yield { 185 'name': name, 186 'file_dep': ['resources/linux/%s' % name], 187 'targets': ['build/%s.gz' % name], 188 'actions': ["gzip -9 -c %(dependencies)s > %(targets)s"], 189 } 190 191 192 def task_distclean (): 193 return { 194 'actions': ['rm -rf .doit.db build scripts/config.py scripts/*.pyc dodo.pyc libbirdfont/Config.vala'], 195 } 196 197