summaryrefslogtreecommitdiffstats
path: root/wscript_build.py
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-01-01 23:56:41 +0100
committerwm4 <wm4@nowhere>2015-01-02 00:00:03 +0100
commit4ed0907f2d596ba66652ca6d739cc12dae7dc2a0 (patch)
tree129a7b1670e0a4328d60d6cf7de7f9539d87ae09 /wscript_build.py
parentda4f7225796037b814919e79912cfaa7a9ddc113 (diff)
downloadmpv-4ed0907f2d596ba66652ca6d739cc12dae7dc2a0.tar.bz2
mpv-4ed0907f2d596ba66652ca6d739cc12dae7dc2a0.tar.xz
build: try to make examples build both in-tree and out-of-tree
The examples simple.c and cocoabasic.m can be compiled without installing libmpv. But also, they didn't use the correct include path libmpv programs normally use, so they couldn't be built with a properly installed system-libmpv. That's pretty bad for examples, which are supposed to show how to use libmpv correctly. So do some bullshit that symlinks libmpv to a "mpv" include directory under the build directory. This name-mismatch is a direct consequence of the bullshit done in 499a6758 (requested in #539 for dumb reasons). (We don't want to name the client API headers directory "mpv", because that would be too unspecific, and clashes with having the mpv binary in the same directory.) If you have spaces or other "unusual" characters in your paths, the build will break, because I couldn't find out where waf hides its function to escape shell parameters (or a way to invoke programs without involving the shell). Neither does such a thing to be documented, nor do they seem to have a clear way to do this in their code. This also doesn't compile the Qt examples, because everything becomes even more terrible from there on.
Diffstat (limited to 'wscript_build.py')
-rw-r--r--wscript_build.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/wscript_build.py b/wscript_build.py
index 694a65b038..2771bbbbec 100644
--- a/wscript_build.py
+++ b/wscript_build.py
@@ -528,15 +528,26 @@ def build(ctx):
( "cocoa/cocoabasic.m", "cocoa" ),
]
+ # Create a "local" include dir, so we can build the examples without
+ # installing the headers.
+ incdir = os.path.join(ctx.bldnode.abspath(), "include")
+ ctx(
+ rule = "mkdir -p {1} && ln -s {0} {1}/mpv".format(
+ os.path.join(ctx.srcnode.abspath(), "libmpv"), incdir),
+ before = ("c",),
+ name = "incdir",
+ )
+
for source in ctx.filtered_sources(examples_sources):
ctx(
target = os.path.splitext(source)[0],
source = "DOCS/client_api_examples/" + source,
- includes = [ctx.bldnode.abspath(), ctx.srcnode.abspath()],
- use = "mpv",
+ includes = [incdir, ctx.srcnode.abspath()],
+ use = "mpv incdir",
features = "c cprogram",
install_path = None
)
+ ctx.env.CFLAGS += ['-isystem', incdir]
if ctx.dependency_satisfied("vf-dlopen-filters"):
dlfilters = "telecine tile rectangle framestep ildetect".split()