Commit Graph

211 Commits

Author SHA1 Message Date
Stefano Pigozzi b7e613f261 build: add special openbsd case for iconv check
Fixes #2710
2016-02-01 23:04:23 +01:00
Stefano Pigozzi 7c804cd796 build: add option to customize config files system path
Some packagers need to install default config files to some path but
automatically load system configuration files from another path.

See #2704
2016-01-11 21:11:10 +01:00
Dmitrij D. Czarkoff a1f949d3b8 waf: add "lua51" ("51obsd") to list of possible lua names 2016-01-11 11:52:27 +01:00
James Ross-Gowan abbb43759a win32: build: set subsystem version
This sets the minimum supported Windows version to Windows Vista. The
subsystem version also affects some Windows API functions, including
GetSystemMetrics(SM_CXPADDEDBORDER).
2015-12-20 21:06:02 +11:00
James Ross-Gowan 647b360a0a w32: use DisplayConfig API to retrieve correct monitor refresh rate
This is based on an older patch by James Ross-Gowan. It was rebased and
cleaned up. Also, the DWM API usage present in the older patch was
removed, because DWM reports nonsense rates at least on Windows 8.1
(they are rounded to integers, just like with the old GDI API - except
the GDI API had a good excuse, as it could report only integers).

Signed-off-by: wm4 <wm4@nowhere>
2015-11-06 19:53:18 +01:00
wm4 0ae8aebb89 video: refactor GPU memcpy usage
Make the GPU memcpy from the dxva2 code generally useful to other parts
of the player.

