Commit Graph

52 Commits

Author SHA1 Message Date
wm4 fe4526195a build: add some warning cflags
These were in the old configure script too.

Two flags are explicitly tested, because I have no idea how widespread
support for them is, and testing them is just easier than trying to look
them up in various gcc/clang manuals. There are people using gcc 4.2
out there, so some caution is warranted.
2014-05-14 20:42:04 +02:00
wm4 176b4abd53 build: fix OpenBSD DVD/CDROM device names
Closes #781.
2014-05-12 23:24:19 +02:00
wm4 0d916c7f96 build: removed undefined behavior from PVR check
This shouldn't matter, but it's probably better if the code to check is
valid - otherwise an extremely clever compiler might fail to compile it,
and the feature would be misdetected. (Probably.)

Found by cppcheck.
2014-05-11 16:41:02 +02:00
Martin Herkt b9474ab875 waf: make shlib tasks less noisy 2014-05-07 21:16:07 +02:00
Stefano Pigozzi ce48da9e02 build: use -pthread when available
Our code currently tries to link -lpthread and adds stuff like -D_REENTRANT
based on the target platform.

GCC actually supports to just pass a -pthread compiler and linker flag that
will automatically enable threading and define the correct symbols for the
platform, so let's try to just use that as our first choice.

clang also supports -pthread but it must be used only as a compiler flag,
so we also take care of that scenario with this commit.
2014-04-27 10:40:01 +02:00
Stefano Pigozzi ae0c8ca219 build: conditionally use -Wempty-body
-Wempty-body is not available on all gcc versions but we were using it
unconditionally. Also remove the usage from the clang case. clang still
defines `__GNUC__` so it still gets all the gcc specific flags.

This should fix the build on systems with older gcc versions like OpenBSD which
still comes bundled with gcc 4.2 for license issues.
2014-04-26 23:53:09 +02:00
wm4 0cff5836c3 Remove CPU detection and inline asm handling
Not needed anymore. I'm not opposed to having asm, but inline asm is too
much of a pain, and it was planned long ago to eventually get rid fo all
inline asm uses.

For the note, the inline asm use that was removed with the previous
commits was almost worthless. It was confined to video filters, and most
video filtering is now done with libavfilter. Some mpv filters (like
vf_pullup) actually redirect to libavfilter if possible.

If asm is added in the future, it should happen in the form of external
files.
2014-04-19 17:10:56 +02:00
wm4 78128bddda Kill all tabs
I hate tabs.

This replaces all tabs in all source files with spaces. The only
exception is old-makefile. The replacement was made by running the
GNU coreutils "expand" command on every file. Since the replacement was
automatic, it's possible that some formatting was destroyed (but perhaps
only if it was assuming that the end of a tab does not correspond to
aligning the end to multiples of 8 spaces).
2014-04-13 18:03:01 +02:00
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