Fix cross building glib with meson for 32 bit Windows, set cpu_family
correctly in the cross file.
Do not build ffmpeg for 32 bit Windows because it is not compatible with
Windows XP and it's better to have a smaller 32 bit binary.
Turn off LTO for 32 bit Windows because it is now broken too, in a
different way than for 64 bit Windows.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Add meson to core deps because glib requires it to build, and python is
much further in the dependency chain to build meson early enough.
Override the meson command to write and use a cross file for mingw cross
builds.
Add -DFFI_STATIC_BUILD to CPPFLAGS for glib.
Fix --env for the linux mingw cross script.
Add dist make args to the make install invocation.
Add --extra-libs=-liconv to ffmpeg ./configure invocation.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Use git master for `graphite2` and a better cmake patch, with these
`DIST_ARGS`:
```
-DGRAPHITE2_NFILEFACE=ON -DGRAPHITE2_TESTS=OFF -DGRAPHITE2_DOCS=OFF
```
Use `DIST_CONFIGURE_OVERRIDES` instead of `DIST_ARGS` for `libvpx` and
`ffmpeg` because their configure scripts error on the `--sysconfdir`
arg.
Change all other references to `libvpx` and `ffmpeg` `DIST_ARGS` to use
`DIST_CONFIGURE_OVERRIDES` instead.
Add `-j1` to `xvidcore` `MAKE_ARGS` because it sometimes fails parallel
builds.
Change the `mkdir` commands to `mkdir -p` in `mingw.sh` because
`core.sh` now also makes those directories.
In `mingw.sh` for `libvpx` extra `CFLAGS`, add `-mstackrealign` for 32
bit builds and `-fno-asynchronous-unwind-tables` for 64 bit builds. The
latter is necessary to build, taken from the msys2 `libvpx` mingw
package.
Also add the `stdint.h` `-include` option to `CFLAGS` for libtheora and
ffmpeg because they use the `libogg` headers.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Merging some work I was doing on trying to make a working mostly static
linux binary a year ago, with some additional minor refactoring.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Move linux distribution detection into `detect_os()` in the core.
The appropriate routine is then called with eval.
Move linux deps installation (for fedora previously) from
`linux-cross-builder` to `mingw-cross.sh` using the `linux_distribution`
variable set by `detect_os()`.
Add a routine to install suse cross dependencies as well.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
Refactor the build environment evaluation, make build variables set
immediately so that they don't grow longer on re-evaluations and defer
all other variables. Export as many build related variables as possible.
Make one more crucial fix for cross builds: run the post_build after
LDFLAGS and LIBS are restored, so that this does not interfere with
setting and restoring the build environment for host builds.
Other changes:
- fontconfig 2.13.0 -> 2.13.1
- openal 1.19.0 -> 1.19.1
- set fontconfig configure type to autoreconf, disable tests
- disable the openssl parallel build patch, it fails unpredictably,
always build openssl with -j1
- configure libicu with --disable-tests and a few other things disabled,
the tests cause link issues on mingw i686
- also make a minor fix to libicu makefiles for mingw (replace echo -n
with printf)
- move $BUILD_ENV evaluation to the builder() main function to defer
some variable initializations
- add patch for openal to mingw-cross to use gcc instead of cmake to
build some native tools it uses, cmake causes issues with cross builds
- in host_env()/target_env() defer variable expansion and include a copy
of $BUILD_ENV in the appropriate sequence
Do not defer evaluating build env variables in mingw-cross.sh, this
interferes with switching them between host/target.
In build_dist() adjust the LDFLAGS and LIBS after pre_build has run,
because host/target env setting happens in pre_build and adjustments get
lost.
- Fix leading spaces in build env vars.
- Pass -Dcc="$CC" to the c2man metaconfig, it tries to use cc on msys2
which fails.
- Pass LDFLAGS to openssl make to fix link errors.
- Change the host_env, target_env and related functions to output a list
of commands for eval.
- Add a --host-env flag to output the host env for cross build
environments.
- Ignore symlink failures when installing dists, symlinks fail on msys2
sometimes for some reason.
- Put libicu in the list of both host and target dists only in
mingw-cross, the host libicu does not build on msys2, and everything
works fine without it.
- Add -j1 to openssl make args to disable parallel builds for the msys2
and cygwin host builds, because they fail otherwise.
- Add "-ldl -lcatgets -lws2_32" to libicu LDFLAGS for the target build,
ws2_32 may be necessary for 32 bit builds.
Support the gentoo crossdev mingw environment for the mingw cross
builder:
- For the cmake toolchains, add /usr/<arch>/usr to root paths, as this
is the mingw root for crossdev.
- -Wno-error=all no longer works with gcc 8.2, instead remove all
-Werror flags in dist_post_configure().
- Also remove all -I/usr/include flags in dist_post_configure().
- Don't prepend ROOT/host/bin to the PATH globally, only in
set_host_env(). This way the target config scripts are correctly found
in PATH.
- Bump openssl 1.0.2o -> 1.0.2p, cmake 3.10.3 -> 3.13.0-rc1, gd 2.2.4 ->
2.2.5 and glib 2.57.2 -> 2.58.1.
- Add libicu unicode handling library, needed by some deps. Put into the
list of dists that must be built for both the host and the target. Use
a whole bunch of patches from MSys2 for it.
- Make openssl build in parallel by using a sed script to prepend a + to
the appropriate make rules.
- Replace fontconfig EXTRA_LIBS with MAKE_ARGS: LIBS="-lintl -liconv"
because these libs were being stripped out from LIBS and LDFLAGS.
- Add V=1 VERBOSE=1 to all make invocations for extra verbosity (to see
compile/link invocations.)
- As a consequence, use dist_ninja_args() for ninja, it will still take
options in DIST_MAKE_ARGS.
- Add CONFIGURE_TYPE "cmakeninja" which is like the "cmake" type except
with -G Ninja to use the ninja generator and built with ninja. Nothing
uses this yet.
- Fix dist_patch() output for already applied patches.
- Add -L/usr/<arch>/usr/lib64 to CFLAGS/CXXFLAGS/OBJCXXFLAGS/LDFLAGS,
because crossdev libpthreads.a is in that directory and it's not in
gcc search paths. It cannot go into CPPFLAGS because those are used
for windres invocations, and windres errors out with non-cpp flags.
- Add -DMINGW_HAS_SECURE_API to all flags to fix a problem with the
mingw headers in crossdev.
- Add -lpthread to a default LIBS env var so that it's often linked last
against any libraries that may need it, at least for autoconf.
- Set the PKG_CONFIG env var to the path of the built pkg-config binary,
not exactly sure why this was necessary.
- Overhaul environment variable saving/restoring for set_host_env() so
that more variables are covered and have good host defaults.
- Add the dlfcn-win32 for mingw for dependencies that need -ldl.
- Add some MSys2 patches for fontconfig.
- Use a sed script to fix the native tools compilation when cross
compiling openal.
- Replace the fedora glib patches for mingw with MSys2 ones for the
newer glib.
- Add --with-threads=posix --disable-libelf to glib DIST_ARGS.
Unset UUID_LIBS when building host fontconfig, which contains
-luuid_mingw for the cross fontconfig.
Add trailing semicolons on core POST_BUILD actions.
- Add the cross root from the mingw-w64 mac brew to the cmake toolchain
files.
- Remove strerror_r/strerror_s from ConfigManager.cpp because the
mingw-w64 brew does not support strerror_s for some reason.
- Strip the vbam executable from the builder script in the build_project
phase.
- Change the bzip2 URL to the github mirror because the bzip.org domain
expired.
- Add libuuid as it's required by the new fontconfig, use the mingw
version for mingw builds, for mingw also set UUID_LIBS to
'-luuid_mingw -luuid' in mingw.sh for fontconfig, the mingw version
is called uuid_mingw because uuid is a core win32 library.
- Lower glib version to 2.57.2 stable.
- Update wxwidgets version to current master sha.
- Fix a bug in flex-2.5.3 post_build where it tries to build flex
current but flex has been removed, and it was just rebuilding 2.5.3.
- Fix "aggressive" relocation and the relocation of .l[ao] and .pc files
in install_dist to ignore /usr/local, and only match /usr.
- Add a "project" pre_build and post_build hooks.
- Add getopt to host-only dists in mingw-cross.sh.
- Use perl instead of readlink -f to get the absolute path of the cmake
toolchain files in mingw-cross.sh, as readlink -f is linux-only.
- In mingw-cross.sh, replace the glib post_build to rebuild
gettext-target instead of gettext --without-included-glib.
- Add overridable functions set_host_env_hook and unset_host_env_hook in
mingw.sh to override in other scripts, in this case mac-cross-builder.
- Update mingw glib patches to current fedora versions.
- Add tools/win/mac-cross-builder script to build mingw windows binaries
on mac, it borrows some necessary parts from the mac native builder
for host dists, and inherits from mingw-cross.sh.
TODO: currently the resulting mac-built binary segfaults due to gcc
8.2.0, just as the msys2-built binary does, this is a separate issue.
Update mingw cmake toolchain files to work-around a bug in cmake where
find_program() would return the current working directory instead of the
executable path if CMAKE_C_COMPILER and related are passed on the
command line.
Fix $CC/$CC_ORIG and $CXX/$CXX_ORIG handling for the core and
mingw-cross (_ORIG is without ccache.)
Put shared code for linux cross builds and cygwin cross builds into
builder/mingw-cross.sh .
Call wxrc when the build platform is cygwin with files resolved via
`cygpath -m` in case the wxrc is a native binary.
Add -fpermissive to CXX/OBJCXX flags.
Reenable libzvbi support for ffmpeg.
Stop building ffmpeg and related dists by default until we fix game
recording.
Set CMAKE_PREFIX_PATH in cmake args as a FILEPATH type variable.
Support xml catalog made with native libxml2 using cygpath in related
commands, make cygpath a noop on non-cygwin platforms.
Remove gdb and zip from msys2 deps.
Add a cygwin installdeps routine using a copy of cyg-apt that it
fetches.
When creating symlinks in install_dist() fully resolve all symlinks in
path parts for the source file, so that host and target binaries are
correctly linked.
When cp -af fails to preserve permission related data, fall back to cp
-rf.
When installing libs with a cross suffix, make a symlink for the lib
without the cross suffix.
Make sure cygwin runs with CYGWIN=winsymlinks:native .
Add paths to host gettext executables to cmake args, otherwise it tries
to use the target executables and fails on paths.
For the pkgconfig bundled glib, turn off win32 platform for the cygwin
host build.
For gettext, remove --disable-auto-import from link flags.
Compile target freetype on cygwin with cmake and manually install the
pkgconfig .pc file using sed.
Add a relocation type 'aggressive', when a dist is marked with this
type, rewrite all '/usr' prefixes to the build root. By default only
files that exist in the dist are matched and rewritten.
Fix regression in linux build by adding some iconv related flags to the
cmake invocation for doxygen and disabling -Werror for xorg dists.
When relocating scripts, use the actual resolved root path for host or
target.
Build libxslt --without-python so that it doesn't try to pick up the
msys2 python.
Other misc. minor tweaks and cleanups.