switch-to-configuration.pl: Interact via DBus

Currently switch-to-configuration.pl uses system() calls to interact
with DBus. This can be error prone, especially when we are parsing
output that could change. In this commit, almost all calls to the
systemctl binary have been replaced with equivalent operations via DBus.
mingw-w64: Update to new upstream version 3.1.0.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
binutils-cross: Remove unreferenced package.

This package wasn't imported by anything in the package tree and also
isn't used for cross-builds. So in order to avoid confusion, it's better
to remove it as it is outdated as well.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
openssl: Fix Windows compat in cert-file.patch.

In Windows there is no get(e)uid() call available, so the build fails.

The patch now checks whether OPENSSL_SYS_WINDOWS is defined and only
uses those calls if _not_ on Windows.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
gcc-cross-wrapper: Enable dontStrip in setup hook.

At least for x86_64-w64-mingw32, it doesn't make sense to use the native
strip tool for stripping of symbols. To the contrary it results in
unusable archive files.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
bzip2/cross: Patch out erroneous path separator.

Not sure why this even got into the upstream release, as _all_ other
includes use forward slashes.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
mingw-w64: Fix typo in preConfigure hook.

D'oh, no wonder the headers are of almost the same size as the main
package.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
mingw-w64-pthreads: Create based on mingw-w64.

The winpthreads library is part of the same source package, so let's
just override the name and the source directory.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
pcre/cross: Enable support for winpthreads.

That way we're able to build with the JIT compiler enabled.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
glew/cross: Fix building with mingw-w64.

This also cleans up the package expression a bit and we no longer
directly override the phases (except patchPhase).

Also for cross-builds we're using the stock mingw target and pass CC, LD
and STRIP to make, because the mingw-w64 targets of the upstream package
are outdated.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
SDL/cross: Fix building with mingw-w64.

This is to make sure that we don't get Xlibs or alsa in cross builds,
because those aren't available on non-Linux/Unix platforms.

Also, until we don't have the DirectX SDK packaged, let's disable it
during cross builds.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
lua52/cross: Allow to cross-compile to mingw-w64.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
gcc-cross-wrapper: Explicitly add LD program name.

This is because autoconf is passing -print-prog-name=ld to the
cross-gcc, which in turn assumes a FHS compliant filesystem hierarchy
and searches ../../../../$crossConfig/bin/ld for the correct ld.

Of course, this won't work on Nix, hence we're explicitly passing the
correct LD program name.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
libgcrypt/cross: Fix build for mingw-w64.

Especially for the 64bit mingw target, because libgcrypt contains
protected mode assembly.

Also, this adds gettext to the crossAttrs of libgpg-error, because it
tries to regenerate the MO files.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Use mingw-w64 for 32bit Windows builds as well.

Mingw(32) is rather poorly maintaned and has quite a lot of bugs. And
because our Windows cross builds were also poorly maintained and most of
the cross-tests were broken as well, I'm just taking this step and try
to switch to mingw-w64 for everything "cross Windows".

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
SDL/cross: Drop --disable-directx.

This is no longer needed, because we've already fixed the dynamic
cross-linker.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Add new package "xpwn" from @dborca's fork.

This really hase some nice utilities for coping with HFS+ and DMG
format. We're going to use it for extracting the xcode DMG, but it could
be used for more, even generating DMGs.

The reason I'm using the fork instead of the repository from
@planetbeing is thet the fork contains a few fixes, especially for
dealing with symlinks in HFS+ images.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Add new package for Apple's XCode.

This package provides the SDK and standard library needed for
cross-compiling to Mac US X. We're using xpwn here to extract the DMG.

Also, this version (XCode 5.0.2) only contains the SDKs for version 10.9
and 10.8, so we might need to add requireFile directives for older
versions as well.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Add a cross-platform port of cctools.

This basically is binutils for Mac OS X, but ported to work on
(GNU/)Linux and FreeBSD.

And it's up-to-date as well! I'm mentioning this, because it was quite
hard to find a recent port of it and I just accidentally stumbled on it
while trying to do the port by myself.

So thanks to @tpoechtrager for doing this.

Also, I've added two more patches, which essentially are:

 * ld-rpath-nonfinal:
     This allows -rpath to be used for linking non-final builds, which
     was allowed for earlier versions of cctools and got a check for
     that in more recent versions.

 * ld-ignore-rpath-link:
     Ignores the -rpath-link option, because the cross-wrapper uses it
     in different places. Unfortunately, the cctools linker doesn't
     support it, so we might need to implement this later if it's
     possible (I'm not a Mach-O man^H^H^Hexpert).

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
gcc-4.8: Hook in cross-darwin libc and binutils.

Let's finally hook everything into the existing cross-building
infrastructure. We're using --with-sysroot instead of --with-headers
here, because the XCode SDK contains references to /usr/lib.

I've tried to patch those references, but unfortunately (at least with
install_name_tool) it isn't possible to change those refernces in stub
dylibs.

So after bugging @tpoechtrager with annoying questions (thanks again), I
think my initial approach (patching the SDK itself and/or regenerating
the dylib stubs) was way to complicated so I ended up with this
implementation.

Also, I've added a condition to binutilsCross to use cctools if the libc
is set to libSystem. This might need some cleanups someday, mainly to
figure out how to properly bridge cctools and binutils.

So, as an example on how to cross-compile GNU Hello to Darwin, you can
use something like this:

(import <nixpkgs> {
  crossSystem = {
    config = "x86_64-apple-darwin13";
    arch = "x86_64";
    libc = "libSystem";
    platform = {};
  };
}).hello.crossDrv

Signed-off-by: aszlig <aszlig@redmoonstudios.org>