Commit Graph

94 Commits

Author SHA1 Message Date
wm4 dad50c379c build: add -Wempty-body to compiler flags
Warns against "if(0);" but not "if(0){}" - perfect for our purposes.
2014-04-04 18:35:30 +02:00
wm4 98cd2c4122 build: simplify libavfilter configure checks
This is all not needed anymore. In particular, remove all configure
switches except --enable-libavfilter.
2014-03-16 13:19:29 +01:00
Ryan Goulden 3160182a7b build: fix unicode handling of the version string
Don't pass unicode types to waf ENV.
As per https://code.google.com/p/waf/issues/detail?id=1420
This directly fixes the "CFVersion" key in the .app bundle plist.
2014-03-14 22:10:22 +01:00
Stefano Pigozzi 08170c6a67 build: syms: add support for Mach-O binaries
Current code stolen from waf's extras, only supported 'pe' and 'elf'. OS X
uses the 'Mach-O' binary format (which waf calls 'mac-o'... go figure).

Add support for generating the global symbols file with nm and using it from
clang.
2014-02-19 21:56:39 +01:00
Diogo Franco (Kovensky) 99e38aee9a build: Add -U__STRICT_ANSI__ to CFLAGS on Cygwin
Cygwin's libc (newlib) doesn't obey a lot of unix feature test macros,
including _GNU_SOURCE; as a result, a lot of functions and defines get
masked out -- important defines such as M_PI and strcasecmp. Work around
it by undefining __STRICT_ANSI__ on cygwin systems.

This will still cause compilation issues on any non-cygwin system that
uses newlib, but hopefully nobody does that, or if they do, they will
find this commit message and know to add -U__STRICT_ANSI__ to their
CFLAGS. Hopefully.
2014-02-13 19:29:23 -03:00
Stefano Pigozzi 590b28c08b build: disable clang's tautological compare warnings [2]
Fixup 8009646583.
2014-02-13 23:16:12 +01:00
Stefano Pigozzi 8009646583 build: disable clang's tautological compare warnings
This silences two non issues in the client.c file. Fixing them as clang would
want us to, would introduce security bugs and potential crashes.
2014-02-13 22:43:17 +01:00
wm4 238c9b1d8d build: include a copy of syms.py from upstream waf
The alternatives to copying this small bit of code are even worse.

This is unmodified, except for the added line 3.
2014-02-10 21:08:37 +01:00
wm4 74b8223da6 build: switch to -std=c99 for saner float semantics
This fixes a weird bug with aspect ratio handling. It has to do with
float handling: with -std=gnu99, gcc implicitly enables broken non-
standard semantics giving float variables excess precision. This can for
example make this fail in theory: "float a = 0.1; assert(a == a);"

While standard C allows excess precision _within_ expressions, it
requires truncation when storing float values in variables of types
"float" or "double". The "gnu99" mode breaks this. It can be unbroken by
using "c99", or by specifying -fexcess-precision=standard. The former
seems less likely to break compilers other than modern gcc. Note that
-ffloat-store would also fix this, but also makes float expressions less
efficient and less precise for no reason.

The code that mistakenly fails because of this is dec_video.c line 393.
It caused the container aspect to be ignored in some or all situations,
depending how the compiler optimizes. For example, on gcc-4.6 with -Os,
the aspect is always ignored.