We need to check at configure time whether SSE intrinsics work at all.
(At least in this form, they won't work on clang, for example. It also
won't work on non-x86.)

Introduce a mp_image_copy_gpu(), and make the dxva2 code use it. Do some
awkward stuff to share the existing code used by mp_image_copy(). I'm
hoping that FFmpeg will sooner or later provide a function like this, so
we can remove most of this again. (There is a patch, bit it's stuck in
limbo since forever.)

All this is used by the following commit.
2015-09-25 19:18:16 +02:00
Stefano Pigozzi d0e19b659e build: make sure the HAVE_ key is undefined on failure
Some particular checks can define the HAVE_ key on their own. To make sure
they work correctly when composed (with compose_checks) we force the HAVE_
key to be undefined if a check fails.
2015-08-19 00:15:41 +02:00
wm4 41101c2996 win32: revert wchar_t changes
Revert "win32: more wchar_t -> WCHAR replacements"
Revert "win32: replace wchar_t with WCHAR"

Doing a "partial" port of this makes no sense anymore from my
perspective. Revert the changes, as they're confusing without
context, maintenance, and progress. These changes were a bit
premature anyway, and might actually cause other issues
(locale neutrality etc. as it was pointed out).
2015-08-01 21:09:11 +02:00
wm4 fefac2c941 win32: more wchar_t -> WCHAR replacements
This was essentially missing from commit 0b52ac8a.

Since L"..." string literals have the type wchar_t[], we can't use them
for UTF-16 strings. Use C11 u"..." string literals instead. These have
the type char16_t[], but we simply assume char16_t is the same
underlying type as WCHAR. In practice, they're both unsigned short.

For this reason use -std=c11 on Windows. Since Windows is a "special"
environment (we require either MinGW or Cygwin), we don't need to worry
too much about compiler compatibility.
2015-07-30 21:50:11 +02:00
Stefano Pigozzi a3a453b69b build: remove useless class 2015-07-26 15:00:47 +02:00
wm4 dbf21467f0 build: always regenerate version hash
Until now, it only used the hash from the previous configure run,
instead of trying to get the latest hash. The "old" build system did
this correctly - we just have to use the existing logic in version.sh.

Since waf supports separate build dirs, extend version.sh with an
argument for setting the path of version.h.
2015-06-30 15:56:26 +02:00
Christian Hesse 5b085fd8b1 build: check for lua52
Arch linux is about to update to lua 5.3.x, but lua 5.2.x will be
provided by package lua52, which contains pkg-config file lua52.pc.

Signed-off-by: wm4 <wm4@nowhere>
2015-05-13 14:59:52 +02:00
wm4 27f7489adc build: exclude -Wredundant-decls
It's useless, and creates a bogus warning in subprocess-posix.c.

Since I don't know which compilers might have it by default, just change
it to -Wno-redundant-decls.
2015-05-09 19:59:52 +02:00
James Ross-Gowan ac7ecbe30c win32: use a platform-specific unicode entry-point
Add a platform-specific entry-point for Windows. This will allow some
platform-specific initialization to be added without the need for ugly
ifdeffery in main.c.

As an immediate advantage, mpv can now use a unicode entry-point and
convert the command line arguments to UTF-8 before passing them to
mpv_main, so osdep_preinit can be simplified a little bit.
2015-04-11 14:27:25 +10:00
wm4 9b59c175e3 lua: reject Lua 5.3
It simply doesn't work, and is hard to make work. Lua 5.3 is a different
language from 5.1 and 5.2, and is different enough to make adding
support a major issue. Most importantly, 5.3 introduced integer types,
which completely mess up any code which deals with numbers.

I tried to make this a compile time check, but failed. Still at least
try to avoid selecting the 5.3 pkg-config package when the generic "lua"
name is used (why can't Lua upstream just provide an official .pc
file...). Maybe this actually covers all cases.

Fixes #1729 (kind of).
2015-04-01 23:59:15 +02:00
Philip Sequeira 5035501037 build: fix building with spaces in path 2015-03-31 15:05:08 +02:00
wm4 8a4239e0c2 player: dump list of satisfied deps instead of config.h with -v
Starting to get tired of seeing the full config.h in verbose output
every time. Make it slightly more elegant by outputting the list of
satisfied dependencies instead.
2015-03-11 23:33:05 +01:00
wm4 dfa562b5db build: make vdpau and dxva2 checks nicer
Using check_statement() with an empty statement just to check for the
header is quite a hack. Fix check_headers() (so it takes a "use"
parameter), and use it for the checks instead.
2015-03-06 11:31:06 +01:00
wm4 445b3fbf82 buid: readd -Wparentheses
This warning wasn't overly helpful in the past, and warned against
perfectly fine code. But at least with recent gcc versions, this is the
warning that complains about assignments in if expressions (why???), so
we want to enable it.

Also change all the code this warning complains about for no reason.
2015-03-02 19:09:25 +01:00
Oliver Freyermuth 40c9e79068 stream_dvb: Always define NO_STREAM_ID_FILTER if missing.
It is also used for initialization in channel-list setup.
Should fix compilation on FreeBSD, and is more correct
since it is used unconditionally.
Reverts 6445648 .
2015-02-28 18:27:21 +01:00
wm4 64456488b3 build: improve DVB check
A use of NO_STREAM_ID_FILTER was added to the DVB code recently. While I
have no idea what it's needed for, it makes mpv fail to compile on
FreeBSD 10.1. Add it to the dvb configure check.
2015-02-27 18:52:53 +01:00
Stefano Pigozzi 8e80b3fd2f build: move QuartzCore linking to the cocoa check
It's needed for the DisplayLink functions so it must be enabled for the basic
cocoa code.
2015-02-25 22:13:07 +01:00
Stefano Pigozzi 0466ce2f98 build: print pkg-config query on failure 2015-02-21 20:25:50 +01:00
wm4 14b231119d build: fix Python 3 unicode issue with waf 1.8.6
Starting with waf 1.8.6 (in Python 3), the hcode variable isn't a
string, but a byte string.

This commit adds the solution proposed in the upstream waf bug report:
https://code.google.com/p/waf/issues/detail?id=1535

It seems a bit overly verbose, but on the other hand, this solution has
the chance of being most correct/compatible.

Fixes #1604.
2015-02-19 09:40:50 +01:00
Stefano Pigozzi f8d7756a14 build: add option to generate a clang compilation database
The compilation database is a JSON file[1] storing all compilation flags. That
is useful for tools using libclang for code completion and error reporting
(for example: YouCompleteMe for vim).

[1]: http://clang.llvm.org/docs/JSONCompilationDatabase.html
2015-02-05 21:06:34 +01:00
wm4 e34957940b vo_opengl: cleanups after vo_opengl_old removal
Don't load all the legacy functions (including ancient extensions).
Slightly simplify function loader and context creation, now that legacy
GL doesn't need to be handled. Remove the code for drawing OSD in legacy
mode.

Remove all the header hacks, which were meant for ancient OpenGL headers
which didn't even support things like OpenGL 1.3. Instead, adjust the
GLX check to make sure we get both OpenGL 3x and 2.1 symbols. For win32
and OSX, we assume that the user has the latest headers anyway. For
wayland, we hope that things somehow go right.
2015-01-21 20:32:42 +01:00
James Ross-Gowan e93c62520e win32: make sure __STRICT_ANSI__ is not defined
__STRICT_ANSI__ disables functions and definitions that aren't in ANSI
C. Unfortunately this includes j1(), which is used by the new
ewa_lanczos code. Cygwin's CFLAGS already unset __STRICT_ANSI__, but it
should be unset for both Cygwin and MinGW.
2015-01-16 21:34:46 +11:00
wm4 3b091995a0 win32: drop hacks for possibly broken static pthreads-win32 linking
We now use threads and other pthread API a lot, and not always we use it
from threads created with pthread_create() (or the main thread). As I
understand, with static linking we would have to use
pthread_win32_thread_attach/detach_np() every time we enter or leave a
foreign thread. We don't do this, and it's not feasible either, so it's
just broken.

This still should work with dynamic pthreads-win32. The MinGW pthread
implementation should be unaffected from all of this.
2015-01-11 02:23:02 +01:00
wm4 f61b8b312d win32: request UTF-16 API variants, Vista+ APIs, and COM C macros
Put the Vista+ (_WIN32_WINNT) and the COM C (COBJMACROS) defines into
the build system, instead of defining them over and over in the code.
2015-01-07 21:42:44 +01:00
wm4 c4f39d2aba build: rename MPLAYER_CONFDIR define
We certainly don't use the mplayer configuration dir. The name didn't
matter, but now that it's in user-visible output (as part of config.h
being dumped in verbose mode), it's a bit too strange.
2015-01-02 03:18:16 +01:00
wm4 a2d790b3a4 player: print config.h contents in verbose mode
It was requested that mpv should print what features etc. have been
enabled at compile time. It can print the configure command line, but it
obviously doesn't include autodetected features.

