示例#1
0
def _build_pdf(ctx):
    from waflib import TaskGen

    TaskGen.declare_chain(
        name    = 'rst2latex',
        rule    = '${RST2LATEX} ${RST2LATEX_FLAGS} ${SRC} ${TGT}',
        ext_in  = '.rst',
        ext_out = '.tex' )

    TaskGen.declare_chain(
        name    = 'pdflatex',
        rule    = '${PDFLATEX} ${PDFLATEX_FLAGS} ${SRC}; ' * 2,
        ext_in  = '.tex',
        ext_out = '.pdf',
        shell   = True )

    ctx.env.RST2LATEX_FLAGS = [
        '--config=' + ctx.srcnode.abspath() + '/DOCS/man/docutils.conf'
    ]

    ctx.env.PDFLATEX_FLAGS = [
        '--interaction=batchmode',
        '--output-directory=DOCS/man/en/',
        '--jobname=mpv'
    ]

    ctx(source = 'DOCS/man/en/mpv.rst')
    _add_rst_manual_dependencies(ctx)
    ctx.install_files(ctx.env.DOCDIR, ['DOCS/man/en/mpv.pdf'])
示例#2
0
def _build_pdf(ctx):
    from waflib import TaskGen

    TaskGen.declare_chain(
        name="rst2latex", rule="${RST2LATEX} ${RST2LATEX_FLAGS} ${SRC} ${TGT}", ext_in=".rst", ext_out=".tex"
    )

    TaskGen.declare_chain(
        name="pdflatex", rule="${PDFLATEX} ${PDFLATEX_FLAGS} ${SRC}; " * 2, ext_in=".tex", ext_out=".pdf", shell=True
    )

    ctx.env.RST2LATEX_FLAGS = ["--config=" + ctx.srcnode.abspath() + "/DOCS/man/docutils.conf"]

    ctx.env.PDFLATEX_FLAGS = ["--interaction=batchmode", "--output-directory=DOCS/man/en/", "--jobname=mpv"]

    ctx(source="DOCS/man/en/mpv.rst")
    _add_rst_manual_dependencies(ctx)
    ctx.install_files(ctx.env.DOCDIR, ["DOCS/man/en/mpv.pdf"])
示例#3
0
def build(ctx):
    ctx.load('waf_customizations')
    ctx.load('generators.sources')

    ctx(
        features = "file2string",
        source = "TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icns",
        target = "osdep/macosx_icon.inc",
    )

    ctx(
        features = "file2string",
        source = "etc/mpv-icon-8bit-16x16.png",
        target = "video/out/x11_icon_16.inc",
    )

    ctx(
        features = "file2string",
        source = "etc/mpv-icon-8bit-32x32.png",
        target = "video/out/x11_icon_32.inc",
    )

    ctx(
        features = "file2string",
        source = "etc/mpv-icon-8bit-64x64.png",
        target = "video/out/x11_icon_64.inc",
    )

    ctx(
        features = "file2string",
        source = "etc/mpv-icon-8bit-128x128.png",
        target = "video/out/x11_icon_128.inc",
    )

    ctx(
        features = "file2string",
        source = "etc/input.conf",
        target = "input/input_conf.h",
    )

    ctx(
        features = "file2string",
        source = "etc/builtin.conf",
        target = "player/builtin_conf.inc",
    )

    ctx(
        features = "file2string",
        source = "sub/osd_font.otf",
        target = "sub/osd_font.h",
    )

    lua_files = ["defaults.lua", "assdraw.lua", "options.lua", "osc.lua",
                 "ytdl_hook.lua", "stats.lua"]

    for fn in lua_files:
        fn = "player/lua/" + fn
        ctx(
            features = "file2string",
            source = fn,
            target = os.path.splitext(fn)[0] + ".inc",
        )

    ctx(
        features = "file2string",
        source = "player/javascript/defaults.js",
        target = "player/javascript/defaults.js.inc",
    )

    if ctx.dependency_satisfied('wayland'):
        ctx.wayland_protocol_code(proto_dir = ctx.env.WL_PROTO_DIR,
            protocol  = "unstable/xdg-shell/xdg-shell-unstable-v6",
            target    = "video/out/wayland/xdg-shell-v6.c")
        ctx.wayland_protocol_header(proto_dir = ctx.env.WL_PROTO_DIR,
            protocol  = "unstable/xdg-shell/xdg-shell-unstable-v6",
            target    = "video/out/wayland/xdg-shell-v6.h")
        ctx.wayland_protocol_code(proto_dir = ctx.env.WL_PROTO_DIR,
            protocol  = "unstable/idle-inhibit/idle-inhibit-unstable-v1",
            target    = "video/out/wayland/idle-inhibit-v1.c")
        ctx.wayland_protocol_header(proto_dir = ctx.env.WL_PROTO_DIR,
            protocol  = "unstable/idle-inhibit/idle-inhibit-unstable-v1",
            target    = "video/out/wayland/idle-inhibit-v1.h")
        ctx.wayland_protocol_code(proto_dir = "../video/out/wayland",
            protocol = "server-decoration",
            target   = "video/out/wayland/srv-decor.c")
        ctx.wayland_protocol_header(proto_dir = "../video/out/wayland",
            protocol = "server-decoration",
            target   = "video/out/wayland/srv-decor.h")

    ctx(features = "ebml_header", target = "ebml_types.h")
    ctx(features = "ebml_definitions", target = "ebml_defs.c")

    if ctx.dependency_satisfied('cplayer'):
        main_fn_c = ctx.pick_first_matching_dep([
            ( "osdep/main-fn-cocoa.c",               "cocoa" ),
            ( "osdep/main-fn-unix.c",                "posix" ),
            ( "osdep/main-fn-win.c",                 "win32-desktop" ),
        ])

    getch2_c = ctx.pick_first_matching_dep([
        ( "osdep/terminal-unix.c",               "posix" ),
        ( "osdep/terminal-win.c",                "win32-desktop" ),
        ( "osdep/terminal-dummy.c" ),
    ])

    timer_c = ctx.pick_first_matching_dep([
        ( "osdep/timer-win2.c",                  "os-win32" ),
        ( "osdep/timer-darwin.c",                "os-darwin" ),
        ( "osdep/timer-linux.c",                 "posix" ),
    ])

    ipc_c = ctx.pick_first_matching_dep([
        ( "input/ipc-unix.c",                    "posix" ),
        ( "input/ipc-win.c",                     "win32-desktop" ),
        ( "input/ipc-dummy.c" ),
    ])

    subprocess_c = ctx.pick_first_matching_dep([
        ( "osdep/subprocess-posix.c",            "posix-spawn" ),
        ( "osdep/subprocess-win.c",              "win32-desktop" ),
        ( "osdep/subprocess-dummy.c" ),
    ])

    sources = [
        ## Audio
        ( "audio/aconverter.c" ),
        ( "audio/audio.c",                       "libaf" ),
        ( "audio/audio_buffer.c" ),
        ( "audio/chmap.c" ),
        ( "audio/chmap_sel.c" ),
        ( "audio/fmt-conversion.c" ),
        ( "audio/format.c" ),
        ( "audio/aframe.c" ),
        ( "audio/decode/ad_lavc.c" ),
        ( "audio/decode/ad_spdif.c" ),
        ( "audio/decode/dec_audio.c" ),
        ( "audio/filter/af.c",                   "libaf" ),
        ( "audio/filter/af_channels.c",          "libaf" ),
        ( "audio/filter/af_equalizer.c",         "libaf" ),
        ( "audio/filter/af_format.c",            "libaf" ),
        ( "audio/filter/af_lavcac3enc.c",        "libaf" ),
        ( "audio/filter/af_lavfi.c",             "libaf" ),
        ( "audio/filter/af_lavrresample.c",      "libaf" ),
        ( "audio/filter/af_pan.c",               "libaf" ),
        ( "audio/filter/af_rubberband.c",        "rubberband" ),
        ( "audio/filter/af_scaletempo.c",        "libaf" ),
        ( "audio/filter/af_volume.c",            "libaf" ),
        ( "audio/filter/tools.c",                "libaf" ),
        ( "audio/out/ao.c" ),
        ( "audio/out/ao_alsa.c",                 "alsa" ),
        ( "audio/out/ao_audiounit.m",            "audiounit" ),
        ( "audio/out/ao_coreaudio_chmap.c",      "audiounit" ),
        ( "audio/out/ao_coreaudio_utils.c",      "audiounit" ),
        ( "audio/out/ao_coreaudio.c",            "coreaudio" ),
        ( "audio/out/ao_coreaudio_chmap.c",      "coreaudio" ),
        ( "audio/out/ao_coreaudio_exclusive.c",  "coreaudio" ),
        ( "audio/out/ao_coreaudio_properties.c", "coreaudio" ),
        ( "audio/out/ao_coreaudio_utils.c",      "coreaudio" ),
        ( "audio/out/ao_jack.c",                 "jack" ),
        ( "audio/out/ao_lavc.c",                 "encoding" ),
        ( "audio/out/ao_null.c" ),
        ( "audio/out/ao_openal.c",               "openal" ),
        ( "audio/out/ao_opensles.c",             "opensles" ),
        ( "audio/out/ao_oss.c",                  "oss-audio" ),
        ( "audio/out/ao_pcm.c" ),
        ( "audio/out/ao_pulse.c",                "pulse" ),
        ( "audio/out/ao_rsound.c",               "rsound" ),
        ( "audio/out/ao_sdl.c",                  "sdl1" ),
        ( "audio/out/ao_sdl.c",                  "sdl2" ),
        ( "audio/out/ao_sndio.c",                "sndio" ),
        ( "audio/out/ao_wasapi.c",               "wasapi" ),
        ( "audio/out/ao_wasapi_utils.c",         "wasapi" ),
        ( "audio/out/ao_wasapi_changenotify.c",  "wasapi" ),
        ( "audio/out/pull.c" ),
        ( "audio/out/push.c" ),

        ## Core
        ( "common/av_common.c" ),
        ( "common/av_log.c" ),
        ( "common/codecs.c" ),
        ( "common/encode_lavc.c",                "encoding" ),
        ( "common/common.c" ),
        ( "common/tags.c" ),
        ( "common/msg.c" ),
        ( "common/playlist.c" ),
        ( "common/recorder.c" ),
        ( "common/version.c" ),

        ## Demuxers
        ( "demux/codec_tags.c" ),
        ( "demux/cue.c" ),
        ( "demux/demux.c" ),
        ( "demux/demux_cue.c" ),
        ( "demux/demux_disc.c" ),
        ( "demux/demux_edl.c" ),
        ( "demux/demux_lavf.c" ),
        ( "demux/demux_libarchive.c",            "libarchive" ),
        ( "demux/demux_mf.c" ),
        ( "demux/demux_mkv.c" ),
        ( "demux/demux_mkv_timeline.c" ),
        ( "demux/demux_null.c" ),
        ( "demux/demux_playlist.c" ),
        ( "demux/demux_raw.c" ),
        ( "demux/demux_rar.c" ),
        ( "demux/demux_timeline.c" ),
        ( "demux/demux_tv.c",                    "tv" ),
        ( "demux/ebml.c" ),
        ( "demux/packet.c" ),
        ( "demux/timeline.c" ),

        ## Input
        ( "input/cmd_list.c" ),
        ( "input/cmd_parse.c" ),
        ( "input/event.c" ),
        ( "input/input.c" ),
        ( "input/ipc.c" ),
        ( ipc_c ),
        ( "input/keycodes.c" ),
        ( "input/pipe-win32.c",                  "win32-pipes" ),

        ## Misc
        ( "misc/bstr.c" ),
        ( "misc/charset_conv.c" ),
        ( "misc/dispatch.c" ),
        ( "misc/json.c" ),
        ( "misc/node.c" ),
        ( "misc/ring.c" ),
        ( "misc/rendezvous.c" ),
        ( "misc/thread_pool.c" ),

        ## Options
        ( "options/m_config.c" ),
        ( "options/m_option.c" ),
        ( "options/m_property.c" ),
        ( "options/options.c" ),
        ( "options/parse_commandline.c" ),
        ( "options/parse_configfile.c" ),
        ( "options/path.c" ),

        ## Player
        ( "player/audio.c" ),
        ( "player/client.c" ),
        ( "player/command.c" ),
        ( "player/configfiles.c" ),
        ( "player/external_files.c" ),
        ( "player/loadfile.c" ),
        ( "player/main.c" ),
        ( "player/misc.c" ),
        ( "player/lavfi.c" ),
        ( "player/lua.c",                        "lua" ),
        ( "player/javascript.c",                 "javascript" ),
        ( "player/osd.c" ),
        ( "player/playloop.c" ),
        ( "player/screenshot.c" ),
        ( "player/scripting.c" ),
        ( "player/sub.c" ),
        ( "player/video.c" ),

        ## Streams
        ( "stream/ai_alsa1x.c",                  "alsa" ),
        ( "stream/ai_oss.c",                     "oss-audio" ),
        ( "stream/ai_sndio.c",                   "sndio" ),
        ( "stream/audio_in.c",                   "audio-input" ),
        ( "stream/cache.c" ),
        ( "stream/cache_file.c" ),
        ( "stream/cookies.c" ),
        ( "stream/dvb_tune.c",                   "dvbin" ),
        ( "stream/frequencies.c",                "tv" ),
        ( "stream/rar.c" ),
        ( "stream/stream.c" ),
        ( "stream/stream_avdevice.c" ),
        ( "stream/stream_bluray.c",              "libbluray" ),
        ( "stream/stream_cdda.c",                "cdda" ),
        ( "stream/stream_dvb.c",                 "dvbin" ),
        ( "stream/stream_dvd.c",                 "dvdread-common" ),
        ( "stream/stream_dvd_common.c",          "dvdread-common" ),
        ( "stream/stream_dvdnav.c",              "dvdnav" ),
        ( "stream/stream_edl.c" ),
        ( "stream/stream_file.c" ),
        ( "stream/stream_cb.c" ),
        ( "stream/stream_lavf.c" ),
        ( "stream/stream_libarchive.c",          "libarchive" ),
        ( "stream/stream_memory.c" ),
        ( "stream/stream_mf.c" ),
        ( "stream/stream_null.c" ),
        ( "stream/stream_rar.c" ),
        ( "stream/stream_smb.c",                 "libsmbclient" ),
        ( "stream/stream_tv.c",                  "tv" ),
        ( "stream/tv.c",                         "tv" ),
        ( "stream/tvi_dummy.c",                  "tv" ),
        ( "stream/tvi_v4l2.c",                   "tv-v4l2"),

        ## Subtitles
        ( "sub/ass_mp.c",                        "libass"),
        ( "sub/dec_sub.c" ),
        ( "sub/draw_bmp.c" ),
        ( "sub/img_convert.c" ),
        ( "sub/lavc_conv.c" ),
        ( "sub/osd.c" ),
        ( "sub/osd_dummy.c",                     "dummy-osd" ),
        ( "sub/osd_libass.c",                    "libass-osd" ),
        ( "sub/sd_ass.c",                        "libass" ),
        ( "sub/sd_lavc.c" ),
        ( "sub/filter_sdh.c" ),

        ## Video
        ( "video/csputils.c" ),
        ( "video/fmt-conversion.c" ),
        ( "video/image_loader.c" ),
        ( "video/image_writer.c" ),
        ( "video/img_format.c" ),
        ( "video/hwdec.c" ),
        ( "video/mp_image.c" ),
        ( "video/mp_image_pool.c" ),
        ( "video/sws_utils.c" ),
        ( "video/vaapi.c",                       "vaapi" ),
        ( "video/vdpau.c",                       "vdpau" ),
        ( "video/vdpau_mixer.c",                 "vdpau" ),
        ( "video/decode/d3d.c",                  "d3d-hwaccel" ),
        ( "video/decode/dec_video.c"),
        ( "video/decode/hw_dxva2.c",             "d3d9-hwaccel" ),
        ( "video/decode/hw_d3d11va.c",           "d3d-hwaccel" ),
        ( "video/decode/hw_mediacodec.c",        "android" ),
        ( "video/decode/vd_lavc.c" ),
        ( "video/filter/refqueue.c" ),
        ( "video/filter/vf.c" ),
        ( "video/filter/vf_buffer.c" ),
        ( "video/filter/vf_crop.c",              "gpl" ),
        ( "video/filter/vf_d3d11vpp.c",          "d3d-hwaccel" ),
        ( "video/filter/vf_dsize.c",             "gpl" ),
        ( "video/filter/vf_expand.c",            "gpl" ),
        ( "video/filter/vf_flip.c",              "gpl" ),
        ( "video/filter/vf_format.c",            "gpl" ),
        ( "video/filter/vf_gradfun.c",           "gpl" ),
        ( "video/filter/vf_lavfi.c" ),
        ( "video/filter/vf_mirror.c",            "gpl" ),
        ( "video/filter/vf_noformat.c",          "gpl" ),
        ( "video/filter/vf_pullup.c",            "gpl" ),
        ( "video/filter/vf_rotate.c",            "gpl" ),
        ( "video/filter/vf_scale.c",             "gpl" ),
        ( "video/filter/vf_stereo3d.c",          "gpl" ),
        ( "video/filter/vf_sub.c",               "gpl" ),
        ( "video/filter/vf_vapoursynth.c",       "vapoursynth-core" ),
        ( "video/filter/vf_vavpp.c",             "vaapi" ),
        ( "video/filter/vf_vdpaupp.c",           "vdpau" ),
        ( "video/filter/vf_yadif.c",             "gpl" ),
        ( "video/out/aspect.c" ),
        ( "video/out/bitmap_packer.c" ),
        ( "video/out/cocoa/video_view.m",        "cocoa" ),
        ( "video/out/cocoa/events_view.m",       "cocoa" ),
        ( "video/out/cocoa/window.m",            "cocoa" ),
        ( "video/out/cocoa_common.m",            "cocoa" ),
        ( "video/out/dither.c" ),
        ( "video/out/filter_kernels.c" ),
        ( "video/out/opengl/angle_dynamic.c",    "egl-angle" ),
        ( "video/out/gpu/context.c" ),
        ( "video/out/gpu/hwdec.c" ),
        ( "video/out/gpu/lcms.c" ),
        ( "video/out/gpu/osd.c" ),
        ( "video/out/gpu/ra.c" ),
        ( "video/out/gpu/spirv.c" ),
        ( "video/out/gpu/spirv_shaderc.c",       "shaderc" ),
        ( "video/out/gpu/shader_cache.c" ),
        ( "video/out/gpu/user_shaders.c" ),
        ( "video/out/gpu/utils.c" ),
        ( "video/out/gpu/video.c" ),
        ( "video/out/gpu/video_shaders.c" ),
        ( "video/out/opengl/common.c",           "gl" ),
        ( "video/out/opengl/formats.c",          "gl" ),
        ( "video/out/opengl/utils.c",            "gl" ),
        ( "video/out/opengl/ra_gl.c",            "gl" ),
        ( "video/out/opengl/context.c",          "gl" ),
        ( "video/out/opengl/context_angle.c",    "egl-angle-win32" ),
        ( "video/out/opengl/context_cocoa.c",    "gl-cocoa" ),
        ( "video/out/opengl/context_drm_egl.c",  "egl-drm" ),
        ( "video/out/opengl/context_dxinterop.c","gl-dxinterop" ),
        ( "video/out/opengl/context_mali_fbdev.c","mali-fbdev" ),
        ( "video/out/opengl/context_android.c",  "android" ),
        ( "video/out/opengl/context_rpi.c",      "rpi" ),
        ( "video/out/opengl/context_vdpau.c",    "vdpau-gl-x11" ),
        ( "video/out/opengl/context_wayland.c",  "gl-wayland" ),
        ( "video/out/opengl/context_win.c",      "gl-win32" ),
        ( "video/out/opengl/context_glx.c",      "gl-x11" ),
        ( "video/out/opengl/context_x11egl.c",   "egl-x11" ),
        ( "video/out/opengl/cuda_dynamic.c",     "cuda-hwaccel" ),
        ( "video/out/opengl/d3d11_helpers.c",    "egl-angle-win32" ),
        ( "video/out/opengl/egl_helpers.c",      "egl-helpers" ),
        ( "video/out/opengl/hwdec_cuda.c",       "cuda-hwaccel" ),
        ( "video/out/opengl/hwdec_d3d11egl.c",   "d3d-hwaccel" ),
        ( "video/out/opengl/hwdec_d3d11eglrgb.c","d3d-hwaccel" ),
        ( "video/out/opengl/hwdec_dxva2gldx.c",  "gl-dxinterop-d3d9" ),
        ( "video/out/opengl/hwdec_dxva2egl.c",   "d3d9-hwaccel" ),
        ( "video/out/opengl/hwdec_osx.c",        "videotoolbox-gl" ),
        ( "video/out/opengl/hwdec_ios.m",        "ios-gl" ),
        ( "video/out/opengl/hwdec_drmprime_drm.c","drmprime && drm" ),
        ( "video/out/opengl/hwdec_rpi.c",        "rpi" ),
        ( "video/out/opengl/hwdec_vaegl.c",      "vaapi-egl" ),
        ( "video/out/opengl/hwdec_vaglx.c",      "vaapi-glx" ),
        ( "video/out/opengl/hwdec_vdpau.c",      "vdpau-gl-x11" ),
        ( "video/out/vo.c" ),
        ( "video/out/vo_mediacodec_embed.c",     "android" ),
        ( "video/out/vo_caca.c",                 "caca" ),
        ( "video/out/vo_drm.c",                  "drm" ),
        ( "video/out/vo_direct3d.c",             "direct3d" ),
        ( "video/out/vo_image.c" ),
        ( "video/out/vo_lavc.c",                 "encoding" ),
        ( "video/out/vo_rpi.c",                  "rpi" ),
        ( "video/out/vo_null.c" ),
        ( "video/out/vo_gpu.c" ),
        ( "video/out/vo_opengl_cb.c",            "gl" ),
        ( "video/out/vo_sdl.c",                  "sdl2" ),
        ( "video/out/vo_tct.c" ),
        ( "video/out/vo_vaapi.c",                "vaapi-x11 && gpl" ),
        ( "video/out/vo_vdpau.c",                "vdpau" ),
        ( "video/out/vo_x11.c" ,                 "x11" ),
        ( "video/out/vo_xv.c",                   "xv" ),
        ( "video/out/w32_common.c",              "win32-desktop" ),
        ( "video/out/win32/displayconfig.c",     "win32-desktop" ),
        ( "video/out/win32/droptarget.c",        "win32-desktop" ),
        ( "video/out/vulkan/utils.c",            "vulkan" ),
        ( "video/out/vulkan/malloc.c",           "vulkan" ),
        ( "video/out/vulkan/formats.c",          "vulkan" ),
        ( "video/out/vulkan/ra_vk.c",            "vulkan" ),
        ( "video/out/vulkan/context.c",          "vulkan" ),
        ( "video/out/vulkan/context_xlib.c",     "vulkan && x11" ),
        ( "video/out/vulkan/context_wayland.c",  "vulkan && wayland" ),
        ( "video/out/vulkan/context_win.c",      "vulkan && win32-desktop" ),
        ( "video/out/vulkan/spirv_nvidia.c",     "vulkan" ),
        ( "video/out/win32/exclusive_hack.c",    "gl-win32" ),
        ( "video/out/wayland_common.c",          "wayland" ),
        ( "video/out/wayland/xdg-shell-v6.c",    "wayland" ),
        ( "video/out/wayland/idle-inhibit-v1.c", "wayland" ),
        ( "video/out/wayland/srv-decor.c",       "wayland" ),
        ( "video/out/win_state.c"),
        ( "video/out/x11_common.c",              "x11" ),
        ( "video/out/drm_atomic.c",              "drm" ),
        ( "video/out/drm_common.c",              "drm" ),
        ( "video/out/drm_prime.c",               "drm && drmprime" ),

        ## osdep
        ( getch2_c ),
        ( "osdep/io.c" ),
        ( "osdep/timer.c" ),
        ( timer_c ),
        ( "osdep/threads.c" ),

        ( "osdep/ar/HIDRemote.m",                "apple-remote" ),
        ( "osdep/macosx_application.m",          "cocoa" ),
        ( "osdep/macosx_events.m",               "cocoa" ),
        ( "osdep/macosx_menubar.m",              "cocoa" ),
        ( "osdep/macosx_touchbar.m",             "macos-touchbar" ),
        ( "osdep/semaphore_osx.c" ),
        ( "osdep/subprocess.c" ),
        ( subprocess_c ),
        ( "osdep/path-macosx.m",                 "cocoa" ),
        ( "osdep/path-unix.c"),
        ( "osdep/path-win.c",                    "win32-desktop" ),
        ( "osdep/path-uwp.c",                    "uwp" ),
        ( "osdep/glob-win.c",                    "glob-win32" ),
        ( "osdep/w32_keyboard.c",                "os-win32" ),
        ( "osdep/w32_keyboard.c",                "os-cygwin" ),
        ( "osdep/windows_utils.c",               "os-win32" ),
        ( "osdep/windows_utils.c",               "os-cygwin" ),
        ( "osdep/mpv.rc",                        "win32-executable" ),
        ( "osdep/win32/pthread.c",               "win32-internal-pthreads"),
        ( "osdep/android/posix-spawn.c",         "android"),
        ( "osdep/android/strnlen.c",             "android"),

        ## tree_allocator
        "ta/ta.c", "ta/ta_talloc.c", "ta/ta_utils.c"
    ]

    if ctx.dependency_satisfied('win32-executable'):
        from waflib import TaskGen

        TaskGen.declare_chain(
            name    = 'windres',
            rule    = '${WINDRES} ${WINDRES_FLAGS} ${SRC} ${TGT}',
            ext_in  = '.rc',
            ext_out = '-rc.o',
            color   = 'PINK')

        ctx.env.WINDRES_FLAGS = [
            '--include-dir={0}'.format(ctx.bldnode.abspath()),
            '--include-dir={0}'.format(ctx.srcnode.abspath())
        ]

        for node in 'osdep/mpv.exe.manifest etc/mpv-icon.ico'.split():
            ctx.add_manual_dependency(
                ctx.path.find_node('osdep/mpv.rc'),
                ctx.path.find_node(node))

        version = ctx.bldnode.find_node('version.h')
        if version:
            ctx.add_manual_dependency(
                ctx.path.find_node('osdep/mpv.rc'),
                version)

    if ctx.dependency_satisfied('cplayer') or ctx.dependency_satisfied('test'):
        ctx(
            target       = "objects",
            source       = ctx.filtered_sources(sources),
            use          = ctx.dependencies_use(),
            includes     = _all_includes(ctx),
            features     = "c",
        )

    syms = False
    if ctx.dependency_satisfied('cplugins'):
        syms = True
        ctx.load("syms")

    if ctx.dependency_satisfied('cplayer'):
        ctx(
            target       = "mpv",
            source       = main_fn_c,
            use          = ctx.dependencies_use() + ['objects'],
            includes     = _all_includes(ctx),
            features     = "c cprogram" + (" syms" if syms else ""),
            export_symbols_def = "libmpv/mpv.def", # for syms=True
            install_path = ctx.env.BINDIR
        )
        for f in ['mpv.conf', 'input.conf', 'mplayer-input.conf', \
                  'restore-old-bindings.conf']:
            ctx.install_as(os.path.join(ctx.env.DOCDIR, f),
                           os.path.join('etc/', f))

        if ctx.env.DEST_OS == 'win32':
            wrapctx = ctx(
                target       = "mpv",
                source       = ['osdep/win32-console-wrapper.c'],
                features     = "c cprogram",
                install_path = ctx.env.BINDIR
            )

            wrapctx.env.cprogram_PATTERN = "%s.com"
            wrapflags = ['-municode', '-mconsole']
            wrapctx.env.CFLAGS = wrapflags
            wrapctx.env.LAST_LINKFLAGS = wrapflags

    if ctx.dependency_satisfied('test'):
        for test in ctx.path.ant_glob("test/*.c"):
            ctx(
                target       = os.path.splitext(test.srcpath())[0],
                source       = test.srcpath(),
                use          = ctx.dependencies_use() + ['objects'],
                includes     = _all_includes(ctx),
                features     = "c cprogram",
                install_path = None,
            )

    build_shared = ctx.dependency_satisfied('libmpv-shared')
    build_static = ctx.dependency_satisfied('libmpv-static')
    if build_shared or build_static:
        if build_shared:
            waftoolsdir = os.path.join(os.path.dirname(__file__), "waftools")
            ctx.load("syms", tooldir=waftoolsdir)
        vre = '#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION\((.*), (.*)\)'
        libmpv_header = ctx.path.find_node("libmpv/client.h").read()
        major, minor = re.search(vre, libmpv_header).groups()
        libversion = major + '.' + minor + '.0'

        def _build_libmpv(shared):
            features = "c "
            if shared:
                features += "cshlib syms"
            else:
                features += "cstlib"

            libmpv_kwargs = {
                "target": "mpv",
                "source":   ctx.filtered_sources(sources),
                "use":      ctx.dependencies_use(),
                "includes": [ctx.bldnode.abspath(), ctx.srcnode.abspath()] + \
                             ctx.dependencies_includes(),
                "features": features,
                "export_symbols_def": "libmpv/mpv.def",
                "install_path": ctx.env.LIBDIR,
                "install_path_implib": ctx.env.LIBDIR,
            }

            if shared and ctx.dependency_satisfied('android'):
                # for Android we just add the linker flag without version
                # as we still need the SONAME for proper linkage.
                # (LINKFLAGS logic taken from waf's apply_vnum in ccroot.py)
                v=ctx.env.SONAME_ST%'libmpv.so'
                ctx.env.append_value('LINKFLAGS',v.split())
            else:
                # for all other configurations we want SONAME to be used
                libmpv_kwargs["vnum"] = libversion

            if shared and ctx.env.DEST_OS == 'win32':
                libmpv_kwargs["install_path"] = ctx.env.BINDIR

            ctx(**libmpv_kwargs)

        if build_shared:
            _build_libmpv(True)
        if build_static:
            _build_libmpv(False)

        def get_deps():
            res = ""
            for k in ctx.env.keys():
                if k.startswith("LIB_") and k != "LIB_ST":
                    res += " ".join(["-l" + x for x in ctx.env[k]]) + " "
            return res

        ctx(
            target       = 'libmpv/mpv.pc',
            source       = 'libmpv/mpv.pc.in',
            features     = 'subst',
            PREFIX       = ctx.env.PREFIX,
            LIBDIR       = ctx.env.LIBDIR,
            INCDIR       = ctx.env.INCDIR,
            VERSION      = libversion,
            PRIV_LIBS    = get_deps(),
        )

        headers = ["client.h", "qthelper.hpp", "opengl_cb.h", "stream_cb.h"]
        for f in headers:
            ctx.install_as(ctx.env.INCDIR + '/mpv/' + f, 'libmpv/' + f)

        ctx.install_as(ctx.env.LIBDIR + '/pkgconfig/mpv.pc', 'libmpv/mpv.pc')

    if ctx.dependency_satisfied('html-build'):
        _build_html(ctx)

    if ctx.dependency_satisfied('manpage-build'):
        _build_man(ctx)

    if ctx.dependency_satisfied('pdf-build'):
        _build_pdf(ctx)

    if ctx.dependency_satisfied('cplayer'):

        if ctx.dependency_satisfied('zsh-comp'):
            ctx.zshcomp(target = "etc/_mpv", source = "TOOLS/zsh.pl")
            ctx.install_files(
                ctx.env.ZSHDIR,
                ['etc/_mpv'])

        ctx.install_files(
            ctx.env.DATADIR + '/applications',
            ['etc/mpv.desktop'] )

        if ctx.dependency_satisfied('encoding'):
            ctx.install_files(ctx.env.CONFDIR, ['etc/encoding-profiles.conf'] )

        for size in '16x16 32x32 64x64'.split():
            ctx.install_as(
                ctx.env.DATADIR + '/icons/hicolor/' + size + '/apps/mpv.png',
                'etc/mpv-icon-8bit-' + size + '.png')

        ctx.install_as(
                ctx.env.DATADIR + '/icons/hicolor/scalable/apps/mpv.svg',
                'etc/mpv-gradient.svg')

        ctx.install_files(
            ctx.env.DATADIR + '/icons/hicolor/symbolic/apps',
            ['etc/mpv-symbolic.svg'])