In future, we should probably just get rid of storing aspects as floats.
2014-02-02 00:00:14 +01:00
wm4 a48a1db1d0 waf: try to fix unicode/byte string messup
Some mpv builds identify with e.g. "mpv b'0.3.3' ". The version looks
like str() was called on a Python byte string. I couldn't reproduce it
on my machine (I tried with both Python 2 and 3), so I'm not exactly
sure what's going on here, but I'm hoping this commit does fix it.
2014-01-21 21:41:53 +01:00
Grzegorz Blach 8255400e9c Detect Lua on FreeBSD 2014-01-15 00:18:14 +01:00
Stefano Pigozzi fb2d418327 build: fix cocoa configure check on OS X 10.7
It failed because the 10.7 SDK doesn't natively support array and dictionary
subscripting.
2014-01-02 20:42:03 +01:00
Martin Herkt e9f577eb9a Windows: use the GUI subsystem, attach to console
This is necessary to start mpv without forcing a console window,
but also breaks console usability. A workaround is to call mpv
from a wrapper process that uses the console subsystem and helps
redirecting the standard streams and WriteConsole output to where
they belong.
2014-01-02 05:30:49 +01:00
Stefano Pigozzi f06a870b88 build: add flag for inline assembly
This is used to disable inline assembly (useful for old version of binutils
like the one in OpenBSD).
2013-12-29 17:39:18 +01:00
Stefano Pigozzi dbf879be14 build: support multiple headers in check_statement
This feature will be used in the next commit.
2013-12-26 21:13:01 +01:00
Stefano Pigozzi 652895abdc build: hide duplicate options from `--help`
Hide --enable variants from [autodetect]'ed options and --enable/--disable
variants for [enable]'d/[disable]'d options. The hidden options are still
usable, just hidden for more readability.
2013-12-26 10:09:17 +01:00
bugmen0t 20d1fc132e build: prefer 4Front OSS to native implementations
If sys/soundcard.h is actually linux/soundcard.h then it supports only OSSv3
API. This may happen when OSSLIBDIR == /usr while forgetting to replace
sys/soundcard.h from glibc.

However, after fa620ff waf prefers native implementation which is inferior
on Linux. To fix try making waf prefer oss-audio-4front. It's quite unusual
to have 4Front OSS installed where native implementation is superior, anyway.
Signed-off-by: bugmen0t <@>

Make the false positives path also undef the 4Front define.
Signed-off-by: Stefano Pigozzi <stefano.pigozzi@gmail.com>

Fixes #396
2013-12-07 17:04:34 +01:00
Stefano Pigozzi a53abbf4a6 build: fix regression in cross-compilation [2]
Fixup commit for 5cb8439015. getattr only works on dot notation.
2013-12-06 10:32:21 +01:00
Stefano Pigozzi 5cb8439015 build: fix regression in cross-compilation
Regression was introduced in bf90317ad in an attempt to fix the Lua check.
2013-12-05 21:38:16 +01:00
Stefano Pigozzi bf90317ad1 build: remove execute kwarg to check_cc when cross-compiling
This prevents waf from running test programs after compilation. A better
approach would be to only remove this option if the check actually errors,
but we are using this only for Lua anyway.
2013-12-04 19:31:28 +01:00
Stefano Pigozzi 6565c0d979 build: make deps_neg work with multiple dependencies
Previous code only worked id len(deps_neg) was 1.
2013-11-29 23:31:17 +01:00
Stefano Pigozzi fa620ffc95 build: reimplement the OSS checks using a more declarative approach
The OSS checks were a big mess and quite buggy. This reimplementes them using
a declarative approach and clearly distinguishing between the various OSS
implementations. The code should now almost be auto-documenting.

We currently support the following implementations of OSS:
 * platform-specific (with `sys/soundcard.h`)
 * SunAudio (default on NetBSD and useable on OpenBSD even if we have sndio
   support there).
 * 4Front (default on FreeBSD)

Since now each OSS check also checks for the appropriate soundcard header,
remove the old soundcard check.

