From 78be9049849fdb308a204e102be664bee074fb18 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sun, 25 Oct 2020 00:00:05 -0700 Subject: [PATCH] mingw build works --- cmake-crossbuild.txt | 26 +++++++ meson-crossbuild.txt | 23 +++++++ mingw.sh | 160 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 209 insertions(+) create mode 100644 cmake-crossbuild.txt create mode 100644 meson-crossbuild.txt create mode 100644 mingw.sh diff --git a/cmake-crossbuild.txt b/cmake-crossbuild.txt new file mode 100644 index 0000000000..ce5d3003fb --- /dev/null +++ b/cmake-crossbuild.txt @@ -0,0 +1,26 @@ +SET(CMAKE_SYSTEM_NAME Windows) +SET(CMAKE_SYSTEM_PROCESSOR x86_64) + +# specify the cross compiler +SET(CMAKE_C_COMPILER /usr/bin/x86_64-w64-mingw32-gcc) +SET(CMAKE_CXX_COMPILER /usr/bin/x86_64-w64-mingw32-g++) + +# where is the target environment +SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32) + +# search for programs in the build host directories +SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +# for libraries and headers in the target directories +SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +# Make sure Qt can be detected by CMake +SET(QT_BINARY_DIR /usr/x86_64-w64-mingw32/bin /usr/bin) + +# set the resource compiler (RHBZ #652435) +SET(CMAKE_RC_COMPILER /usr/bin/x86_64-w64-mingw32-windres) + +# These are needed for compiling lapack (RHBZ #753906) +SET(CMAKE_Fortran_COMPILER /usr/bin/x86_64-w64-mingw32-gfortran) +SET(CMAKE_AR:FILEPATH /usr/bin/x86_64-w64-mingw32-ar) +SET(CMAKE_RANLIB:FILEPATH /usr/bin/x86_64-w64-mingw32-ranlib) diff --git a/meson-crossbuild.txt b/meson-crossbuild.txt new file mode 100644 index 0000000000..ea4be236a0 --- /dev/null +++ b/meson-crossbuild.txt @@ -0,0 +1,23 @@ +[host_machine] +system = 'windows' +cpu_family = 'x86_64' +cpu = 'x86_64' +endian = 'little' + +[properties] +c_args = ['-I/home/blp/pspp/mingw/inst/include'] +c_link_args = ['-L/home/blp/pspp/mingw/inst/lib', '-liconv', '-fno-stack-protector'] +root = '/home/blp/pspp/mingw/inst' +needs_exe_wrapper = true + +[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' +pkgconfig = 'x86_64-w64-mingw32-pkg-config' +windres = 'x86_64-w64-mingw32-windres' +ranlib = '/usr/bin/x86_64-w64-mingw32-ranlib' +dlltool = '/usr/bin/x86_64-w64-mingw32-dlltool' diff --git a/mingw.sh b/mingw.sh new file mode 100644 index 0000000000..dcd3d787af --- /dev/null +++ b/mingw.sh @@ -0,0 +1,160 @@ +#! /bin/sh -e + +set -x +export WINEPATH='/home/blp/pspp/mingw/inst/bin;/usr/x86_64-w64-mingw32/lib;/usr/lib/gcc/x86_64-w64-mingw32/10-win32;/home/blp/pspp/mingw/inst/bin' +wineserver -p || : + +base=/home/blp/pspp/mingw-build +cache=/home/blp/pspp/cache + +fetch () { + local url=$1 file=$cache/$(basename $1) + if test ! -f "$file"; then + mkdir -p ../cache + wget -O "$file" "$url" || exit 1 + fi + echo "$file" +} + +enter () { + local url=$1 + cd "$base" + file=$(fetch "$url") || return 1 + tar xf "$file" || return 1 + + dir=$(tar tf "$file" | head -1) + cd "$dir" +} + +mingw_configure () { + test -x config.status || mingw-configure "$@" +} + +(enter https://ftp.gnu.org/pub/gnu/gsl/gsl-1.16.tar.gz +mingw_configure +make -j128 +make -j128 install) + +(enter https://github.com/win-iconv/win-iconv/archive/v0.0.8.tar.gz +mingw-cmake -DBUILD_STATIC=1 . +make -j128 install) + +(enter https://ftp.gnu.org/pub/gnu/gettext/gettext-0.21.tar.gz +cd gettext-runtime +mingw_configure +make -j128 install) + +(enter ftp://xmlsoft.org/libxml2/libxml2-2.9.10.tar.gz +: fetch ftp://xmlsoft.org/libxml2/libxml2-2.9.10.tar.gz.asc +: gpg libxml2-2.9.10.tar.gz.asc +mingw_configure --without-python +make -j128 install) + +(enter https://download.sourceforge.net/libpng/libpng-1.6.37.tar.xz +mingw_configure +make -j128 install) + +(enter https://www.cairographics.org/releases/pixman-0.40.0.tar.gz +mingw_configure +make -j128 install) + +(enter https://github.com/libffi/libffi/releases/download/v3.3/libffi-3.3.tar.gz +mingw_configure +make -j128 install) + +(enter https://download.gnome.org/sources/glib/2.64/glib-2.64.5.tar.xz +mingw-mesonbuild) + +(enter https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz + test -f autogen.sh || patch -p1 < $cache/bzip2-1.0.5-autoconfiscated.patch + grep -q fdopen bzlib.h || patch -p1 < $cache/bzip2-use-cdecl-calling-convention.patch + chmod +x autogen.sh + test -x configure || ./autogen.sh + mingw_configure + make -j128 install) + +(enter https://download.savannah.gnu.org/releases/freetype/freetype-2.10.2.tar.xz + mingw_configure \ + --enable-static \ + --enable-shared \ + --with-zlib=yes \ + --with-bzip2=yes \ + --with-png=yes \ + --enable-freetype-config \ + --with-harfbuzz=no + make -j128 install) + +(enter https://www.cairographics.org/releases/cairo-1.16.0.tar.xz + if grep -q font-variations test/Makefile.sources; then + sed -i '/font-variations/d' test/Makefile.sources + NOCONFIGURE=: ./autogen.sh + fi +mingw_configure --enable-gobject +make -j128 install +sed -i.bak '/^Libs:/s/^\(.*\)$/\1 -lpixman-1 -lgdi32 -lssp/' ~/pspp/mingw/inst/lib/pkgconfig/cairo.pc) + +(enter https://fontconfig.org/release/fontconfig-2.13.1.tar.bz2 + grep -q ENABLE_TESTS configure.ac || patch -p1 < $cache/fontconfig_tests.patch + grep -q ENABLE_TESTS configure || autoreconf -ifv + mingw_configure --disable-docs --disable-tests --with-arch=x86_64 --enable-libxml2 + make -j128 install) + +(enter https://github.com/harfbuzz/harfbuzz/releases/download/2.6.8/harfbuzz-2.6.8.tar.xz +mingw_configure --enable-shared --enable-static --enable-delay-load +make -j128 install LDFLAGS=-lpthread) + +(enter https://ftp.gnome.org/pub/GNOME/sources/pango/1.46/pango-1.46.0.tar.xz +mingw-mesonbuild -Dintrospection=false -Dgtk_doc=false -Dc_link_args='-L/home/blp/pspp/mingw/inst/lib -fstack-protector -lssp -lpixman-1 -lpng -lz') + +(enter https://github.com/GNOME/atk/archive/ATK_2_36_0.tar.gz +mingw-mesonbuild --default-library=both -Dintrospection=false -Dgtk_doc=false) + +(enter https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/archive/2.40.0/gdk-pixbuf-2.40.0.tar.gz +mingw-mesonbuild -Dgir=false -Drelocatable=true -Djasper=true -Dx11=false \ + -Dbuiltin_loaders=bmp,gif,ico,jpeg,tiff,png) + +(enter https://github.com/anholt/libepoxy/releases/download/1.5.4/libepoxy-1.5.4.tar.xz +mingw-mesonbuild) + +(enter https://download.gnome.org/sources/gtk+/3.24/gtk+-3.24.21.tar.xz +mingw_configure --disable-cups GLIB_COMPILE_RESOURCES=glib-compile-resources GLIB_COMPILE_SCHEMAS=glib-compile-schemas +make -j128 install) + +(enter https://download.gnome.org/sources/gtksourceview/3.24/gtksourceview-3.24.11.tar.xz + mingw_configure --disable-static --disable-gtk-doc --disable-introspection + make -j128 install) +# Most recent step: add -L/usr/lib/gcc/x86_64-w64-mingw32/10-win32 to mingw-configure LDFLAGS + +(enter https://download.gnome.org/sources/librsvg/2.50/librsvg-2.50.0.tar.xz + ln -s ~/pspp/mingw/inst/bin/gdk-pixbuf-query-loaders.exe gdk-pixbuf-query-loaders + PATH=$PWD:$PATH + RUST_TARGET=x86_64-pc-windows-gnu RUST_TARGET_SUBDIR=$RUST_TARGET/release mingw-configure --without-pic --enable-introspection=no + RUST_TARGET=x86_64-pc-windows-gnu RUST_TARGET_SUBDIR=$RUST_TARGET/release PKG_CONFIG_PATH=/home/blp/pspp/mingw/inst/lib/pkgconfig CARGO_TARGET_ARGS=--target=x86_64-pc-windows-gnu make -j128 -e V=1 LIBS='-luserenv' +) + +(enter https://ftp.gnu.org/pub/gnu/termcap/termcap-1.3.1.tar.gz + autoconf + mingw_configure + make -j128 + x86_64-w64-mingw32-gcc -shared -Wl,--out-implib,libtermcap.dll.a \ + -o libtermcap-0.dll termcap.o tparam.o version.o + make install prefix=/home/blp/pspp/mingw/inst exec_prefix=/home/blp/pspp/mingw/inst oldincludedir= + install -m755 libtermcap-0.dll /home/blp/pspp/mingw/inst/bin + install -m755 libtermcap.dll.a /home/blp/pspp/mingw/inst/lib/) + +(enter https://ftp.gnu.org/pub/gnu/readline/readline-8.0.tar.gz + mingw_configure + make -j128 install) + +(enter http://alpha.gnu.org/gnu/ssw/spread-sheet-widget-0.6.tar.gz + mingw_configure + make -j128 install) + +(enter https://icon-theme.freedesktop.org/releases/hicolor-icon-theme-0.17.tar.xz + mingw_configure + make -j128 install) + +(enter https://download.gnome.org/sources/adwaita-icon-theme/3.37/adwaita-icon-theme-3.37.92.tar.xz + mingw_configure + make -j128 install) + -- 2.30.2