mingw build works
[pspp] / mingw.sh
diff --git a/mingw.sh b/mingw.sh
new file mode 100644 (file)
index 0000000..dcd3d78
--- /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)