Many thanks to @bugmen0t for in depth info about all the BSDs.
Check #380 and #359 for more info on this commit.
2013-11-29 23:11:12 +01:00
Stefano Pigozzi e8677aa363 build: make --disable-gl disable all the gl backends
Fixes #369
2013-11-28 09:06:43 +01:00
Stefano Pigozzi 54948f1b62 build: remove pointless exception handling in oss check 2013-11-26 21:35:37 +01:00
Stefano Pigozzi 803ff1a283 build: unbreak __get_osslibdir__ on python3
Fixes #370
2013-11-26 21:35:37 +01:00
Stefano Pigozzi 4c634762b4 build: check for pthreads with and without additional cflags 2013-11-26 14:16:29 +01:00
Stefano Pigozzi 58bf7fd1f3 build: add -mwin32 on cygwin 2013-11-26 00:33:40 +01:00
Stefano Pigozzi ded99df98a build: don't abort if our OSS implementation isn't from 4Front
Original commit was implemented differently by @bugmen0t. The problem here was
that the waf API was called directly, instead of using our own check_cc (which
defaults, among other things, to non mandatory checks).
2013-11-25 22:26:39 +01:00
Stefano Pigozzi ccb50bfdae build: run oss_audio.c check with oss cflags as well 2013-11-25 22:18:45 +01:00
bugmen0t defbe48dee build: unbreak __get_osslibdir__()
- without Utils.* always returns empty string
- subprocess doesn't need extra quoting for sh -c
- "source" is a bash'ism, not in POSIX sh
- most shell commands embed newline at the end
2013-11-25 22:16:57 +01:00
bugmen0t f26fb0098f build: only check 4Front OSS after passing its CFLAGS 2013-11-25 22:16:11 +01:00
Natanael Copa 98fca35318 build: fix construction of args to pkg-config
This makes it work with pkgconf (https://github.com/pkgconf/pkgconf)

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
2013-11-25 11:00:43 +01:00
Stefano Pigozzi efa7f8f376 build: make waf append pkgconfig flags as-is [2]
fixup commit... removes a redundant `return`
2013-11-24 16:01:38 +01:00
Stefano Pigozzi d8f1a57876 build: make waf append pkgconfig flags as-is
waf apparently only appends a pkgconfig flag if it doesn't already exist in
the lib storage. Since our configure often checks for multiple libraries in
one call we want to keep the flags as is. This is especially important to
always keep stuff like -lm in the right place.
2013-11-24 15:57:49 +01:00
Stefano Pigozzi 38b7eede1e build: store dependencies as lists
In Python sets are unordered, so iterating them after converting to a list
always leads to different results. The code iterated on them to collect all
the flags to pass to the compiler, and since the order of the flags changed,
waf would rebuild all of the C files. Seems like in Python 2 this worked as
expected by pure chance.

This commit stores the sets as lists, and converts them to sets when the set
operations are needed.

Fixes #363
2013-11-24 14:31:14 +01:00
Stefano Pigozzi 806b410c6a build: cache compiler defines on the configure context directly 2013-11-24 14:10:35 +01:00
Stefano Pigozzi 705a7310e6 build: remove unused mng fragment 2013-11-23 16:17:53 +01:00
Stefano Pigozzi 55ce26e454 build: also run the test binary during the lua checks 2013-11-23 16:17:53 +01:00
Stefano Pigozzi f315c93302 build: fix lua check to actually test for libquvi 2013-11-23 16:17:52 +01:00
Stefano Pigozzi 26f8887422 build: fix missing prototypes in lua check fragment 2013-11-23 16:17:52 +01:00
Stefano Pigozzi 22d8cdfe90 build: use static instead of prototype in libavfilter fragment 2013-11-23 16:17:52 +01:00
Stefano Pigozzi 3a0ce6acb9 build: fix libavfilter check to include function prototype
Apparently the check error'ed on some compilers for missing prototype and
simply adding one fixes it.
2013-11-23 14:55:55 +01:00
Stefano Pigozzi 7475f7d957 build: remove spam generated by link task
Simply override the cprogram Task's __str__ method with our own implementation.
This is way easier on the eyes when compiling mpv during development, since
warnings are not pushed outside of your average screenful of content.
2013-11-22 19:12:43 +01:00
Stefano Pigozzi 7e2edad8ef switch the build system to waf
This commit adds a new build system based on waf. configure and Makefile
are deprecated effective immediately and someday in the future they will be
removed (they are still available by running ./old-configure).

You can find how the choice for waf came to be in `DOCS/waf-buildsystem.rst`.
TL;DR: we couldn't get the same level of abstraction and customization with
other build systems we tried (CMake and autotools).

For guidance on how to build the software now, take a look at README.md
and the cross compilation guide.

CREDITS:
This is a squash of ~250 commits. Some of them are not by me, so here is the
deserved attribution:

 - @wm4 contributed some Windows fixes, renamed configure to old-configure
   and contributed to the bootstrap script. Also, GNU/Linux testing.
 - @lachs0r contributed some Windows fixes and the bootstrap script.
 - @Nikoli contributed a lot of testing and discovered many bugs.
 - @CrimsonVoid contributed changes to the bootstrap script.
2013-11-21 21:22:36 +01:00