示例#4
0
文件: gob2.py 项目: AleemDev/waf
#!/usr/bin/env python
# encoding: utf-8
# Ali Sabil, 2007

from waflib import TaskGen

TaskGen.declare_chain(
	name = 'gob2',
	rule = '${GOB2} -o ${TGT[0].bld_dir()} ${GOB2FLAGS} ${SRC}',
	ext_in = '.gob',
	ext_out = '.c'
)

def configure(conf):
	conf.find_program('gob2', var='GOB2')
	conf.env['GOB2FLAGS'] = ''

示例#5
0
@TaskGen.taskgen_method
def check_create_modelsim_worklib_task(self,lib):
    worklib = self.get_worklib_path_from_string(lib)
    worklib_gen_output = worklib.find_node('_info')
    if worklib_gen_output is None and not getattr(self,'worklib_task',None):
        worklib_gen_output = worklib.make_node('_info')
        worklib_task = self.create_task('vlibTask',None,worklib_gen_output.get_bld())
        return worklib,worklib_gen_output
    else:
        return worklib,None


TaskGen.declare_chain(
        rule         = '${MODEL_VLOG} -l ${VLOG_LOGFILE} ${VLOG_V_OPTIONS} -work ${gen.WORKLIB.abspath()} ${VERILOG_INC_DIRS} ${SRC} && echo "${TGT}" > ${TGT}',
        ext_in       = ['.lib.src' ],
        ext_out      = ['.lib.src.out' ],
        reentrant    = False,
        scan         = scan_verilog_task,
        after        = 'vlibTask',
)

TaskGen.declare_chain(
        rule         = '${MODEL_VLOG} -l ${VLOG_LOGFILE} ${VLOG_V_OPTIONS} -work ${gen.WORKLIB.abspath()} ${VERILOG_INC_DIRS} ${SRC} && echo "${TGT}" > ${TGT}',
        ext_in       = ['.vp', ],
        ext_out      = ['.vp.out', ],
        reentrant    = False,
        scan         = scan_verilog_task,
        after        = 'vlibTask',
)


class ModelsimSvlogTask(Task.Task):
示例#6
0
#!/usr/bin/env python

from waflib import Logs

from waflib import TaskGen
TaskGen.declare_chain(
        name='ppp',
        rule='${PPP} ${SRC} ${TGT}',
        shell=False,
        ext_in='.pp',
        ext_out='.cc',
        reentrant=True,
)

def configure(ctx):
  ctx.msg('Setting up Piccolo Pre-Processor', 1)
  ctx.env['PPP'] = ctx.path.find_resource('util/ppp.py').abspath()
示例#7
0
def build(ctx):
    ctx.load("waf_customizations")
    ctx.load("generators.sources")

    ctx.file2string(source="TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icns", target="osdep/macosx_icon.inc")

    ctx.file2string(source="video/out/x11_icon.bin", target="video/out/x11_icon.inc")

    ctx.file2string(source="etc/input.conf", target="input/input_conf.h")

    ctx.file2string(source="etc/builtin.conf", target="player/builtin_conf.inc")

    ctx.file2string(source="sub/osd_font.otf", target="sub/osd_font.h")

    lua_files = ["defaults.lua", "assdraw.lua", "options.lua", "osc.lua", "ytdl_hook.lua"]
    for fn in lua_files:
        fn = "player/lua/" + fn
        ctx.file2string(source=fn, target=os.path.splitext(fn)[0] + ".inc")

    ctx.matroska_header(source="demux/ebml.c demux/demux_mkv.c", target="ebml_types.h")

    ctx.matroska_definitions(source="demux/ebml.c", target="ebml_defs.c")

    if ctx.env.DEST_OS == "win32":
        main_fn_c = "osdep/main-fn-win.c"
    elif ctx.dependency_satisfied("cocoa"):
        main_fn_c = "osdep/main-fn-cocoa.c"
    else:
        main_fn_c = "osdep/main-fn-unix.c"

    getch2_c = {"win32": "osdep/terminal-win.c"}.get(ctx.env.DEST_OS, "osdep/terminal-unix.c")

    timer_c = {"win32": "osdep/timer-win2.c", "darwin": "osdep/timer-darwin.c"}.get(
        ctx.env.DEST_OS, "osdep/timer-linux.c"
    )

    sources = [
        ## Audio
        ("audio/audio.c"),
        ("audio/audio_buffer.c"),
        ("audio/chmap.c"),
        ("audio/chmap_sel.c"),
        ("audio/fmt-conversion.c"),
        ("audio/format.c"),
        ("audio/decode/ad_lavc.c"),
        ("audio/decode/ad_spdif.c"),
        ("audio/decode/dec_audio.c"),
        ("audio/filter/af.c"),
        ("audio/filter/af_channels.c"),
        ("audio/filter/af_drc.c"),
        ("audio/filter/af_equalizer.c"),
        ("audio/filter/af_format.c"),
        ("audio/filter/af_lavcac3enc.c"),
        ("audio/filter/af_lavfi.c"),
        ("audio/filter/af_lavrresample.c"),
        ("audio/filter/af_pan.c"),
        ("audio/filter/af_rubberband.c", "rubberband"),
        ("audio/filter/af_scaletempo.c"),
        ("audio/filter/af_volume.c"),
        ("audio/filter/tools.c"),
        ("audio/out/ao.c"),
        ("audio/out/ao_alsa.c", "alsa"),
        ("audio/out/ao_audiounit.m", "audiounit"),
        ("audio/out/ao_coreaudio_chmap.c", "audiounit"),
        ("audio/out/ao_coreaudio_utils.c", "audiounit"),
        ("audio/out/ao_coreaudio.c", "coreaudio"),
        ("audio/out/ao_coreaudio_chmap.c", "coreaudio"),
        ("audio/out/ao_coreaudio_exclusive.c", "coreaudio"),
        ("audio/out/ao_coreaudio_properties.c", "coreaudio"),
        ("audio/out/ao_coreaudio_utils.c", "coreaudio"),
        ("audio/out/ao_jack.c", "jack"),
        ("audio/out/ao_lavc.c", "encoding"),
        ("audio/out/ao_null.c"),
        ("audio/out/ao_openal.c", "openal"),
        ("audio/out/ao_opensles.c", "opensles"),
        ("audio/out/ao_oss.c", "oss-audio"),
        ("audio/out/ao_pcm.c"),
        ("audio/out/ao_pulse.c", "pulse"),
        ("audio/out/ao_rsound.c", "rsound"),
        ("audio/out/ao_sdl.c", "sdl1"),
        ("audio/out/ao_sdl.c", "sdl2"),
        ("audio/out/ao_sndio.c", "sndio"),
        ("audio/out/ao_wasapi.c", "wasapi"),
        ("audio/out/ao_wasapi_utils.c", "wasapi"),
        ("audio/out/ao_wasapi_changenotify.c", "wasapi"),
        ("audio/out/pull.c"),
        ("audio/out/push.c"),
        ## Core
        ("common/av_common.c"),
        ("common/av_log.c"),
        ("common/codecs.c"),
        ("common/encode_lavc.c", "encoding"),
        ("common/common.c"),
        ("common/tags.c"),
        ("common/msg.c"),
        ("common/playlist.c"),
        ("common/version.c"),
        ## Demuxers
        ("demux/codec_tags.c"),
        ("demux/cue.c"),
        ("demux/demux.c"),
        ("demux/demux_cue.c"),
        ("demux/demux_disc.c"),
        ("demux/demux_edl.c"),
        ("demux/demux_lavf.c"),
        ("demux/demux_libarchive.c", "libarchive"),
        ("demux/demux_mf.c"),
        ("demux/demux_mkv.c"),
        ("demux/demux_mkv_timeline.c"),
        ("demux/demux_null.c"),
        ("demux/demux_playlist.c"),
        ("demux/demux_raw.c"),
        ("demux/demux_rar.c"),
        ("demux/demux_timeline.c"),
        ("demux/demux_tv.c", "tv"),
        ("demux/ebml.c"),
        ("demux/packet.c"),
        ("demux/timeline.c"),
        ## Input
        ("input/cmd_list.c"),
        ("input/cmd_parse.c"),
        ("input/event.c"),
        ("input/input.c"),
        ("input/ipc.c"),
        ("input/ipc-unix.c", "!mingw"),
        ("input/ipc-win.c", "mingw"),
        ("input/keycodes.c"),
        ("input/pipe-win32.c", "mingw"),
        ## Misc
        ("misc/bstr.c"),
        ("misc/charset_conv.c"),
        ("misc/dispatch.c"),
        ("misc/json.c"),
        ("misc/node.c"),
        ("misc/ring.c"),
        ("misc/rendezvous.c"),
        ## Options
        ("options/m_config.c"),
        ("options/m_option.c"),
        ("options/m_property.c"),
        ("options/options.c"),
        ("options/parse_commandline.c"),
        ("options/parse_configfile.c"),
        ("options/path.c"),
        ## Player
        ("player/audio.c"),
        ("player/client.c"),
        ("player/command.c"),
        ("player/configfiles.c"),
        ("player/external_files.c"),
        ("player/loadfile.c"),
        ("player/main.c"),
        ("player/misc.c"),
        ("player/lavfi.c"),
        ("player/lua.c", "lua"),
        ("player/osd.c"),
        ("player/playloop.c"),
        ("player/screenshot.c"),
        ("player/scripting.c"),
        ("player/sub.c"),
        ("player/video.c"),
        ## Streams
        ("stream/ai_alsa1x.c", "alsa"),
        ("stream/ai_oss.c", "oss-audio"),
        ("stream/ai_sndio.c", "sndio"),
        ("stream/audio_in.c", "audio-input"),
        ("stream/cache.c"),
        ("stream/cache_file.c"),
        ("stream/cookies.c"),
        ("stream/dvb_tune.c", "dvbin"),
        ("stream/frequencies.c", "tv"),
        ("stream/rar.c"),
        ("stream/stream.c"),
        ("stream/stream_avdevice.c"),
        ("stream/stream_bluray.c", "libbluray"),
        ("stream/stream_cdda.c", "cdda"),
        ("stream/stream_dvb.c", "dvbin"),
        ("stream/stream_dvd.c", "dvdread"),
        ("stream/stream_dvd_common.c", "dvdread"),
        ("stream/stream_dvdnav.c", "dvdnav"),
        ("stream/stream_edl.c"),
        ("stream/stream_file.c"),
        ("stream/stream_cb.c"),
        ("stream/stream_lavf.c"),
        ("stream/stream_libarchive.c", "libarchive"),
        ("stream/stream_memory.c"),
        ("stream/stream_mf.c"),
        ("stream/stream_null.c"),
        ("stream/stream_rar.c"),
        ("stream/stream_smb.c", "libsmbclient"),
        ("stream/stream_tv.c", "tv"),
        ("stream/tv.c", "tv"),
        ("stream/tvi_dummy.c", "tv"),
        ("stream/tvi_v4l2.c", "tv-v4l2"),
        ## Subtitles
        ("sub/ass_mp.c", "libass"),
        ("sub/dec_sub.c"),
        ("sub/draw_bmp.c"),
        ("sub/img_convert.c"),
        ("sub/lavc_conv.c"),
        ("sub/osd.c"),
        ("sub/osd_dummy.c", "dummy-osd"),
        ("sub/osd_libass.c", "libass-osd"),
        ("sub/sd_ass.c", "libass"),
        ("sub/sd_lavc.c"),
        ## Video
        ("video/csputils.c"),
        ("video/fmt-conversion.c"),
        ("video/gpu_memcpy.c", "sse4-intrinsics"),
        ("video/image_writer.c"),
        ("video/img_format.c"),
        ("video/hwdec.c"),
        ("video/mp_image.c"),
        ("video/mp_image_pool.c"),
        ("video/sws_utils.c"),
        ("video/vaapi.c", "vaapi"),
        ("video/vdpau.c", "vdpau"),
        ("video/vdpau_mixer.c", "vdpau"),
        ("video/decode/dec_video.c"),
        ("video/decode/cuda.c", "cuda-hwaccel"),
        ("video/decode/dxva2.c", "d3d-hwaccel"),
        ("video/decode/d3d11va.c", "d3d-hwaccel"),
        ("video/decode/d3d.c", "win32"),
        ("video/decode/vaapi.c", "vaapi-hwaccel"),
        ("video/decode/vd_lavc.c"),
        ("video/decode/videotoolbox.c", "videotoolbox-hwaccel"),
        ("video/decode/vdpau.c", "vdpau-hwaccel"),
        ("video/filter/refqueue.c"),
        ("video/filter/vf.c"),
        ("video/filter/vf_buffer.c"),
        ("video/filter/vf_crop.c"),
        ("video/filter/vf_d3d11vpp.c", "d3d-hwaccel"),
        ("video/filter/vf_dlopen.c", "dlopen"),
        ("video/filter/vf_dsize.c"),
        ("video/filter/vf_eq.c"),
        ("video/filter/vf_expand.c"),
        ("video/filter/vf_flip.c"),
        ("video/filter/vf_format.c"),
        ("video/filter/vf_gradfun.c"),
        ("video/filter/vf_lavfi.c"),
        ("video/filter/vf_mirror.c"),
        ("video/filter/vf_noformat.c"),
        ("video/filter/vf_pullup.c"),
        ("video/filter/vf_rotate.c"),
        ("video/filter/vf_scale.c"),
        ("video/filter/vf_stereo3d.c"),
        ("video/filter/vf_sub.c"),
        ("video/filter/vf_vapoursynth.c", "vapoursynth-core"),
        ("video/filter/vf_vavpp.c", "vaapi"),
        ("video/filter/vf_vdpaupp.c", "vdpau"),
        ("video/filter/vf_yadif.c"),
        ("video/out/aspect.c"),
        ("video/out/bitmap_packer.c"),
        ("video/out/cocoa/video_view.m", "cocoa"),
        ("video/out/cocoa/events_view.m", "cocoa"),
        ("video/out/cocoa/window.m", "cocoa"),
        ("video/out/cocoa_common.m", "cocoa"),
        ("video/out/dither.c"),
        ("video/out/filter_kernels.c"),
        ("video/out/opengl/angle_dynamic.c", "egl-angle"),
        ("video/out/opengl/common.c", "gl"),
        ("video/out/opengl/context.c", "gl"),
        ("video/out/opengl/context_angle.c", "egl-angle"),
        ("video/out/opengl/context_cocoa.c", "gl-cocoa"),
        ("video/out/opengl/context_drm_egl.c", "egl-drm"),
        ("video/out/opengl/context_dxinterop.c", "gl-dxinterop"),
        ("video/out/opengl/context_mali_fbdev.c", "mali-fbdev"),
        ("video/out/opengl/context_rpi.c", "rpi"),
        ("video/out/opengl/context_wayland.c", "gl-wayland"),
        ("video/out/opengl/context_w32.c", "gl-win32"),
        ("video/out/opengl/context_x11.c", "gl-x11"),
        ("video/out/opengl/context_x11egl.c", "egl-x11"),
        ("video/out/opengl/cuda_dynamic.c", "cuda-hwaccel"),
        ("video/out/opengl/egl_helpers.c", "egl-helpers"),
        ("video/out/opengl/formats.c", "gl"),
        ("video/out/opengl/hwdec.c", "gl"),
        ("video/out/opengl/hwdec_cuda.c", "cuda-hwaccel"),
        ("video/out/opengl/hwdec_d3d11egl.c", "egl-angle"),
        ("video/out/opengl/hwdec_d3d11eglrgb.c", "egl-angle"),
        ("video/out/opengl/hwdec_dxva2.c", "gl-win32"),
        ("video/out/opengl/hwdec_dxva2gldx.c", "gl-dxinterop"),
        ("video/out/opengl/hwdec_dxva2egl.c", "egl-angle"),
        ("video/out/opengl/hwdec_osx.c", "videotoolbox-gl"),
        ("video/out/opengl/hwdec_rpi.c", "rpi"),
        ("video/out/opengl/hwdec_vaegl.c", "vaapi-egl"),
        ("video/out/opengl/hwdec_vaglx.c", "vaapi-glx"),
        ("video/out/opengl/hwdec_vdpau.c", "vdpau-gl-x11"),
        ("video/out/opengl/lcms.c", "gl"),
        ("video/out/opengl/osd.c", "gl"),
        ("video/out/opengl/user_shaders.c", "gl"),
        ("video/out/opengl/utils.c", "gl"),
        ("video/out/opengl/video.c", "gl"),
        ("video/out/opengl/video_shaders.c", "gl"),
        ("video/out/vo.c"),
        ("video/out/vo_caca.c", "caca"),
        ("video/out/vo_drm.c", "drm"),
        ("video/out/vo_direct3d.c", "direct3d"),
        ("video/out/vo_image.c"),
        ("video/out/vo_lavc.c", "encoding"),
        ("video/out/vo_rpi.c", "rpi"),
        ("video/out/vo_null.c"),
        ("video/out/vo_opengl.c", "gl"),
        ("video/out/vo_opengl_cb.c", "gl"),
        ("video/out/vo_sdl.c", "sdl2"),
        ("video/out/vo_tct.c"),
        ("video/out/vo_vaapi.c", "vaapi-x11"),
        ("video/out/vo_vdpau.c", "vdpau"),
        ("video/out/vo_wayland.c", "wayland"),
        ("video/out/vo_x11.c", "x11"),
        ("video/out/vo_xv.c", "xv"),
        ("video/out/w32_common.c", "win32"),
        ("video/out/win32/displayconfig.c", "win32"),
        ("video/out/win32/exclusive_hack.c", "gl-win32"),
        ("video/out/wayland_common.c", "wayland"),
        ("video/out/wayland/buffer.c", "wayland"),
        ("video/out/wayland/memfile.c", "wayland"),
        ("video/out/win_state.c"),
        ("video/out/x11_common.c", "x11"),
        ("video/out/drm_common.c", "drm"),
        ## osdep
        (getch2_c),
        ("osdep/io.c"),
        ("osdep/timer.c"),
        (timer_c),
        ("osdep/threads.c"),
        ("osdep/ar/HIDRemote.m", "apple-remote"),
        ("osdep/macosx_application.m", "cocoa"),
        ("osdep/macosx_events.m", "cocoa"),
        ("osdep/semaphore_osx.c"),
        ("osdep/subprocess.c"),
        ("osdep/subprocess-posix.c", "posix-spawn"),
        ("osdep/subprocess-win.c", "os-win32"),
        ("osdep/path-macosx.m", "cocoa"),
        ("osdep/path-unix.c"),
        ("osdep/path-win.c", "os-win32"),
        ("osdep/path-win.c", "os-cygwin"),
        ("osdep/glob-win.c", "glob-win32-replacement"),
        ("osdep/w32_keyboard.c", "os-win32"),
        ("osdep/w32_keyboard.c", "os-cygwin"),
        ("osdep/windows_utils.c", "win32"),
        ("osdep/mpv.rc", "win32-executable"),
        ("osdep/win32/pthread.c", "win32-internal-pthreads"),
        ("osdep/android/strnlen.c", "android"),
        ## tree_allocator
        "ta/ta.c",
        "ta/ta_talloc.c",
        "ta/ta_utils.c",
    ]

    if ctx.dependency_satisfied("win32-executable"):
        from waflib import TaskGen

        TaskGen.declare_chain(
            name="windres",
            rule="${WINDRES} ${WINDRES_FLAGS} ${SRC} ${TGT}",
            ext_in=".rc",
            ext_out="-rc.o",
            color="PINK",
        )

        ctx.env.WINDRES_FLAGS = [
            "--include-dir={0}".format(ctx.bldnode.abspath()),
            "--include-dir={0}".format(ctx.srcnode.abspath()),
        ]

        for node in "osdep/mpv.exe.manifest etc/mpv-icon.ico".split():
            ctx.add_manual_dependency(ctx.path.find_node("osdep/mpv.rc"), ctx.path.find_node(node))

        version = ctx.bldnode.find_node("version.h")
        if version:
            ctx.add_manual_dependency(ctx.path.find_node("osdep/mpv.rc"), version)

    if ctx.dependency_satisfied("cplayer") or ctx.dependency_satisfied("test"):
        ctx(
            target="objects",
            source=ctx.filtered_sources(sources),
            use=ctx.dependencies_use(),
            includes=_all_includes(ctx),
            features="c",
        )

    if ctx.dependency_satisfied("cplayer"):
        ctx(
            target="mpv",
            source=main_fn_c,
            use=ctx.dependencies_use() + ["objects"],
            includes=_all_includes(ctx),
            features="c cprogram",
            install_path=ctx.env.BINDIR,
        )
        for f in ["mpv.conf", "input.conf", "mplayer-input.conf", "restore-old-bindings.conf"]:
            ctx.install_as(os.path.join(ctx.env.DOCDIR, f), os.path.join("etc/", f))

        if ctx.env.DEST_OS == "win32":
            wrapctx = ctx(
                target="mpv",
                source=["osdep/win32-console-wrapper.c"],
                features="c cprogram",
                install_path=ctx.env.BINDIR,
            )

            wrapctx.env.cprogram_PATTERN = "%s.com"
            wrapflags = ["-municode", "-mconsole"]
            wrapctx.env.CFLAGS = wrapflags
            wrapctx.env.LAST_LINKFLAGS = wrapflags

    if ctx.dependency_satisfied("test"):
        for test in ctx.path.ant_glob("test/*.c"):
            ctx(
                target=os.path.splitext(test.srcpath())[0],
                source=test.srcpath(),
                use=ctx.dependencies_use() + ["objects"],
                includes=_all_includes(ctx),
                features="c cprogram",
                install_path=None,
            )

    build_shared = ctx.dependency_satisfied("libmpv-shared")
    build_static = ctx.dependency_satisfied("libmpv-static")
    if build_shared or build_static:
        if build_shared:
            waftoolsdir = os.path.join(os.path.dirname(__file__), "waftools")
            ctx.load("syms", tooldir=waftoolsdir)
        vre = "#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION\((.*), (.*)\)"
        libmpv_header = ctx.path.find_node("libmpv/client.h").read()
        major, minor = re.search(vre, libmpv_header).groups()
        libversion = major + "." + minor + ".0"

        def _build_libmpv(shared):
            features = "c "
            if shared:
                features += "cshlib syms"
            else:
                features += "cstlib"

            libmpv_kwargs = {
                "target": "mpv",
                "source": ctx.filtered_sources(sources),
                "use": ctx.dependencies_use(),
                "includes": [ctx.bldnode.abspath(), ctx.srcnode.abspath()] + ctx.dependencies_includes(),
                "features": features,
                "export_symbols_def": "libmpv/mpv.def",
                "install_path": ctx.env.LIBDIR,
            }

            if shared and ctx.dependency_satisfied("android"):
                # for Android we just add the linker flag without version
                # as we still need the SONAME for proper linkage.
                # (LINKFLAGS logic taken from waf's apply_vnum in ccroot.py)
                v = ctx.env.SONAME_ST % "libmpv.so"
                ctx.env.append_value("LINKFLAGS", v.split())
            else:
                # for all other configurations we want SONAME to be used
                libmpv_kwargs["vnum"] = libversion

            ctx(**libmpv_kwargs)

        if build_shared:
            _build_libmpv(True)
        if build_static:
            _build_libmpv(False)

        def get_deps():
            res = ""
            for k in ctx.env.keys():
                if k.startswith("LIB_") and k != "LIB_ST":
                    res += " ".join(["-l" + x for x in ctx.env[k]]) + " "
            return res

        ctx(
            target="libmpv/mpv.pc",
            source="libmpv/mpv.pc.in",
            features="subst",
            PREFIX=ctx.env.PREFIX,
            LIBDIR=ctx.env.LIBDIR,
            INCDIR=ctx.env.INCDIR,
            VERSION=libversion,
            PRIV_LIBS=get_deps(),
        )

        headers = ["client.h", "qthelper.hpp", "opengl_cb.h", "stream_cb.h"]
        for f in headers:
            ctx.install_as(ctx.env.INCDIR + "/mpv/" + f, "libmpv/" + f)

        ctx.install_as(ctx.env.LIBDIR + "/pkgconfig/mpv.pc", "libmpv/mpv.pc")

    if ctx.dependency_satisfied("vf-dlopen-filters"):
        dlfilters = "telecine tile rectangle framestep ildetect".split()
        for dlfilter in dlfilters:
            ctx(
                target=dlfilter,
                source=["TOOLS/vf_dlopen/" + dlfilter + ".c", "TOOLS/vf_dlopen/filterutils.c"],
                includes=[ctx.srcnode.abspath() + "/video/filter"],
                features="c cshlib",
                install_path=ctx.env.LIBDIR + "/mpv",
            )

    if ctx.dependency_satisfied("html-build"):
        _build_html(ctx)

    if ctx.dependency_satisfied("manpage-build"):
        _build_man(ctx)

    if ctx.dependency_satisfied("pdf-build"):
        _build_pdf(ctx)

    if ctx.dependency_satisfied("cplayer"):

        if ctx.dependency_satisfied("zsh-comp"):
            ctx.zshcomp(target="etc/_mpv", source="TOOLS/zsh.pl")
            ctx.install_files(ctx.env.ZSHDIR, ["etc/_mpv"])

        ctx.install_files(ctx.env.DATADIR + "/applications", ["etc/mpv.desktop"])

        if ctx.dependency_satisfied("encoding"):
            ctx.install_files(ctx.env.CONFDIR, ["etc/encoding-profiles.conf"])

        for size in "16x16 32x32 64x64".split():
            ctx.install_as(
                ctx.env.DATADIR + "/icons/hicolor/" + size + "/apps/mpv.png", "etc/mpv-icon-8bit-" + size + ".png"
            )

        ctx.install_as(ctx.env.DATADIR + "/icons/hicolor/scalable/apps/mpv.svg", "etc/mpv-gradient.svg")

        ctx.install_files(ctx.env.DATADIR + "/icons/hicolor/symbolic/apps", ["etc/mpv-symbolic.svg"])
    if not env.PROC_TNS_ADMIN:
        env.PROC_TNS_ADMIN = cnf.options.tns_admin
    if not env.PROC_CONNECTION:
        env.PROC_CONNECTION = cnf.options.connection
    cnf.find_program("proc", var="PROC", path_list=env.PROC_ORACLE + path.sep + "bin")


def proc(tsk):
    env = tsk.env
    gen = tsk.generator
    bld = gen.bld
    inc_nodes = gen.to_incnodes(Utils.to_list(getattr(gen, "includes", [])) + env["INCLUDES"])

    # FIXME the if-else construct will not work in python 2
    cmd = (
        [env.PROC]
        + ["SQLCHECK=SEMANTICS"]
        + (["SYS_INCLUDE=(" + ",".join(env.PROC_INCLUDES) + ")"] if env.PROC_INCLUDES else [])
        + ["INCLUDE=(" + ",".join([i.bldpath() for i in inc_nodes]) + ")"]
        + ["userid=" + env.PROC_CONNECTION]
        + ["INAME=" + tsk.inputs[0].bldpath()]
        + ["ONAME=" + tsk.outputs[0].bldpath()]
    )
    exec_env = {"ORACLE_HOME": env.PROC_ORACLE, "LD_LIBRARY_PATH": env.PROC_ORACLE + path.sep + "lib"}
    if env.PROC_TNS_ADMIN:
        exec_env["TNS_ADMIN"] = env.PROC_TNS_ADMIN
    return tsk.exec_command(cmd, env=exec_env)


TaskGen.declare_chain(name="proc", rule=proc, ext_in=".pc", ext_out=".c")
示例#9
0
文件: shaders.py 项目: wsmind/oak
	shaderFile = open(src, "r")
	headerFile = open(tgt, "w")
	
	headerFile.write("namespace oak {\n")
	
	# deduce variable name from filename
	split = os.path.splitext(os.path.basename(src))
	variableName = split[0] + split[1].upper()[1:]
	
	headerFile.write("const char *" + variableName + "String = \"")
	for line in shaderFile:
		# escape '\' and '"'
		line = line.replace("\\", "\\\\")
		line = line.replace("\"", "\\\"")
		
		# content, with \n between lines
		headerFile.write(line.strip() + "\\n")
	
	headerFile.write("\";\n")
	
	headerFile.write("} // oak namespace\n")
	
	shaderFile.close()
	headerFile.close()
	
	return 0

from waflib import TaskGen
TaskGen.declare_chain(name = "vertex_shader", rule = build_shader, ext_in = ".vs", ext_out = ".vs.h")
TaskGen.declare_chain(name = "fragment_shader", rule = build_shader, ext_in = ".fs", ext_out = ".fs.h")
示例#10
0
from waflib import TaskGen
import sys

TaskGen.declare_chain(
		name='genpy',
		rule='${PYTHON} ${SRC} ${GENPY_ARGS} > ${TGT}',
		reentrant=True,
		color='BLUE',
		ext_in='.genpy',
		ext_out='.c',
		before='c')

def configure(conf):
    conf.env['PYTHON'] = sys.executable
    conf.env['GENPY_EXT'] = ['.genpy']
    conf.env['GENPY_ARGS'] = ''
    return True
示例#11
0
def c_hook(self, node):
	"Binds the c file extensions create :py:class:`waflib.Tools.c.c` instances"
	if not self.env.CC and self.env.CXX:
		return self.create_compiled_task('cxx', node)
	return self.create_compiled_task('c', node)

