From dd0da6744b609b33a8ef78b7f1e71a7f159110af Mon Sep 17 00:00:00 2001 From: Kevin Ollivier Date: Mon, 7 Dec 2009 00:42:51 +0000 Subject: [PATCH] Commit of start on waf build system. Uses the most recent waf release. Currently builds on OS X with ffmpeg, OpenAL and libass providers, do waf configure; waf build to build. Originally committed to SVN as r3854. --- aegisub/libass/wscript | 26 ++++++ aegisub/libffms/wscript | 26 ++++++ aegisub/src/libresrc/wscript | 34 ++++++++ aegisub/src/wscript | 63 ++++++++++++++ aegisub/tools/wscript | 31 +++++++ aegisub/wscript | 159 +++++++++++++++++++++++++++++++++++ 6 files changed, 339 insertions(+) create mode 100644 aegisub/libass/wscript create mode 100644 aegisub/libffms/wscript create mode 100644 aegisub/src/libresrc/wscript create mode 100644 aegisub/src/wscript create mode 100644 aegisub/tools/wscript create mode 100644 aegisub/wscript diff --git a/aegisub/libass/wscript b/aegisub/libass/wscript new file mode 100644 index 000000000..fb470d90a --- /dev/null +++ b/aegisub/libass/wscript @@ -0,0 +1,26 @@ +#! /usr/bin/env python +# encoding: utf-8 +# +# Copyright (c) 2009, Kevin Ollivier +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +def build(bld): + obj = bld.new_task_gen( + features = 'cc cstaticlib', + target = 'ass_aegisub', + defines = 'CONFIG_ICONV CONFIG_FONTCONFIG', + includes = '.', + uselib = 'FREETYPE2') + + obj.find_sources_in_dirs('.') diff --git a/aegisub/libffms/wscript b/aegisub/libffms/wscript new file mode 100644 index 000000000..bc0c9e889 --- /dev/null +++ b/aegisub/libffms/wscript @@ -0,0 +1,26 @@ +#! /usr/bin/env python +# encoding: utf-8 +# +# Copyright (c) 2009, Kevin Ollivier +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +def build(bld): + obj = bld.new_task_gen( + features = 'cc cxx cstaticlib', + target = 'ffmpegsource_aegisub', + defines = 'FFMS_EXPORTS HAVE_STRLCPY', + includes = 'include src/core', + uselib = 'FFMPEG') + + obj.find_sources_in_dirs('src/core') diff --git a/aegisub/src/libresrc/wscript b/aegisub/src/libresrc/wscript new file mode 100644 index 000000000..e4da7cd44 --- /dev/null +++ b/aegisub/src/libresrc/wscript @@ -0,0 +1,34 @@ +#! /usr/bin/env python +# encoding: utf-8 +# +# Copyright (c) 2009, Kevin Ollivier +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import os + +dir = os.path.abspath('.') + +source_list = [ + 'src/bitmaps/16', 'src/bitmaps/24', 'src/bitmaps/misc/splash.png', 'src/bitmaps/misc/wxicon.png' +] + +sources = '' +for source in source_list: + sources += ' %s/%s' % (dir, source) + +def build(bld): + obj = bld.new_task_gen( + rule = dir + '/build/default/tools/common-respack %s/src/libresrc/libresrc.cpp' % dir + sources, + after = 'common-respack', + ) diff --git a/aegisub/src/wscript b/aegisub/src/wscript new file mode 100644 index 000000000..ce0a2d72d --- /dev/null +++ b/aegisub/src/wscript @@ -0,0 +1,63 @@ +#! /usr/bin/env python +# encoding: utf-8 +# +# Copyright (c) 2009, Kevin Ollivier +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import sys + +import Options +import distutils.dir_util + +def build(bld): + subdirs = ['libresrc'] + uselib_local = [] + includes = ['#', '.'] + + if Options.options.with_provider_video == 'ffmpegsource' or Options.options.with_provider_audio == 'ffmpegsource': + uselib_local.append('ffmpegsource_aegisub') + includes.append('../libffms/include') + + if Options.options.with_provider_subtitle == 'libass': + uselib_local.append('ass_aegisub') + + bld.add_subdirs(subdirs) + + excludes = [] + + if not sys.platform.startswith('win'): + excludes.append('vfw_wrap.cpp') + + dirs = ["."] + + obj = bld.new_task_gen( + features = 'cc cxx cprogram', + target = 'aegisub', + includes = includes, + source = 'libresrc/libresrc.cpp', + defines = '', + uselib = 'GL CURL FONTCONFIG FREETYPE2 WX', + uselib_local = uselib_local) + + if sys.platform.startswith('darwin'): + excludes.append('bundledirs-test.c') + dirs.append('libosxutil') + obj.mac_app = True + bld.add_post_fun(copy_mac_bundle_files) + + obj.find_sources_in_dirs(dirs, excludes=excludes) + +def copy_mac_bundle_files(bld): + distutils.dir_util.copy_tree('packages/osx_bundle/Contents', 'build/default/src/aegisub.app/Contents', '') + diff --git a/aegisub/tools/wscript b/aegisub/tools/wscript new file mode 100644 index 000000000..3432389cb --- /dev/null +++ b/aegisub/tools/wscript @@ -0,0 +1,31 @@ +#! /usr/bin/env python +# encoding: utf-8 +# +# Copyright (c) 2009, Kevin Ollivier +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import sys + +def build(bld): + # 1. A simple program + obj = bld.new_task_gen( + features = 'cc cxx cprogram', + target = 'common-respack', + includes = '.', + source = 'common-respack.cpp', + defines = '', + uselib = 'WX') + + # so that we build this before the sources + bld.add_group() diff --git a/aegisub/wscript b/aegisub/wscript new file mode 100644 index 000000000..8ab46f437 --- /dev/null +++ b/aegisub/wscript @@ -0,0 +1,159 @@ +#! /usr/bin/env python +# encoding: utf-8 +# +# Copyright (c) 2009, Kevin Ollivier +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +import os +import sys + +import Options + +VERSION= (2,2,0) +APPNAME='Aegisub' + +appdir = os.path.abspath('.') + +srcdir = '.' +blddir = 'build' + +def get_path_to_wxconfig(): + if 'WX_CONFIG' in os.environ: + return os.environ['WX_CONFIG'] + else: + return 'wx-config' + +def set_options(opt): + opt.tool_options('compiler_cxx compiler_cc') + + audio_player_default = "PortAudio" + if sys.platform.startswith('darwin'): + audio_player_default = "OpenAL" + elif sys.platform.startswith("linux"): + audio_player_default = "ALSA" + + opt.add_option('--debug', action='store_true', help='build in debug mode') + opt.add_option('--with-provider-video', action='store', default="ffmpegsource", help='Default Video Provider. (default: ffmpegsource)') + opt.add_option('--with-provider-audio', action='store', default="ffmpegsource", help='Default Audio Provider. (default: ffmpegsource)') + opt.add_option('--with-player-audio', action='store', default=audio_player_default, help='Default Audio Player (default: Linux/ALSA, Darwin/OpenAL, */PortAudio.)') + opt.add_option('--with-provider-subtitle', action='store', default='libass', help='Default Subtitle Provider. (default: libass)') + +def configure(conf): + conf.check_tool('compiler_cxx compiler_cc') + if sys.platform.startswith('darwin'): + conf.check_tool('osx') + + conf.env.append_value('CPPPATH', '/usr/local/aegisub-deps/include') + + conf.define('HAVE_GETTEXT', 1) + + if not sys.platform.startswith('win'): + conf.define('HAVE_PTHREAD', 1) + + conf.check_cc(fragment=''' + #include + int main() { dcgettext('test', 'test', 0); } + ''', define_name='HAVE_DCGETTEXT', define_ret='1') + + conf.check_cc(fragment=''' + #include + int main() { gettext('test', 'test', 0); } + ''', define_name='HAVE_GETTEXT', define_ret='1') + + conf.check_cc(define_name='HAVE_LOCALE_H', header_name='locale.h', define_ret='1') + conf.check_cc(define_name='HAVE_MEMORY_H', header_name='memory.h', define_ret='1') + conf.check_cc(define_name='HAVE_SOUNDCARD_H', header_name='soundcard.h', define_ret='1') + conf.check_cc(define_name='HAVE_STDINT_H', header_name='stdint.h', define_ret='1') + conf.check_cc(define_name='HAVE_STDLIB_H', header_name='stdlib.h', define_ret='1') + conf.check_cc(define_name='HAVE_STDBOOL_H', header_name='stdbool.h', define_ret='1') + conf.check_cc(define_name='HAVE_STRING_H', header_name='string.h', define_ret='1') + conf.check_cc(define_name='HAVE_STRINGS_H', header_name='strings.h', define_ret='1') + conf.check_cc(define_name='HAVE_SYS_STAT_H', header_name='sys/stat.h', define_ret='1') + conf.check_cc(define_name='HAVE_SYS_TYPES_H', header_name='sys/types.h', define_ret='1') + conf.check_cc(define_name='HAVE_UNISTD_H', header_name='unistd.h', define_ret='1') + + conf.define('AEGISUB_VERSION_DATA', "%d.%d" % (VERSION[0], VERSION[1])) + + conf.define('DEFAULT_PROVIDER_VIDEO', Options.options.with_provider_video) + conf.define('DEFAULT_PROVIDER_AUDIO', Options.options.with_provider_audio) + conf.define('DEFAULT_PLAYER_AUDIO', Options.options.with_player_audio) + conf.define('DEFAULT_PROVIDER_SUBTITLE', 'libass') # FIXME! + + wants_ffmpeg = False + if Options.options.with_provider_video == 'ffmpegsource': + conf.define('WITH_FFMPEGSOURCE', 1) + wants_ffmpeg = True + + if Options.options.with_provider_audio == 'ffmpegsource': + conf.define('WITH_FFMPEGSOURCE', 1) + wants_ffmpeg = True + + if Options.options.with_provider_subtitle == 'libass': + #conf.env['LIBASS_LIB'] = 'ass_aegisub' + conf.env.append_value('CPPPATH', '../libass') + conf.define('WITH_LIBASS', 1) + + if wants_ffmpeg: + conf.check_cfg(package='libavcodec', args='--cflags --libs', uselib_store='FFMPEG', mandatory=True) + conf.check_cfg(package='libavformat', args='--cflags --libs', uselib_store='FFMPEG', mandatory=True) + conf.check_cfg(package='libswscale', args='--cflags --libs', uselib_store='FFMPEG', mandatory=True) + conf.check_cfg(package='libavutil', args='--cflags --libs', uselib_store='FFMPEG', mandatory=True) + conf.check_cfg(package='libpostproc', args='--cflags --libs', uselib_store='FFMPEG', mandatory=True) + + audio_player = Options.options.with_player_audio + if audio_player.lower() == 'openal': + if sys.platform.startswith('darwin'): + conf.env.append_value('FRAMEWORK', 'OpenAL') + else: + conf.check_cfg(package='openal', args='--cflags --libs', uselib_store='FFMPEG', mandatory=True) + conf.define('WITH_OPENAL', 1) + + gettext_version = '' + if not sys.platform.startswith('darwin'): + gettext_version = "%d%d" % (VERSION[0], VERSION[1]) + conf.define('GETTEXT_PACKAGE', 'aegisub') + + conf.env.append_value('LIB', 'iconv') + + # deps + conf.check_cfg(path=get_path_to_wxconfig(), args='--cxxflags --libs core,adv,gl,net,stc,xml', package='', uselib_store='WX', mandatory=True) + conf.check_cfg(path='freetype-config', args='--cflags --libs', package='', uselib_store='FREETYPE2', mandatory=True) + conf.check_cfg(path='curl-config', args='--cflags --libs', package='', uselib_store='CURL', mandatory=True) + conf.check_cfg(package='fontconfig', args='--cflags --libs', uselib_store='FONTCONFIG', mandatory=True) + + if sys.platform.startswith('darwin'): + conf.define('HAVE_APPLE_OPENGL_FRAMEWORK', 1) + # conf.env['CPPPATHS_GL'] = ['/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers'] + + conf.write_config_header('acconf.h') + + if Options.options.debug: + conf.env.append_value('CCFLAGS', conf.env['CCFLAGS_DEBUG']) + conf.env.append_value('CXXFLAGS', conf.env['CXXFLAGS_DEBUG']) + conf.env.append_value('LINKFLAGS', conf.env['LINKFLAGS_DEBUG']) + + if conf.env.CXX_NAME == 'gcc': + conf.env.append_value('CPPFLAGS', ['-Wall', '-Wextra', '-Wno-unused-parameter']) + conf.env.append_value('CCFLAGS', ['-std=gnu99', '-pipe']) + +def build(bld): + subdirs = ['tools', 'src'] + + if Options.options.with_provider_video == 'ffmpegsource' or Options.options.with_provider_video == 'ffmpegsource': + subdirs.insert(0, 'libffms') + + if Options.options.with_provider_subtitle == 'libass': + subdirs.insert(0, 'libass') + + bld.add_subdirs(subdirs)