From e05e56061c75588dbc31a4ced73e13207e537fd9 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 24 Jan 2021 12:28:04 -0700 Subject: [PATCH] [mingw] Reinstate win32 cross-compiling with autotools instructions Was removed in favor of meson in 6058ede3ae983c53d1d6f5352d4235bafce3499a. However, those fail to build for me. --- Makefile.am | 1 + README.mingw.md | 32 ++++++++++++++++++++++++-------- mingw-configure.sh | 28 ++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 8 deletions(-) create mode 100755 mingw-configure.sh diff --git a/Makefile.am b/Makefile.am index c27b0059b..f476c964f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -42,6 +42,7 @@ EXTRA_DIST = \ perf/texts/fa-thelittleprince.txt \ meson-cc-tests/intel-atomic-primitives-test.c \ meson-cc-tests/solaris-atomic-operations.c \ + mingw-configure.sh \ $(NULL) MAINTAINERCLEANFILES = \ diff --git a/README.mingw.md b/README.mingw.md index b9943d7ae..d9bd34740 100644 --- a/README.mingw.md +++ b/README.mingw.md @@ -4,17 +4,33 @@ implementation and that specially is important where OpenType specification is or wasn't that clear. For having access to Uniscribe on Linux/macOS these steps are recommended: -1. Install Wine from your favorite package manager. On Fedora that's `dnf install wine`. +You want to follow the 32bit instructions. The 64bit equivalents are included +for reference. -2. And `mingw-w64` compiler. - With `brew` on macOS, you can have it like `brew install mingw-w64`. - On Fedora, with `dnf install mingw32-gcc-c++`, or `dnf install mingw64-gcc-c++` for the - 64-bit Windows. Use `apt install g++-mingw-w64` on Debian. +1. Install Wine. + - Fedora: `dnf install wine`. -3. See how `.ci/build-win32.sh` uses meson or run that script anyway. +2. Install `mingw-w64` compiler. + - Fedora, 32bit: `dnf install mingw32-gcc-c++` + - Fedora, 64bit: `dnf install mingw64-gcc-c++` + - Debian: `apt install g++-mingw-w64` + - Mac: `brew install mingw-w64` -Now you can use hb-shape by `(cd win32build/harfbuzz-win32 && wine hb-shape.exe)` -but if you like to shape with the Microsoft Uniscribe, +3. If you have drank the `meson` koolaid, look at `.ci/build-win32.sh` to see how to + invoke `meson` now, or just run that script. Otherwise, here's how to use the + old trusty autotools instead: + + a) Install dependencies. + - Fedora, 32bit: `dnf install mingw32-glib2 mingw32-cairo mingw32-freetype` + - Fedora, 64bit: `dnf install mingw64-glib2 mingw64-cairo mingw64-freetype` + + b) Configure: + - `NOCONFIGURE=1 ./autogen.sh && mkdir winbuild && cd winbuild` + - 32bit: `../mingw-configure.sh i686` + - 64bit: `../mingw-configure.sh x86_64` + +Now you can use `hb-shape` by `(cd win32build/util && wine hb-shape.exe)` +but if you like to shape with the Microsoft Uniscribe: 4. Bring a 32bit version of `usp10.dll` for yourself from `C:\Windows\SysWOW64\usp10.dll` of your Windows installation (assuming you have a 64-bit installation, otherwise diff --git a/mingw-configure.sh b/mingw-configure.sh new file mode 100755 index 000000000..3281ce382 --- /dev/null +++ b/mingw-configure.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +case $1 in + i686 | x86_64) ;; + *) echo "Usage: $0 i686|x86_64" >&2; exit 1 ;; +esac + +target=$1-w64-mingw32 +shift + +exec "$(dirname "$0")"/configure \ + --build=`../config.guess` \ + --host=$target \ + --prefix=$HOME/.local/$target \ + CC= \ + CXX= \ + CPP= \ + LD= \ + CFLAGS="-static-libgcc" \ + CXXFLAGS="-static-libgcc -static-libstdc++" \ + CPPFLAGS="-I$HOME/.local/$target/include" \ + LDFLAGS=-L$HOME/.local/$target/lib \ + PKG_CONFIG_LIBDIR=$HOME/.local/$target/lib/pkgconfig:/usr/$target/sys-root/mingw/lib/pkgconfig/ \ + PKG_CONFIG_PATH=$HOME/.local/$target/share/pkgconfig:/usr/$target/sys-root/mingw/share/pkgconfig/ \ + PATH=$HOME/.local/$target/bin:/usr/$target/sys-root/mingw/bin:/usr/$target/bin:$PATH \ + --without-icu \ + --with-uniscribe \ + "$@"