class c(Task.Task):
	"Compiles C files into object files"
	run_str = '${CC} ${ARCH_ST:ARCH} ${CFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${CC_SRC_F}${SRC} ${CC_TGT_F}${TGT} ${CPPFLAGS}'
	vars    = ['CCDEPS'] # unused variable to depend on, just in case
	ext_in  = ['.h'] # set the build order easily by using ext_out=['.h']
	scan    = c_preproc.scan

class cprogram(link_task):
	"Links object files into c programs"
	run_str = '${LINK_CC} ${LINKFLAGS} ${CCLNK_SRC_F}${SRC} ${CCLNK_TGT_F}${TGT} ${RPATH_ST:RPATH} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${FRAMEWORK_ST:FRAMEWORK} ${ARCH_ST:ARCH} ${STLIB_MARKER} ${STLIBPATH_ST:STLIBPATH} ${STLIB_ST:STLIB} ${SHLIB_MARKER} ${LIBPATH_ST:LIBPATH} ${LIB_ST:LIB} ${LDFLAGS}'
	ext_out = ['.bin']
	vars    = ['LINKDEPS']
	inst_to = '${BINDIR}'

class cstlib(stlink_task):
	"Links object files into a c static libraries"
	pass # do not remove

TaskGen.declare_chain(
    "hex",
    rule = "${OBJCOPY} -O ihex ${SRC} ${TGT}",
    ext_in = ".elf",
    ext_out = ".hex",
)
示例#12
0
文件: Build.py 项目: zsx/waf
	def declare_chain(self, *k, **kw):
		"""alias for TaskGen.declare_chain (wrapper provided for convenience - avoid the import)"""
		return TaskGen.declare_chain(*k, **kw)
示例#13
0
    worklib = self.get_worklib_path_from_string(lib)
    worklib_gen_output = worklib.find_node('_info')
    if worklib_gen_output is None and not getattr(self, 'worklib_task', None):
        worklib_gen_output = worklib.make_node('_info')
        worklib_task = self.create_task('vlibTask', None,
                                        worklib_gen_output.get_bld())
        return worklib, worklib_gen_output
    else:
        return worklib, None


TaskGen.declare_chain(
    rule=
    '${MODEL_VLOG} -l ${VLOG_LOGFILE} ${VLOG_V_OPTIONS} -work ${gen.WORKLIB.abspath()} ${VERILOG_INC_DIRS} ${SRC} && echo "${TGT}" > ${TGT}',
    ext_in=['.lib.src'],
    ext_out=['.lib.src.out'],
    reentrant=False,
    scan=scan_verilog_task,
    after='vlibTask',
)

