As a part of meson migration, this builds hb-shape dependencies using meson subprojects and removes different unrelated mingw files we've put on source root about things that aren't really our concern. This also simplifies all the instructions we've put in README.mingw.md and makes it easy to build the project on distros that no mingw libraries (such i686-win32-{freetype,glib,...} are packaged. The known catch is however lack of hb-view as its need for build of cairo which apparently isn't that straightforward.pull/2438/head
parent
bb719915d9
commit
6058ede3ae
20 changed files with 84 additions and 202 deletions
@ -0,0 +1,15 @@ |
||||
#!/bin/bash |
||||
set -e |
||||
|
||||
meson --cross-file=.ci/win32-cross-file.txt win32build --wrap-mode=forcefallback -Dtests=disabled \ |
||||
-Dglib=enabled -Dfreetype=enabled -Dgdi=enabled $@ |
||||
ninja -Cwin32build -j8 # building with all the cores won't work fine with CricleCI for some reason |
||||
|
||||
rm -rf win32build/harfbuzz-win32 |
||||
mkdir win32build/harfbuzz-win32 |
||||
cp win32build/util/hb-*.exe win32build/harfbuzz-win32 |
||||
find win32build -name '*.dll' -exec cp {} win32build/harfbuzz-win32 \; |
||||
i686-w64-mingw32-strip win32build/harfbuzz-win32/*.{dll,exe} |
||||
rm -f harfbuzz-win32.zip |
||||
(cd win32build/harfbuzz-win32 && zip ../../harfbuzz-win32.zip -r .) |
||||
echo "harfbuzz-win32.zip is ready." |
@ -0,0 +1,20 @@ |
||||
[host_machine] |
||||
system = 'windows' |
||||
cpu_family = 'x86' |
||||
cpu = 'i686' |
||||
endian = 'little' |
||||
|
||||
[properties] |
||||
c_args = [] |
||||
c_link_args = ['-static-libgcc', '-Wl,-Bstatic', '-lpthread'] |
||||
cpp_args = [] |
||||
cpp_link_args = ['-static-libgcc', '-static-libstdc++', '-Wl,-Bstatic', '-lpthread'] |
||||
|
||||
[binaries] |
||||
c = 'i686-w64-mingw32-gcc' |
||||
cpp = 'i686-w64-mingw32-g++' |
||||
ar = 'i686-w64-mingw32-ar' |
||||
ld = 'i686-w64-mingw32-ld' |
||||
objcopy = 'i686-w64-mingw32-objcopy' |
||||
strip = 'i686-w64-mingw32-strip' |
||||
windres = 'i686-w64-mingw32-windres' |
@ -0,0 +1,20 @@ |
||||
[host_machine] |
||||
system = 'windows' |
||||
cpu_family = 'x86_64' |
||||
cpu = 'x86_64' |
||||
endian = 'little' |
||||
|
||||
[properties] |
||||
c_args = [] |
||||
c_link_args = ['-static-libgcc', '-Wl,-Bstatic', '-lpthread'] |
||||
cpp_args = [] |
||||
cpp_link_args = ['-static-libgcc', '-static-libstdc++', '-Wl,-Bstatic', '-lpthread'] |
||||
|
||||
[binaries] |
||||
c = 'x86_64-w64-mingw32-gcc' |
||||
cpp = 'x86_64-w64-mingw32-g++' |
||||
ar = 'x86_64-w64-mingw32-ar' |
||||
ld = 'x86_64-w64-mingw32-ld' |
||||
objcopy = 'x86_64-w64-mingw32-objcopy' |
||||
strip = 'x86_64-w64-mingw32-strip' |
||||
windres = 'x86_64-w64-mingw32-windres' |
@ -1,17 +0,0 @@ |
||||
[binaries] |
||||
c = '@host@-gcc' |
||||
cpp = '@host@-g++' |
||||
ar = '@host@-ar' |
||||
ranlib = '@host@-ranlib' |
||||
strip = '@host@-strip' |
||||
windres = '@host@-windres' |
||||
pkgconfig = 'pkg-config' |
||||
|
||||
[host_machine] |
||||
system = 'windows' |
||||
cpu_family = '@cpu@' |
||||
cpu = '@cpu@' |
||||
endian = 'little' |
||||
|
||||
[properties] |
||||
cpp_args = ['-D_WIN32_WINNT=0x0601', '-O2', '-pipe', '-march=@arch@'] |
@ -1,28 +0,0 @@ |
||||
#!/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 \ |
||||
"$@" |
@ -1,56 +0,0 @@ |
||||
#!/usr/bin/env python3 |
||||
|
||||
# Copied from https://github.com/xantares/mingw-ldd/blob/master/mingw-ldd.py |
||||
# Modified to point to right prefix location on Fedora. |
||||
|
||||
# WTFPL - Do What the Fuck You Want to Public License |
||||
import pefile |
||||
import os |
||||
import sys |
||||
|
||||
|
||||
def get_dependency(filename): |
||||
deps = [] |
||||
pe = pefile.PE(filename) |
||||
for imp in pe.DIRECTORY_ENTRY_IMPORT: |
||||
deps.append(imp.dll.decode()) |
||||
return deps |
||||
|
||||
|
||||
def dep_tree(root, prefix=None): |
||||
if not prefix: |
||||
arch = get_arch(root) |
||||
#print('Arch =', arch) |
||||
prefix = '/usr/'+arch+'-w64-mingw32/sys-root/mingw/bin' |
||||
#print('Using default prefix', prefix) |
||||
dep_dlls = dict() |
||||
|
||||
def dep_tree_impl(root, prefix): |
||||
for dll in get_dependency(root): |
||||
if dll in dep_dlls: |
||||
continue |
||||
full_path = os.path.join(prefix, dll) |
||||
if os.path.exists(full_path): |
||||
dep_dlls[dll] = full_path |
||||
dep_tree_impl(full_path, prefix=prefix) |
||||
else: |
||||
dep_dlls[dll] = 'not found' |
||||
|
||||
dep_tree_impl(root, prefix) |
||||
return (dep_dlls) |
||||
|
||||
|
||||
def get_arch(filename): |
||||
type2arch= {pefile.OPTIONAL_HEADER_MAGIC_PE: 'i686', |
||||
pefile.OPTIONAL_HEADER_MAGIC_PE_PLUS: 'x86_64'} |
||||
pe = pefile.PE(filename) |
||||
try: |
||||
return type2arch[pe.PE_TYPE] |
||||
except KeyError: |
||||
sys.exit ('Error: unknown architecture') |
||||
|
||||
if __name__ == '__main__': |
||||
filename = sys.argv[1] |
||||
for dll, full_path in dep_tree(filename).items(): |
||||
print(' ' * 7, dll, '=>', full_path) |
||||
|
@ -1,33 +0,0 @@ |
||||
#!/bin/sh |
||||
|
||||
# Usage: ./mingw-meson.sh prefix host |
||||
# host being i686 or x86_64 |
||||
|
||||
case $2 in |
||||
i686 | x86_64) ;; |
||||
*) echo "Usage: $0 prefix i686|x86_64" >&2; exit 1 ;; |
||||
esac |
||||
|
||||
cpu=$2 |
||||
host=$2-w64-mingw32 |
||||
if test "x$2" = "xx86_64" ; then |
||||
arch=x86-64 |
||||
else |
||||
arch=i686 |
||||
fi |
||||
|
||||
rm -rf builddir && mkdir builddir && cd builddir && cp ../meson-mingw-cross.txt . |
||||
|
||||
sed -i -e "s/@cpu_family@/$cpu/g;s/@cpu@/$cpu/g;s/@host@/$host/g;s/@arch@/$arch/g" meson-mingw-cross.txt |
||||
|
||||
meson .. \ |
||||
--prefix=$1 \ |
||||
--libdir=lib \ |
||||
--buildtype=release \ |
||||
--strip \ |
||||
--cross-file meson-mingw-cross.txt \ |
||||
--default-library shared \ |
||||
-Dgraphite=enabled |
||||
|
||||
ninja |
||||
ninja install |
@ -1,2 +0,0 @@ |
||||
#!/bin/sh |
||||
exec "$(dirname "$0")"/mingw-configure.sh i686 "$@" |
@ -1,2 +0,0 @@ |
||||
#!/bin/sh |
||||
exec "$(dirname "$0")"/mingw-configure.sh x86_64 "$@" |
@ -1,5 +1,6 @@ |
||||
[wrap-git] |
||||
directory=fontconfig |
||||
url=https://github.com/centricular/fontconfig.git |
||||
depth=1 |
||||
push-url=git@github.com:centricular/fontconfig.git |
||||
revision=meson |
||||
|
@ -1,5 +1,6 @@ |
||||
[wrap-git] |
||||
directory=freetype2 |
||||
url=https://github.com/centricular/freetype2.git |
||||
depth=1 |
||||
push-url=git@github.com:centricular/freetype2.git |
||||
revision=meson |
||||
|
@ -1,5 +1,6 @@ |
||||
[wrap-git] |
||||
directory=glib |
||||
url=https://gitlab.gnome.org/GNOME/glib.git |
||||
depth=1 |
||||
push-url=git@gitlab.gnome.org:GNOME/glib.git |
||||
revision=2.58.1 |
||||
|
@ -1,4 +1,5 @@ |
||||
[wrap-git] |
||||
directory=libffi |
||||
url=https://github.com/centricular/libffi.git |
||||
url=https://gitlab.freedesktop.org/gstreamer/meson-ports/libffi.git |
||||
depth=1 |
||||
revision=meson |
||||
|
@ -1,4 +1,5 @@ |
||||
[wrap-git] |
||||
directory=proxy-libintl |
||||
url=https://github.com/frida/proxy-libintl.git |
||||
depth=1 |
||||
revision=0.1 |
||||
|
@ -1,4 +1,5 @@ |
||||
[wrap-git] |
||||
directory=zlib |
||||
url=https://github.com/centricular/zlib.git |
||||
depth=1 |
||||
revision=meson |
||||
|
Loading…
Reference in new issue