The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Fix windows build

These changes was commited to the Birdfont repository Thu, 17 Sep 2015 15:54:09 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
author Johan Mattsson <johan.mattsson.m@gmail.com>
Thu, 17 Sep 2015 15:54:09 +0000 (17:54 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Thu, 17 Sep 2015 15:54:09 +0000 (17:54 +0200)
commit a9455c70df2ef0d8611d5c126eeb4ad74a5d3dfd
tree a7e413c2b722f08948dd36566e90e42d0e285bba
parent 17a839a224952bcae53e65137a3fb3d3d80676b8
Fix windows build

build.py
configure
dodo.py
scripts/builder.py
scripts/configfile.py
diff --git a/build.py b/build.py
--- a/build.py +++ b/build.py @@ -1,14 +1,26 @@ #!/usr/bin/python3 import dodo + from sys import platform + from scripts.builder import process_tasks - - process_tasks(dodo.task_libbirdgems()) - process_tasks(dodo.task_libbirdfont()) - process_tasks(dodo.task_birdfont()) - process_tasks(dodo.task_birdfont_autotrace()) - process_tasks(dodo.task_birdfont_export()) - process_tasks(dodo.task_birdfont_import()) + from scripts import config + from scripts.translations import compile_translations + + if not platform == "msys": + process_tasks(dodo.task_libbirdgems()) + process_tasks(dodo.task_libbirdfont()) + else: + process_tasks(dodo.make_libbirdgems('libbirdgems.dll', [])) + process_tasks(dodo.make_libbirdfont('libbirdfont.dll', ['libbirdgems.dll'])) + + if config.GTK: + process_tasks(dodo.task_birdfont()) + process_tasks(dodo.task_birdfont_autotrace()) + process_tasks(dodo.task_birdfont_export()) + process_tasks(dodo.task_birdfont_import()) + + compile_translations() print('Done')
--- a/configure +++ b/configure @@ -63,7 +63,7 @@ print (OKGREEN + 'Using posix profile.' + ENDC) return 'True' - def configure (gtk, libbgee): + def configure(gtk, libbgee): global gee if not test_program_version ('valac', 0, 16, 0): @@ -85,7 +85,6 @@ ] else: libs = [ - 'gdk-pixbuf-2.0', 'gio-2.0', 'glib-2.0', 'sqlite3', @@ -183,10 +182,10 @@ else: options.nonnull = True - configure (options.gtk, options.gee) + configure(options.gtk, options.gee) - configfile.write_config (options.prefix) - configfile.write_compile_parameters (options.prefix, + configfile.write_config(options.prefix) + configfile.write_compile_parameters(options.prefix, options.dest, options.cc, gee, @@ -194,5 +193,6 @@ options.nonnull, valacflags, cflags, - ldflags) + ldflags, + options.gtk)
diff --git a/dodo.py b/dodo.py
--- a/dodo.py +++ b/dodo.py @@ -54,15 +54,15 @@ SO_VERSION=version.SO_VERSION def soname(target_binary): - if "darwin" in sys.platform: + if "darwin" in sys.platform or "msys" in sys.platform: return '' return '-Wl,-soname,' + target_binary - def make_birdfont(target_binary): + def make_birdfont(target_binary, deps): valac_command = config.VALAC + """\ -C \ - --vapidir=./ \ + --vapidir=./ \g --basedir build/birdfont/ \ """ + config.NON_NULL + """ \ """ + config.VALACFLAGS.get("birdfont", "") + """ \ @@ -116,14 +116,14 @@ linker_command, target_binary, None, - ['libbirdgems.so', 'libbirdfont.so']) + deps) yield birdfont.build() def task_birdfont(): - yield make_birdfont('birdfont') + yield make_birdfont('birdfont', ['libbirdgems.so', 'libbirdfont.so']) - def make_birdfont_export(target_binary): + def make_birdfont_export(target_binary, deps): valac_command = config.VALAC + """ \ -C \ --enable-experimental \ @@ -170,14 +170,14 @@ linker_command, target_binary, None, - ['libbirdgems.so', 'libbirdfont.so']) + deps) yield birdfont_export.build() def task_birdfont_export(): - yield make_birdfont_export('birdfont-export') + yield make_birdfont_export('birdfont-export', ['libbirdgems.so', 'libbirdfont.so']) - def make_birdfont_import(target_binary): + def make_birdfont_import(target_binary, deps): valac_command = config.VALAC + """\ -C \ --enable-experimental \ @@ -224,14 +224,14 @@ linker_command, target_binary, None, - ['libbirdgems.so', 'libbirdfont.so']) + deps) yield birdfont_import.build() def task_birdfont_import(): - yield make_birdfont_import('birdfont-import') - - def make_birdfont_autotrace(target_binary): + yield make_birdfont_import('birdfont-import', ['libbirdgems.so', 'libbirdfont.so']) + + def make_birdfont_autotrace(target_binary, deps): valac_command = config.VALAC + """\ -C \ --enable-experimental \ @@ -279,14 +279,14 @@ linker_command, target_binary, None, - ['libbirdgems.so', 'libbirdfont.so']) + deps) yield birdfont_autotrace.build() def task_birdfont_autotrace(): yield make_birdfont_autotrace('birdfont-autotrace') - def make_libbirdfont(target_binary): + def make_libbirdfont(target_binary, deps): valac_command = config.VALAC + """\ -C \ --vapidir=./ \ @@ -343,14 +343,14 @@ linker_command, target_binary, 'libbirdfont.so', - ['libbirdgems.so']) + deps) yield libbirdfont.build() def task_libbirdfont(): - yield make_libbirdfont('libbirdfont.so.' + version.SO_VERSION_MAJOR) + yield make_libbirdfont('libbirdfont.so.' + version.SO_VERSION_MAJOR, ['libbirdgems.so']) - def make_libbirdgems(target_binary): + def make_libbirdgems(target_binary, deps): valac_command = config.VALAC + """\ -C \ -H build/libbirdgems/birdgems.h \ @@ -385,12 +385,13 @@ cc_command, linker_command, target_binary, - 'libbirdgems.so') + None, + deps) yield libbirdgems.build() def task_libbirdgems(): - yield make_libbirdgems('libbirdgems.so.' + version.LIBBIRDGEMS_SO_VERSION_MAJOR) + yield make_libbirdgems('libbirdgems.so.' + version.LIBBIRDGEMS_SO_VERSION_MAJOR, []) def task_compile_translations (): """translate po files"""
--- a/scripts/builder.py +++ b/scripts/builder.py @@ -2,6 +2,7 @@ import fnmatch import glob import types + import time from os import path from scripts.run import run @@ -126,11 +127,43 @@ 'actions': [createlink], 'targets': [path.join('build', 'bin', self.link)] } + + def is_up_to_date(task): + for target in task['targets']: + if not path.isfile(target): + return False + + if not 'file_dep' in task.keys(): + return False + + for dep in task['file_dep']: + if not path.isfile(dep): + print('Dependency is not created yet: ' + dep + ' needed for ' + task['targets']) + exit(1) + + target_times = [] + for target in task['targets']: + target_times.append(path.getmtime(target)) + target_times.sort() + + dependency_times = [] + for dependency in task['file_dep']: + if not path.basename(dependency) == 'placeholder': + dependency_times.append(path.getmtime(dependency)) + dependency_times.sort() + + if len(dependency_times) == 0 or len(target_times) == 0: + return False + + return dependency_times[-1] > target_times[0] def execute_task(task): - for action in task['actions']: - print(action) - run(action) + if is_up_to_date(task): + print(task['basename'] + ' - up to date.') + else: + for action in task['actions']: + print(action) + run(action) def process_tasks(generator): for task in generator:
--- a/scripts/configfile.py +++ b/scripts/configfile.py @@ -38,7 +38,7 @@ f.write("}") def write_compile_parameters (prefix, dest, cc, gee, valac, non_null, - valacflags, cflags, ldflags): + valacflags, cflags, ldflags, gtk): f = open('./scripts/config.py', 'w+') f.write("#!/usr/bin/python3\n") f.write("PREFIX = \"" + prefix + "\"\n") @@ -55,4 +55,5 @@ f.write("VALACFLAGS = " + str(valacflags) + "\n") f.write("CFLAGS = " + str(cflags) + "\n") f.write("LDFLAGS = " + str(ldflags) + "\n") + f.write("GTK = " + str(gtk) + "\n")