I tried to think of a nicer way than dumping the config.h as text, but
this was still the simplest way.
2015-01-02 03:06:06 +01:00
wm4 bafb9b2271 win32: add native wrappers for pthread functions
Off by default, use --enable-win32-internal-pthreads .

This probably still needs a lot more testing. It also won't work on
Windows XP.
2015-01-01 15:10:42 +01:00
wm4 592aa9c70c build: add -Werror=format-security, add -W flags in all platforms
The idea of using -Werror=format-security comes from MPlayer.

Try to use the compiler flags with any compiler. There's no reason not
to apply them on clang.
2014-12-17 22:24:20 +01:00
wm4 91b8a7f994 build: add checks for some compiler warning flags 2014-12-14 20:44:27 +01:00
wm4 031aef9be9 vaapi/GLX: don't access VO backend
Same as with the VDA change.
2014-12-03 21:07:18 +01:00
Stefano Pigozzi d7adb818b0 build: give precedence to Lua52 over LuaJIT
LuaJIT ships with a broken .pc file on OS X (see #1110), and leaving
Lua52 last was done only to improve libquvi interoperability.
2014-12-02 22:10:13 +01:00
Stefano Pigozzi 90e3e99021 build: fix Lua detection
We need to manually define the flag since we are using a separate identifier
for each of the Lua checks. This was done before 9b45b48 by the composed check
with a define_key (see waftools/checks/generic.py).

The pkg-config check was the only one to not redefine a define key because Waf
already does that automatically when we call the generated function with the
same identifier as the generator function. Now if they are called with two
different arguments we will get two different definitions.

Fixes #1218
2014-10-25 23:05:50 +02:00
wm4 9b45b48c46 Drop libquvi support
No development activity (or even any sign of life) for almost a year.

A replacement based on youtube-dl will probably be provided before the
next mpv release. Ask on the IRC channel if you want to test.

Simplify the Lua check too: libquvi linking against a different Lua
version than mpv was a frequent issue, but with libquvi gone, no
direct dependency uses Lua, and such a clash is rather unlikely.
2014-10-25 20:18:22 +02:00
Stefano Pigozzi f2ef3e664b build: remove useless function 2014-10-11 21:03:13 +02:00
Stefano Pigozzi d906d09162 build: update waf to version 1.8.1
Fixes #1164
2014-10-11 20:54:42 +02:00
wm4 8fd954ac8e build: add -Wno-format-zero-length
This warning makes absolutely no sense. Passing an empty string to
printf-like functions is perfectly fine. In the OSD case, it just sets
an empty message, practically clearing the OSD.
2014-09-26 13:52:55 +02:00
Stefano Pigozzi 7b0de4aa0e build: add a check_program check
This wraps waf's find_program in our own check boilerplate code so that it
can be used in the declarative dependencies section of the wscript.

Can be used like this:

    }, {
        'name': 'sed',
        'desc': 'sed program',
        'func': check_program('sed', 'SED'),
    }, {

First argument is the program name, and the second is the waf variable name
where the program path will be stored. In this example we will be able to
refer to sed with ${{SED}} when creating waf Tasks in wscript_build.

/cc @giselher: I think you need this for wayland-scanner.
2014-09-03 23:52:56 +02:00
wm4 f8f3a1b4a1 build: drop check for XF86keysym.h
This is always included in the Xorg development headers. Strictly
speaking it's not necessarily available with other X implementations,
but these are hopefully all dead.
2014-08-16 21:57:51 +02:00
wm4 fe782a6e95 x11: use xrandr to retrieve display refresh rate
Drop use of the ancient XF86VM, and use the slightly less ancient Xrandr
extension to retrieve the refresh rate. Xrandr has the advantage that it
supports multiple monitors (at least the modern version of it).

For now, we don't attempt any dynamic reconfiguration. We don't request
and listen to Xrandr events, and we don't notify the VO code of changes
in the refresh rate. (The later works by assuming that X coordinates map
directly to Xrandr coordinates, which probably is wrong with compositing
window manager, at least if these use complicated transformations. But I
know of no API to handle this.)

It would be nice to drop use of the Xinerama extension too, but
unfortunately, at least one EWMH feature uses Xinerama screen numbers,
and I don't know how that maps to Xrandr outputs.
2014-08-16 21:56:22 +02:00
Stefano Pigozzi 212374149f build: expose waf variants to the user
This allows the user to execute multiple configuration and build steps. It
can be used for several scenarios where you need different compiler flags.
2014-08-06 09:31:59 +02:00
Stefano Pigozzi 8af0d9fec8 build: syms: reindent
We avoided reindenting this in the past to allow merging upstream changes.
In hindsight these are very unlikely and we are actually doing changes on
the code, so it's better to have the correct indentation and formatting in
our source file.
2014-08-05 12:57:34 +02:00
Stefano Pigozzi b34621e1b1 build: syms: fix *.def file for mach-o binary format
There was a missing trailing newline which caused some warnings when calling
`ld`.
2014-08-05 12:13:27 +02:00
wm4 bdf607ea5f build: list exported symbols explicitly
Instead of using a regex to match names to be exported from the libmpv
dynamic shared library, use a libmpv.def file, which lists all exported
functions explicitly.

This reduces the platform specifics in syms.py. I'm not sure if the
separate compile_sym task is still needed (it could probably be
collapsed, which would concentrate the platform specifics into one
place).
2014-08-05 02:21:29 +02:00
wm4 62a79ae556 build: fix export of libmpv symbols on mingw
The _ usually prefixed to functions on Windows was unexpectedly missing.
2014-08-05 01:02:54 +02:00
Tsukasa OMOTO b0ff0527a3 build: enable compiler optimization by default 2014-07-20 00:08:36 +02:00
wm4 d68d4dd984 Revert "build: avoid defining _GNU_SOURCE"
This reverts commit 2e6a8f260c.

Too many problems for now, such as with OSX and asprintf().
2014-07-10 09:25:37 +02:00
wm4 1a1e631ccd build: deal with endian mess
There is no standard mechanism for detecting endianess. Doing it at
compile time in a portable way is probably hard. Doing it properly
with a configure check is probably hard too. Using the endian
definitions in <sys/types.h> (usually includes <endian.h>, which is
not available everywhere) works under circumstances, but the previous
commit broke it on OSX.

Ideally all code should be endian dependent, but that is not possible
due to the dependencies (such as FFmpeg, some video output APIs, some
audio output APIs).

Create a header osdep/endian.h, which contains various fallbacks.
Note that the last fallback uses libavutil; however, it's not clear
whether AV_HAVE_BIGENDIAN is a public symbol, or whether including
<libavutil/bswap.h> really makes it visible. And in fact we don't want
to pollute the namespace with libavutil definitions either. Thus it's
only the last fallback.
2014-07-10 00:58:56 +02:00
wm4 2e6a8f260c build: avoid defining _GNU_SOURCE
_GNU_SOURCE defines the kitchen sink, and also prefers glibc definitions
where glibc and POSIX conflict. Even though POSIX is worth less than
toilet paper, we still prefer the POSIX definitions.

rar.c needs asprintf(), which is _GNU_SOURCE-only. So we define
_GNU_SOURCE too specifically for this file.
2014-07-09 22:10:33 +02:00
Alessandro Ghedini 211ca98e9c build: set default cdrom and dvd devices on linux 2014-06-30 23:19:53 +02:00
Philip Sequeira a7293b92f4 build: version string as native str type for each Python version
Should resolve the "mpv b'...'" issue on Python 3 without breaking
things on Python 2.

Also, remove redundant wait for process.
2014-06-14 10:11:07 +02:00
Alessandro Ghedini 6842d4bde5 build: fix generation of zsh completion
The Perl script must be run *after* the mpv executable is generated. Also use
an absolute path to it.
2014-06-13 12:27:01 +02:00
Alessandro Ghedini cc74bc3fec build: generate and install zsh completion script 2014-06-08 20:48:42 +02:00
wm4 a192f32a3a stream: remove VCD support
If a single person complains, I will readd it. But I don't expect that
this will happen.

The main reason for removing this is that it's some of the most unclean
code remaining, it's unmaintained, and I've never ever heard of someone
using it.
2014-06-01 17:22:21 +02:00
wm4 8178b80748 gl_x11: always require some GLX API functions, avoid dlsym()
The functions glXGetProcAddressARB() and glXQueryExtensionsString() were
loaded using dlsym(). This could fail when compiling to libmpv, because
then dlopen(NULL, ...) will look in the main program's list of
libraries, and the libGL linked to libmpv is never considered. (Don't
know if this somehow could be worked around.) The result is that using
vo_opengl with libmpv can fail.

Avoid this by not using dlsym(). glXGetProcAddressARB() was already used
directly in the same file, and that never caused any problems. (Still
add it to the configure test.) glXQueryExtensionsString() is documented
as added in GLX 1.1 - that's ancient.
2014-05-31 21:53:04 +02:00
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
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