TaskGen.declare_chain(
    rule=
    '${MODEL_VLOG} -l ${VLOG_LOGFILE} ${VLOG_V_OPTIONS} -work ${gen.WORKLIB.abspath()} ${VERILOG_INC_DIRS} ${SRC} && echo "${TGT}" > ${TGT}',
    ext_in=[
        '.vp',
    ],
    ext_out=[
        '.vp.out',
    ],
    reentrant=False,
示例#14
0
# Cython tool for waf

from waflib.Configure import conf
from waflib import TaskGen

TaskGen.declare_chain(
        name = "cython",
        rule = "${CYTHON} ${CYTHONFLAGS} ${CPPPATH_ST:INCPATHS} ${SRC} -o ${TGT}",
        ext_in = ['.pyx'],
        ext_out = ['.cxx'],
        reentrant = True,
        )

@conf
def check_cython_version(conf, minver):
    conf.start_msg("Checking cython version")
    minver = tuple(minver)
    import re
    version_re = re.compile(r'cython\s*version\s*(?P<major>\d*)\.(?P<minor>\d*)(?:\.(?P<micro>\d*))?', re.I).search
    cmd = conf.cmd_to_list(conf.env['CYTHON'])
    cmd = cmd + ['--version']
    from waflib.Tools import fc_config
    stdout, stderr = fc_config.getoutput(conf, cmd)
    if stdout:
        match = version_re(stdout)
    else:
        match = version_re(stderr)
    if not match:
        conf.fatal("cannot determine the Cython version")
    cy_ver = [match.group('major'), match.group('minor')]
    if match.group('micro'):
示例#15
0
# Cython tool for waf

from waflib.Configure import conf
from waflib import TaskGen

TaskGen.declare_chain(
        name = "cython",
        rule = "${CYTHON} ${CYTHONFLAGS} ${CPPPATH_ST:INCPATHS} ${SRC} -o ${TGT}",
        ext_in = ['.pyx'],
        ext_out = ['.c'],
        reentrant = True,
        )

@conf
def check_cython_version(conf, minver):
    conf.start_msg("Checking cython version")
    minver = tuple(minver)
    import re
    version_re = re.compile(r'cython\s*version\s*(?P<major>\d*)\.(?P<minor>\d*)(?:\.(?P<micro>\d*))?', re.I).search
    cmd = conf.cmd_to_list(conf.env['CYTHON'])
    cmd = cmd + ['--version']
    from waflib.Tools import fc_config
    stdout, stderr = fc_config.getoutput(conf, cmd)
    if stdout:
        match = version_re(stdout)
    else:
        match = version_re(stderr)
    if not match:
        conf.fatal("cannot determine the Cython version")
    cy_ver = [match.group('major'), match.group('minor')]
    if match.group('micro'):
示例#16
0
def build(ctx):
    ctx.load('waf_customizations')
    ctx.load('generators.sources')

    ctx.file2string(
        source="TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icns",
        target="osdep/macosx_icon.inc")

    ctx.file2string(source="video/out/x11_icon.bin",
                    target="video/out/x11_icon.inc")

    ctx.file2string(source="etc/input.conf", target="input/input_conf.h")

    ctx.file2string(source="sub/osd_font.otf", target="sub/osd_font.h")

    ctx.file2string(source="video/out/opengl/nnedi3_weights.bin",
                    target="video/out/opengl/nnedi3_weights.inc")

    lua_files = [
        "defaults.lua", "assdraw.lua", "options.lua", "osc.lua",
        "ytdl_hook.lua"
    ]
    for fn in lua_files:
        fn = "player/lua/" + fn
        ctx.file2string(source=fn, target=os.path.splitext(fn)[0] + ".inc")

    ctx.matroska_header(source="demux/ebml.c demux/demux_mkv.c",
                        target="ebml_types.h")

    ctx.matroska_definitions(source="demux/ebml.c", target="ebml_defs.c")

    if ctx.env.DEST_OS == 'win32':
        main_fn_c = 'osdep/main-fn-win.c'
    elif ctx.dependency_satisfied('cocoa'):
        main_fn_c = 'osdep/main-fn-cocoa.c'
    else:
        main_fn_c = 'osdep/main-fn-unix.c'

    getch2_c = {
        'win32': 'osdep/terminal-win.c',
    }.get(ctx.env.DEST_OS, "osdep/terminal-unix.c")

    timer_c = {
        'win32': 'osdep/timer-win2.c',
        'darwin': 'osdep/timer-darwin.c',
    }.get(ctx.env.DEST_OS, "osdep/timer-linux.c")

    sources = [
        ## Audio
        ("audio/audio.c"),
        ("audio/audio_buffer.c"),
        ("audio/chmap.c"),
        ("audio/chmap_sel.c"),
        ("audio/fmt-conversion.c"),
        ("audio/format.c"),
        ("audio/mixer.c"),
        ("audio/decode/ad_lavc.c"),
        ("audio/decode/ad_spdif.c"),
        ("audio/decode/dec_audio.c"),
        ("audio/filter/af.c"),
        ("audio/filter/af_channels.c"),
        ("audio/filter/af_delay.c"),
        ("audio/filter/af_drc.c"),
        ("audio/filter/af_equalizer.c"),
        ("audio/filter/af_format.c"),
        ("audio/filter/af_lavcac3enc.c"),
        ("audio/filter/af_lavfi.c", "libavfilter"),
        ("audio/filter/af_lavrresample.c"),
        ("audio/filter/af_pan.c"),
        ("audio/filter/af_rubberband.c", "rubberband"),
        ("audio/filter/af_scaletempo.c"),
        ("audio/filter/af_volume.c"),
        ("audio/filter/tools.c"),
        ("audio/out/ao.c"),
        ("audio/out/ao_alsa.c", "alsa"),
        ("audio/out/ao_coreaudio.c", "coreaudio"),
        ("audio/out/ao_coreaudio_chmap.c", "coreaudio"),
        ("audio/out/ao_coreaudio_exclusive.c", "coreaudio"),
        ("audio/out/ao_coreaudio_properties.c", "coreaudio"),
        ("audio/out/ao_coreaudio_utils.c", "coreaudio"),
        ("audio/out/ao_dsound.c", "dsound"),
        ("audio/out/ao_jack.c", "jack"),
        ("audio/out/ao_lavc.c", "encoding"),
        ("audio/out/ao_null.c"),
        ("audio/out/ao_openal.c", "openal"),
        ("audio/out/ao_oss.c", "oss-audio"),
        ("audio/out/ao_pcm.c"),
        ("audio/out/ao_pulse.c", "pulse"),
        ("audio/out/ao_rsound.c", "rsound"),
        ("audio/out/ao_sdl.c", "sdl1"),
        ("audio/out/ao_sdl.c", "sdl2"),
        ("audio/out/ao_sndio.c", "sndio"),
        ("audio/out/ao_wasapi.c", "wasapi"),
        ("audio/out/ao_wasapi_utils.c", "wasapi"),
        ("audio/out/ao_wasapi_changenotify.c", "wasapi"),
        ("audio/out/pull.c"),
        ("audio/out/push.c"),

        ## Core
        ("common/av_common.c"),
        ("common/av_log.c"),
        ("common/codecs.c"),
        ("common/encode_lavc.c", "encoding"),
        ("common/common.c"),
        ("common/tags.c"),
        ("common/msg.c"),
        ("common/playlist.c"),
        ("common/version.c"),

        ## Demuxers
        ("demux/codec_tags.c"),
        ("demux/cue.c"),
        ("demux/demux.c"),
        ("demux/demux_cue.c"),
        ("demux/demux_disc.c"),
        ("demux/demux_edl.c"),
        ("demux/demux_lavf.c"),
        ("demux/demux_libarchive.c", "libarchive"),
        ("demux/demux_mf.c"),
        ("demux/demux_mkv.c"),
        ("demux/demux_mkv_timeline.c"),
        ("demux/demux_playlist.c"),
        ("demux/demux_raw.c"),
        ("demux/demux_rar.c"),
        ("demux/demux_subreader.c"),
        ("demux/demux_tv.c", "tv"),
        ("demux/ebml.c"),
        ("demux/packet.c"),
        ("demux/timeline.c"),

        ## Input
        ("input/cmd_list.c"),
        ("input/cmd_parse.c"),
        ("input/event.c"),
        ("input/input.c"),
        ("input/ipc.c", "!mingw"),
        ("input/keycodes.c"),
        ("input/pipe-win32.c", "waio"),

        ## Misc
        ("misc/bstr.c"),
        ("misc/charset_conv.c"),
        ("misc/dispatch.c"),
        ("misc/json.c"),
        ("misc/ring.c"),
        ("misc/rendezvous.c"),

        ## Options
        ("options/m_config.c"),
        ("options/m_option.c"),
        ("options/m_property.c"),
        ("options/options.c"),
        ("options/parse_commandline.c"),
        ("options/parse_configfile.c"),
        ("options/path.c"),

        ## Player
        ("player/audio.c"),
        ("player/client.c"),
        ("player/command.c"),
        ("player/configfiles.c"),
        ("player/external_files.c"),
        ("player/loadfile.c"),
        ("player/main.c"),
        ("player/misc.c"),
        ("player/lua.c", "lua"),
        ("player/osd.c"),
        ("player/playloop.c"),
        ("player/screenshot.c"),
        ("player/scripting.c"),
        ("player/sub.c"),
        ("player/video.c"),

        ## Streams
        ("stream/ai_alsa1x.c", "alsa"),
        ("stream/ai_oss.c", "oss-audio"),
        ("stream/ai_sndio.c", "sndio"),
        ("stream/audio_in.c", "audio-input"),
        ("stream/cache.c"),
        ("stream/cache_file.c"),
        ("stream/cookies.c"),
        ("stream/dvb_tune.c", "dvbin"),
        ("stream/frequencies.c", "tv"),
        ("stream/rar.c"),
        ("stream/stream.c"),
        ("stream/stream_avdevice.c"),
        ("stream/stream_bluray.c", "libbluray"),
        ("stream/stream_cdda.c", "cdda"),
        ("stream/stream_dvb.c", "dvbin"),
        ("stream/stream_dvd.c", "dvdread"),
        ("stream/stream_dvd_common.c", "dvdread"),
        ("stream/stream_dvdnav.c", "dvdnav"),
        ("stream/stream_edl.c"),
        ("stream/stream_file.c"),
        ("stream/stream_lavf.c"),
        ("stream/stream_libarchive.c", "libarchive"),
        ("stream/stream_memory.c"),
        ("stream/stream_mf.c"),
        ("stream/stream_null.c"),
        ("stream/stream_pvr.c", "pvr"),
        ("stream/stream_rar.c"),
        ("stream/stream_smb.c", "libsmbclient"),
        ("stream/stream_tv.c", "tv"),
        ("stream/tv.c", "tv"),
        ("stream/tvi_dummy.c", "tv"),
        ("stream/tvi_v4l2.c", "tv-v4l2"),

        ## Subtitles
        ("sub/ass_mp.c", "libass"),
        ("sub/dec_sub.c"),
        ("sub/draw_bmp.c"),
        ("sub/img_convert.c"),
        ("sub/osd.c"),
        ("sub/osd_dummy.c", "dummy-osd"),
        ("sub/osd_libass.c", "libass-osd"),
        ("sub/sd_ass.c", "libass"),
        ("sub/sd_lavc.c"),
        ("sub/sd_lavc_conv.c"),
        ("sub/sd_lavf_srt.c"),
        ("sub/sd_microdvd.c"),
        ("sub/sd_movtext.c"),
        ("sub/sd_srt.c"),

        ## Video
        ("video/csputils.c"),
        ("video/fmt-conversion.c"),
        ("video/gpu_memcpy.c", "sse4-intrinsics"),
        ("video/image_writer.c"),
        ("video/img_format.c"),
        ("video/mp_image.c"),
        ("video/mp_image_pool.c"),
        ("video/sws_utils.c"),
        ("video/vaapi.c", "vaapi"),
        ("video/vdpau.c", "vdpau"),
        ("video/vdpau_mixer.c", "vdpau"),
        ("video/decode/dec_video.c"),
        ("video/decode/dxva2.c", "dxva2-hwaccel"),
        ("video/decode/rpi.c", "rpi"),
        ("video/decode/vaapi.c", "vaapi-hwaccel"),
        ("video/decode/vd_lavc.c"),
        ("video/decode/videotoolbox.c", "videotoolbox-hwaccel"),
        ("video/decode/vdpau.c", "vdpau-hwaccel"),
        ("video/filter/vf.c"),
        ("video/filter/vf_buffer.c"),
        ("video/filter/vf_crop.c"),
        ("video/filter/vf_dlopen.c", "dlopen"),
        ("video/filter/vf_dsize.c"),
        ("video/filter/vf_eq.c"),
        ("video/filter/vf_expand.c"),
        ("video/filter/vf_flip.c"),
        ("video/filter/vf_format.c"),
        ("video/filter/vf_gradfun.c", "libavfilter"),
        ("video/filter/vf_lavfi.c", "libavfilter"),
        ("video/filter/vf_mirror.c", "libavfilter"),
        ("video/filter/vf_noformat.c"),
        ("video/filter/vf_pullup.c", "libavfilter"),
        ("video/filter/vf_rotate.c", "libavfilter"),
        ("video/filter/vf_scale.c"),
        ("video/filter/vf_stereo3d.c", "libavfilter"),
        ("video/filter/vf_sub.c"),
        ("video/filter/vf_vapoursynth.c", "vapoursynth-core"),
        ("video/filter/vf_vavpp.c", "vaapi"),
        ("video/filter/vf_vdpaupp.c", "vdpau"),
        ("video/filter/vf_vdpaurb.c", "vdpau"),
        ("video/filter/vf_yadif.c", "libavfilter"),
        ("video/out/aspect.c"),
        ("video/out/bitmap_packer.c"),
        ("video/out/cocoa/video_view.m", "cocoa"),
        ("video/out/cocoa/events_view.m", "cocoa"),
        ("video/out/cocoa/window.m", "cocoa"),
        ("video/out/cocoa_common.m", "cocoa"),
        ("video/out/dither.c"),
        ("video/out/filter_kernels.c"),
        ("video/out/opengl/cocoa.c", "gl-cocoa"),
        ("video/out/opengl/common.c", "gl"),
        ("video/out/opengl/rpi.c", "rpi"),
        ("video/out/opengl/hwdec.c", "gl"),
        ("video/out/opengl/hwdec_dxva2.c", "gl-win32"),
        ("video/out/opengl/hwdec_vaegl.c", "vaapi-egl"),
        ("video/out/opengl/hwdec_vaglx.c", "vaapi-glx"),
        ("video/out/opengl/hwdec_osx.c", "videotoolbox-gl"),
        ("video/out/opengl/hwdec_vdpau.c", "vdpau-gl-x11"),
        ("video/out/opengl/lcms.c", "gl"),
        ("video/out/opengl/nnedi3.c", "gl"),
        ("video/out/opengl/osd.c", "gl"),
        ("video/out/opengl/superxbr.c", "gl"),
        ("video/out/opengl/utils.c", "gl"),
        ("video/out/opengl/video.c", "gl"),
        ("video/out/opengl/video_shaders.c", "gl"),
        ("video/out/opengl/w32.c", "gl-win32"),
        ("video/out/opengl/angle.c", "egl-angle"),
        ("video/out/opengl/wayland.c", "gl-wayland"),
        ("video/out/opengl/x11.c", "gl-x11"),
        ("video/out/opengl/x11egl.c", "egl-x11"),
        ("video/out/opengl/drm_egl.c", "egl-drm"),
        ("video/out/vo.c"),
        ("video/out/vo_caca.c", "caca"),
        ("video/out/vo_drm.c", "drm"),
        ("video/out/vo_direct3d.c", "direct3d"),
        ("video/out/vo_image.c"),
        ("video/out/vo_lavc.c", "encoding"),
        ("video/out/vo_rpi.c", "rpi"),
        ("video/out/vo_null.c"),
        ("video/out/vo_opengl.c", "gl"),
        ("video/out/vo_opengl_cb.c", "gl"),
        ("video/out/vo_sdl.c", "sdl2"),
        ("video/out/vo_vaapi.c", "vaapi-x11"),
        ("video/out/vo_vdpau.c", "vdpau"),
        ("video/out/vo_wayland.c", "wayland"),
        ("video/out/vo_x11.c", "x11"),
        ("video/out/vo_xv.c", "xv"),
        ("video/out/w32_common.c", "win32"),
        ("video/out/win32/displayconfig.c", "win32"),
        ("video/out/win32/exclusive_hack.c", "gl-win32"),
        ("video/out/wayland_common.c", "wayland"),
        ("video/out/wayland/buffer.c", "wayland"),
        ("video/out/wayland/memfile.c", "wayland"),
        ("video/out/win_state.c"),
        ("video/out/x11_common.c", "x11"),
        ("video/out/drm_common.c", "drm"),

        ## osdep
        (getch2_c),
        ("osdep/io.c"),
        ("osdep/timer.c"),
        (timer_c),
        ("osdep/threads.c"),
        ("osdep/ar/HIDRemote.m", "apple-remote"),
        ("osdep/macosx_application.m", "cocoa"),
        ("osdep/macosx_events.m", "cocoa"),
        ("osdep/semaphore_osx.c"),
        ("osdep/subprocess.c"),
        ("osdep/subprocess-posix.c", "posix-spawn"),
        ("osdep/subprocess-win.c", "os-win32"),
        ("osdep/path-macosx.m", "cocoa"),
        ("osdep/path-unix.c"),
        ("osdep/path-win.c", "os-win32"),
        ("osdep/path-win.c", "os-cygwin"),
        ("osdep/glob-win.c", "glob-win32-replacement"),
        ("osdep/w32_keyboard.c", "os-win32"),
        ("osdep/w32_keyboard.c", "os-cygwin"),
        ("osdep/mpv.rc", "win32-executable"),
        ("osdep/win32/pthread.c", "win32-internal-pthreads"),

        ## tree_allocator
        "ta/ta.c",
        "ta/ta_talloc.c",
        "ta/ta_utils.c"
    ]

    if ctx.dependency_satisfied('win32-executable'):
        from waflib import TaskGen

        TaskGen.declare_chain(name='windres',
                              rule='${WINDRES} ${WINDRES_FLAGS} ${SRC} ${TGT}',
                              ext_in='.rc',
                              ext_out='-rc.o',
                              color='PINK')

        ctx.env.WINDRES_FLAGS = [
            '--include-dir={0}'.format(ctx.bldnode.abspath()),
            '--include-dir={0}'.format(ctx.srcnode.abspath())
        ]

        for node in 'osdep/mpv.exe.manifest etc/mpv-icon.ico'.split():
            ctx.add_manual_dependency(ctx.path.find_node('osdep/mpv.rc'),
                                      ctx.path.find_node(node))

        version = ctx.bldnode.find_node('version.h')
        if version:
            ctx.add_manual_dependency(ctx.path.find_node('osdep/mpv.rc'),
                                      version)

    if ctx.dependency_satisfied('cplayer') or ctx.dependency_satisfied('test'):
        ctx(
            target="objects",
            source=ctx.filtered_sources(sources),
            use=ctx.dependencies_use(),
            includes=_all_includes(ctx),
            features="c",
        )

    if ctx.dependency_satisfied('cplayer'):
        ctx(target="mpv",
            source=main_fn_c,
            use=ctx.dependencies_use() + ['objects'],
            includes=_all_includes(ctx),
            features="c cprogram",
            install_path=ctx.env.BINDIR)
        for f in ['example.conf', 'input.conf', 'mplayer-input.conf', \
                  'restore-old-bindings.conf']:
            ctx.install_as(os.path.join(ctx.env.DOCDIR, f),
                           os.path.join('etc/', f))

        if ctx.env.DEST_OS == 'win32':
            wrapctx = ctx(target="mpv",
                          source=['osdep/win32-console-wrapper.c'],
                          features="c cprogram",
                          install_path=ctx.env.BINDIR)

            wrapctx.env.cprogram_PATTERN = "%s.com"
            wrapflags = ['-municode', '-mconsole']
            wrapctx.env.CFLAGS = wrapflags
            wrapctx.env.LAST_LINKFLAGS = wrapflags

    if ctx.dependency_satisfied('test'):
        for test in ctx.path.ant_glob("test/*.c"):
            ctx(
                target=os.path.splitext(test.srcpath())[0],
                source=test.srcpath(),
                use=ctx.dependencies_use() + ['objects'],
                includes=_all_includes(ctx),
                features="c cprogram",
            )

    build_shared = ctx.dependency_satisfied('libmpv-shared')
    build_static = ctx.dependency_satisfied('libmpv-static')
    if build_shared or build_static:
        if build_shared:
            waftoolsdir = os.path.join(os.path.dirname(__file__), "waftools")
            ctx.load("syms", tooldir=waftoolsdir)
        vre = '^#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION\((.*), (.*)\)$'
        libmpv_header = ctx.path.find_node("libmpv/client.h").read()
        major, minor = re.search(vre, libmpv_header, re.M).groups()
        libversion = major + '.' + minor + '.0'

        def _build_libmpv(shared):
            features = "c "
            if shared:
                features += "cshlib syms"
            else:
                features += "cstlib"
            ctx(
                target       = "mpv",
                source       = ctx.filtered_sources(sources),
                use          = ctx.dependencies_use(),
                includes     = [ctx.bldnode.abspath(), ctx.srcnode.abspath()] + \
                                ctx.dependencies_includes(),
                features     = features,
                export_symbols_def = "libmpv/mpv.def",
                install_path = ctx.env.LIBDIR,
                vnum         = libversion,
            )

        if build_shared:
            _build_libmpv(True)
        if build_static:
            _build_libmpv(False)

        def get_deps():
            res = ""
            for k in ctx.env.keys():
                if k.startswith("LIB_") and k != "LIB_ST":
                    res += " ".join(["-l" + x for x in ctx.env[k]]) + " "
            return res

        ctx(
            target='libmpv/mpv.pc',
            source='libmpv/mpv.pc.in',
            features='subst',
            PREFIX=ctx.env.PREFIX,
            LIBDIR=ctx.env.LIBDIR,
            INCDIR=ctx.env.INCDIR,
            VERSION=libversion,
            PRIV_LIBS=get_deps(),
        )

        headers = ["client.h", "qthelper.hpp", "opengl_cb.h"]
        for f in headers:
            ctx.install_as(ctx.env.INCDIR + '/mpv/' + f, 'libmpv/' + f)

        ctx.install_as(ctx.env.LIBDIR + '/pkgconfig/mpv.pc', 'libmpv/mpv.pc')

    if ctx.dependency_satisfied("vf-dlopen-filters"):
        dlfilters = "telecine tile rectangle framestep ildetect".split()
        for dlfilter in dlfilters:
            ctx(target=dlfilter,
                source=[
                    'TOOLS/vf_dlopen/' + dlfilter + '.c',
                    'TOOLS/vf_dlopen/filterutils.c'
                ],
                includes=[ctx.srcnode.abspath() + '/video/filter'],
                features='c cshlib',
                install_path=ctx.env.LIBDIR + '/mpv')

    if ctx.dependency_satisfied('manpage-build'):
        _build_man(ctx)

    if ctx.dependency_satisfied('pdf-build'):
        _build_pdf(ctx)

    if ctx.dependency_satisfied('cplayer'):

        if ctx.dependency_satisfied('zsh-comp'):
            ctx.zshcomp(target="etc/_mpv")
            ctx.install_files(ctx.env.ZSHDIR, ['etc/_mpv'])

        ctx.install_files(ctx.env.DATADIR + '/applications',
                          ['etc/mpv.desktop'])

        ctx.install_files(ctx.env.CONFDIR, ['etc/encoding-profiles.conf'])

        for size in '16x16 32x32 64x64'.split():
            ctx.install_as(
                ctx.env.DATADIR + '/icons/hicolor/' + size + '/apps/mpv.png',
                'etc/mpv-icon-8bit-' + size + '.png')

        ctx.install_as(
            ctx.env.DATADIR + '/icons/hicolor/scalable/apps/mpv.svg',
            'etc/mpv-gradient.svg')
示例#17
0
    tsk.last_cmd = lst = []
    lst.extend(to_list(env.FLEX))
    lst.extend(to_list(env.FLEXFLAGS))
    inputs = [a.path_from(tsk.get_cwd()) for a in tsk.inputs]
    if env.FLEX_MSYS:
        inputs = [x.replace(os.sep, "/") for x in inputs]
    lst.extend(inputs)
    lst = [x for x in lst if x]
    txt = bld.cmd_and_log(lst, cwd=wd, env=env.env or None, quiet=0)
    tsk.outputs[0].write(txt.replace("\r\n", "\n").replace("\r", "\n"))  # issue #1207


TaskGen.declare_chain(
    name="flex",
    rule=flexfun,  # issue #854
    ext_in=".l",
    decider=decide_ext,
)

# To support the following:
# bld(features='c', flexflags='-P/foo')
Task.classes["flex"].vars = ["FLEXFLAGS", "FLEX"]
ccroot.USELIB_VARS["c"].add("FLEXFLAGS")
ccroot.USELIB_VARS["cxx"].add("FLEXFLAGS")


def configure(conf):
    """
    Detect the *flex* program
    """
    conf.find_program("flex", var="FLEX")
示例#18
0
文件: lua.py 项目: RunarFreyr/waz
#! /usr/bin/env python
# encoding: utf-8
# WARNING! All changes made to this file will be lost!

from waflib import TaskGen,Utils
TaskGen.declare_chain(name='luac',rule='${LUAC} -s -o ${TGT} ${SRC}',ext_in='.lua',ext_out='.luac',reentrant=False)
def init_lua(self):
	self.default_chmod=Utils.O755
def configure(conf):
	conf.find_program('luac',var='LUAC')

TaskGen.feature('lua')(init_lua)
示例#19
0
#!/usr/bin/env python
# encoding: utf-8
# Bernhard Schuster, 2016

from waflib import TaskGen

TaskGen.declare_chain(
	name = 'gtkbuilder',
	rule = 'gtk-builder-tool validate ${SRC}',
	ext_in = ['.ui','.ui.in'],
	reentrant = False,
	color = 'CYAN',
)
示例#20
0
文件: Build.py 项目: blablack/ams-lv2
	def declare_chain(self, *k, **kw):
		"""
		Wraps :py:func:`waflib.TaskGen.declare_chain` for convenience
		"""
		return TaskGen.declare_chain(*k, **kw)
示例#21
0
文件: lua.py 项目: ldiez/GWNSyM
#! /usr/bin/env python
# encoding: utf-8
# WARNING! All changes made to this file will be lost!

from waflib import TaskGen, Utils
TaskGen.declare_chain(name='luac',
                      rule='${LUAC} -s -o ${TGT} ${SRC}',
                      ext_in='.lua',
                      ext_out='.luac',
                      reentrant=False)


def init_lua(self):
    self.default_chmod = Utils.O755


def configure(conf):
    conf.find_program('luac', var='LUAC')


TaskGen.feature('lua')(init_lua)
示例#22
0
def build(ctx):
    ctx.load('waf_customizations')
    ctx.load('generators.sources')

    ctx(
        features="file2string",
        source="TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icns",
        target=
        "generated/TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icns.inc",
    )

    icons = [16, 32, 64, 128]
    for size in icons:
        name = "etc/mpv-icon-8bit-%dx%d.png" % (size, size)
        ctx(
            features="file2string",
            source=name,
            target="generated/%s.inc" % name,
        )

    ctx(
        features="file2string",
        source="etc/input.conf",
        target="generated/etc/input.conf.inc",
    )

    ctx(
        features="file2string",
        source="etc/builtin.conf",
        target="generated/etc/builtin.conf.inc",
    )

    ctx(
        features="file2string",
        source="sub/osd_font.otf",
        target="generated/sub/osd_font.otf.inc",
    )

    lua_files = [
        "defaults.lua", "assdraw.lua", "options.lua", "osc.lua",
        "ytdl_hook.lua", "stats.lua", "console.lua", "auto_profiles.lua"
    ]

    for fn in lua_files:
        fn = "player/lua/" + fn
        ctx(
            features="file2string",
            source=fn,
            target="generated/%s.inc" % fn,
        )

    ctx(
        features="file2string",
        source="player/javascript/defaults.js",
        target="generated/player/javascript/defaults.js.inc",
    )

    if ctx.dependency_satisfied('wayland'):
        ctx.wayland_protocol_code(proto_dir=ctx.env.WL_PROTO_DIR,
                                  protocol="stable/xdg-shell/xdg-shell",
                                  target="generated/wayland/xdg-shell.c")
        ctx.wayland_protocol_header(proto_dir=ctx.env.WL_PROTO_DIR,
                                    protocol="stable/xdg-shell/xdg-shell",
                                    target="generated/wayland/xdg-shell.h")
        ctx.wayland_protocol_code(
            proto_dir=ctx.env.WL_PROTO_DIR,
            protocol="unstable/idle-inhibit/idle-inhibit-unstable-v1",
            target="generated/wayland/idle-inhibit-unstable-v1.c")
        ctx.wayland_protocol_header(
            proto_dir=ctx.env.WL_PROTO_DIR,
            protocol="unstable/idle-inhibit/idle-inhibit-unstable-v1",
            target="generated/wayland/idle-inhibit-unstable-v1.h")
        ctx.wayland_protocol_code(
            proto_dir=ctx.env.WL_PROTO_DIR,
            protocol="stable/presentation-time/presentation-time",
            target="generated/wayland/presentation-time.c")
        ctx.wayland_protocol_header(
            proto_dir=ctx.env.WL_PROTO_DIR,
            protocol="stable/presentation-time/presentation-time",
            target="generated/wayland/presentation-time.h")
        ctx.wayland_protocol_code(
            proto_dir=ctx.env.WL_PROTO_DIR,
            protocol="unstable/xdg-decoration/xdg-decoration-unstable-v1",
            target="generated/wayland/xdg-decoration-unstable-v1.c")
        ctx.wayland_protocol_header(
            proto_dir=ctx.env.WL_PROTO_DIR,
            protocol="unstable/xdg-decoration/xdg-decoration-unstable-v1",
            target="generated/wayland/xdg-decoration-unstable-v1.h")

    ctx(features="ebml_header", target="generated/ebml_types.h")
    ctx(features="ebml_definitions", target="generated/ebml_defs.c")

    def swift(task):
        src = [x.abspath() for x in task.inputs]
        bridge = ctx.path.find_node("osdep/macOS_swift_bridge.h").abspath()
        tgt = task.outputs[0].abspath()
        header = task.outputs[1].abspath()
        module = task.outputs[2].abspath()
        module_name = os.path.basename(module).rsplit(".", 1)[0]

        cmd = [ctx.env.SWIFT]
        cmd.extend(ctx.env.SWIFT_FLAGS)
        cmd.extend([
            "-module-name",
            module_name,
            "-emit-module-path",
            module,
            "-import-objc-header",
            bridge,
            "-emit-objc-header-path",
            header,
            "-o",
            tgt,
        ])
        cmd.extend(src)
        cmd.extend(["-I.", "-I%s" % ctx.srcnode.abspath()])

        return task.exec_command(cmd)

    if ctx.dependency_satisfied('cocoa') and ctx.dependency_satisfied('swift'):
        swift_source = [
            ("osdep/macos/log_helper.swift"),
            ("osdep/macos/libmpv_helper.swift"),
            ("osdep/macos/mpv_helper.swift"),
            ("osdep/macos/swift_extensions.swift"),
            ("osdep/macos/swift_compat.swift"),
            ("osdep/macos/remote_command_center.swift", "macos-media-player"),
            ("video/out/mac/common.swift"),
            ("video/out/mac/view.swift"),
            ("video/out/mac/window.swift"),
            ("video/out/mac/title_bar.swift"),
            ("video/out/cocoa_cb_common.swift", "macos-cocoa-cb"),
            ("video/out/mac/gl_layer.swift", "macos-cocoa-cb"),
        ]

        ctx(
            rule=swift,
            source=ctx.filtered_sources(swift_source),
            target=[
                "osdep/macOS_swift.o", "osdep/macOS_swift.h",
                "osdep/macOS_swift.swiftmodule"
            ],
            before='c',
        )

        ctx.env.append_value('LINKFLAGS', [
            '-Xlinker', '-add_ast_path', '-Xlinker',
            ctx.path.find_or_declare(
                "osdep/macOS_swift.swiftmodule").abspath()
        ])

    if ctx.dependency_satisfied('cplayer'):
        main_fn_c = ctx.pick_first_matching_dep([
            ("osdep/main-fn-cocoa.c", "cocoa"),
            ("osdep/main-fn-unix.c", "posix"),
            ("osdep/main-fn-win.c", "win32-desktop"),
        ])

    getch2_c = ctx.pick_first_matching_dep([
        ("osdep/terminal-unix.c", "posix"),
        ("osdep/terminal-win.c", "win32-desktop"),
        ("osdep/terminal-dummy.c"),
    ])

    timer_c = ctx.pick_first_matching_dep([
        ("osdep/timer-win2.c", "os-win32"),
        ("osdep/timer-darwin.c", "os-darwin"),
        ("osdep/timer-linux.c", "posix"),
    ])

    ipc_c = ctx.pick_first_matching_dep([
        ("input/ipc-unix.c", "posix"),
        ("input/ipc-win.c", "win32-desktop"),
        ("input/ipc-dummy.c"),
    ])

    subprocess_c = ctx.pick_first_matching_dep([
        ("osdep/subprocess-posix.c", "posix"),
        ("osdep/subprocess-win.c", "win32-desktop"),
        ("osdep/subprocess-dummy.c"),
    ])

    sources = [
        ## Audio
        ("audio/aframe.c"),
        ("audio/chmap.c"),
        ("audio/chmap_sel.c"),
        ("audio/decode/ad_lavc.c"),
        ("audio/decode/ad_spdif.c"),
        ("audio/filter/af_drop.c"),
        ("audio/filter/af_format.c"),
        ("audio/filter/af_lavcac3enc.c"),
        ("audio/filter/af_rubberband.c", "rubberband"),
        ("audio/filter/af_scaletempo.c"),
        ("audio/filter/af_scaletempo2.c"),
        ("audio/filter/af_scaletempo2_internals.c"),
        ("audio/fmt-conversion.c"),
        ("audio/format.c"),
        ("audio/out/ao.c"),
        ("audio/out/ao_alsa.c", "alsa"),
        ("audio/out/ao_audiotrack.c", "android"),
        ("audio/out/ao_audiounit.m", "audiounit"),
        ("audio/out/ao_coreaudio.c", "coreaudio"),
        ("audio/out/ao_coreaudio_chmap.c", "coreaudio || audiounit"),
        ("audio/out/ao_coreaudio_exclusive.c", "coreaudio"),
        ("audio/out/ao_coreaudio_properties.c", "coreaudio"),
        ("audio/out/ao_coreaudio_utils.c", "coreaudio || audiounit"),
        ("audio/out/ao_jack.c", "jack"),
        ("audio/out/ao_lavc.c"),
        ("audio/out/ao_null.c"),
        ("audio/out/ao_openal.c", "openal"),
        ("audio/out/ao_opensles.c", "opensles"),
        ("audio/out/ao_oss.c", "oss-audio"),
        ("audio/out/ao_pcm.c"),
        ("audio/out/ao_pulse.c", "pulse"),
        ("audio/out/ao_sdl.c", "sdl2-audio"),
        ("audio/out/ao_wasapi.c", "wasapi"),
        ("audio/out/ao_wasapi_changenotify.c", "wasapi"),
        ("audio/out/ao_wasapi_utils.c", "wasapi"),
        ("audio/out/buffer.c"),

        ## Core
        ("common/av_common.c"),
        ("common/av_log.c"),
        ("common/codecs.c"),
        ("common/common.c"),
        ("common/encode_lavc.c"),
        ("common/msg.c"),
        ("common/playlist.c"),
        ("common/recorder.c"),
        ("common/stats.c"),
        ("common/tags.c"),
        ("common/version.c"),

        ## Demuxers
        ("demux/codec_tags.c"),
        ("demux/cue.c"),
        ("demux/cache.c"),
        ("demux/demux.c"),
        ("demux/demux_cue.c"),
        ("demux/demux_disc.c"),
        ("demux/demux_edl.c"),
        ("demux/demux_lavf.c"),
        ("demux/demux_libarchive.c", "libarchive"),
        ("demux/demux_mf.c"),
        ("demux/demux_mkv.c"),
        ("demux/demux_mkv_timeline.c"),
        ("demux/demux_null.c"),
        ("demux/demux_playlist.c"),
        ("demux/demux_raw.c"),
        ("demux/demux_timeline.c"),
        ("demux/ebml.c"),
        ("demux/packet.c"),
        ("demux/timeline.c"),
        ("filters/f_async_queue.c"),
        ("filters/f_autoconvert.c"),
        ("filters/f_auto_filters.c"),
        ("filters/f_decoder_wrapper.c"),
        ("filters/f_demux_in.c"),
        ("filters/f_hwtransfer.c"),
        ("filters/f_lavfi.c"),
        ("filters/f_output_chain.c"),
        ("filters/f_swresample.c"),
        ("filters/f_swscale.c"),
        ("filters/f_utils.c"),
        ("filters/filter.c"),
        ("filters/frame.c"),
        ("filters/user_filters.c"),

        ## Input
        ("input/cmd.c"),
        ("input/event.c"),
        ("input/input.c"),
        ("input/ipc.c"),
        (ipc_c),
        ("input/keycodes.c"),
        ("input/sdl_gamepad.c", "sdl2-gamepad"),

        ## Misc
        ("misc/bstr.c"),
        ("misc/charset_conv.c"),
        ("misc/dispatch.c"),
        ("misc/jni.c", "android"),
        ("misc/json.c"),
        ("misc/natural_sort.c"),
        ("misc/node.c"),
        ("misc/rendezvous.c"),
        ("misc/thread_pool.c"),
        ("misc/thread_tools.c"),

        ## Options
        ("options/m_config_core.c"),
        ("options/m_config_frontend.c"),
        ("options/m_option.c"),
        ("options/m_property.c"),
        ("options/options.c"),
        ("options/parse_commandline.c"),
        ("options/parse_configfile.c"),
        ("options/path.c"),

        ## Player
        ("player/audio.c"),
        ("player/client.c"),
        ("player/command.c"),
        ("player/configfiles.c"),
        ("player/external_files.c"),
        ("player/javascript.c", "javascript"),
        ("player/loadfile.c"),
        ("player/lua.c", "lua"),
        ("player/main.c"),
        ("player/misc.c"),
        ("player/osd.c"),
        ("player/playloop.c"),
        ("player/screenshot.c"),
        ("player/scripting.c"),
        ("player/sub.c"),
        ("player/video.c"),

        ## Streams
        ("stream/cookies.c"),
        ("stream/dvb_tune.c", "dvbin"),
        ("stream/stream.c"),
        ("stream/stream_avdevice.c"),
        ("stream/stream_bluray.c", "libbluray"),
        ("stream/stream_cb.c"),
        ("stream/stream_cdda.c", "cdda"),
        ("stream/stream_concat.c"),
        ("stream/stream_slice.c"),
        ("stream/stream_dvb.c", "dvbin"),
        ("stream/stream_dvdnav.c", "dvdnav"),
        ("stream/stream_edl.c"),
        ("stream/stream_file.c"),
        ("stream/stream_lavf.c"),
        ("stream/stream_libarchive.c", "libarchive"),
        ("stream/stream_memory.c"),
        ("stream/stream_mf.c"),
        ("stream/stream_null.c"),

        ## Subtitles
        ("sub/ass_mp.c"),
        ("sub/dec_sub.c"),
        ("sub/draw_bmp.c"),
        ("sub/filter_regex.c", "posix"),
        ("sub/filter_jsre.c", "javascript"),
        ("sub/filter_sdh.c"),
        ("sub/img_convert.c"),
        ("sub/lavc_conv.c"),
        ("sub/osd.c"),
        ("sub/osd_libass.c"),
        ("sub/sd_ass.c"),
        ("sub/sd_lavc.c"),

        ## Tests
        ("test/chmap.c", "tests"),
        ("test/gl_video.c", "tests"),
        ("test/img_format.c", "tests"),
        ("test/json.c", "tests"),
        ("test/linked_list.c", "tests"),
        ("test/paths.c", "tests"),
        ("test/repack.c", "tests && zimg"),
        ("test/scale_sws.c", "tests"),
        ("test/scale_test.c", "tests"),
        ("test/scale_zimg.c", "tests && zimg"),
        ("test/tests.c", "tests"),

        ## Video
        ("video/csputils.c"),
        ("video/cuda.c", "cuda-hwaccel"),
        ("video/d3d.c", "d3d-hwaccel"),
        ("video/decode/vd_lavc.c"),
        ("video/filter/refqueue.c"),
        ("video/filter/vf_d3d11vpp.c", "d3d-hwaccel"),
        ("video/filter/vf_fingerprint.c", "zimg"),
        ("video/filter/vf_format.c"),
        ("video/filter/vf_gpu.c", "egl-helpers && gl && egl"),
        ("video/filter/vf_sub.c"),
        ("video/filter/vf_vapoursynth.c", "vapoursynth"),
        ("video/filter/vf_vavpp.c", "vaapi"),
        ("video/filter/vf_vdpaupp.c", "vdpau"),
        ("video/fmt-conversion.c"),
        ("video/hwdec.c"),
        ("video/image_loader.c"),
        ("video/image_writer.c"),
        ("video/img_format.c"),
        ("video/mp_image.c"),
        ("video/mp_image_pool.c"),
        ("video/out/android_common.c", "android"),
        ("video/out/aspect.c"),
        ("video/out/bitmap_packer.c"),
        ("video/out/cocoa/events_view.m", "cocoa"),
        ("video/out/cocoa/video_view.m", "cocoa"),
        ("video/out/cocoa/window.m", "cocoa"),
        ("video/out/cocoa_common.m", "cocoa"),
        ("video/out/d3d11/context.c", "d3d11"),
        ("video/out/d3d11/hwdec_d3d11va.c", "d3d11 && d3d-hwaccel"),
        ("video/out/d3d11/hwdec_dxva2dxgi.c", "d3d11 && d3d9-hwaccel"),
        ("video/out/d3d11/ra_d3d11.c", "d3d11"),
        ("video/out/dither.c"),
        ("video/out/dr_helper.c"),
        ("video/out/drm_atomic.c", "drm"),
        ("video/out/drm_common.c", "drm"),
        ("video/out/drm_prime.c", "drm"),
        ("video/out/filter_kernels.c"),
        ("video/out/gpu/context.c"),
        ("video/out/gpu/d3d11_helpers.c", "d3d11 || egl-angle-win32"),
        ("video/out/gpu/error_diffusion.c"),
        ("video/out/gpu/hwdec.c"),
        ("video/out/gpu/lcms.c"),
        ("video/out/gpu/libmpv_gpu.c"),
        ("video/out/gpu/osd.c"),
        ("video/out/gpu/ra.c"),
        ("video/out/gpu/shader_cache.c"),
        ("video/out/gpu/spirv.c"),
        ("video/out/gpu/spirv_shaderc.c", "shaderc"),
        ("video/out/gpu/user_shaders.c"),
        ("video/out/gpu/utils.c"),
        ("video/out/gpu/video.c"),
        ("video/out/gpu/video_shaders.c"),
        ("video/out/hwdec/hwdec_cuda.c", "cuda-interop"),
        ("video/out/hwdec/hwdec_cuda_gl.c", "cuda-interop && gl"),
        ("video/out/hwdec/hwdec_cuda_vk.c", "cuda-interop && vulkan"),
        ("video/out/hwdec/hwdec_vaapi.c", "vaapi-egl || vaapi-vulkan"),
        ("video/out/hwdec/hwdec_vaapi_gl.c", "vaapi-egl"),
        ("video/out/hwdec/hwdec_vaapi_vk.c", "vaapi-vulkan"),
        ("video/out/libmpv_sw.c"),
        ("video/out/placebo/ra_pl.c", "libplacebo"),
        ("video/out/placebo/utils.c", "libplacebo"),
        ("video/out/opengl/angle_dynamic.c", "egl-angle"),
        ("video/out/opengl/common.c", "gl"),
        ("video/out/opengl/context.c", "gl"),
        ("video/out/opengl/context_android.c", "egl-android"),
        ("video/out/opengl/context_angle.c", "egl-angle-win32"),
        ("video/out/opengl/context_cocoa.c", "gl-cocoa"),
        ("video/out/opengl/context_drm_egl.c", "egl-drm"),
        ("video/out/opengl/context_dxinterop.c", "gl-dxinterop"),
        ("video/out/opengl/context_glx.c", "gl-x11"),
        ("video/out/opengl/context_rpi.c", "rpi"),
        ("video/out/opengl/context_wayland.c", "gl-wayland"),
        ("video/out/opengl/context_win.c", "gl-win32"),
        ("video/out/opengl/context_x11egl.c", "egl-x11"),
        ("video/out/opengl/egl_helpers.c", "egl-helpers"),
        ("video/out/opengl/formats.c", "gl"),
        ("video/out/opengl/hwdec_d3d11egl.c", "d3d-hwaccel && egl-angle"),
        ("video/out/opengl/hwdec_drmprime_drm.c", "drm"),
        ("video/out/opengl/hwdec_dxva2egl.c", "d3d9-hwaccel && egl-angle"),
        ("video/out/opengl/hwdec_dxva2gldx.c", "gl-dxinterop-d3d9"),
        ("video/out/opengl/hwdec_ios.m", "ios-gl"),
        ("video/out/opengl/hwdec_osx.c", "videotoolbox-gl"),
        ("video/out/opengl/hwdec_rpi.c", "rpi-mmal"),
        ("video/out/opengl/hwdec_vdpau.c", "vdpau-gl-x11"),
        ("video/out/opengl/libmpv_gl.c", "gl"),
        ("video/out/opengl/oml_sync.c", "egl-x11 || gl-x11"),
        ("video/out/opengl/ra_gl.c", "gl"),
        ("video/out/opengl/utils.c", "gl"),
        ("video/out/vo.c"),
        ("video/out/vo_caca.c", "caca"),
        ("video/out/vo_direct3d.c", "direct3d"),
        ("video/out/vo_drm.c", "drm"),
        ("video/out/vo_gpu.c"),
        ("video/out/vo_image.c"),
        ("video/out/vo_lavc.c"),
        ("video/out/vo_libmpv.c"),
        ("video/out/vo_mediacodec_embed.c", "android"),
        ("video/out/vo_null.c"),
        ("video/out/vo_rpi.c", "rpi-mmal"),
        ("video/out/vo_sdl.c", "sdl2-video"),
        ("video/out/vo_sixel.c", "sixel"),
        ("video/out/vo_tct.c"),
        ("video/out/vo_vaapi.c", "vaapi-x11 && gpl"),
        ("video/out/vo_vdpau.c", "vdpau"),
        ("video/out/vo_wlshm.c", "wayland && memfd_create"),
        ("video/out/vo_x11.c", "x11"),
        ("video/out/vo_xv.c", "xv"),
        ("video/out/vulkan/context.c", "vulkan"),
        ("video/out/vulkan/context_display.c", "vulkan"),
        ("video/out/vulkan/context_android.c", "vulkan && android"),
        ("video/out/vulkan/context_wayland.c", "vulkan && wayland"),
        ("video/out/vulkan/context_win.c", "vulkan && win32-desktop"),
        ("video/out/vulkan/context_xlib.c", "vulkan && x11"),
        ("video/out/vulkan/utils.c", "vulkan"),
        ("video/out/w32_common.c", "win32-desktop"),
        ("generated/wayland/idle-inhibit-unstable-v1.c", "wayland"),
        ("generated/wayland/presentation-time.c", "wayland"),
        ("generated/wayland/xdg-decoration-unstable-v1.c", "wayland"),
        ("generated/wayland/xdg-shell.c", "wayland"),
        ("video/out/wayland_common.c", "wayland"),
        ("video/out/win32/displayconfig.c", "win32-desktop"),
        ("video/out/win32/droptarget.c", "win32-desktop"),
        ("video/out/win_state.c"),
        ("video/out/x11_common.c", "x11"),
        ("video/repack.c"),
        ("video/sws_utils.c"),
        ("video/zimg.c", "zimg"),
        ("video/vaapi.c", "vaapi"),
        ("video/vdpau.c", "vdpau"),
        ("video/vdpau_mixer.c", "vdpau"),

        ## osdep
        (getch2_c),
        ("osdep/io.c"),
        ("osdep/threads.c"),
        ("osdep/timer.c"),
        (timer_c),
        ("osdep/polldev.c", "posix"),
        ("osdep/android/strnlen.c", "android"),
        ("osdep/glob-win.c", "glob-win32"),
        ("osdep/macosx_application.m", "cocoa"),
        ("osdep/macosx_events.m", "cocoa"),
        ("osdep/macosx_menubar.m", "cocoa"),
        ("osdep/macosx_touchbar.m", "macos-touchbar"),
        ("osdep/mpv.rc", "win32-executable"),
        ("osdep/path-macosx.m", "cocoa"),
        ("osdep/path-unix.c"),
        ("osdep/path-uwp.c", "uwp"),
        ("osdep/path-win.c", "win32-desktop"),
        ("osdep/semaphore_osx.c"),
        ("osdep/subprocess.c"),
        (subprocess_c),
        ("osdep/w32_keyboard.c", "os-cygwin"),
        ("osdep/w32_keyboard.c", "os-win32"),
        ("osdep/win32/pthread.c", "win32-internal-pthreads"),
        ("osdep/windows_utils.c", "os-cygwin"),
        ("osdep/windows_utils.c", "os-win32"),

        ## tree_allocator
        "ta/ta.c",
        "ta/ta_talloc.c",
        "ta/ta_utils.c"
    ]

    if ctx.dependency_satisfied('win32-executable'):
        from waflib import TaskGen

        TaskGen.declare_chain(name='windres',
                              rule='${WINDRES} ${WINDRES_FLAGS} ${SRC} ${TGT}',
                              ext_in='.rc',
                              ext_out='-rc.o',
                              color='PINK')

        ctx.env.WINDRES_FLAGS = [
            '--include-dir={0}'.format(ctx.bldnode.abspath()),
            '--include-dir={0}'.format(ctx.srcnode.abspath()),
            '--codepage=65001'  # Unicode codepage
        ]

        for node in 'osdep/mpv.exe.manifest etc/mpv-icon.ico'.split():
            ctx.add_manual_dependency(ctx.path.find_node('osdep/mpv.rc'),
                                      ctx.path.find_node(node))

        version = ctx.bldnode.find_node('generated/version.h')
        if version:
            ctx.add_manual_dependency(ctx.path.find_node('osdep/mpv.rc'),
                                      version)

    if ctx.dependency_satisfied('cplayer'):
        ctx(
            target="objects",
            source=ctx.filtered_sources(sources),
            use=ctx.dependencies_use(),
            includes=_all_includes(ctx),
            features="c",
        )

    syms = False
    if ctx.dependency_satisfied('cplugins'):
        syms = True
        ctx.load("syms")

    additional_objects = []
    if ctx.dependency_satisfied('swift'):
        additional_objects.append("osdep/macOS_swift.o")

    if ctx.dependency_satisfied('cplayer'):
        ctx(
            target="mpv",
            source=main_fn_c,
            use=ctx.dependencies_use() + ['objects'],
            add_objects=additional_objects,
            includes=_all_includes(ctx),
            features="c cprogram" + (" syms" if syms else ""),
            export_symbols_def="libmpv/mpv.def",  # for syms=True
            install_path=ctx.env.BINDIR)
        for f in ['mpv.conf', 'input.conf', 'mplayer-input.conf', \
                  'restore-old-bindings.conf']:
            ctx.install_as(os.path.join(ctx.env.DOCDIR, f),
                           os.path.join('etc/', f))

        if ctx.env.DEST_OS == 'win32':
            wrapctx = ctx(target="mpv",
                          source=['osdep/win32-console-wrapper.c'],
                          features="c cprogram",
                          install_path=ctx.env.BINDIR)

            wrapctx.env.cprogram_PATTERN = "%s.com"
            wrapflags = ['-municode', '-Wl,--subsystem,console']
            wrapctx.env.CFLAGS = ctx.env.CFLAGS + wrapflags
            wrapctx.env.LAST_LINKFLAGS = ctx.env.LAST_LINKFLAGS + wrapflags

    build_shared = ctx.dependency_satisfied('libmpv-shared')
    build_static = ctx.dependency_satisfied('libmpv-static')
    if build_shared or build_static:
        if build_shared:
            waftoolsdir = os.path.join(os.path.dirname(__file__), "waftools")
            ctx.load("syms", tooldir=waftoolsdir)
        vre = '#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION\((.*), (.*)\)'
        libmpv_header = ctx.path.find_node("libmpv/client.h").read()
        major, minor = re.search(vre, libmpv_header).groups()
        libversion = major + '.' + minor + '.0'

        def _build_libmpv(shared):
            features = "c "
            if shared:
                features += "cshlib syms"
            else:
                features += "cstlib"

            libmpv_kwargs = {
                "target": "mpv",
                "source":   ctx.filtered_sources(sources),
                "use":      ctx.dependencies_use(),
                "add_objects": additional_objects,
                "includes": [ctx.bldnode.abspath(), ctx.srcnode.abspath()] + \
                             ctx.dependencies_includes(),
                "features": features,
                "export_symbols_def": "libmpv/mpv.def",
                "install_path": ctx.env.LIBDIR,
                "install_path_implib": ctx.env.LIBDIR,
            }

            if shared and ctx.dependency_satisfied('android'):
                # for Android we just add the linker flag without version
                # as we still need the SONAME for proper linkage.
                # (LINKFLAGS logic taken from waf's apply_vnum in ccroot.py)
                v = ctx.env.SONAME_ST % 'libmpv.so'
                ctx.env.append_value('LINKFLAGS', v.split())
            else:
                # for all other configurations we want SONAME to be used
                libmpv_kwargs["vnum"] = libversion

            if shared and ctx.env.DEST_OS == 'win32':
                libmpv_kwargs["install_path"] = ctx.env.BINDIR

            ctx(**libmpv_kwargs)

        if build_shared:
            _build_libmpv(True)
        if build_static:
            _build_libmpv(False)

        def get_deps():
            res = []
            for k in ctx.env.keys():
                if (k.startswith("LIB_") and k != "LIB_ST") \
                or (k.startswith("STLIB_") and k != "STLIB_ST" and k != "STLIB_MARKER"):
                    for l in ctx.env[k]:
                        if l in res:
                            res.remove(l)
                        res.append(l)
            return " ".join(["-l" + l for l in res])

        ctx(
            target='libmpv/mpv.pc',
            source='libmpv/mpv.pc.in',
            features='subst',
            PREFIX=ctx.env.PREFIX,
            LIBDIR=ctx.env.LIBDIR,
            INCDIR=ctx.env.INCLUDEDIR,
            VERSION=libversion,
            PRIV_LIBS=get_deps(),
        )

        headers = [
            "client.h", "opengl_cb.h", "render.h", "render_gl.h", "stream_cb.h"
        ]
        for f in headers:
            ctx.install_as(ctx.env.INCLUDEDIR + '/mpv/' + f, 'libmpv/' + f)

        ctx.install_as(ctx.env.LIBDIR + '/pkgconfig/mpv.pc', 'libmpv/mpv.pc')

    if ctx.dependency_satisfied('html-build'):
        _build_html(ctx)

    if ctx.dependency_satisfied('manpage-build'):
        _build_man(ctx)

    if ctx.dependency_satisfied('pdf-build'):
        _build_pdf(ctx)

    if ctx.dependency_satisfied('cplayer'):

        if ctx.env.ZSHDIR:
            ctx.install_as(ctx.env.ZSHDIR + '/_mpv', 'etc/_mpv.zsh')

        if ctx.env.BASHDIR:
            ctx.install_as(ctx.env.BASHDIR + '/mpv', 'etc/mpv.bash-completion')

        ctx.install_files(ctx.env.DATADIR + '/applications',
                          ['etc/mpv.desktop'])

        ctx.install_files(ctx.env.CONFDIR, ['etc/encoding-profiles.conf'])

        for size in '16x16 32x32 64x64 128x128'.split():
            ctx.install_as(
                ctx.env.DATADIR + '/icons/hicolor/' + size + '/apps/mpv.png',
                'etc/mpv-icon-8bit-' + size + '.png')

        ctx.install_as(
            ctx.env.DATADIR + '/icons/hicolor/scalable/apps/mpv.svg',
            'etc/mpv-gradient.svg')

        ctx.install_files(ctx.env.DATADIR + '/icons/hicolor/symbolic/apps',
                          ['etc/mpv-symbolic.svg'])
示例#23
0

def proc(tsk):
    env = tsk.env
    gen = tsk.generator
    inc_nodes = gen.to_incnodes(
        Utils.to_list(getattr(gen, 'includes', [])) + env['INCLUDES'])

    cmd = ([env.PROC] + ['SQLCHECK=SEMANTICS'] +
           (['SYS_INCLUDE=(' + ','.join(env.PROC_INCLUDES) +
             ')'] if env.PROC_INCLUDES else []) +
           ['INCLUDE=(' + ','.join([i.bldpath() for i in inc_nodes]) + ')'] +
           ['userid=' + env.PROC_CONNECTION] +
           ['INAME=' + tsk.inputs[0].bldpath()] +
           ['ONAME=' + tsk.outputs[0].bldpath()])
    exec_env = {
        'ORACLE_HOME': env.PROC_ORACLE,
        'LD_LIBRARY_PATH': env.PROC_ORACLE + path.sep + 'lib',
    }
    if env.PROC_TNS_ADMIN:
        exec_env['TNS_ADMIN'] = env.PROC_TNS_ADMIN
    return tsk.exec_command(cmd, env=exec_env)


TaskGen.declare_chain(
    name='proc',
    rule=proc,
    ext_in='.pc',
    ext_out='.c',
)
示例#24
0
文件: modelsim.py 项目: hoangt/brick
#        scan         = verilog_scanner_task,
#)

#TaskGen.declare_chain(
#        rule         = '${MODEL_VLOG} -l ${VLOG_LOGFILE} ${VLOG_V_OPTIONS} -work ${WORKLIB} ${VERILOG_INC_DIRS} ${SRC} && echo "${TGT}" > ${TGT}',
#        ext_in       = ['.v' ],
#        ext_out      = ['.v.out' ],
#        reentrant    = False,
#        scan         = scan_verilog_task,
#		after        = 'vlibTask',
#)

TaskGen.declare_chain(
		rule         = '${MODEL_VLOG} -l ${VLOG_LOGFILE} ${VLOG_V_OPTIONS} -work ${gen.WORKLIB.abspath()} ${VERILOG_INC_DIRS} ${SRC} && echo "${TGT}" > ${TGT}',
        ext_in       = ['.lib.src' ],
        ext_out      = ['.lib.src.out' ],
        reentrant    = False,
        scan         = scan_verilog_task,
		after        = 'vlibTask',
)

TaskGen.declare_chain(
        rule         = '${MODEL_VLOG} -l ${VLOG_LOGFILE} ${VLOG_V_OPTIONS} -work ${gen.WORKLIB.abspath()} ${VERILOG_INC_DIRS} ${SRC} && echo "${TGT}" > ${TGT}',
        ext_in       = ['.vp', ],
        ext_out      = ['.vp.out', ],
        reentrant    = False,
        scan         = scan_verilog_task,
		after        = 'vlibTask',
)

TaskGen.declare_chain(
        rule         = '${MODEL_VCOM} -l ${gen.get_logdir_node().make_node(gen.env.VCOM_LOGFILE).abspath()+gen.name} ${VCOM_OPTIONS} -work ${gen.WORKLIB.abspath()} ${SRC}',
示例#25
0
	if conf.env.CDS_MIXED_SIGNAL:
		conf.env.NCELAB_OPTIONS.extend(['-discipline', 'logic'])
	if not conf.env.NCSIM_OPTIONS:
		conf.env.NCSIM_OPTIONS = ['-64bit','-gui']


	conf.find_program('ncsim',var='CDS_NCSIM')
	conf.find_program('ncelab',var='CDS_NCELAB')
	conf.find_program('ncvlog',var='CDS_NCVLOG')
	conf.find_program('ncvhdl',var='CDS_NCVHDL')


TaskGen.declare_chain(
        rule         = '${CDS_NCVLOG} -cdslib ${CDS_LIB_PATH} -hdlvar ${CDS_HDLVAR_PATH} -logfile ${gen.get_logdir_node().abspath()+env.NCVLOG_LOGFILE+gen.name} ${NCVLOG_OPTIONS} -work ${WORKLIB} ${VERILOG_INC_DIRS} ${SRC} && echo "${TGT}" > ${TGT}',
        ext_in       = [ '.lib.src',],
        ext_out      = [ '.lib.src.out',],
        reentrant    = False,
        scan         = scan_verilog_task
)
TaskGen.declare_chain(
        rule         = '${CDS_NCVLOG} -cdslib ${CDS_LIB_PATH} -hdlvar ${CDS_HDLVAR_PATH} -logfile ${gen.get_logdir_node().abspath()+env.NCVLOG_LOGFILE+gen.name} ${NCVLOG_OPTIONS} -work ${WORKLIB} ${VERILOG_INC_DIRS} ${SRC} && echo "${TGT}" > ${TGT}',
        ext_in       = [ '.vp', ],
        ext_out      = [ '.vp.out', ],
        reentrant    = False,
        scan         = scan_verilog_task
)
TaskGen.declare_chain(
        rule         = '${CDS_NCVHDL} -cdslib ${CDS_LIB_PATH} -hdlvar ${CDS_HDLVAR_PATH} -logfile ${gen.get_logdir_node().abspath()+env.NCVHDL_LOGFILE+gen.name} ${NCVHDL_OPTIONS} -work ${WORKLIB} ${SRC}',
        ext_in       = ['.vhd'],
        scan         = vhdl_scanner,
        reentrant    = False,
示例#26
0
文件: flex.py 项目: afeldman/waf
			return [xx]
		return xx
	tsk.last_cmd = lst = []
	lst.extend(to_list(env.FLEX))
	lst.extend(to_list(env.FLEXFLAGS))
	inputs = [a.path_from(tsk.get_cwd()) for a in tsk.inputs]
	if env.FLEX_MSYS:
		inputs = [x.replace(os.sep, '/') for x in inputs]
	lst.extend(inputs)
	lst = [x for x in lst if x]
	txt = bld.cmd_and_log(lst, cwd=wd, env=env.env or None, quiet=0)
	tsk.outputs[0].write(txt.replace('\r\n', '\n').replace('\r', '\n')) # issue #1207

TaskGen.declare_chain(
	name = 'flex',
	rule = flexfun, # issue #854
	ext_in = '.l',
	decider = decide_ext,
)

# To support the following:
# bld(features='c', flexflags='-P/foo')
Task.classes['flex'].vars = ['FLEXFLAGS', 'FLEX']
ccroot.USELIB_VARS['c'].add('FLEXFLAGS')
ccroot.USELIB_VARS['cxx'].add('FLEXFLAGS')

def configure(conf):
	"""
	Detect the *flex* program
	"""
	conf.find_program('flex', var='FLEX')
	conf.env.FLEXFLAGS = ['-t']
示例#27
0
文件: flex.py 项目: solarblue/waf
			return [xx]
		return xx
	tsk.last_cmd = lst = []
	lst.extend(to_list(env.FLEX))
	lst.extend(to_list(env.FLEXFLAGS))
	inputs = [a.path_from(tsk.get_cwd()) for a in tsk.inputs]
	if env.FLEX_MSYS:
		inputs = [x.replace(os.sep, '/') for x in inputs]
	lst.extend(inputs)
	lst = [x for x in lst if x]
	txt = bld.cmd_and_log(lst, cwd=wd, env=env.env or None, quiet=0)
	tsk.outputs[0].write(txt.replace('\r\n', '\n').replace('\r', '\n')) # issue #1207

TaskGen.declare_chain(
	name = 'flex',
	rule = flexfun, # issue #854
	ext_in = '.l',
	decider = decide_ext,
)

# To support the following:
# bld(features='c', flexflags='-P/foo')
Task.classes['flex'].vars = ['FLEXFLAGS', 'FLEX']
ccroot.USELIB_VARS['c'].add('FLEXFLAGS')
ccroot.USELIB_VARS['cxx'].add('FLEXFLAGS')

def configure(conf):
	"""
	Detect the *flex* program
	"""
	conf.find_program('flex', var='FLEX')
	conf.env.FLEXFLAGS = ['-t']
示例#28
0
	# FIXME the if-else construct will not work in python 2
	cmd = (
		[env.PROC] +
		['SQLCHECK=SEMANTICS'] +
		(['SYS_INCLUDE=(' + ','.join(env.PROC_INCLUDES) + ')']
			if env.PROC_INCLUDES else []) +
		['INCLUDE=(' + ','.join(
			[i.bldpath() for i in inc_nodes]
		) + ')'] +
		['userid=' + env.PROC_CONNECTION] +
		['INAME=' + tsk.inputs[0].bldpath()] +
		['ONAME=' + tsk.outputs[0].bldpath()]
	)
	exec_env = {
		'ORACLE_HOME': env.PROC_ORACLE,
		'LD_LIBRARY_PATH': env.PROC_ORACLE + path.sep + 'lib',
	}
	if env.PROC_TNS_ADMIN:
		exec_env['TNS_ADMIN'] = env.PROC_TNS_ADMIN
	return tsk.exec_command(cmd, env=exec_env)

TaskGen.declare_chain(
	name = 'proc',
	rule = proc,
	ext_in = '.pc',
	ext_out = '.c',
	reentrant = True,
)

示例#29
0
            #includes = '.',
            #source   = cpp_src,
            #**kw)

def cxxtest_generate_suite(tsk):
    pathparts = tsk.inputs[0].abspath().split('/')
    testIdx = (pathparts[::-1].index('test') + 1) * -1
    nameparts = '/'.join(pathparts[testIdx:])
    # adding the --include flag with the relative path to the test suite is
    # required for waf to properly generate the dependency tree, otherwise it
    # misses the dependency on the hpp file
    tsk.exec_command('%s %s -o %s %s --include=%s' % (tsk.env['CXXTESTGEN'][0],
                                                     ' '.join(tsk.env['CXXTESTFLAGS_suite']),
                                                     tsk.outputs[0].abspath(),
                                                     tsk.inputs[0].abspath(),
                                                     nameparts))

def cxxtest_generate_runner(tsk):
    tsk.exec_command('%s %s -o %s' % (tsk.env['CXXTESTGEN'][0],
                                      ' '.join(tsk.env['CXXTESTFLAGS_runner']),
                                      tsk.outputs[0].abspath()))

# Create a task generator that can make test suites
TaskGen.declare_chain(
    name      = 'cxxtest-gen',
    rule      = cxxtest_generate_suite,
    shell     = False,
    reentrant = False,
    ext_out   = 'Test.cpp',
    ext_in    = 'Test.hpp')
示例#30
0
文件: proc.py 项目: pbx/kupfer
    bld = gen.bld
    inc_nodes = gen.to_incnodes(Utils.to_list(getattr(gen, 'includes', [])) + env['INCLUDES'])

    # FIXME the if-else construct will not work in python 2
    cmd = (
        [env.PROC] +
        ['SQLCHECK=SEMANTICS'] +
        (['SYS_INCLUDE=(' + ','.join(env.PROC_INCLUDES) + ')']
            if env.PROC_INCLUDES else []) +
        ['INCLUDE=(' + ','.join(
            [i.bldpath() for i in inc_nodes]
        ) + ')'] +
        ['userid=' + env.PROC_CONNECTION] +
        ['INAME=' + tsk.inputs[0].bldpath()] +
        ['ONAME=' + tsk.outputs[0].bldpath()]
    )
    exec_env = {
        'ORACLE_HOME': env.PROC_ORACLE,
        'LD_LIBRARY_PATH': env.PROC_ORACLE + path.sep + 'lib',
    }
    if env.PROC_TNS_ADMIN:
        exec_env['TNS_ADMIN'] = env.PROC_TNS_ADMIN
    return tsk.exec_command(cmd, env=exec_env)

TaskGen.declare_chain(
    name='proc',
    rule=proc,
    ext_in='.pc',
    ext_out='.c',
)
示例#31
0
#!/usr/bin/env python
# encoding: utf-8
# Ali Sabil, 2007

from waflib import TaskGen

TaskGen.declare_chain(
    name='gob2',
    rule='${GOB2} -o ${TGT[0].bld_dir()} ${GOB2FLAGS} ${SRC}',
    ext_in='.gob',
    ext_out='.cc .h')


def configure(conf):
    conf.find_program('gob2', var='GOB2')
    conf.env['GOB2FLAGS'] = ''
示例#32
0
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2010 (ita)

"""
Erlang support
"""

from waflib import TaskGen

TaskGen.declare_chain(name = 'erlc',
	rule      = '${ERLC} ${ERLC_FLAGS} ${SRC[0].abspath()} -o ${TGT[0].name}',
	reentrant = False,
	ext_in    = '.erl',
	ext_out   = '.beam')

def configure(conf):
	conf.find_program('erlc', var='ERLC')
	conf.env.ERLC_FLAGS = []

	def declare_chain(self, *k, **kw):
		"""
		Wrapper for :py:func:`waflib.TaskGen.declare_chain` provided for convenience
		"""
		return TaskGen.declare_chain(*k, **kw)
示例#34
0
def build(ctx):
    ctx.load("waf_customizations")
    ctx.load("generators.sources")

    ctx.file2string(source="video/out/x11_icon.bin", target="video/out/x11_icon.inc")

    ctx.file2string(source="etc/input.conf", target="input/input_conf.h")

    ctx.file2string(source="video/out/gl_video_shaders.glsl", target="video/out/gl_video_shaders.h")

    ctx.file2string(source="sub/osd_font.otf", target="sub/osd_font.h")

    ctx.file2string(source="player/lua/defaults.lua", target="player/lua/defaults.inc")

    ctx.file2string(source="player/lua/assdraw.lua", target="player/lua/assdraw.inc")

    ctx.file2string(source="player/lua/osc.lua", target="player/lua/osc.inc")

    ctx.matroska_header(source="demux/ebml.c demux/demux_mkv.c", target="ebml_types.h")

    ctx.matroska_definitions(source="demux/ebml.c", target="ebml_defs.c")

    getch2_c = {"win32": "osdep/terminal-win.c"}.get(ctx.env.DEST_OS, "osdep/terminal-unix.c")

    timer_c = {"win32": "osdep/timer-win2.c", "darwin": "osdep/timer-darwin.c"}.get(
        ctx.env.DEST_OS, "osdep/timer-linux.c"
    )

    sources = [
        ## Audio
        ("audio/audio.c"),
        ("audio/audio_buffer.c"),
        ("audio/chmap.c"),
        ("audio/chmap_sel.c"),
        ("audio/fmt-conversion.c"),
        ("audio/format.c"),
        ("audio/mixer.c"),
        ("audio/reorder_ch.c"),
        ("audio/decode/ad_lavc.c"),
        ("audio/decode/ad_mpg123.c", "mpg123"),
        ("audio/decode/ad_spdif.c"),
        ("audio/decode/dec_audio.c"),
        ("audio/filter/af.c"),
        ("audio/filter/af_bs2b.c", "libbs2b"),
        ("audio/filter/af_center.c"),
        ("audio/filter/af_channels.c"),
        ("audio/filter/af_convert24.c"),
        ("audio/filter/af_convertsignendian.c"),
        ("audio/filter/af_delay.c"),
        ("audio/filter/af_drc.c"),
        ("audio/filter/af_dummy.c"),
        ("audio/filter/af_equalizer.c"),
        ("audio/filter/af_export.c", "sys-mman-h"),
        ("audio/filter/af_extrastereo.c"),
        ("audio/filter/af_format.c"),
        ("audio/filter/af_hrtf.c"),
        ("audio/filter/af_karaoke.c"),
        ("audio/filter/af_ladspa.c", "ladspa"),
        ("audio/filter/af_lavcac3enc.c"),
        ("audio/filter/af_lavfi.c", "af-lavfi"),
        ("audio/filter/af_lavrresample.c"),
        ("audio/filter/af_pan.c"),
        ("audio/filter/af_scaletempo.c"),
        ("audio/filter/af_sinesuppress.c"),
        ("audio/filter/af_sub.c"),
        ("audio/filter/af_surround.c"),
        ("audio/filter/af_sweep.c"),
        ("audio/filter/af_volume.c"),
        ("audio/filter/filter.c"),
        ("audio/filter/tools.c"),
        ("audio/filter/window.c"),
        ("audio/out/ao.c"),
        ("audio/out/ao_alsa.c", "alsa"),
        ("audio/out/ao_coreaudio.c", "coreaudio"),
        ("audio/out/ao_coreaudio_properties.c", "coreaudio"),
        ("audio/out/ao_coreaudio_utils.c", "coreaudio"),
        ("audio/out/ao_dsound.c", "dsound"),
        ("audio/out/ao_jack.c", "jack"),
        ("audio/out/ao_lavc.c", "encoding"),
        ("audio/out/ao_null.c"),
        ("audio/out/ao_openal.c", "openal"),
        ("audio/out/ao_oss.c", "oss-audio"),
        ("audio/out/ao_pcm.c"),
        ("audio/out/ao_portaudio.c", "portaudio"),
        ("audio/out/ao_pulse.c", "pulse"),
        ("audio/out/ao_rsound.c", "rsound"),
        ("audio/out/ao_sdl.c", "sdl"),
        ("audio/out/ao_sdl.c", "sdl2"),
        ("audio/out/ao_sndio.c", "sndio"),
        ("audio/out/ao_wasapi.c", "wasapi"),
        ## Bstr
        ("bstr/bstr.c"),
        ## Core
        ("common/asxparser.c"),
        ("common/av_common.c"),
        ("common/av_log.c"),
        ("common/av_opts.c"),
        ("common/codecs.c"),
        ("common/cpudetect.c"),
        ("common/encode_lavc.c", "encoding"),
        ("common/common.c"),
        ("common/msg.c"),
        ("common/playlist.c"),
        ("common/playlist_parser.c"),
        ("common/version.c"),
        ## Demuxers
        ("demux/codec_tags.c"),
        ("demux/demux.c"),
        ("demux/demux_cue.c"),
        ("demux/demux_edl.c"),
        ("demux/demux_lavf.c"),
        ("demux/demux_libass.c", "libass"),
        ("demux/demux_mf.c"),
        ("demux/demux_mkv.c"),
        ("demux/demux_playlist.c"),
        ("demux/demux_raw.c"),
        ("demux/demux_subreader.c"),
        ("demux/ebml.c"),
        ("demux/mf.c"),
        ## Input
        ("input/cmd_list.c"),
        ("input/cmd_parse.c"),
        ("input/input.c"),
        ("input/keycodes.c"),
        ("input/joystick.c", "joystick"),
        ("input/lirc.c", "lirc"),
        ## Misc
        ("misc/ring.c"),
        ("misc/charset_conv.c"),
        ## Options
        ("options/m_config.c"),
        ("options/m_option.c"),
        ("options/m_property.c"),
        ("options/options.c"),
        ("options/parse_commandline.c"),
        ("options/parse_configfile.c"),
        ("options/path.c"),
        ## Player
        ("player/audio.c"),
        ("player/command.c"),
        ("player/configfiles.c"),
        ("player/dvdnav.c"),
        ("player/loadfile.c"),
        ("player/main.c"),
        ("player/misc.c"),
        ("player/lua.c", "lua"),
        ("player/osd.c"),
        ("player/playloop.c"),
        ("player/screenshot.c"),
        ("player/sub.c"),
        ("player/timeline/tl_cue.c"),
        ("player/timeline/tl_mpv_edl.c"),
        ("player/timeline/tl_matroska.c"),
        ("player/video.c"),
        ## Streams
        ("stream/ai_alsa1x.c", "alsa"),
        ("stream/ai_oss.c", "oss-audio"),
        ("stream/ai_sndio.c", "sndio"),
        ("stream/audio_in.c", "audio-input"),
        ("stream/cache.c"),
        ("stream/cdinfo.c", "cdda"),
        ("stream/cookies.c"),
        ("stream/dvb_tune.c", "dvbin"),
        ("stream/frequencies.c", "tv"),
        ("stream/rar.c"),
        ("stream/stream.c"),
        ("stream/stream_avdevice.c"),
        ("stream/stream_bluray.c", "libbluray"),
        ("stream/stream_cdda.c", "cdda"),
        ("stream/stream_dvb.c", "dvbin"),
        ("stream/stream_dvd.c", "dvdread"),
        ("stream/stream_dvd_common.c", "dvdread"),
        ("stream/stream_dvdnav.c", "dvdnav"),
        ("stream/stream_edl.c"),
        ("stream/stream_file.c"),
        ("stream/stream_lavf.c"),
        ("stream/stream_memory.c"),
        ("stream/stream_mf.c"),
        ("stream/stream_null.c"),
        ("stream/stream_pvr.c", "pvr"),
        ("stream/stream_radio.c", "radio"),
        ("stream/stream_rar.c"),
        ("stream/stream_smb.c", "libsmbclient"),
        ("stream/stream_tv.c", "tv"),
        ("stream/stream_vcd.c", "vcd"),
        ("stream/tv.c", "tv"),
        ("stream/tvi_dummy.c", "tv"),
        ("stream/tvi_v4l2.c", "tv-v4l2"),
        ("stream/resolve/resolve_quvi.c", "libquvi4"),
        ("stream/resolve/resolve_quvi9.c", "libquvi9"),
        ## Subtitles
        ("sub/ass_mp.c", "libass"),
        ("sub/dec_sub.c"),
        ("sub/draw_bmp.c"),
        ("sub/find_subfiles.c"),
        ("sub/img_convert.c"),
        ("sub/osd.c"),
        ("sub/osd_dummy.c", "dummy-osd"),
        ("sub/osd_libass.c", "libass-osd"),
        ("sub/sd_ass.c", "libass"),
        ("sub/sd_lavc.c"),
        ("sub/sd_lavc_conv.c"),
        ("sub/sd_lavf_srt.c"),
        ("sub/sd_microdvd.c"),
        ("sub/sd_movtext.c"),
        ("sub/sd_spu.c"),
        ("sub/sd_srt.c"),
        ("sub/spudec.c"),
        ## Video
        ("video/csputils.c"),
        ("video/fmt-conversion.c"),
        ("video/image_writer.c"),
        ("video/img_format.c"),
        ("video/mp_image.c"),
        ("video/mp_image_pool.c"),
        ("video/sws_utils.c"),
        ("video/vaapi.c", "vaapi"),
        ("video/vdpau.c", "vdpau"),
        ("video/decode/dec_video.c"),
        ("video/decode/lavc_dr1.c", "!avutil-refcounting"),
        ("video/decode/vaapi.c", "vaapi-hwaccel"),
        ("video/decode/vd_lavc.c"),
        ("video/decode/vda.c", "vda-hwaccel"),
        ("video/decode/vdpau.c", "vdpau-hwaccel"),
        ("video/decode/vdpau_old.c", "vdpau-decoder"),
        ("video/filter/pullup.c"),
        ("video/filter/vf.c"),
        ("video/filter/vf_crop.c"),
        ("video/filter/vf_delogo.c"),
        ("video/filter/vf_divtc.c"),
        ("video/filter/vf_dlopen.c", "dlopen"),
        ("video/filter/vf_dsize.c"),
        ("video/filter/vf_eq.c"),
        ("video/filter/vf_expand.c"),
        ("video/filter/vf_flip.c"),
        ("video/filter/vf_format.c"),
        ("video/filter/vf_gradfun.c"),
        ("video/filter/vf_hqdn3d.c"),
        ("video/filter/vf_ilpack.c"),
        ("video/filter/vf_lavfi.c", "vf-lavfi"),
        ("video/filter/vf_mirror.c"),
        ("video/filter/vf_noformat.c"),
        ("video/filter/vf_noise.c"),
        ("video/filter/vf_phase.c"),
        ("video/filter/vf_pp.c", "libpostproc"),
        ("video/filter/vf_pullup.c"),
        ("video/filter/vf_rotate.c"),
        ("video/filter/vf_scale.c"),
        ("video/filter/vf_screenshot.c"),
        ("video/filter/vf_softpulldown.c"),
        ("video/filter/vf_stereo3d.c"),
        ("video/filter/vf_sub.c"),
        ("video/filter/vf_swapuv.c"),
        ("video/filter/vf_unsharp.c"),
        ("video/filter/vf_vavpp.c", "vaapi-vpp"),
        ("video/filter/vf_yadif.c"),
        ("video/out/aspect.c"),
        ("video/out/bitmap_packer.c"),
        ("video/out/cocoa/additions.m", "cocoa"),
        ("video/out/cocoa/view.m", "cocoa"),
        ("video/out/cocoa/window.m", "cocoa"),
        ("video/out/cocoa_common.m", "cocoa"),
        ("video/out/dither.c"),
        ("video/out/filter_kernels.c"),
        ("video/out/gl_cocoa.c", "gl-cocoa"),
        ("video/out/gl_common.c", "gl"),
        ("video/out/gl_hwdec_vaglx.c", "vaapi-glx"),
        ("video/out/gl_hwdec_vda.c", "vda-gl"),
        ("video/out/gl_hwdec_vdpau.c", "vdpau-gl-x11"),
        ("video/out/gl_lcms.c", "gl"),
        ("video/out/gl_osd.c", "gl"),
        ("video/out/gl_video.c", "gl"),
        ("video/out/gl_w32.c", "gl-win32"),
        ("video/out/gl_wayland.c", "gl-wayland"),
        ("video/out/gl_x11.c", "gl-x11"),
        ("video/out/pnm_loader.c", "gl"),
        ("video/out/vo.c"),
        ("video/out/vo_caca.c", "caca"),
        ("video/out/vo_corevideo.c", "corevideo"),
        ("video/out/vo_direct3d.c", "direct3d"),
        ("video/out/vo_image.c"),
        ("video/out/vo_lavc.c", "encoding"),
        ("video/out/vo_null.c"),
        ("video/out/vo_opengl.c", "gl"),
        ("video/out/vo_opengl_old.c", "gl"),
        ("video/out/vo_sdl.c", "sdl2"),
        ("video/out/vo_vaapi.c", "vaapi"),
        ("video/out/vo_vdpau.c", "vdpau"),
        ("video/out/vo_wayland.c", "wayland"),
        ("video/out/vo_x11.c", "x11"),
        ("video/out/vo_xv.c", "xv"),
        ("video/out/w32_common.c", "gdi"),
        ("video/out/wayland_common.c", "wayland"),
        ("video/out/x11_common.c", "x11"),
        ## osdep
        (getch2_c),
        ("osdep/io.c"),
        ("osdep/numcores.c"),
        ("osdep/timer.c"),
        (timer_c),
        ("osdep/threads.c"),
        ("osdep/ar/HIDRemote.m", "cocoa"),
        ("osdep/macosx_application.m", "cocoa"),
        ("osdep/macosx_events.m", "cocoa"),
        ("osdep/path-macosx.m", "cocoa"),
        ("osdep/path-win.c", "os-win32"),
        ("osdep/path-win.c", "os-cygwin"),
        ("osdep/glob-win.c", "glob-win32-replacement"),
        ("osdep/priority.c", "priority"),
        ("osdep/mpv.rc", "win32-executable"),
        ## tree_allocator
        "ta/ta.c",
        "ta/ta_talloc.c",
        "ta/ta_utils.c",
    ]

    if ctx.dependency_satisfied("win32-executable"):
        from waflib import TaskGen

        TaskGen.declare_chain(
            name="windres",
            rule="${WINDRES} ${WINDRES_FLAGS} ${SRC} ${TGT}",
            ext_in=".rc",
            ext_out="-rc.o",
            color="PINK",
        )

        ctx.env.WINDRES_FLAGS = [
            "--include-dir={0}".format(ctx.bldnode.abspath()),
            "--include-dir={0}".format(ctx.srcnode.abspath()),
        ]

        for node in "osdep/mpv.exe.manifest etc/mpv-icon.ico".split():
            ctx.add_manual_dependency(ctx.path.find_node("osdep/mpv.rc"), ctx.path.find_node(node))

    cprog_kwargs = {}
    if ctx.dependency_satisfied("macosx-bundle"):
        import os

        basepath = "TOOLS/osxbundle/mpv.app/Contents"
        cprog_kwargs["mac_app"] = True
        cprog_kwargs["mac_plist"] = os.path.join(basepath, "Info.plist")

        resources_glob = os.path.join(basepath, "Resources", "*")
        resources_nodes = ctx.srcnode.ant_glob(resources_glob)
        resources = [node.srcpath() for node in resources_nodes]
        cprog_kwargs["mac_resources"] = resources

        for resource in resources:
            res_basename = os.path.basename(resource)
            install_name = "/mpv.app/Contents/Resources/" + res_basename
            ctx.install_as(ctx.env.BINDIR + install_name, resource)

    ctx(
        target="mpv",
        source=ctx.filtered_sources(sources),
        use=ctx.dependencies_use(),
        includes=[ctx.bldnode.abspath(), ctx.srcnode.abspath()] + ctx.dependencies_includes(),
        features="c cprogram",
        install_path=ctx.env.BINDIR,
        **cprog_kwargs
    )

    if ctx.dependency_satisfied("macosx-bundle"):
        from waflib import Utils

        ctx.install_files(ctx.env.BINDIR, "mpv", chmod=Utils.O755)

    if ctx.dependency_satisfied("vf-dlopen-filters"):
        dlfilters = "showqscale telecine tile rectangle framestep \
                     ildetect".split()
        for dlfilter in dlfilters:
            ctx(
                target=dlfilter,
                source=["TOOLS/vf_dlopen/" + dlfilter + ".c", "TOOLS/vf_dlopen/filterutils.c"],
                includes=[ctx.srcnode.abspath() + "/video/filter"],
                features="c cshlib",
                install_path=ctx.env.LIBDIR + "/mpv",
            )

    if ctx.dependency_satisfied("manpage-build"):
        _build_man(ctx)

    if ctx.dependency_satisfied("pdf-build"):
        _build_pdf(ctx)

    ctx.install_files(ctx.env.DATADIR + "/applications", ["etc/mpv.desktop"])

    ctx.install_files(ctx.env.CONFDIR, ["etc/encoding-profiles.conf"])

    for size in "16x16 32x32 64x64".split():
        ctx.install_as(
            ctx.env.DATADIR + "/icons/hicolor/" + size + "/apps/mpv.png", "etc/mpv-icon-8bit-" + size + ".png"
        )
示例#35
0
def build(ctx):
    ctx.load('waf_customizations')
    ctx.load('generators.sources')

    ctx(
        features="file2string",
        source="TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icns",
        target="osdep/macosx_icon.inc",
    )

    ctx(
        features="file2string",
        source="etc/mpv-icon-8bit-16x16.png",
        target="video/out/x11_icon_16.inc",
    )

    ctx(
        features="file2string",
        source="etc/mpv-icon-8bit-32x32.png",
        target="video/out/x11_icon_32.inc",
    )

    ctx(
        features="file2string",
        source="etc/mpv-icon-8bit-64x64.png",
        target="video/out/x11_icon_64.inc",
    )

    ctx(
        features="file2string",
        source="etc/mpv-icon-8bit-128x128.png",
        target="video/out/x11_icon_128.inc",
    )

    ctx(
        features="file2string",
        source="etc/input.conf",
        target="input/input_conf.h",
    )

    ctx(
        features="file2string",
        source="etc/builtin.conf",
        target="player/builtin_conf.inc",
    )

    ctx(
        features="file2string",
        source="sub/osd_font.otf",
        target="sub/osd_font.h",
    )

    lua_files = [
        "defaults.lua", "assdraw.lua", "options.lua", "osc.lua",
        "ytdl_hook.lua"
    ]

    for fn in lua_files:
        fn = "player/lua/" + fn
        ctx(
            features="file2string",
            source=fn,
            target=os.path.splitext(fn)[0] + ".inc",
        )

    ctx(
        features="file2string",
        source="player/javascript/defaults.js",
        target="player/javascript/defaults.js.inc",
    )

    ctx(features="ebml_header", target="ebml_types.h")
    ctx(features="ebml_definitions", target="ebml_defs.c")

    main_fn_c = ctx.pick_first_matching_dep([
        ("osdep/main-fn-win.c", "win32-desktop"),
        ("osdep/main-fn-cocoa.c", "cocoa"),
        ("osdep/main-fn-unix.c"),
    ])

    getch2_c = ctx.pick_first_matching_dep([
        ("osdep/terminal-unix.c", "posix"),
        ("osdep/terminal-win.c", "win32-desktop"),
        ("osdep/terminal-dummy.c"),
    ])

    timer_c = ctx.pick_first_matching_dep([
        ("osdep/timer-win2.c", "os-win32"),
        ("osdep/timer-darwin.c", "os-darwin"),
        ("osdep/timer-linux.c", "posix"),
    ])

    ipc_c = ctx.pick_first_matching_dep([
        ("input/ipc-unix.c", "posix"),
        ("input/ipc-win.c", "win32-desktop"),
        ("input/ipc-dummy.c"),
    ])

    subprocess_c = ctx.pick_first_matching_dep([
        ("osdep/subprocess-posix.c", "posix-spawn"),
        ("osdep/subprocess-win.c", "win32-desktop"),
        ("osdep/subprocess-dummy.c"),
    ])

    sources = [
        ## Audio
        ("audio/audio.c"),
        ("audio/audio_buffer.c"),
        ("audio/chmap.c"),
        ("audio/chmap_sel.c"),
        ("audio/fmt-conversion.c"),
        ("audio/format.c"),
        ("audio/decode/ad_lavc.c"),
        ("audio/decode/ad_spdif.c"),
        ("audio/decode/dec_audio.c"),
        ("audio/filter/af.c"),
        ("audio/filter/af_channels.c"),
        ("audio/filter/af_equalizer.c"),
        ("audio/filter/af_format.c"),
        ("audio/filter/af_lavcac3enc.c"),
        ("audio/filter/af_lavfi.c"),
        ("audio/filter/af_lavrresample.c"),
        ("audio/filter/af_pan.c"),
        ("audio/filter/af_rubberband.c", "rubberband"),
        ("audio/filter/af_scaletempo.c"),
        ("audio/filter/af_volume.c"),
        ("audio/filter/tools.c"),
        ("audio/out/ao.c"),
        ("audio/out/ao_alsa.c", "alsa"),
        ("audio/out/ao_audiounit.m", "audiounit"),
        ("audio/out/ao_coreaudio_chmap.c", "audiounit"),
        ("audio/out/ao_coreaudio_utils.c", "audiounit"),
        ("audio/out/ao_coreaudio.c", "coreaudio"),
        ("audio/out/ao_coreaudio_chmap.c", "coreaudio"),
        ("audio/out/ao_coreaudio_exclusive.c", "coreaudio"),
        ("audio/out/ao_coreaudio_properties.c", "coreaudio"),
        ("audio/out/ao_coreaudio_utils.c", "coreaudio"),
        ("audio/out/ao_jack.c", "jack"),
        ("audio/out/ao_lavc.c", "encoding"),
        ("audio/out/ao_null.c"),
        ("audio/out/ao_openal.c", "openal"),
        ("audio/out/ao_opensles.c", "opensles"),
        ("audio/out/ao_oss.c", "oss-audio"),
        ("audio/out/ao_pcm.c"),
        ("audio/out/ao_pulse.c", "pulse"),
        ("audio/out/ao_rsound.c", "rsound"),
        ("audio/out/ao_sdl.c", "sdl1"),
        ("audio/out/ao_sdl.c", "sdl2"),
        ("audio/out/ao_sndio.c", "sndio"),
        ("audio/out/ao_wasapi.c", "wasapi"),
        ("audio/out/ao_wasapi_utils.c", "wasapi"),
        ("audio/out/ao_wasapi_changenotify.c", "wasapi"),
        ("audio/out/pull.c"),
        ("audio/out/push.c"),

        ## Core
        ("common/av_common.c"),
        ("common/av_log.c"),
        ("common/codecs.c"),
        ("common/encode_lavc.c", "encoding"),
        ("common/common.c"),
        ("common/tags.c"),
        ("common/msg.c"),
        ("common/playlist.c"),
        ("common/recorder.c"),
        ("common/version.c"),

        ## Demuxers
        ("demux/codec_tags.c"),
        ("demux/cue.c"),
        ("demux/demux.c"),
        ("demux/demux_cue.c"),
        ("demux/demux_disc.c"),
        ("demux/demux_edl.c"),
        ("demux/demux_lavf.c"),
        ("demux/demux_libarchive.c", "libarchive"),
        ("demux/demux_mf.c"),
        ("demux/demux_mkv.c"),
        ("demux/demux_mkv_timeline.c"),
        ("demux/demux_null.c"),
        ("demux/demux_playlist.c"),
        ("demux/demux_raw.c"),
        ("demux/demux_rar.c"),
        ("demux/demux_timeline.c"),
        ("demux/demux_tv.c", "tv"),
        ("demux/ebml.c"),
        ("demux/packet.c"),
        ("demux/timeline.c"),

        ## Input
        ("input/cmd_list.c"),
        ("input/cmd_parse.c"),
        ("input/event.c"),
        ("input/input.c"),
        ("input/ipc.c"),
        (ipc_c),
        ("input/keycodes.c"),
        ("input/pipe-win32.c", "win32-pipes"),

        ## Misc
        ("misc/bstr.c"),
        ("misc/charset_conv.c"),
        ("misc/dispatch.c"),
        ("misc/json.c"),
        ("misc/node.c"),
        ("misc/ring.c"),
        ("misc/rendezvous.c"),
        ("misc/thread_pool.c"),

        ## Options
        ("options/m_config.c"),
        ("options/m_option.c"),
        ("options/m_property.c"),
        ("options/options.c"),
        ("options/parse_commandline.c"),
        ("options/parse_configfile.c"),
        ("options/path.c"),

        ## Player
        ("player/audio.c"),
        ("player/client.c"),
        ("player/command.c"),
        ("player/configfiles.c"),
        ("player/external_files.c"),
        ("player/loadfile.c"),
        ("player/main.c"),
        ("player/misc.c"),
        ("player/lavfi.c"),
        ("player/lua.c", "lua"),
        ("player/javascript.c", "javascript"),
        ("player/osd.c"),
        ("player/playloop.c"),
        ("player/screenshot.c"),
        ("player/scripting.c"),
        ("player/sub.c"),
        ("player/video.c"),

        ## Streams
        ("stream/ai_alsa1x.c", "alsa"),
        ("stream/ai_oss.c", "oss-audio"),
        ("stream/ai_sndio.c", "sndio"),
        ("stream/audio_in.c", "audio-input"),
        ("stream/cache.c"),
        ("stream/cache_file.c"),
        ("stream/cookies.c"),
        ("stream/dvb_tune.c", "dvbin"),
        ("stream/frequencies.c", "tv"),
        ("stream/rar.c"),
        ("stream/stream.c"),
        ("stream/stream_avdevice.c"),
        ("stream/stream_bluray.c", "libbluray"),
        ("stream/stream_cdda.c", "cdda"),
        ("stream/stream_dvb.c", "dvbin"),
        ("stream/stream_dvd.c", "dvdread-common"),
        ("stream/stream_dvd_common.c", "dvdread-common"),
        ("stream/stream_dvdnav.c", "dvdnav"),
        ("stream/stream_edl.c"),
        ("stream/stream_file.c"),
        ("stream/stream_cb.c"),
        ("stream/stream_lavf.c"),
        ("stream/stream_libarchive.c", "libarchive"),
        ("stream/stream_memory.c"),
        ("stream/stream_mf.c"),
        ("stream/stream_null.c"),
        ("stream/stream_rar.c"),
        ("stream/stream_smb.c", "libsmbclient"),
        ("stream/stream_tv.c", "tv"),
        ("stream/tv.c", "tv"),
        ("stream/tvi_dummy.c", "tv"),
        ("stream/tvi_v4l2.c", "tv-v4l2"),

        ## Subtitles
        ("sub/ass_mp.c", "libass"),
        ("sub/dec_sub.c"),
        ("sub/draw_bmp.c"),
        ("sub/img_convert.c"),
        ("sub/lavc_conv.c"),
        ("sub/osd.c"),
        ("sub/osd_dummy.c", "dummy-osd"),
        ("sub/osd_libass.c", "libass-osd"),
        ("sub/sd_ass.c", "libass"),
        ("sub/sd_lavc.c"),
        ("sub/filter_sdh.c"),

        ## Video
        ("video/csputils.c"),
        ("video/fmt-conversion.c"),
        ("video/gpu_memcpy.c", "sse4-intrinsics"),
        ("video/image_loader.c"),
        ("video/image_writer.c"),
        ("video/img_format.c"),
        ("video/hwdec.c"),
        ("video/mp_image.c"),
        ("video/mp_image_pool.c"),
        ("video/sws_utils.c"),
        ("video/vaapi.c", "vaapi"),
        ("video/vdpau.c", "vdpau"),
        ("video/vdpau_mixer.c", "vdpau"),
        ("video/vt.c", "videotoolbox-hwaccel"),
        ("video/decode/d3d.c", "d3d-hwaccel"),
        ("video/decode/dec_video.c"),
        ("video/decode/hw_cuda.c", "cuda-hwaccel"),
        ("video/decode/hw_dxva2.c", "d3d9-hwaccel"),
        ("video/decode/hw_d3d11va.c", "d3d-hwaccel"),
        ("video/decode/hw_videotoolbox.c", "videotoolbox-hwaccel"),
        ("video/decode/vd_lavc.c"),
        ("video/filter/refqueue.c"),
        ("video/filter/vf.c"),
        ("video/filter/vf_buffer.c"),
        ("video/filter/vf_crop.c"),
        ("video/filter/vf_d3d11vpp.c", "d3d-hwaccel"),
        ("video/filter/vf_dsize.c"),
        ("video/filter/vf_eq.c"),
        ("video/filter/vf_expand.c"),
        ("video/filter/vf_flip.c"),
        ("video/filter/vf_format.c"),
        ("video/filter/vf_gradfun.c"),
        ("video/filter/vf_lavfi.c"),
        ("video/filter/vf_mirror.c"),
        ("video/filter/vf_noformat.c"),
        ("video/filter/vf_pullup.c"),
        ("video/filter/vf_rotate.c"),
        ("video/filter/vf_scale.c"),
        ("video/filter/vf_stereo3d.c"),
        ("video/filter/vf_sub.c"),
        ("video/filter/vf_vapoursynth.c", "vapoursynth-core"),
        ("video/filter/vf_vavpp.c", "vaapi"),
        ("video/filter/vf_vdpaupp.c", "vdpau"),
        ("video/filter/vf_yadif.c"),
        ("video/out/aspect.c"),
        ("video/out/bitmap_packer.c"),
        ("video/out/cocoa/video_view.m", "cocoa"),
        ("video/out/cocoa/events_view.m", "cocoa"),
        ("video/out/cocoa/window.m", "cocoa"),
        ("video/out/cocoa_common.m", "cocoa"),
        ("video/out/dither.c"),
        ("video/out/filter_kernels.c"),
        ("video/out/opengl/angle_dynamic.c", "egl-angle"),
        ("video/out/opengl/common.c", "gl"),
        ("video/out/opengl/context.c", "gl"),
        ("video/out/opengl/context_angle.c", "egl-angle-win32"),
        ("video/out/opengl/context_cocoa.c", "gl-cocoa"),
        ("video/out/opengl/context_drm_egl.c", "egl-drm"),
        ("video/out/opengl/context_dxinterop.c", "gl-dxinterop"),
        ("video/out/opengl/context_mali_fbdev.c", "mali-fbdev"),
        ("video/out/opengl/context_rpi.c", "rpi"),
        ("video/out/opengl/context_vdpau.c", "vdpau-gl-x11"),
        ("video/out/opengl/context_wayland.c", "gl-wayland"),
        ("video/out/opengl/context_w32.c", "gl-win32"),
        ("video/out/opengl/context_x11.c", "gl-x11"),
        ("video/out/opengl/context_x11egl.c", "egl-x11"),
        ("video/out/opengl/cuda_dynamic.c", "cuda-hwaccel"),
        ("video/out/opengl/egl_helpers.c", "egl-helpers"),
        ("video/out/opengl/formats.c", "gl"),
        ("video/out/opengl/gl_utils.c", "gl"),
        ("video/out/opengl/hwdec.c", "gl"),
        ("video/out/opengl/hwdec_cuda.c", "cuda-hwaccel"),
        ("video/out/opengl/hwdec_d3d11egl.c", "d3d-hwaccel"),
        ("video/out/opengl/hwdec_d3d11eglrgb.c", "d3d-hwaccel"),
        ("video/out/opengl/hwdec_dxva2gldx.c", "gl-dxinterop-d3d9"),
        ("video/out/opengl/hwdec_dxva2egl.c", "d3d9-hwaccel"),
        ("video/out/opengl/hwdec_osx.c", "videotoolbox-gl"),
        ("video/out/opengl/hwdec_ios.m", "ios-gl"),
        ("video/out/opengl/hwdec_rpi.c", "rpi"),
        ("video/out/opengl/hwdec_vaegl.c", "vaapi-egl"),
        ("video/out/opengl/hwdec_vaglx.c", "vaapi-glx"),
        ("video/out/opengl/hwdec_vdpau.c", "vdpau-gl-x11"),
        ("video/out/opengl/lcms.c", "gl"),
        ("video/out/opengl/osd.c", "gl"),
        ("video/out/opengl/ra.c", "gl"),
        ("video/out/opengl/ra_gl.c", "gl"),
        ("video/out/opengl/shader_cache.c", "gl"),
        ("video/out/opengl/user_shaders.c", "gl"),
        ("video/out/opengl/utils.c", "gl"),
        ("video/out/opengl/video.c", "gl"),
        ("video/out/opengl/video_shaders.c", "gl"),
        ("video/out/vo.c"),
        ("video/out/vo_caca.c", "caca"),
        ("video/out/vo_drm.c", "drm"),
        ("video/out/vo_direct3d.c", "direct3d"),
        ("video/out/vo_image.c"),
        ("video/out/vo_lavc.c", "encoding"),
        ("video/out/vo_rpi.c", "rpi"),
        ("video/out/vo_null.c"),
        ("video/out/vo_opengl.c", "gl"),
        ("video/out/vo_opengl_cb.c", "gl"),
        ("video/out/vo_sdl.c", "sdl2"),
        ("video/out/vo_tct.c"),
        ("video/out/vo_vaapi.c", "vaapi-x11"),
        ("video/out/vo_vdpau.c", "vdpau"),
        ("video/out/vo_wayland.c", "wayland"),
        ("video/out/vo_x11.c", "x11"),
        ("video/out/vo_xv.c", "xv"),
        ("video/out/w32_common.c", "win32-desktop"),
        ("video/out/win32/displayconfig.c", "win32-desktop"),
        ("video/out/win32/droptarget.c", "win32-desktop"),
        ("video/out/win32/exclusive_hack.c", "gl-win32"),
        ("video/out/wayland_common.c", "wayland"),
        ("video/out/wayland/buffer.c", "wayland"),
        ("video/out/wayland/memfile.c", "wayland"),
        ("video/out/win_state.c"),
        ("video/out/x11_common.c", "x11"),
        ("video/out/drm_common.c", "drm"),

        ## osdep
        (getch2_c),
        ("osdep/io.c"),
        ("osdep/timer.c"),
        (timer_c),
        ("osdep/threads.c"),
        ("osdep/ar/HIDRemote.m", "apple-remote"),
        ("osdep/macosx_application.m", "cocoa"),
        ("osdep/macosx_events.m", "cocoa"),
        ("osdep/macosx_touchbar.m", "macos-touchbar"),
        ("osdep/semaphore_osx.c"),
        ("osdep/subprocess.c"),
        (subprocess_c),
        ("osdep/path-macosx.m", "cocoa"),
        ("osdep/path-unix.c"),
        ("osdep/path-win.c", "win32-desktop"),
        ("osdep/path-win.c", "os-cygwin"),
        ("osdep/path-uwp.c", "uwp"),
        ("osdep/glob-win.c", "glob-win32"),
        ("osdep/w32_keyboard.c", "os-win32"),
        ("osdep/w32_keyboard.c", "os-cygwin"),
        ("osdep/windows_utils.c", "os-win32"),
        ("osdep/mpv.rc", "win32-executable"),
        ("osdep/win32/pthread.c", "win32-internal-pthreads"),
        ("osdep/android/strnlen.c", "android"),

        ## tree_allocator
        "ta/ta.c",
        "ta/ta_talloc.c",
        "ta/ta_utils.c"
    ]

    if ctx.dependency_satisfied('win32-executable'):
        from waflib import TaskGen

        TaskGen.declare_chain(name='windres',
                              rule='${WINDRES} ${WINDRES_FLAGS} ${SRC} ${TGT}',
                              ext_in='.rc',
                              ext_out='-rc.o',
                              color='PINK')

        ctx.env.WINDRES_FLAGS = [
            '--include-dir={0}'.format(ctx.bldnode.abspath()),
            '--include-dir={0}'.format(ctx.srcnode.abspath())
        ]

        for node in 'osdep/mpv.exe.manifest etc/mpv-icon.ico'.split():
            ctx.add_manual_dependency(ctx.path.find_node('osdep/mpv.rc'),
                                      ctx.path.find_node(node))

        version = ctx.bldnode.find_node('version.h')
        if version:
            ctx.add_manual_dependency(ctx.path.find_node('osdep/mpv.rc'),
                                      version)

    if ctx.dependency_satisfied('cplayer') or ctx.dependency_satisfied('test'):
        ctx(
            target="objects",
            source=ctx.filtered_sources(sources),
            use=ctx.dependencies_use(),
            includes=_all_includes(ctx),
            features="c",
        )

    syms = False
    if ctx.dependency_satisfied('cplugins'):
        syms = True
        ctx.load("syms")

    if ctx.dependency_satisfied('cplayer'):
        ctx(
            target="mpv",
            source=main_fn_c,
            use=ctx.dependencies_use() + ['objects'],
            includes=_all_includes(ctx),
            features="c cprogram" + (" syms" if syms else ""),
            export_symbols_def="libmpv/mpv.def",  # for syms=True
            install_path=ctx.env.BINDIR)
        for f in ['mpv.conf', 'input.conf', 'mplayer-input.conf', \
                  'restore-old-bindings.conf']:
            ctx.install_as(os.path.join(ctx.env.DOCDIR, f),
                           os.path.join('etc/', f))

        if ctx.env.DEST_OS == 'win32':
            wrapctx = ctx(target="mpv",
                          source=['osdep/win32-console-wrapper.c'],
                          features="c cprogram",
                          install_path=ctx.env.BINDIR)

            wrapctx.env.cprogram_PATTERN = "%s.com"
            wrapflags = ['-municode', '-mconsole']
            wrapctx.env.CFLAGS = wrapflags
            wrapctx.env.LAST_LINKFLAGS = wrapflags

    if ctx.dependency_satisfied('test'):
        for test in ctx.path.ant_glob("test/*.c"):
            ctx(
                target=os.path.splitext(test.srcpath())[0],
                source=test.srcpath(),
                use=ctx.dependencies_use() + ['objects'],
                includes=_all_includes(ctx),
                features="c cprogram",
                install_path=None,
            )

    build_shared = ctx.dependency_satisfied('libmpv-shared')
    build_static = ctx.dependency_satisfied('libmpv-static')
    if build_shared or build_static:
        if build_shared:
            waftoolsdir = os.path.join(os.path.dirname(__file__), "waftools")
            ctx.load("syms", tooldir=waftoolsdir)
        vre = '#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION\((.*), (.*)\)'
        libmpv_header = ctx.path.find_node("libmpv/client.h").read()
        major, minor = re.search(vre, libmpv_header).groups()
        libversion = major + '.' + minor + '.0'

        def _build_libmpv(shared):
            features = "c "
            if shared:
                features += "cshlib syms"
            else:
                features += "cstlib"

            libmpv_kwargs = {
                "target": "mpv",
                "source":   ctx.filtered_sources(sources),
                "use":      ctx.dependencies_use(),
                "includes": [ctx.bldnode.abspath(), ctx.srcnode.abspath()] + \
                             ctx.dependencies_includes(),
                "features": features,
                "export_symbols_def": "libmpv/mpv.def",
                "install_path": ctx.env.LIBDIR,
                "install_path_implib": ctx.env.LIBDIR,
            }

            if shared and ctx.dependency_satisfied('android'):
                # for Android we just add the linker flag without version
                # as we still need the SONAME for proper linkage.
                # (LINKFLAGS logic taken from waf's apply_vnum in ccroot.py)
                v = ctx.env.SONAME_ST % 'libmpv.so'
                ctx.env.append_value('LINKFLAGS', v.split())
            else:
                # for all other configurations we want SONAME to be used
                libmpv_kwargs["vnum"] = libversion

            if shared and ctx.env.DEST_OS == 'win32':
                libmpv_kwargs["install_path"] = ctx.env.BINDIR

            ctx(**libmpv_kwargs)

        if build_shared:
            _build_libmpv(True)
        if build_static:
            _build_libmpv(False)

        def get_deps():
            res = ""
            for k in ctx.env.keys():
                if k.startswith("LIB_") and k != "LIB_ST":
                    res += " ".join(["-l" + x for x in ctx.env[k]]) + " "
            return res

        ctx(
            target='libmpv/mpv.pc',
            source='libmpv/mpv.pc.in',
            features='subst',
            PREFIX=ctx.env.PREFIX,
            LIBDIR=ctx.env.LIBDIR,
            INCDIR=ctx.env.INCDIR,
            VERSION=libversion,
            PRIV_LIBS=get_deps(),
        )

        headers = ["client.h", "qthelper.hpp", "opengl_cb.h", "stream_cb.h"]
        for f in headers:
            ctx.install_as(ctx.env.INCDIR + '/mpv/' + f, 'libmpv/' + f)

        ctx.install_as(ctx.env.LIBDIR + '/pkgconfig/mpv.pc', 'libmpv/mpv.pc')

    if ctx.dependency_satisfied('html-build'):
        _build_html(ctx)

    if ctx.dependency_satisfied('manpage-build'):
        _build_man(ctx)

    if ctx.dependency_satisfied('pdf-build'):
        _build_pdf(ctx)

    if ctx.dependency_satisfied('cplayer'):

        if ctx.dependency_satisfied('zsh-comp'):
            ctx.zshcomp(target="etc/_mpv", source="TOOLS/zsh.pl")
            ctx.install_files(ctx.env.ZSHDIR, ['etc/_mpv'])

        ctx.install_files(ctx.env.DATADIR + '/applications',
                          ['etc/mpv.desktop'])

        if ctx.dependency_satisfied('encoding'):
            ctx.install_files(ctx.env.CONFDIR, ['etc/encoding-profiles.conf'])

        for size in '16x16 32x32 64x64'.split():
            ctx.install_as(
                ctx.env.DATADIR + '/icons/hicolor/' + size + '/apps/mpv.png',
                'etc/mpv-icon-8bit-' + size + '.png')

        ctx.install_as(
            ctx.env.DATADIR + '/icons/hicolor/scalable/apps/mpv.svg',
            'etc/mpv-gradient.svg')

        ctx.install_files(ctx.env.DATADIR + '/icons/hicolor/symbolic/apps',
                          ['etc/mpv-symbolic.svg'])
示例#36
0
	def declare_chain(self, *k, **kw):
		"""
		Wrapper for :py:func:`waflib.TaskGen.declare_chain` provided for convenience
		"""
		return TaskGen.declare_chain(*k, **kw)
示例#37
0
 def declare_chain(self, *k, **kw):
     return TaskGen.declare_chain(*k, **kw)
示例#38
0
 def declare_chain(self, *k, **kw):
     return TaskGen.declare_chain(*k, **kw)
示例#39
0
文件: Build.py 项目: kingmax/waf
	def declare_chain(self, *k, **kw):
		"""
		Wraps :py:func:`waflib.TaskGen.declare_chain` for convenience
		"""
		return TaskGen.declare_chain(*k, **kw)
示例#40
0
def build(ctx):
    ctx.load('waf_customizations')
    ctx.load('generators.sources')

    ctx.file2string(
        source = "TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icns",
        target = "osdep/macosx_icon.inc")

    ctx.file2string(
        source = "video/out/x11_icon.bin",
        target = "video/out/x11_icon.inc")

    ctx.file2string(
        source = "etc/input.conf",
        target = "input/input_conf.h")

    ctx.file2string(
        source = "sub/osd_font.otf",
        target = "sub/osd_font.h")

    ctx.file2string(
        source = "video/out/opengl/nnedi3_weights.bin",
        target = "video/out/opengl/nnedi3_weights.inc")

    lua_files = ["defaults.lua", "assdraw.lua", "options.lua", "osc.lua",
                 "ytdl_hook.lua"]
    for fn in lua_files:
        fn = "player/lua/" + fn
        ctx.file2string(source = fn, target = os.path.splitext(fn)[0] + ".inc")

    ctx.matroska_header(
        source = "demux/ebml.c demux/demux_mkv.c",
        target = "ebml_types.h")

    ctx.matroska_definitions(
        source = "demux/ebml.c",
        target = "ebml_defs.c")

    if ctx.env.DEST_OS == 'win32':
        main_fn_c = 'osdep/main-fn-win.c'
    elif ctx.dependency_satisfied('cocoa'):
        main_fn_c = 'osdep/main-fn-cocoa.c'
    else:
        main_fn_c = 'osdep/main-fn-unix.c'

    getch2_c = {
        'win32':  'osdep/terminal-win.c',
    }.get(ctx.env.DEST_OS, "osdep/terminal-unix.c")

    timer_c = {
        'win32':  'osdep/timer-win2.c',
        'darwin': 'osdep/timer-darwin.c',
    }.get(ctx.env.DEST_OS, "osdep/timer-linux.c")

    sources = [
        ## Audio
        ( "audio/audio.c" ),
        ( "audio/audio_buffer.c" ),
        ( "audio/chmap.c" ),
        ( "audio/chmap_sel.c" ),
        ( "audio/fmt-conversion.c" ),
        ( "audio/format.c" ),
        ( "audio/mixer.c" ),
        ( "audio/decode/ad_lavc.c" ),
        ( "audio/decode/ad_spdif.c" ),
        ( "audio/decode/dec_audio.c" ),
        ( "audio/filter/af.c" ),
        ( "audio/filter/af_channels.c" ),
        ( "audio/filter/af_delay.c" ),
        ( "audio/filter/af_drc.c" ),
        ( "audio/filter/af_equalizer.c" ),
        ( "audio/filter/af_format.c" ),
        ( "audio/filter/af_lavcac3enc.c" ),
        ( "audio/filter/af_lavfi.c",             "libavfilter" ),
        ( "audio/filter/af_lavrresample.c" ),
        ( "audio/filter/af_pan.c" ),
        ( "audio/filter/af_rubberband.c",        "rubberband" ),
        ( "audio/filter/af_scaletempo.c" ),
        ( "audio/filter/af_volume.c" ),
        ( "audio/filter/tools.c" ),
        ( "audio/out/ao.c" ),
        ( "audio/out/ao_alsa.c",                 "alsa" ),
        ( "audio/out/ao_coreaudio.c",            "coreaudio" ),
        ( "audio/out/ao_coreaudio_chmap.c",      "coreaudio" ),
        ( "audio/out/ao_coreaudio_exclusive.c",  "coreaudio" ),
        ( "audio/out/ao_coreaudio_properties.c", "coreaudio" ),
        ( "audio/out/ao_coreaudio_utils.c",      "coreaudio" ),
        ( "audio/out/ao_dsound.c",               "dsound" ),
        ( "audio/out/ao_jack.c",                 "jack" ),
        ( "audio/out/ao_lavc.c",                 "encoding" ),
        ( "audio/out/ao_null.c" ),
        ( "audio/out/ao_openal.c",               "openal" ),
        ( "audio/out/ao_oss.c",                  "oss-audio" ),
        ( "audio/out/ao_pcm.c" ),
        ( "audio/out/ao_pulse.c",                "pulse" ),
        ( "audio/out/ao_rsound.c",               "rsound" ),
        ( "audio/out/ao_sdl.c",                  "sdl1" ),
        ( "audio/out/ao_sdl.c",                  "sdl2" ),
        ( "audio/out/ao_sndio.c",                "sndio" ),
        ( "audio/out/ao_wasapi.c",               "wasapi" ),
        ( "audio/out/ao_wasapi_utils.c",         "wasapi" ),
        ( "audio/out/ao_wasapi_changenotify.c",  "wasapi" ),
        ( "audio/out/pull.c" ),
        ( "audio/out/push.c" ),

        ## Core
        ( "common/av_common.c" ),
        ( "common/av_log.c" ),
        ( "common/codecs.c" ),
        ( "common/encode_lavc.c",                "encoding" ),
        ( "common/common.c" ),
        ( "common/tags.c" ),
        ( "common/msg.c" ),
        ( "common/playlist.c" ),
        ( "common/version.c" ),

        ## Demuxers
        ( "demux/codec_tags.c" ),
        ( "demux/cue.c" ),
        ( "demux/demux.c" ),
        ( "demux/demux_cue.c" ),
        ( "demux/demux_disc.c" ),
        ( "demux/demux_edl.c" ),
        ( "demux/demux_lavf.c" ),
        ( "demux/demux_libarchive.c",            "libarchive" ),
        ( "demux/demux_mf.c" ),
        ( "demux/demux_mkv.c" ),
        ( "demux/demux_mkv_timeline.c" ),
        ( "demux/demux_playlist.c" ),
        ( "demux/demux_raw.c" ),
        ( "demux/demux_rar.c" ),
        ( "demux/demux_subreader.c" ),
        ( "demux/demux_tv.c",                    "tv" ),
        ( "demux/ebml.c" ),
        ( "demux/packet.c" ),
        ( "demux/timeline.c" ),

        ## Input
        ( "input/cmd_list.c" ),
        ( "input/cmd_parse.c" ),
        ( "input/event.c" ),
        ( "input/input.c" ),
        ( "input/ipc.c",                         "!mingw" ),
        ( "input/keycodes.c" ),
        ( "input/pipe-win32.c",                  "waio" ),

        ## Misc
        ( "misc/bstr.c" ),
        ( "misc/charset_conv.c" ),
        ( "misc/dispatch.c" ),
        ( "misc/json.c" ),
        ( "misc/ring.c" ),
        ( "misc/rendezvous.c" ),

        ## Options
        ( "options/m_config.c" ),
        ( "options/m_option.c" ),
        ( "options/m_property.c" ),
        ( "options/options.c" ),
        ( "options/parse_commandline.c" ),
        ( "options/parse_configfile.c" ),
        ( "options/path.c" ),

        ## Player
        ( "player/audio.c" ),
        ( "player/client.c" ),
        ( "player/command.c" ),
        ( "player/configfiles.c" ),
        ( "player/external_files.c" ),
        ( "player/loadfile.c" ),
        ( "player/main.c" ),
        ( "player/misc.c" ),
        ( "player/lua.c",                        "lua" ),
        ( "player/osd.c" ),
        ( "player/playloop.c" ),
        ( "player/screenshot.c" ),
        ( "player/scripting.c" ),
        ( "player/sub.c" ),
        ( "player/video.c" ),

        ## Streams
        ( "stream/ai_alsa1x.c",                  "alsa" ),
        ( "stream/ai_oss.c",                     "oss-audio" ),
        ( "stream/ai_sndio.c",                   "sndio" ),
        ( "stream/audio_in.c",                   "audio-input" ),
        ( "stream/cache.c" ),
        ( "stream/cache_file.c" ),
        ( "stream/cookies.c" ),
        ( "stream/dvb_tune.c",                   "dvbin" ),
        ( "stream/frequencies.c",                "tv" ),
        ( "stream/rar.c" ),
        ( "stream/stream.c" ),
        ( "stream/stream_avdevice.c" ),
        ( "stream/stream_bluray.c",              "libbluray" ),
        ( "stream/stream_cdda.c",                "cdda" ),
        ( "stream/stream_dvb.c",                 "dvbin" ),
        ( "stream/stream_dvd.c",                 "dvdread" ),
        ( "stream/stream_dvd_common.c",          "dvdread" ),
        ( "stream/stream_dvdnav.c",              "dvdnav" ),
        ( "stream/stream_edl.c" ),
        ( "stream/stream_file.c" ),
        ( "stream/stream_lavf.c" ),
        ( "stream/stream_libarchive.c",          "libarchive" ),
        ( "stream/stream_memory.c" ),
        ( "stream/stream_mf.c" ),
        ( "stream/stream_null.c" ),
        ( "stream/stream_pvr.c",                 "pvr" ),
        ( "stream/stream_rar.c" ),
        ( "stream/stream_smb.c",                 "libsmbclient" ),
        ( "stream/stream_tv.c",                  "tv" ),
        ( "stream/tv.c",                         "tv" ),
        ( "stream/tvi_dummy.c",                  "tv" ),
        ( "stream/tvi_v4l2.c",                   "tv-v4l2"),

        ## Subtitles
        ( "sub/ass_mp.c",                        "libass"),
        ( "sub/dec_sub.c" ),
        ( "sub/draw_bmp.c" ),
        ( "sub/img_convert.c" ),
        ( "sub/osd.c" ),
        ( "sub/osd_dummy.c",                     "dummy-osd" ),
        ( "sub/osd_libass.c",                    "libass-osd" ),
        ( "sub/sd_ass.c",                        "libass" ),
        ( "sub/sd_lavc.c" ),
        ( "sub/sd_lavc_conv.c" ),
        ( "sub/sd_lavf_srt.c" ),
        ( "sub/sd_microdvd.c" ),
        ( "sub/sd_movtext.c" ),
        ( "sub/sd_srt.c" ),

        ## Video
        ( "video/csputils.c" ),
        ( "video/fmt-conversion.c" ),
        ( "video/gpu_memcpy.c",                  "sse4-intrinsics" ),
        ( "video/image_writer.c" ),
        ( "video/img_format.c" ),
        ( "video/mp_image.c" ),
        ( "video/mp_image_pool.c" ),
        ( "video/sws_utils.c" ),
        ( "video/vaapi.c",                       "vaapi" ),
        ( "video/vdpau.c",                       "vdpau" ),
        ( "video/vdpau_mixer.c",                 "vdpau" ),
        ( "video/decode/dec_video.c"),
        ( "video/decode/dxva2.c",                "dxva2-hwaccel" ),
        ( "video/decode/rpi.c",                  "rpi" ),
        ( "video/decode/vaapi.c",                "vaapi-hwaccel" ),
        ( "video/decode/vd_lavc.c" ),
        ( "video/decode/videotoolbox.c",         "videotoolbox-hwaccel" ),
        ( "video/decode/vdpau.c",                "vdpau-hwaccel" ),
        ( "video/filter/vf.c" ),
        ( "video/filter/vf_buffer.c" ),
        ( "video/filter/vf_crop.c" ),
        ( "video/filter/vf_canny.c",             "opencv" ),
        ( "video/filter/vf_vector.c",            "opencv" ),
        ( "video/filter/vf_vectorraster.c" ),
        ( "video/filter/vf_dlopen.c",            "dlopen" ),
        ( "video/filter/vf_dsize.c" ),
        ( "video/filter/vf_eq.c" ),
        ( "video/filter/vf_expand.c" ),
        ( "video/filter/vf_flip.c" ),
        ( "video/filter/vf_format.c" ),
        ( "video/filter/vf_gradfun.c",           "libavfilter"),
        ( "video/filter/vf_lavfi.c",             "libavfilter"),
        ( "video/filter/vf_mirror.c",            "libavfilter"),
        ( "video/filter/vf_noformat.c" ),
        ( "video/filter/vf_pullup.c",            "libavfilter"),
        ( "video/filter/vf_rotate.c",            "libavfilter"),
        ( "video/filter/vf_scale.c" ),
        ( "video/filter/vf_stereo3d.c",          "libavfilter"),
        ( "video/filter/vf_sub.c" ),
        ( "video/filter/vf_vapoursynth.c",       "vapoursynth-core" ),
        ( "video/filter/vf_vavpp.c",             "vaapi"),
        ( "video/filter/vf_vdpaupp.c",           "vdpau" ),
        ( "video/filter/vf_vdpaurb.c",           "vdpau" ),
        ( "video/filter/vf_yadif.c",             "libavfilter"),
        ( "video/out/aspect.c" ),
        ( "video/out/bitmap_packer.c" ),
        ( "video/out/cocoa/video_view.m",        "cocoa" ),
        ( "video/out/cocoa/events_view.m",       "cocoa" ),
        ( "video/out/cocoa/window.m",            "cocoa" ),
        ( "video/out/cocoa_common.m",            "cocoa" ),
        ( "video/out/dither.c" ),
        ( "video/out/filter_kernels.c" ),
        ( "video/out/opengl/cocoa.c",            "gl-cocoa" ),
        ( "video/out/opengl/common.c",           "gl" ),
        ( "video/out/opengl/rpi.c",              "rpi" ),
        ( "video/out/opengl/hwdec.c",            "gl" ),
        ( "video/out/opengl/hwdec_dxva2.c",      "gl-win32" ),
        ( "video/out/opengl/hwdec_vaegl.c",      "vaapi-egl" ),
        ( "video/out/opengl/hwdec_vaglx.c",      "vaapi-glx" ),
        ( "video/out/opengl/hwdec_osx.c",        "videotoolbox-gl" ),
        ( "video/out/opengl/hwdec_vdpau.c",      "vdpau-gl-x11" ),
        ( "video/out/opengl/lcms.c",             "gl" ),
        ( "video/out/opengl/nnedi3.c",           "gl" ),
        ( "video/out/opengl/osd.c",              "gl" ),
        ( "video/out/opengl/superxbr.c",         "gl" ),
        ( "video/out/opengl/utils.c",            "gl" ),
        ( "video/out/opengl/video.c",            "gl" ),
        ( "video/out/opengl/video_shaders.c",    "gl" ),
        ( "video/out/opengl/w32.c",              "gl-win32" ),
        ( "video/out/opengl/wayland.c",          "gl-wayland" ),
        ( "video/out/opengl/x11.c",              "gl-x11" ),
        ( "video/out/opengl/x11egl.c",           "egl-x11" ),
        ( "video/out/opengl/drm_egl.c",          "egl-drm" ),
        ( "video/out/vo.c" ),
        ( "video/out/vo_caca.c",                 "caca" ),
        ( "video/out/vo_drm.c",                  "drm" ),
        ( "video/out/vo_direct3d.c",             "direct3d" ),
        ( "video/out/vo_image.c" ),
        ( "video/out/vo_lavc.c",                 "encoding" ),
        ( "video/out/vo_rpi.c",                  "rpi" ),
        ( "video/out/vo_null.c" ),
        ( "video/out/vo_opengl.c",               "gl" ),
        ( "video/out/vo_opengl_cb.c",            "gl" ),
        ( "video/out/vo_sdl.c",                  "sdl2" ),
        ( "video/out/vo_vaapi.c",                "vaapi-x11" ),
        ( "video/out/vo_vdpau.c",                "vdpau" ),
        ( "video/out/vo_wayland.c",              "wayland" ),
        ( "video/out/vo_x11.c" ,                 "x11" ),
        ( "video/out/vo_xv.c",                   "xv" ),
        ( "video/out/vo_tkkr.c" ),
        ( "video/out/w32_common.c",              "win32" ),
        ( "video/out/win32/displayconfig.c",     "win32" ),
        ( "video/out/wayland_common.c",          "wayland" ),
        ( "video/out/wayland/buffer.c",          "wayland" ),
        ( "video/out/wayland/memfile.c",         "wayland" ),
        ( "video/out/win_state.c"),
        ( "video/out/x11_common.c",              "x11" ),
        ( "video/out/drm_common.c",              "drm" ),

        ## osdep
        ( getch2_c ),
        ( "osdep/io.c" ),
        ( "osdep/timer.c" ),
        ( timer_c ),
        ( "osdep/threads.c" ),

        ( "osdep/ar/HIDRemote.m",                "apple-remote" ),
        ( "osdep/macosx_application.m",          "cocoa" ),
        ( "osdep/macosx_events.m",               "cocoa" ),
        ( "osdep/semaphore_osx.c" ),
        ( "osdep/subprocess.c" ),
        ( "osdep/subprocess-posix.c",            "posix-spawn" ),
        ( "osdep/subprocess-win.c",              "os-win32" ),
        ( "osdep/path-macosx.m",                 "cocoa" ),
        ( "osdep/path-unix.c"),
        ( "osdep/path-win.c",                    "os-win32" ),
        ( "osdep/path-win.c",                    "os-cygwin" ),
        ( "osdep/glob-win.c",                    "glob-win32-replacement" ),
        ( "osdep/w32_keyboard.c",                "os-win32" ),
        ( "osdep/w32_keyboard.c",                "os-cygwin" ),
        ( "osdep/mpv.rc",                        "win32-executable" ),
        ( "osdep/win32/pthread.c",               "win32-internal-pthreads"),

        ## tree_allocator
        "ta/ta.c", "ta/ta_talloc.c", "ta/ta_utils.c"
    ]

    if ctx.dependency_satisfied('win32-executable'):
        from waflib import TaskGen

        TaskGen.declare_chain(
            name    = 'windres',
            rule    = '${WINDRES} ${WINDRES_FLAGS} ${SRC} ${TGT}',
            ext_in  = '.rc',
            ext_out = '-rc.o',
            color   = 'PINK')

        ctx.env.WINDRES_FLAGS = [
            '--include-dir={0}'.format(ctx.bldnode.abspath()),
            '--include-dir={0}'.format(ctx.srcnode.abspath())
        ]

        for node in 'osdep/mpv.exe.manifest etc/mpv-icon.ico'.split():
            ctx.add_manual_dependency(
                ctx.path.find_node('osdep/mpv.rc'),
                ctx.path.find_node(node))

        version = ctx.bldnode.find_node('version.h')
        if version:
            ctx.add_manual_dependency(
                ctx.path.find_node('osdep/mpv.rc'),
                version)

    if ctx.dependency_satisfied('cplayer') or ctx.dependency_satisfied('test'):
        ctx(
            target       = "objects",
            source       = ctx.filtered_sources(sources),
            use          = ctx.dependencies_use(),
            includes     = _all_includes(ctx),
            features     = "c",
        )

    if ctx.dependency_satisfied('cplayer'):
        ctx(
            target       = "mpv",
            source       = main_fn_c,
            use          = ctx.dependencies_use() + ['objects'],
            includes     = _all_includes(ctx),
            features     = "c cprogram",
            install_path = ctx.env.BINDIR
        )
        for f in ['example.conf', 'input.conf', 'mplayer-input.conf', \
                  'restore-old-bindings.conf']:
            ctx.install_as(os.path.join(ctx.env.DOCDIR, f),
                           os.path.join('etc/', f))

        if ctx.env.DEST_OS == 'win32':
            wrapctx = ctx(
                target       = "mpv",
                source       = ['osdep/win32-console-wrapper.c'],
                features     = "c cprogram",
                install_path = ctx.env.BINDIR
            )

            wrapctx.env.cprogram_PATTERN = "%s.com"
            wrapflags = ['-municode', '-mconsole']
            wrapctx.env.CFLAGS = wrapflags
            wrapctx.env.LAST_LINKFLAGS = wrapflags

    if ctx.dependency_satisfied('test'):
        for test in ctx.path.ant_glob("test/*.c"):
            ctx(
                target   = os.path.splitext(test.srcpath())[0],
                source   = test.srcpath(),
                use      = ctx.dependencies_use() + ['objects'],
                includes = _all_includes(ctx),
                features = "c cprogram",
            )

    build_shared = ctx.dependency_satisfied('libmpv-shared')
    build_static = ctx.dependency_satisfied('libmpv-static')
    if build_shared or build_static:
        if build_shared:
            waftoolsdir = os.path.join(os.path.dirname(__file__), "waftools")
            ctx.load("syms", tooldir=waftoolsdir)
        vre = '^#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION\((.*), (.*)\)$'
        libmpv_header = ctx.path.find_node("libmpv/client.h").read()
        major, minor = re.search(vre, libmpv_header, re.M).groups()
        libversion = major + '.' + minor + '.0'

        def _build_libmpv(shared):
            features = "c "
            if shared:
                features += "cshlib syms"
            else:
                features += "cstlib"
            ctx(
                target       = "mpv",
                source       = ctx.filtered_sources(sources),
                use          = ctx.dependencies_use(),
                includes     = [ctx.bldnode.abspath(), ctx.srcnode.abspath()] + \
                                ctx.dependencies_includes(),
                features     = features,
                export_symbols_def = "libmpv/mpv.def",
                install_path = ctx.env.LIBDIR,
                vnum         = libversion,
            )
        if build_shared:
            _build_libmpv(True)
        if build_static:
            _build_libmpv(False)

        def get_deps():
            res = ""
            for k in ctx.env.keys():
                if k.startswith("LIB_") and k != "LIB_ST":
                    res += " ".join(["-l" + x for x in ctx.env[k]]) + " "
            return res

        ctx(
            target       = 'libmpv/mpv.pc',
            source       = 'libmpv/mpv.pc.in',
            features     = 'subst',
            PREFIX       = ctx.env.PREFIX,
            LIBDIR       = ctx.env.LIBDIR,
            INCDIR       = ctx.env.INCDIR,
            VERSION      = libversion,
            PRIV_LIBS    = get_deps(),
        )

        headers = ["client.h", "qthelper.hpp", "opengl_cb.h"]
        for f in headers:
            ctx.install_as(ctx.env.INCDIR + '/mpv/' + f, 'libmpv/' + f)

        ctx.install_as(ctx.env.LIBDIR + '/pkgconfig/mpv.pc', 'libmpv/mpv.pc')

    if ctx.dependency_satisfied("vf-dlopen-filters"):
        dlfilters = "telecine tile rectangle framestep ildetect".split()
        for dlfilter in dlfilters:
            ctx(
                target       = dlfilter,
                source       = ['TOOLS/vf_dlopen/'+dlfilter+'.c',
                                'TOOLS/vf_dlopen/filterutils.c'],
                includes     = [ctx.srcnode.abspath() + '/video/filter'],
                features     = 'c cshlib',
                install_path = ctx.env.LIBDIR + '/mpv' )

    if ctx.dependency_satisfied('manpage-build'):
        _build_man(ctx)

    if ctx.dependency_satisfied('pdf-build'):
        _build_pdf(ctx)

    if ctx.dependency_satisfied('cplayer'):

        if ctx.dependency_satisfied('zsh-comp'):
            ctx.zshcomp(target = "etc/_mpv")
            ctx.install_files(
                ctx.env.ZSHDIR,
                ['etc/_mpv'])

        ctx.install_files(
            ctx.env.DATADIR + '/applications',
            ['etc/mpv.desktop'] )

        ctx.install_files(ctx.env.CONFDIR, ['etc/encoding-profiles.conf'] )

        for size in '16x16 32x32 64x64'.split():
            ctx.install_as(
                ctx.env.DATADIR + '/icons/hicolor/' + size + '/apps/mpv.png',
                'etc/mpv-icon-8bit-' + size + '.png')
示例#41
0
def build(ctx):
    ctx.load('waf_customizations')
    ctx.load('generators.sources')

    ctx.file2string(
        source = "TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icns",
        target = "osdep/macosx_icon.inc")

    ctx.file2string(
        source = "video/out/x11_icon.bin",
        target = "video/out/x11_icon.inc")

    ctx.file2string(
        source = "etc/input.conf",
        target = "input/input_conf.h")

    ctx.file2string(
        source = "video/out/gl_video_shaders.glsl",
        target = "video/out/gl_video_shaders.h")

    ctx.file2string(
        source = "sub/osd_font.otf",
        target = "sub/osd_font.h")

    ctx.file2string(
        source = "player/lua/defaults.lua",
        target = "player/lua/defaults.inc")

    ctx.file2string(
        source = "player/lua/assdraw.lua",
        target = "player/lua/assdraw.inc")

    ctx.file2string(
        source = "player/lua/options.lua",
        target = "player/lua/options.inc")

    ctx.file2string(
        source = "player/lua/osc.lua",
        target = "player/lua/osc.inc")

    ctx.matroska_header(
        source = "demux/ebml.c demux/demux_mkv.c",
        target = "ebml_types.h")

    ctx.matroska_definitions(
        source = "demux/ebml.c",
        target = "ebml_defs.c")

    getch2_c = {
        'win32':  'osdep/terminal-win.c',
    }.get(ctx.env.DEST_OS, "osdep/terminal-unix.c")

    timer_c = {
        'win32':  'osdep/timer-win2.c',
        'darwin': 'osdep/timer-darwin.c',
    }.get(ctx.env.DEST_OS, "osdep/timer-linux.c")

    sources = [
        ## Audio
        ( "audio/audio.c" ),
        ( "audio/audio_buffer.c" ),
        ( "audio/chmap.c" ),
        ( "audio/chmap_sel.c" ),
        ( "audio/fmt-conversion.c" ),
        ( "audio/format.c" ),
        ( "audio/mixer.c" ),
        ( "audio/decode/ad_lavc.c" ),
        ( "audio/decode/ad_mpg123.c",            "mpg123" ),
        ( "audio/decode/ad_spdif.c" ),
        ( "audio/decode/dec_audio.c" ),
        ( "audio/filter/af.c" ),
        ( "audio/filter/af_bs2b.c",              "libbs2b" ),
        ( "audio/filter/af_center.c" ),
        ( "audio/filter/af_channels.c" ),
        ( "audio/filter/af_convert24.c" ),
        ( "audio/filter/af_convertsignendian.c" ),
        ( "audio/filter/af_delay.c" ),
        ( "audio/filter/af_drc.c" ),
        ( "audio/filter/af_dummy.c" ),
        ( "audio/filter/af_equalizer.c" ),
        ( "audio/filter/af_export.c",            "sys-mman-h" ),
        ( "audio/filter/af_extrastereo.c" ),
        ( "audio/filter/af_format.c" ),
        ( "audio/filter/af_hrtf.c" ),
        ( "audio/filter/af_karaoke.c" ),
        ( "audio/filter/af_ladspa.c",            "ladspa" ),
        ( "audio/filter/af_lavcac3enc.c" ),
        ( "audio/filter/af_lavfi.c",             "libavfilter" ),
        ( "audio/filter/af_lavrresample.c" ),
        ( "audio/filter/af_pan.c" ),
        ( "audio/filter/af_scaletempo.c" ),
        ( "audio/filter/af_sinesuppress.c" ),
        ( "audio/filter/af_sub.c" ),
        ( "audio/filter/af_surround.c" ),
        ( "audio/filter/af_sweep.c" ),
        ( "audio/filter/af_volume.c" ),
        ( "audio/filter/filter.c" ),
        ( "audio/filter/tools.c" ),
        ( "audio/filter/window.c" ),
        ( "audio/out/ao.c" ),
        ( "audio/out/ao_alsa.c",                 "alsa" ),
        ( "audio/out/ao_coreaudio.c",            "coreaudio" ),
        ( "audio/out/ao_coreaudio_device.c",     "coreaudio" ),
        ( "audio/out/ao_coreaudio_properties.c", "coreaudio" ),
        ( "audio/out/ao_coreaudio_utils.c",      "coreaudio" ),
        ( "audio/out/ao_dsound.c",               "dsound" ),
        ( "audio/out/ao_jack.c",                 "jack" ),
        ( "audio/out/ao_lavc.c",                 "encoding" ),
        ( "audio/out/ao_null.c" ),
        ( "audio/out/ao_openal.c",               "openal" ),
        ( "audio/out/ao_oss.c",                  "oss-audio" ),
        ( "audio/out/ao_pcm.c" ),
        ( "audio/out/ao_portaudio.c",            "portaudio" ),
        ( "audio/out/ao_pulse.c",                "pulse" ),
        ( "audio/out/ao_rsound.c",               "rsound" ),
        ( "audio/out/ao_sdl.c",                  "sdl1" ),
        ( "audio/out/ao_sdl.c",                  "sdl2" ),
        ( "audio/out/ao_sndio.c",                "sndio" ),
        ( "audio/out/ao_wasapi.c",               "wasapi" ),
        ( "audio/out/ao_wasapi_utils.c",         "wasapi" ),
        ( "audio/out/pull.c" ),
        ( "audio/out/push.c" ),

        ## Core
        ( "common/av_common.c" ),
        ( "common/av_log.c" ),
        ( "common/codecs.c" ),
        ( "common/encode_lavc.c",                "encoding" ),
        ( "common/common.c" ),
        ( "common/tags.c" ),
        ( "common/msg.c" ),
        ( "common/playlist.c" ),
        ( "common/version.c" ),

        ## Demuxers
        ( "demux/codec_tags.c" ),
        ( "demux/demux.c" ),
        ( "demux/demux_cue.c" ),
        ( "demux/demux_disc.c" ),
        ( "demux/demux_edl.c" ),
        ( "demux/demux_lavf.c" ),
        ( "demux/demux_libass.c",                "libass"),
        ( "demux/demux_mf.c" ),
        ( "demux/demux_mkv.c" ),
        ( "demux/demux_playlist.c" ),
        ( "demux/demux_raw.c" ),
        ( "demux/demux_subreader.c" ),
        ( "demux/demux_tv.c",                    "tv" ),
        ( "demux/ebml.c" ),
        ( "demux/mf.c" ),
        ( "demux/packet.c" ),

        ## Input
        ( "input/cmd_list.c" ),
        ( "input/cmd_parse.c" ),
        ( "input/event.c" ),
        ( "input/input.c" ),
        ( "input/keycodes.c" ),
        ( "input/pipe-unix.c",                   "!mingw" ),
        ( "input/pipe-win32.c",                  "waio" ),
        ( "input/joystick.c",                    "joystick" ),
        ( "input/lirc.c",                        "lirc" ),

        ## Misc
        ( "misc/bstr.c" ),
        ( "misc/charset_conv.c" ),
        ( "misc/dispatch.c" ),
        ( "misc/ring.c" ),
        ( "misc/rendezvous.c" ),

        ## Options
        ( "options/m_config.c" ),
        ( "options/m_option.c" ),
        ( "options/m_property.c" ),
        ( "options/options.c" ),
        ( "options/parse_commandline.c" ),
        ( "options/parse_configfile.c" ),
        ( "options/path.c" ),

        ## Player
        ( "player/audio.c" ),
        ( "player/client.c" ),
        ( "player/command.c" ),
        ( "player/configfiles.c" ),
        ( "player/discnav.c" ),
        ( "player/loadfile.c" ),
        ( "player/main.c" ),
        ( "player/misc.c" ),
        ( "player/lua.c",                        "lua" ),
        ( "player/osd.c" ),
        ( "player/playloop.c" ),
        ( "player/screenshot.c" ),
        ( "player/scripting.c" ),
        ( "player/sub.c" ),
        ( "player/timeline/tl_cue.c" ),
        ( "player/timeline/tl_mpv_edl.c" ),
        ( "player/timeline/tl_matroska.c" ),
        ( "player/video.c" ),

        ## Streams
        ( "stream/ai_alsa1x.c",                  "alsa" ),
        ( "stream/ai_oss.c",                     "oss-audio" ),
        ( "stream/ai_sndio.c",                   "sndio" ),
        ( "stream/audio_in.c",                   "audio-input" ),
        ( "stream/cache.c" ),
        ( "stream/cache_file.c" ),
        ( "stream/cookies.c" ),
        ( "stream/dvb_tune.c",                   "dvbin" ),
        ( "stream/frequencies.c",                "tv" ),
        ( "stream/rar.c" ),
        ( "stream/stream.c" ),
        ( "stream/stream_avdevice.c" ),
        ( "stream/stream_bluray.c",              "libbluray" ),
        ( "stream/stream_cdda.c",                "cdda" ),
        ( "stream/stream_dvb.c",                 "dvbin" ),
        ( "stream/stream_dvd.c",                 "dvdread" ),
        ( "stream/stream_dvd_common.c",          "dvdread" ),
        ( "stream/stream_dvdnav.c",              "dvdnav" ),
        ( "stream/stream_edl.c" ),
        ( "stream/stream_file.c" ),
        ( "stream/stream_lavf.c" ),
        ( "stream/stream_memory.c" ),
        ( "stream/stream_mf.c" ),
        ( "stream/stream_null.c" ),
        ( "stream/stream_pvr.c",                 "pvr" ),
        ( "stream/stream_rar.c" ),
        ( "stream/stream_smb.c",                 "libsmbclient" ),
        ( "stream/stream_tv.c",                  "tv" ),
        ( "stream/tv.c",                         "tv" ),
        ( "stream/tvi_dummy.c",                  "tv" ),
        ( "stream/tvi_v4l2.c",                   "tv-v4l2"),
        ( "stream/resolve/resolve_quvi.c",       "libquvi4" ),
        ( "stream/resolve/resolve_quvi9.c",      "libquvi9" ),

        ## Subtitles
        ( "sub/ass_mp.c",                        "libass"),
        ( "sub/dec_sub.c" ),
        ( "sub/draw_bmp.c" ),
        ( "sub/find_subfiles.c" ),
        ( "sub/img_convert.c" ),
        ( "sub/osd.c" ),
        ( "sub/osd_dummy.c",                     "dummy-osd" ),
        ( "sub/osd_libass.c",                    "libass-osd" ),
        ( "sub/sd_ass.c",                        "libass" ),
        ( "sub/sd_lavc.c" ),
        ( "sub/sd_lavc_conv.c" ),
        ( "sub/sd_lavf_srt.c" ),
        ( "sub/sd_microdvd.c" ),
        ( "sub/sd_movtext.c" ),
        ( "sub/sd_srt.c" ),

        ## Video
        ( "video/csputils.c" ),
        ( "video/fmt-conversion.c" ),
        ( "video/image_writer.c" ),
        ( "video/img_format.c" ),
        ( "video/mp_image.c" ),
        ( "video/mp_image_pool.c" ),
        ( "video/sws_utils.c" ),
        ( "video/vaapi.c",                       "vaapi" ),
        ( "video/vdpau.c",                       "vdpau" ),
        ( "video/vdpau_mixer.c",                 "vdpau" ),
        ( "video/decode/dec_video.c"),
        ( "video/decode/vaapi.c",                "vaapi-hwaccel" ),
        ( "video/decode/vd_lavc.c" ),
        ( "video/decode/vda.c",                  "vda-hwaccel" ),
        ( "video/decode/vdpau.c",                "vdpau-hwaccel" ),
        ( "video/filter/pullup.c" ),
        ( "video/filter/vf.c" ),
        ( "video/filter/vf_buffer.c" ),
        ( "video/filter/vf_crop.c" ),
        ( "video/filter/vf_delogo.c" ),
        ( "video/filter/vf_divtc.c" ),
        ( "video/filter/vf_dlopen.c",            "dlopen" ),
        ( "video/filter/vf_dsize.c" ),
        ( "video/filter/vf_eq.c" ),
        ( "video/filter/vf_expand.c" ),
        ( "video/filter/vf_flip.c" ),
        ( "video/filter/vf_format.c" ),
        ( "video/filter/vf_gradfun.c" ),
        ( "video/filter/vf_hqdn3d.c" ),
        ( "video/filter/vf_ilpack.c" ),
        ( "video/filter/vf_lavfi.c",             "libavfilter"),
        ( "video/filter/vf_mirror.c" ),
        ( "video/filter/vf_noformat.c" ),
        ( "video/filter/vf_noise.c" ),
        ( "video/filter/vf_phase.c" ),
        ( "video/filter/vf_pp.c",                "libpostproc" ),
        ( "video/filter/vf_pullup.c" ),
        ( "video/filter/vf_rotate.c" ),
        ( "video/filter/vf_scale.c" ),
        ( "video/filter/vf_screenshot.c" ),
        ( "video/filter/vf_softpulldown.c" ),
        ( "video/filter/vf_stereo3d.c" ),
        ( "video/filter/vf_sub.c" ),
        ( "video/filter/vf_swapuv.c" ),
        ( "video/filter/vf_unsharp.c" ),
        ( "video/filter/vf_vapoursynth.c",       "vapoursynth" ),
        ( "video/filter/vf_vavpp.c",             "vaapi-vpp"),
        ( "video/filter/vf_vdpaupp.c",           "vdpau" ),
        ( "video/filter/vf_yadif.c" ),
        ( "video/out/aspect.c" ),
        ( "video/out/bitmap_packer.c" ),
        ( "video/out/cocoa/additions.m",         "cocoa" ),
        ( "video/out/cocoa/view.m",              "cocoa" ),
        ( "video/out/cocoa/window.m",            "cocoa" ),
        ( "video/out/cocoa_common.m",            "cocoa" ),
        ( "video/out/dither.c" ),
        ( "video/out/filter_kernels.c" ),
        ( "video/out/gl_cocoa.c",                "gl-cocoa" ),
        ( "video/out/gl_common.c",               "gl" ),
        ( "video/out/gl_hwdec_vaglx.c",          "vaapi-glx" ),
        ( "video/out/gl_hwdec_vda.c",            "vda-gl" ),
        ( "video/out/gl_hwdec_vdpau.c",          "vdpau-gl-x11" ),
        ( "video/out/gl_lcms.c",                 "gl" ),
        ( "video/out/gl_osd.c",                  "gl" ),
        ( "video/out/gl_video.c",                "gl" ),
        ( "video/out/gl_w32.c",                  "gl-win32" ),
        ( "video/out/gl_wayland.c",              "gl-wayland" ),
        ( "video/out/gl_x11.c",                  "gl-x11" ),
        ( "video/out/pnm_loader.c",              "gl" ),
        ( "video/out/vo.c" ),
        ( "video/out/vo_caca.c",                 "caca" ),
        ( "video/out/vo_direct3d.c",             "direct3d" ),
        ( "video/out/vo_image.c" ),
        ( "video/out/vo_lavc.c",                 "encoding" ),
        ( "video/out/vo_null.c" ),
        ( "video/out/vo_opengl.c",               "gl" ),
        ( "video/out/vo_opengl_old.c",           "gl" ),
        ( "video/out/vo_sdl.c",                  "sdl2" ),
        ( "video/out/vo_vaapi.c",                "vaapi" ),
        ( "video/out/vo_vdpau.c",                "vdpau" ),
        ( "video/out/vo_wayland.c",              "wayland" ),
        ( "video/out/vo_x11.c" ,                 "x11" ),
        ( "video/out/vo_xv.c",                   "xv" ),
        ( "video/out/w32_common.c",              "gdi" ),
        ( "video/out/wayland_common.c",          "wayland" ),
        ( "video/out/wayland/buffer.c",          "wayland" ),
        ( "video/out/wayland/memfile.c",         "wayland" ),
        ( "video/out/win_state.c"),
        ( "video/out/x11_common.c",              "x11" ),

        ## osdep
        ( getch2_c ),
        ( "osdep/io.c" ),
        ( "osdep/numcores.c"),
        ( "osdep/timer.c" ),
        ( timer_c ),
        ( "osdep/threads.c" ),

        ( "osdep/ar/HIDRemote.m",                "cocoa" ),
        ( "osdep/macosx_application.m",          "cocoa-application" ),
        ( "osdep/macosx_events.m",               "cocoa" ),
        ( "osdep/semaphore_osx.c" ),
        ( "osdep/path-macosx.m",                 "cocoa" ),
        ( "osdep/path-win.c",                    "os-win32" ),
        ( "osdep/path-win.c",                    "os-cygwin" ),
        ( "osdep/glob-win.c",                    "glob-win32-replacement" ),
        ( "osdep/w32_keyboard.c",                "os-win32" ),
        ( "osdep/w32_keyboard.c",                "os-cygwin" ),
        ( "osdep/mpv.rc",                        "win32-executable" ),

        ## tree_allocator
        "ta/ta.c", "ta/ta_talloc.c", "ta/ta_utils.c"
    ]

    if ctx.dependency_satisfied('win32-executable'):
        from waflib import TaskGen

        TaskGen.declare_chain(
            name    = 'windres',
            rule    = '${WINDRES} ${WINDRES_FLAGS} ${SRC} ${TGT}',
            ext_in  = '.rc',
            ext_out = '-rc.o',
            color   = 'PINK')

        ctx.env.WINDRES_FLAGS = [
            '--include-dir={0}'.format(ctx.bldnode.abspath()),
            '--include-dir={0}'.format(ctx.srcnode.abspath())
        ]

        for node in 'osdep/mpv.exe.manifest etc/mpv-icon.ico'.split():
            ctx.add_manual_dependency(
                ctx.path.find_node('osdep/mpv.rc'),
                ctx.path.find_node(node))

    cprog_kwargs = {}
    if ctx.dependency_satisfied('macosx-bundle'):
        import os
        basepath = 'TOOLS/osxbundle/mpv.app/Contents'
        cprog_kwargs['mac_app']   = True
        cprog_kwargs['mac_plist'] = os.path.join(basepath, 'Info.plist')

        resources_glob  = os.path.join(basepath, 'Resources', '*')
        resources_nodes = ctx.srcnode.ant_glob(resources_glob)
        resources       = [node.srcpath() for node in resources_nodes]
        cprog_kwargs['mac_resources'] = resources

        for resource in resources:
            res_basename = os.path.basename(resource)
            install_name = '/mpv.app/Contents/Resources/' + res_basename
            ctx.install_as(ctx.env.BINDIR + install_name, resource)


    if ctx.dependency_satisfied('cplayer'):
        ctx(
            target       = "mpv",
            source       = ctx.filtered_sources(sources) + ["player/main_fn.c"],
            use          = ctx.dependencies_use(),
            includes     = [ctx.bldnode.abspath(), ctx.srcnode.abspath()] + \
                           ctx.dependencies_includes(),
            features     = "c cprogram",
            install_path = ctx.env.BINDIR,
            **cprog_kwargs
        )

    build_shared = ctx.dependency_satisfied('libmpv-shared')
    build_static = ctx.dependency_satisfied('libmpv-static')
    if build_shared or build_static:
        if build_shared:
            import os
            waftoolsdir = os.path.join(os.path.dirname(__file__), "waftools")
            ctx.load("syms", tooldir=waftoolsdir)
        vre = '^#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION\((.*), (.*)\)$'
        libmpv_header = ctx.path.find_node("libmpv/client.h").read()
        major, minor = re.search(vre, libmpv_header, re.M).groups()
        libversion = major + '.' + minor + '.0'

        def _build_libmpv(shared):
            features = "c "
            if shared:
                features += "cshlib syms"
            else:
                features += "cstlib"
            ctx(
                target       = "mpv",
                source       = ctx.filtered_sources(sources),
                use          = ctx.dependencies_use(),
                includes     = [ctx.bldnode.abspath(), ctx.srcnode.abspath()] + \
                                ctx.dependencies_includes(),
                features     = features,
                export_symbols_def = "libmpv/mpv.def",
                install_path = ctx.env.LIBDIR,
                vnum         = libversion,
            )
        if build_shared:
            _build_libmpv(True)
        if build_static:
            _build_libmpv(False)

        def get_deps():
            res = ""
            for k in ctx.env.keys():
                if k.startswith("LIB_") and k != "LIB_ST":
                    res += " ".join(["-l" + x for x in ctx.env[k]]) + " "
            return res

        ctx(
            target       = 'libmpv/mpv.pc',
            source       = 'libmpv/mpv.pc.in',
            features     = 'subst',
            PREFIX       = ctx.env.PREFIX,
            LIBDIR       = ctx.env.LIBDIR,
            INCDIR       = ctx.env.INCDIR,
            VERSION      = libversion,
            PRIV_LIBS    = get_deps(),
        )

        headers = ["client.h"]
        for f in headers:
            ctx.install_as(ctx.env.INCDIR + '/mpv/' + f, 'libmpv/' + f)

        ctx.install_as(ctx.env.LIBDIR + '/pkgconfig/mpv.pc', 'libmpv/mpv.pc')

    if ctx.dependency_satisfied('client-api-examples'):
        # This assumes all examples are single-file (as examples should be)
        for f in ["simple"]:
            ctx(
                target       = f,
                source       = "DOCS/client_api_examples/" + f + ".c",
                includes     = [ctx.bldnode.abspath(), ctx.srcnode.abspath()],
                use          = "mpv",
                features     = "c cprogram",
                install_path = None
            )

    if ctx.env.DEST_OS == 'win32':
        wrapctx = ctx(
            target       = "mpv",
            source       = ['osdep/win32-console-wrapper.c'],
            features     = "c cprogram",
            install_path = ctx.env.BINDIR
        )

        wrapctx.env.cprogram_PATTERN = "%s.com"
        wrapflags = ['-municode', '-mconsole']
        wrapctx.env.CFLAGS = wrapflags
        wrapctx.env.LAST_LINKFLAGS = wrapflags

    if ctx.dependency_satisfied('macosx-bundle'):
        from waflib import Utils
        ctx.install_files(ctx.env.BINDIR, 'mpv', chmod=Utils.O755)

    if ctx.dependency_satisfied("vf-dlopen-filters"):
        dlfilters = "showqscale telecine tile rectangle framestep \
                     ildetect".split()
        for dlfilter in dlfilters:
            ctx(
                target       = dlfilter,
                source       = ['TOOLS/vf_dlopen/'+dlfilter+'.c',
                                'TOOLS/vf_dlopen/filterutils.c'],
                includes     = [ctx.srcnode.abspath() + '/video/filter'],
                features     = 'c cshlib',
                install_path = ctx.env.LIBDIR + '/mpv' )

    if ctx.dependency_satisfied('manpage-build'):
        _build_man(ctx)

    if ctx.dependency_satisfied('pdf-build'):
        _build_pdf(ctx)

    if ctx.dependency_satisfied('zsh-comp'):
        ctx.zshcomp(target = "etc/_mpv")
        ctx.install_files(
            ctx.env.DATADIR + '/zsh/vendor-completions',
            ['etc/_mpv'])

    ctx.install_files(
        ctx.env.DATADIR + '/applications',
        ['etc/mpv.desktop'] )

    ctx.install_files(ctx.env.CONFDIR, ['etc/encoding-profiles.conf'] )

    for size in '16x16 32x32 64x64'.split():
        ctx.install_as(
            ctx.env.DATADIR + '/icons/hicolor/' + size + '/apps/mpv.png',
            'etc/mpv-icon-8bit-' + size + '.png')
示例#42
0
def build(ctx):
    ctx.load('waf_customizations')
    ctx.load('generators.sources')

    ctx.file2string(
        source = "TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icns",
        target = "osdep/macosx_icon.inc")

    ctx.file2string(
        source = "video/out/x11_icon.bin",
        target = "video/out/x11_icon.inc")

    ctx.file2string(
        source = "etc/input.conf",
        target = "input/input_conf.h")

    ctx.file2string(
        source = "video/out/gl_video_shaders.glsl",
        target = "video/out/gl_video_shaders.h")

    ctx.file2string(
        source = "sub/osd_font.otf",
        target = "sub/osd_font.h")

    ctx.file2string(
        source = "player/lua/defaults.lua",
        target = "player/lua/defaults.inc")

    ctx.file2string(
        source = "player/lua/assdraw.lua",
        target = "player/lua/assdraw.inc")

    ctx.file2string(
        source = "player/lua/osc.lua",
        target = "player/lua/osc.inc")

    ctx.matroska_header(
        source = "demux/ebml.c demux/demux_mkv.c",
        target = "ebml_types.h")

    ctx.matroska_definitions(
        source = "demux/ebml.c",
        target = "ebml_defs.c")

    getch2_c = {
        'win32':  'osdep/terminal-win.c',
    }.get(ctx.env.DEST_OS, "osdep/terminal-unix.c")

    timer_c = {
        'win32':  'osdep/timer-win2.c',
        'darwin': 'osdep/timer-darwin.c',
    }.get(ctx.env.DEST_OS, "osdep/timer-linux.c")

    sources = [
        ## Audio
        ( "audio/audio.c" ),
        ( "audio/audio_buffer.c" ),
        ( "audio/chmap.c" ),
        ( "audio/chmap_sel.c" ),
        ( "audio/fmt-conversion.c" ),
        ( "audio/format.c" ),
        ( "audio/mixer.c" ),
        ( "audio/decode/ad_lavc.c" ),
        ( "audio/decode/ad_mpg123.c",            "mpg123" ),
        ( "audio/decode/ad_spdif.c" ),
        ( "audio/decode/dec_audio.c" ),
        ( "audio/filter/af.c" ),
        ( "audio/filter/af_bs2b.c",              "libbs2b" ),
        ( "audio/filter/af_center.c" ),
        ( "audio/filter/af_channels.c" ),
        ( "audio/filter/af_convert24.c" ),
        ( "audio/filter/af_convertsignendian.c" ),
        ( "audio/filter/af_delay.c" ),
        ( "audio/filter/af_drc.c" ),
        ( "audio/filter/af_dummy.c" ),
        ( "audio/filter/af_equalizer.c" ),
        ( "audio/filter/af_export.c",            "sys-mman-h" ),
        ( "audio/filter/af_extrastereo.c" ),
        ( "audio/filter/af_format.c" ),
        ( "audio/filter/af_hrtf.c" ),
        ( "audio/filter/af_karaoke.c" ),
        ( "audio/filter/af_ladspa.c",            "ladspa" ),
        ( "audio/filter/af_lavcac3enc.c" ),
        ( "audio/filter/af_lavfi.c",             "libavfilter" ),
        ( "audio/filter/af_lavrresample.c" ),
        ( "audio/filter/af_pan.c" ),
        ( "audio/filter/af_scaletempo.c" ),
        ( "audio/filter/af_sinesuppress.c" ),
        ( "audio/filter/af_sub.c" ),
        ( "audio/filter/af_surround.c" ),
        ( "audio/filter/af_sweep.c" ),
        ( "audio/filter/af_volume.c" ),
        ( "audio/filter/filter.c" ),
        ( "audio/filter/tools.c" ),
        ( "audio/filter/window.c" ),
        ( "audio/out/ao.c" ),
        ( "audio/out/ao_alsa.c",                 "alsa" ),
        ( "audio/out/ao_coreaudio.c",            "coreaudio" ),
        ( "audio/out/ao_coreaudio_properties.c", "coreaudio" ),
        ( "audio/out/ao_coreaudio_utils.c",      "coreaudio" ),
        ( "audio/out/ao_dsound.c",               "dsound" ),
        ( "audio/out/ao_jack.c",                 "jack" ),
        ( "audio/out/ao_lavc.c",                 "encoding" ),
        ( "audio/out/ao_null.c" ),
        ( "audio/out/ao_openal.c",               "openal" ),
        ( "audio/out/ao_oss.c",                  "oss-audio" ),
        ( "audio/out/ao_pcm.c" ),
        ( "audio/out/ao_portaudio.c",            "portaudio" ),
        ( "audio/out/ao_pulse.c",                "pulse" ),
        ( "audio/out/ao_rsound.c",               "rsound" ),
        ( "audio/out/ao_sdl.c",                  "sdl1" ),
        ( "audio/out/ao_sdl.c",                  "sdl2" ),
        ( "audio/out/ao_sndio.c",                "sndio" ),
        ( "audio/out/ao_wasapi.c",               "wasapi" ),
        ( "audio/out/ao_wasapi_utils.c",         "wasapi" ),
        ( "audio/out/pull.c" ),
        ( "audio/out/push.c" ),

        ## Bstr
        ( "bstr/bstr.c" ),

        ## Core
        ( "common/av_common.c" ),
        ( "common/av_log.c" ),
        ( "common/av_opts.c" ),
        ( "common/codecs.c" ),
        ( "common/encode_lavc.c",                "encoding" ),
        ( "common/common.c" ),
        ( "common/tags.c" ),
        ( "common/msg.c" ),
        ( "common/playlist.c" ),
        ( "common/version.c" ),

        ## Demuxers
        ( "demux/codec_tags.c" ),
        ( "demux/demux.c" ),
        ( "demux/demux_cue.c" ),
        ( "demux/demux_edl.c" ),
        ( "demux/demux_lavf.c" ),
        ( "demux/demux_libass.c",                "libass"),
        ( "demux/demux_mf.c" ),
        ( "demux/demux_mkv.c" ),
        ( "demux/demux_playlist.c" ),
        ( "demux/demux_raw.c" ),
        ( "demux/demux_subreader.c" ),
        ( "demux/ebml.c" ),
        ( "demux/mf.c" ),

        ## Input
        ( "input/cmd_list.c" ),
        ( "input/cmd_parse.c" ),
        ( "input/event.c" ),
        ( "input/input.c" ),
        ( "input/keycodes.c" ),
        ( "input/joystick.c",                    "joystick" ),
        ( "input/lirc.c",                        "lirc" ),

        ## Misc
        ( "misc/charset_conv.c" ),
        ( "misc/dispatch.c" ),
        ( "misc/ring.c" ),

        ## Options
        ( "options/m_config.c" ),
        ( "options/m_option.c" ),
        ( "options/m_property.c" ),
        ( "options/options.c" ),
        ( "options/parse_commandline.c" ),
        ( "options/parse_configfile.c" ),
        ( "options/path.c" ),

        ## Player
        ( "player/audio.c" ),
        ( "player/client.c" ),
        ( "player/command.c" ),
        ( "player/configfiles.c" ),
        ( "player/discnav.c" ),
        ( "player/loadfile.c" ),
        ( "player/main.c" ),
        ( "player/misc.c" ),
        ( "player/lua.c",                        "lua" ),
        ( "player/osd.c" ),
        ( "player/playloop.c" ),
        ( "player/screenshot.c" ),
        ( "player/sub.c" ),
        ( "player/timeline/tl_cue.c" ),
        ( "player/timeline/tl_mpv_edl.c" ),
        ( "player/timeline/tl_matroska.c" ),
        ( "player/video.c" ),

        ## Streams
        ( "stream/ai_alsa1x.c",                  "alsa" ),
        ( "stream/ai_oss.c",                     "oss-audio" ),
        ( "stream/ai_sndio.c",                   "sndio" ),
        ( "stream/audio_in.c",                   "audio-input" ),
        ( "stream/cache.c" ),
        ( "stream/cookies.c" ),
        ( "stream/dvb_tune.c",                   "dvbin" ),
        ( "stream/frequencies.c",                "tv" ),
        ( "stream/rar.c" ),
        ( "stream/stream.c" ),
        ( "stream/stream_avdevice.c" ),
        ( "stream/stream_bluray.c",              "libbluray" ),
        ( "stream/stream_cdda.c",                "cdda" ),
        ( "stream/stream_dvb.c",                 "dvbin" ),
        ( "stream/stream_dvd.c",                 "dvdread" ),
        ( "stream/stream_dvd_common.c",          "dvdread" ),
        ( "stream/stream_dvdnav.c",              "dvdnav" ),
        ( "stream/stream_edl.c" ),
        ( "stream/stream_file.c" ),
        ( "stream/stream_lavf.c" ),
        ( "stream/stream_memory.c" ),
        ( "stream/stream_mf.c" ),
        ( "stream/stream_null.c" ),
        ( "stream/stream_pvr.c",                 "pvr" ),
        ( "stream/stream_rar.c" ),
        ( "stream/stream_smb.c",                 "libsmbclient" ),
        ( "stream/stream_tv.c",                  "tv" ),
        ( "stream/stream_vcd.c",                 "vcd" ),
        ( "stream/tv.c",                         "tv" ),
        ( "stream/tvi_dummy.c",                  "tv" ),
        ( "stream/tvi_v4l2.c",                   "tv-v4l2"),
        ( "stream/resolve/resolve_quvi.c",       "libquvi4" ),
        ( "stream/resolve/resolve_quvi9.c",      "libquvi9" ),

        ## Subtitles
        ( "sub/ass_mp.c",                        "libass"),
        ( "sub/dec_sub.c" ),
        ( "sub/draw_bmp.c" ),
        ( "sub/find_subfiles.c" ),
        ( "sub/img_convert.c" ),
        ( "sub/osd.c" ),
        ( "sub/osd_dummy.c",                     "dummy-osd" ),
        ( "sub/osd_libass.c",                    "libass-osd" ),
        ( "sub/sd_ass.c",                        "libass" ),
        ( "sub/sd_lavc.c" ),
        ( "sub/sd_lavc_conv.c" ),
        ( "sub/sd_lavf_srt.c" ),
        ( "sub/sd_microdvd.c" ),
        ( "sub/sd_movtext.c" ),
        ( "sub/sd_srt.c" ),

        ## Video
        ( "video/csputils.c" ),
        ( "video/fmt-conversion.c" ),
        ( "video/image_writer.c" ),
        ( "video/img_format.c" ),
        ( "video/mp_image.c" ),
        ( "video/mp_image_pool.c" ),
        ( "video/sws_utils.c" ),
        ( "video/vaapi.c",                       "vaapi" ),
        ( "video/vdpau.c",                       "vdpau" ),
        ( "video/vdpau_mixer.c",                 "vdpau" ),
        ( "video/decode/dec_video.c"),
        ( "video/decode/vaapi.c",                "vaapi-hwaccel" ),
        ( "video/decode/vd_lavc.c" ),
        ( "video/decode/vda.c",                  "vda-hwaccel" ),
        ( "video/decode/vdpau.c",                "vdpau-hwaccel" ),
        ( "video/filter/pullup.c" ),
        ( "video/filter/vf.c" ),
        ( "video/filter/vf_crop.c" ),
        ( "video/filter/vf_delogo.c" ),
        ( "video/filter/vf_divtc.c" ),
        ( "video/filter/vf_dlopen.c",            "dlopen" ),
        ( "video/filter/vf_dsize.c" ),
        ( "video/filter/vf_eq.c" ),
        ( "video/filter/vf_expand.c" ),
        ( "video/filter/vf_flip.c" ),
        ( "video/filter/vf_format.c" ),
        ( "video/filter/vf_gradfun.c" ),
        ( "video/filter/vf_hqdn3d.c" ),
        ( "video/filter/vf_ilpack.c" ),
        ( "video/filter/vf_lavfi.c",             "libavfilter"),
        ( "video/filter/vf_mirror.c" ),
        ( "video/filter/vf_noformat.c" ),
        ( "video/filter/vf_noise.c" ),
        ( "video/filter/vf_phase.c" ),
        ( "video/filter/vf_pp.c",                "libpostproc" ),
        ( "video/filter/vf_pullup.c" ),
        ( "video/filter/vf_rotate.c" ),
        ( "video/filter/vf_scale.c" ),
        ( "video/filter/vf_screenshot.c" ),
        ( "video/filter/vf_softpulldown.c" ),
        ( "video/filter/vf_stereo3d.c" ),
        ( "video/filter/vf_sub.c" ),
        ( "video/filter/vf_swapuv.c" ),
        ( "video/filter/vf_unsharp.c" ),
        ( "video/filter/vf_vapoursynth.c",       "vapoursynth" ),
        ( "video/filter/vf_vavpp.c",             "vaapi-vpp"),
        ( "video/filter/vf_vdpaupp.c",           "vdpau" ),
        ( "video/filter/vf_yadif.c" ),
        ( "video/out/aspect.c" ),
        ( "video/out/bitmap_packer.c" ),
        ( "video/out/cocoa/additions.m",         "cocoa" ),
        ( "video/out/cocoa/view.m",              "cocoa" ),
        ( "video/out/cocoa/window.m",            "cocoa" ),
        ( "video/out/cocoa_common.m",            "cocoa" ),
        ( "video/out/dither.c" ),
        ( "video/out/filter_kernels.c" ),
        ( "video/out/gl_cocoa.c",                "gl-cocoa" ),
        ( "video/out/gl_common.c",               "gl" ),
        ( "video/out/gl_hwdec_vaglx.c",          "vaapi-glx" ),
        ( "video/out/gl_hwdec_vda.c",            "vda-gl" ),
        ( "video/out/gl_hwdec_vdpau.c",          "vdpau-gl-x11" ),
        ( "video/out/gl_lcms.c",                 "gl" ),
        ( "video/out/gl_osd.c",                  "gl" ),
        ( "video/out/gl_video.c",                "gl" ),
        ( "video/out/gl_w32.c",                  "gl-win32" ),
        ( "video/out/gl_wayland.c",              "gl-wayland" ),
        ( "video/out/gl_x11.c",                  "gl-x11" ),
        ( "video/out/pnm_loader.c",              "gl" ),
        ( "video/out/vo.c" ),
        ( "video/out/vo_caca.c",                 "caca" ),
        ( "video/out/vo_corevideo.c",            "corevideo"),
        ( "video/out/vo_direct3d.c",             "direct3d" ),
        ( "video/out/vo_image.c" ),
        ( "video/out/vo_lavc.c",                 "encoding" ),
        ( "video/out/vo_null.c" ),
        ( "video/out/vo_opengl.c",               "gl" ),
        ( "video/out/vo_opengl_old.c",           "gl" ),
        ( "video/out/vo_sdl.c",                  "sdl2" ),
        ( "video/out/vo_vaapi.c",                "vaapi" ),
        ( "video/out/vo_vdpau.c",                "vdpau" ),
        ( "video/out/vo_wayland.c",              "wayland" ),
        ( "video/out/vo_x11.c" ,                 "x11" ),
        ( "video/out/vo_xv.c",                   "xv" ),
        ( "video/out/w32_common.c",              "gdi" ),
        ( "video/out/wayland_common.c",          "wayland" ),
        ( "video/out/win_state.c"),
        ( "video/out/x11_common.c",              "x11" ),

        ## osdep
        ( getch2_c ),
        ( "osdep/io.c" ),
        ( "osdep/numcores.c"),
        ( "osdep/timer.c" ),
        ( timer_c ),
        ( "osdep/threads.c" ),

        ( "osdep/ar/HIDRemote.m",                "cocoa" ),
        ( "osdep/macosx_application.m",          "cocoa" ),
        ( "osdep/macosx_events.m",               "cocoa" ),
        ( "osdep/path-macosx.m",                 "cocoa" ),

        ( "osdep/path-win.c",                    "os-win32" ),
        ( "osdep/path-win.c",                    "os-cygwin" ),
        ( "osdep/glob-win.c",                    "glob-win32-replacement" ),
        ( "osdep/priority.c",                    "priority" ),
        ( "osdep/w32_keyboard.c",                "os-win32" ),
        ( "osdep/w32_keyboard.c",                "os-cygwin" ),
        ( "osdep/mpv.rc",                        "win32-executable" ),

        ## tree_allocator
        "ta/ta.c", "ta/ta_talloc.c", "ta/ta_utils.c"
    ]

    if ctx.dependency_satisfied('win32-executable'):
        from waflib import TaskGen

        TaskGen.declare_chain(
            name    = 'windres',
            rule    = '${WINDRES} ${WINDRES_FLAGS} ${SRC} ${TGT}',
            ext_in  = '.rc',
            ext_out = '-rc.o',
            color   = 'PINK')

        ctx.env.WINDRES_FLAGS = [
            '--include-dir={0}'.format(ctx.bldnode.abspath()),
            '--include-dir={0}'.format(ctx.srcnode.abspath())
        ]

        for node in 'osdep/mpv.exe.manifest etc/mpv-icon.ico'.split():
            ctx.add_manual_dependency(
                ctx.path.find_node('osdep/mpv.rc'),
                ctx.path.find_node(node))

    cprog_kwargs = {}
    if ctx.dependency_satisfied('macosx-bundle'):
        import os
        basepath = 'TOOLS/osxbundle/mpv.app/Contents'
        cprog_kwargs['mac_app']   = True
        cprog_kwargs['mac_plist'] = os.path.join(basepath, 'Info.plist')

        resources_glob  = os.path.join(basepath, 'Resources', '*')
        resources_nodes = ctx.srcnode.ant_glob(resources_glob)
        resources       = [node.srcpath() for node in resources_nodes]
        cprog_kwargs['mac_resources'] = resources

        for resource in resources:
            res_basename = os.path.basename(resource)
            install_name = '/mpv.app/Contents/Resources/' + res_basename
            ctx.install_as(ctx.env.BINDIR + install_name, resource)

    ctx(
        target       = "mpv",
        source       = ctx.filtered_sources(sources) + ["player/main_fn.c"],
        use          = ctx.dependencies_use(),
        includes     = [ctx.bldnode.abspath(), ctx.srcnode.abspath()] + \
                       ctx.dependencies_includes(),
        features     = "c cprogram",
        install_path = ctx.env.BINDIR,
        **cprog_kwargs
    )

    if ctx.dependency_satisfied('libmpv-shared'):
        ctx.load("syms")
        vnum = int(re.search('^#define MPV_CLIENT_API_VERSION 0x(.*)UL$',
                             ctx.path.find_node("libmpv/client.h").read(),
                             re.M)
                   .group(1), 16)
        libversion = (str(vnum >> 24) + '.' +
                      str((vnum >> 16) & 0xff) + '.' +
                      str(vnum & 0xffff))
        ctx(
            target       = "mpv",
            source       = ctx.filtered_sources(sources),
            use          = ctx.dependencies_use(),
            includes     = [ctx.bldnode.abspath(), ctx.srcnode.abspath()] + \
                            ctx.dependencies_includes(),
            features     = "c cshlib syms",
            export_symbols_regex = 'mpv_.*',
            install_path = ctx.env.LIBDIR,
            vnum         = libversion,
        )

        ctx(
            target       = 'libmpv/mpv.pc',
            source       = 'libmpv/mpv.pc.in',
            features     = 'subst',
            PREFIX       = ctx.env.PREFIX,
            LIBDIR       = ctx.env.LIBDIR,
            INCDIR       = ctx.env.INCDIR,
            VERSION      = libversion,
        )

        headers = ["client.h"]
        for f in headers:
            ctx.install_as(ctx.env.INCDIR + '/mpv/' + f, 'libmpv/' + f)

        ctx.install_as(ctx.env.LIBDIR + '/pkgconfig/mpv.pc', 'libmpv/mpv.pc')

    if ctx.dependency_satisfied('client-api-examples'):
        # This assumes all examples are single-file (as examples should be)
        for f in ["simple"]:
            ctx(
                target       = f,
                source       = "DOCS/client_api_examples/" + f + ".c",
                includes     = [ctx.bldnode.abspath(), ctx.srcnode.abspath()],
                use          = "mpv",
                features     = "c cprogram",
            )

    if ctx.env.DEST_OS == 'win32':
        wrapctx = ctx(
            target       = "mpv",
            source       = ['osdep/win32-console-wrapper.c'],
            features     = "c cprogram",
            install_path = ctx.env.BINDIR
        )

        wrapctx.env.cprogram_PATTERN = "%s.com"
        wrapflags = ['-municode', '-mconsole']
        wrapctx.env.CFLAGS = wrapflags
        wrapctx.env.LAST_LINKFLAGS = wrapflags

    if ctx.dependency_satisfied('macosx-bundle'):
        from waflib import Utils
        ctx.install_files(ctx.env.BINDIR, 'mpv', chmod=Utils.O755)

    if ctx.dependency_satisfied("vf-dlopen-filters"):
        dlfilters = "showqscale telecine tile rectangle framestep \
                     ildetect".split()
        for dlfilter in dlfilters:
            ctx(
                target       = dlfilter,
                source       = ['TOOLS/vf_dlopen/'+dlfilter+'.c',
                                'TOOLS/vf_dlopen/filterutils.c'],
                includes     = [ctx.srcnode.abspath() + '/video/filter'],
                features     = 'c cshlib',
                install_path = ctx.env.LIBDIR + '/mpv' )

    if ctx.dependency_satisfied('manpage-build'):
        _build_man(ctx)

    if ctx.dependency_satisfied('pdf-build'):
        _build_pdf(ctx)

    ctx.install_files(
        ctx.env.DATADIR + '/applications',
        ['etc/mpv.desktop'] )

    ctx.install_files(ctx.env.CONFDIR, ['etc/encoding-profiles.conf'] )

    for size in '16x16 32x32 64x64'.split():
        ctx.install_as(
            ctx.env.DATADIR + '/icons/hicolor/' + size + '/apps/mpv.png',
            'etc/mpv-icon-8bit-' + size + '.png')
示例#43
0
# -*- coding: utf-8 -*-
u"All *basic* coffeescript related details"
from subprocess import check_output
import sys
from pathlib import Path
from waflib import Logs, Errors, TaskGen
from waflib.Configure import conf
from waflib.Context import Context

from ._utils import copyfiles
from ._requirements import REQ as requirements

TaskGen.declare_chain(name='coffees',
                      rule='${COFFEE} --compile -o ${TGT} ${SRC}',
                      ext_in='.coffee',
                      ext_out='.js',
                      shell=False,
                      reentrant=False,
                      install_path=None)


@requirements.addcheck
def check_nodejs(cnf, _, version):
    "check for nodejs"
    mand = not sys.platform.startswith("win")
    requirements.programversion(cnf, 'node', version, mandatory=mand)


@requirements.addcheck
def check_nodejs_typescript(cnf, _, version):
    "check for coffeelint"