Re: [GNC] Errors from jhbuild on Windows 11

Sherlock <[email protected]>
Newsgroups gmane.comp.gnome.apps.gnucash.user
Message-ID <[email protected]>
Hi Neil,

MSYS2 has been migrating away from 32-bit support.  To recolve the 
issue, it is usually a matter of identifying the appropriate packages 
still mainained at https://repo.msys2.org/mingw/mingw32 and pulling them 
ourselves.  When I decide to setup the environment, I usually modify the 
setup-mingw64.ps1 script locally.  The attached version is what I used 
in June.  Note: At the pause, I apply updates within the 
gnucash-on-windows.git folder that I find appropriate.

Regards,

Sherlock


On 8/8/26 3:06 AM, Neil Aggarwal wrote:
> Hello all:
> 
> I am following this guide:
> https://wiki.gnucash.org/wiki/Building_on_Windows
> 
> Everything seems to go fine until I ran this command:
> jhbuild -f src/gnucash-on-windows.git/jhbuildrc build
> 
> It gives me this output:
> Required packages:
>    System installed packages which are too old:
>      (none)
>    No matching system package installed:
>      boost
>      cmake
>      ninja
> jhbuild build: Required system dependencies not installed. Install using
> the command 'jhbuild sysdeps --install' or to ignore system dependencies
> use command-line option --nodeps
> 
> When I ran
> jhbuild sysdeps --install
> the first time, it installed some stuff, but gave me some messages about
> things not found so I ran it multiple times with it installing some
> packages.
> 
> Now, when I run it, nothing installs and I get this output:
> 
> System installed packages which are new enough:
>      automake
>      libtool
>      make
>      pkg-config
>      libxslt (libxslt.pc, required=1.1.26, installed=1.1.45)
>      libxml2 (libxml-2.0.pc, required=2.7.8, installed=2.15.3)
>      intltool (required=0.50.2)
>      itstool
>      git
>      xmllint
>      xsltproc
>      python3-devel (python3.pc, required=3.2, installed=3.14)
>      xmlcatalog
>      docbook-xml
>      docbook-xsl
>      cc
>      libffi (libffi.pc, required=3.0.0, installed=3.7.1)
>      zlib (zlib.pc, installed=1.3.2)
>      libpcre (libpcre.pc, required=8.31, installed=8.45)
>      libpng (libpng.pc, installed=1.6.58)
>      freetype2 (freetype2.pc, required=12.0.6, installed=26.6.20)
>      bison (required=2.4)
>      flex (required=2.0)
>      c++
>      libicu (icu-i18n.pc, required=4, installed=76.1)
>      bash-completion (bash-completion.pc, installed=2.17.0)
>      gperf
>      libarchive (libarchive.pc, required=3.2.1, installed=3.8.9)
>      sqlite3 (sqlite3.pc, required=3.8.3, installed=3.53.4)
>      gnutls (gnutls.pc, required=3.1, installed=3.8.13)
>      p11-kit (p11-kit-1.pc, required=0.19.0, installed=0.26.4)
>      libuuid (uuid.pc, installed=2.40.2)
>      libyaml
>      libgcrypt (required=1.5.0)
>      libnghttp2 (libnghttp2.pc, installed=1.70.0)
>      krb5
>      texinfo
>      libtasn1 (libtasn1.pc, required=2.7, installed=4.21.0)
>      asciidoc
>      libdb
>      llvm
>      libclang
>      readline
>      hogweed (hogweed.pc, required=3.2, installed=4.0)
>      nettle (nettle.pc, required=3.2, installed=4.0)
>      libcurl (libcurl.pc, installed=8.21.0)
>      gpgme (required=1.0.0)
>      file
>      mpc
>      mpfr
>      libunistring
> Required packages:
>    System installed packages which are too old:
>      (none)
>    No matching system package installed:
>      ninja
>      shared-mime-info (shared-mime-info.pc, required=1.0)
>      fontconfig (fontconfig.pc, required=2.13.0)
>      gl (gl.pc)
>      libXext (xext.pc)
>      libXrender (xrender.pc)
>      x11 (x11.pc)
>      libXft (xft.pc, required=2.0.0)
>      ragel
>      libjpeg
>      egl (egl.pc, required=1.3)
>      cups (required=1.4)
>      libXcursor (xcursor.pc)
>      desktop-file-utils (required=0.20)
>      flac (flac.pc, required=1.1.4)
>      libvpx (vpx.pc)
>      taglib (taglib.pc, required=1.5)
>      wavpack (wavpack.pc, required=4.2)
>      libavfilter (libavfilter.pc)
>      libavformat (libavformat.pc)
>      libavcodec (libavcodec.pc)
>      libavutil (libavutil.pc)
>      x11-xcb (x11-xcb.pc)
>      libv4l (libv4l2.pc)
>      dbus (dbus-1.pc, required=1.4.10)
>      libXtst (xtst.pc, required=1)
>      xi (xi.pc)
>      xkbcommon-x11 (xkbcommon-x11.pc)
>      pulseaudio (libpulse-mainloop-glib.pc, required=2.0)
>      yasm
>      cargo
>      graphviz (libgvc.pc, required=2.26.0)
>      vala-bootstrap
>      polkit-gobject (polkit-gobject-1.pc, required=0.103)
>      libcanberra (libcanberra-gtk.pc, required=0.30)
>      nss (nss.pc, required=3.12.11)
>      pam
>      cmake
>      libproxy (libproxy-1.0.pc)
>      argyll
>      lcms2 (lcms2.pc, required=2.6)
>      docbook-utils (required=0.6.14)
>      libxkbfile (xkbfile.pc)
>      libXrandr (xrandr.pc, required=1.3)
>      xkeyboard-config (xkeyboard-config.pc)
>      libexif (libexif.pc, required=0.6.19)
>      libtiff
>      libdrm (libdrm.pc, required=2.4.45)
>      libXcomposite (xcomposite.pc)
>      xcb-dri2 (xcb-dri2.pc, required=1.8.1)
>      hunspell (hunspell.pc)
>      avahi (avahi-gobject.pc, required=0.6.31)
>      hyphen
>      libwebp
>      mesa-libGLES (glesv2.pc, required=3.0)
>      openjpeg (libopenjp2.pc, required=2.2.0)
>      ruby
>      libXdamage (xdamage.pc)
>      libXt (xt.pc)
>      libcanberra-gtk3 (libcanberra-gtk3.pc)
>      dbus-glib (dbus-glib-1.pc, required=0.98)
>      libpwquality (pwquality.pc)
>      smbclient (smbclient.pc)
>      kyotocabinet (kyotocabinet.pc)
>      anthy (anthy.pc, required=0.3)
>      libhangul (libhangul.pc, required=0.1.0)
>      libxklavier (libxklavier.pc, required=5.0)
>      sm (sm.pc)
>      xtrans (xtrans.pc, required=1.3.5)
>      liboauth (oauth.pc, required=0.9.4)
>      openldap
>      nspr (nspr.pc, required=4.9.2)
>      dbus-run-session
>      cvt
>      libevdev (libevdev.pc, required=1.2.2)
>      libxkbcommon (xkbcommon.pc, required=0.5.0)
>      libX11 (x11.pc)
>      libXfixes (xfixes.pc)
>      libXi (xi.pc, required=1.7.4)
>      libXinerama
>      mesa-libEGL
>      startup-notification (libstartup-notification-1.0.pc, required=0.12)
>      xcb-randr (xcb-randr.pc)
>      xcb-res (xcb-res.pc)
>      xvfb-run
>      polkit-agent (polkit-agent-1.pc, required=0.102)
>      fuse (fuse.pc, required=2.8.0)
>      libbluray (libbluray.pc)
>      libcap
>      libimobiledevice (libimobiledevice-1.0.pc, required=1.2.0)
>      libnfs (libnfs.pc, required=1.9.8)
>      libplist-2.0 (libplist-2.0.pc, required=2.2.0)
>      libusb1 (libusb-1.0.pc, required=1.0.19)
>      dotconf (dotconf.pc, required=1.3)
>      espeak (required=1.46.02)
>      libsndfile (sndfile.pc, required=1.0.21)
>      exempi (exempi-2.0.pc, required=2.2.0)
>      boost (required=1.33.1)
>      libdmapsharing (libdmapsharing-3.0.pc)
>      libvorbis (vorbisfile.pc)
>      libraw (libraw.pc)
>      lmdb
>      libstemmer
>      valgrind (valgrind.pc, required=3.10.0)
>      libmusicbrainz (libmusicbrainz5.pc, required=5.0) Optional packages:
> (JHBuild will build the missing packages)
>    System installed packages which are too old:
>      (none)
>    No matching system package installed:
>      libepoxy (epoxy.pc)
>      iso-codes (iso-codes.pc)
>      cogl (cogl-1.0.pc)
>      libgdata (libgdata.pc)
>      WebKit6.0 (webkitgtk-6.0.pc, required=2.41.90)
>      mozjs102 (mozjs-102.pc, required=102.1.0gnome1)
>      telepathy-glib (telepathy-glib.pc)
>      telepathy-logger (telepathy-logger-0.2.pc)
>      libgee (gee-0.8.pc)
>      WebKit (webkit2gtk-4.0.pc, required=2.41.90)
> I: Installing dependencies on system: ninja shared-mime-info fontconfig gl
> libXext libXrender x11 libXft ragel libjpeg egl cups libXcursor
> desktop-file-utils flac libvpx taglib wavpack libavfilter libavformat
> libavcodec libavutil x11-xcb libv4l dbus libXtst xi xkbcommon-x11
> pulseaudio yasm cargo graphviz vala-bootstrap polkit-gobject libcanberra
> nss pam cmake libproxy argyll lcms2 docbook-utils libxkbfile libXrandr
> xkeyboard-config libexif libtiff libdrm libXcomposite xcb-dri2 hunspell
> avahi hyphen libwebp mesa-libGLES openjpeg ruby libXdamage libXt
> libcanberra-gtk3 dbus-glib libpwquality smbclient kyotocabinet anthy
> libhangul libxklavier sm xtrans liboauth openldap nspr dbus-run-session
> cvt libevdev libxkbcommon libX11 libXfixes libXi libXinerama mesa-libEGL
> startup-notification xcb-randr xcb-res xvfb-run polkit-agent fuse
> libbluray libcap libimobiledevice libnfs libplist-2.0 libusb1 dotconf
> espeak libsndfile exempi boost libdmapsharing libvorbis libraw lmdb
> libstemmer valgrind libmusicbrainz libepoxy iso-codes cogl libgdata
> WebKit6.0 mozjs102 telepathy-glib telepathy-logger libgee WebKit
> I: Using pacman to install packages.  Please wait.
> W: Provider for "ninja" was not found, ignoring
> W: Provider for "ragel" was not found, ignoring
> W: Provider for "libjpeg" was not found, ignoring
> W: Provider for "cups" was not found, ignoring
> W: Provider for "desktop-file-utils" was not found, ignoring
> W: Provider for "yasm" was not found, ignoring
> W: Provider for "cargo" was not found, ignoring
> W: Provider for "vala-bootstrap" was not found, ignoring
> W: Provider for "pam" was not found, ignoring
> W: Provider for "cmake" was not found, ignoring
> W: Provider for "argyll" was not found, ignoring
> W: Provider for "docbook-utils" was not found, ignoring
> W: Provider for "libtiff" was not found, ignoring
> W: Provider for "hyphen" was not found, ignoring
> W: Provider for "libwebp" was not found, ignoring
> W: Provider for "ruby" was not found, ignoring
> W: Provider for "openldap" was not found, ignoring
> W: Provider for "dbus-run-session" was not found, ignoring
> W: Provider for "cvt" was not found, ignoring
> W: Provider for "libXinerama" was not found, ignoring
> W: Provider for "mesa-libEGL" was not found, ignoring
> W: Provider for "xvfb-run" was not found, ignoring
> W: Provider for "libcap" was not found, ignoring
> W: Provider for "espeak" was not found, ignoring
> W: Provider for "boost" was not found, ignoring
> W: Provider for "lmdb" was not found, ignoring
> W: Provider for "libstemmer" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/shared-mime-info.pc" was not found,
> ignoring
> W: Provider for "/usr/lib/pkgconfig/fontconfig.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/gl.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/xext.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/xrender.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/x11.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/xft.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/egl.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/xcursor.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/flac.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/vpx.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/taglib.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/wavpack.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/libavfilter.pc" was not found,
> ignoring
> W: Provider for "/usr/lib/pkgconfig/libavformat.pc" was not found,
> ignoring
> W: Provider for "/usr/lib/pkgconfig/libavcodec.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/libavutil.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/x11-xcb.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/libv4l2.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/dbus-1.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/xtst.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/xi.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/xkbcommon-x11.pc" was not found,
> ignoring
> W: Provider for "/usr/lib/pkgconfig/libpulse-mainloop-glib.pc" was not
> found, ignoring
> W: Provider for "/usr/lib/pkgconfig/libgvc.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/polkit-gobject-1.pc" was not found,
> ignoring
> W: Provider for "/usr/lib/pkgconfig/libcanberra-gtk.pc" was not found,
> ignoring
> W: Provider for "/usr/lib/pkgconfig/nss.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/libproxy-1.0.pc" was not found,
> ignoring
> W: Provider for "/usr/lib/pkgconfig/lcms2.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/xkbfile.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/xrandr.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/xkeyboard-config.pc" was not found,
> ignoring
> W: Provider for "/usr/lib/pkgconfig/libexif.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/libdrm.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/xcomposite.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/xcb-dri2.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/hunspell.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/avahi-gobject.pc" was not found,
> ignoring
> W: Provider for "/usr/lib/pkgconfig/glesv2.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/libopenjp2.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/xdamage.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/xt.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/libcanberra-gtk3.pc" was not found,
> ignoring
> W: Provider for "/usr/lib/pkgconfig/dbus-glib-1.pc" was not found,
> ignoring
> W: Provider for "/usr/lib/pkgconfig/pwquality.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/smbclient.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/kyotocabinet.pc" was not found,
> ignoring
> W: Provider for "/usr/lib/pkgconfig/anthy.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/libhangul.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/libxklavier.pc" was not found,
> ignoring
> W: Provider for "/usr/lib/pkgconfig/sm.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/xtrans.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/oauth.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/nspr.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/libevdev.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/xkbcommon.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/x11.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/xfixes.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/xi.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/libstartup-notification-1.0.pc" was
> not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/xcb-randr.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/xcb-res.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/polkit-agent-1.pc" was not found,
> ignoring
> W: Provider for "/usr/lib/pkgconfig/fuse.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/libbluray.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/libimobiledevice-1.0.pc" was not
> found, ignoring
> W: Provider for "/usr/lib/pkgconfig/libnfs.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/libplist-2.0.pc" was not found,
> ignoring
> W: Provider for "/usr/lib/pkgconfig/libusb-1.0.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/dotconf.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/sndfile.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/exempi-2.0.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/libdmapsharing-3.0.pc" was not found,
> ignoring
> W: Provider for "/usr/lib/pkgconfig/vorbisfile.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/libraw.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/valgrind.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/libmusicbrainz5.pc" was not found,
> ignoring
> W: Provider for "/usr/lib/pkgconfig/epoxy.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/iso-codes.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/cogl-1.0.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/libgdata.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/webkitgtk-6.0.pc" was not found,
> ignoring
> W: Provider for "/usr/lib/pkgconfig/mozjs-102.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/telepathy-glib.pc" was not found,
> ignoring
> W: Provider for "/usr/lib/pkgconfig/telepathy-logger-0.2.pc" was not
> found, ignoring
> W: Provider for "/usr/lib/pkgconfig/gee-0.8.pc" was not found, ignoring
> W: Provider for "/usr/lib/pkgconfig/webkit2gtk-4.0.pc" was not found,
> ignoring
> I: Nothing to install
> 
> Any ideas what went wrong?
> 
> Thank you,
>    Neil
>

_______________________________________________
gnucash-user mailing list
[email protected]
To update your subscription preferences or to unsubscribe:
https://lists.gnucash.org/mailman/listinfo/gnucash-user
-----
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.
setup-mingw64.ps1 (text/plain, 19.3 KB)
# setup-mingw64.ps1: Powershell Script to create a MinGW64 Build Environment.
# Copyright 2017 John Ralls <[email protected]>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, contact:
# Free Software Foundation           Voice:  +1-617-542-5942
# 51 Franklin Street, Fifth Floor    Fax:    +1-617-542-2652
# Boston, MA  02110-1301,  USA       [email protected]

<#
.SYNOPSIS

Prepares a MinGW-w64 development environment from scratch
or enhances one already existing on the system.

.DESCRIPTION

Prepares a development environment for building GnuCash with jhbuild
in a MinGW-w64 (a.k.a. MSys2) environment. All required packages are
installed and the gnucash-on-windows repository containing the other
needed scripts is cloned into the target.

You may need to allow running scripts on your computer and depending
on where the target_dir is you may need to run the script with
Administrator privileges.

.PARAMETER target_dir

Optional. The path at which you wish to create the environment. If
none is provided the environment will be created at C:\gcdev64.

.PARAMETER download_dir

Optional. A path to which to download installers. Defaults to
target_dir\downloads.

.PARAMETER msys2_root

Optional. The root path of an already installed MSys2 environment.
E.g. C:\msys64.

.PARAMETER x86_64

Optional. A switch value. If true the toolchain will build x86_64
binaries; if false it will build i686 binaries. Defaults to false.

.PARAMETER preferred_mirror

Optional. A URI to a preferred repository mirror for both the
development environment setup and for the MSys2 package manager.
Defaults to http://repo.msys2.org

#>

[CmdletBinding()]
Param(
	[Parameter()] [string]$target_dir = "c:\\gcdev64",
	[Parameter()] [string]$download_dir = "$target_dir\\downloads",
	[Parameter()] [string]$msys2_root = "$target_dir\\msys2",
	[Parameter()] [switch]$x86_64,
	[Parameter()] [string]$preferred_mirror = "http://repo.msys2.org"
)

$bash_path = "$msys2_root\\usr\\bin\\bash.exe"

$progressPreference = 'silentlyContinue'
if ($x86_64) {
    $arch = "mingw64"
    $arch_code = "x86_64"
}
else {
    $arch = "mingw32"
    $arch_code = "i686"
}

$arch_long = "mingw-w64-$arch_code"
$mingw_prefix = "$arch/$arch_long-"
$mingw_path = "/$arch"
$mingw_bin = "$mingw_path/bin"
$preferred_mirror = $preferred_mirror.TrimEnd('/')
$mingw_url_prefix = "$preferred_mirror/mingw/$arch_code/$arch_long-"
$env:MSYSTEM = $arch.ToUpper()

if (!(test-path -path $target_dir)) {
    new-item "$target_dir" -type directory
}

if (!(test-path -path $download_dir)) {
    new-item "$download_dir" -type directory
}

function make-pkgnames ([string]$prefix, [string]$items) {
    $items.split(" ") | foreach-object {"$prefix$_"}
}

function Install-Package([string]$url, [string]$install_dir,
			 [string]$setup_args)
{
    $filename = $url.Substring($url.LastIndexOf("/") + 1)
    $download_file = "$download_dir\$filename"
    if (!(test-path -path $download_file)) {
	write-host "Downloading $download_file from $url"
	(New-Object System.Net.WebClient).DownloadFile($url, "$download_file")
    }

    write-host "Installing $download_file $setup_args"
    $psi = new-object "Diagnostics.ProcessStartInfo"
    $psi.Filename = "$download_file"
    $psi.Arguments = "$setup_args"
    $proc = [Diagnostics.Process]::Start($psi)
    $proc.waitForExit()
}


function bash-command() {
    param ([string]$command = "")
    if (!(test-path -path $bash_path)) {
	write-host "Shell program not found, aborting."
	return
    }
    #write-host "Running bash command ""$command"""
    Start-Process -FilePath "$bash_path" -ArgumentList "-c ""export PATH=/usr/bin; $command""" -NoNewWindow -Wait
}

function make-unixpath([string]$path) {
    $path -replace  "^([A-Z]):", '/$1' -replace "\\", '/' -replace "//", '/'  -replace "\(", '\(' -replace "\)", '\)' -replace " ", '\ '
}

# Install MSYS2 for the current machine's architechture.

if (!(test-path -path $bash_path)) {
    $mingw64_installer32 = "$preferred_mirror/distrib/msys2-i686-latest.exe"
    $mingw64_installer64 = "$preferred_mirror/distrib/msys2-x86_64-latest.exe"

    $mingw64_installer = If ([IntPtr]::size -eq 4) {$mingw64_installer32} Else {$mingw64_installer64}
    $msys_install_dir = (join-path $target_dir "msys2") -replace "\\", '/'
    $msys_setup_args = @"
"@

    install-package -url $mingw64_installer -install_dir "$msys2_root" -setup_args "in --root $msys_install_dir --al --am -c"

}
if (!(test-path -path $bash_path)) {
    write-host "Failed to install MSys2, aborting."
    exit
}

# prepend preferred_mirror to pacman mirrorlists
if ($PSBoundParameters.ContainsKey('preferred_mirror')) {
    $mirror_beacon = '# This and the next line are managed by GnuCash bootstrap: setup-mingw64.ps1'
    $mirrorconf_list = ( '[mingw32]', 'mingw/i686'),
                       ( '[mingw64]', 'mingw/x86_64'),
                       ( '[msys]',    'msys/$arch')
    $pacmanconf_path = "$msys2_root\etc\pacman.conf"
    $pacmanconf = (Get-Content -Path "$pacmanconf_path" -Raw) -creplace "(?m)^${mirror_beacon}\r?\nServer = .+\r?\n",''
    foreach ($mirrorconf in $mirrorconf_list) {
        $mirror_prepend = "$($mirrorconf[0])`n$mirror_beacon`nServer = $preferred_mirror/$($mirrorconf[1])`n"
        $pacmanconf = $pacmanconf -creplace ([System.Text.RegularExpressions.Regex]::Escape($mirrorconf[0]) + '.*\r?\n'),$mirror_prepend
    }
    Set-Content -NoNewline -Value $pacmanconf -Path "$pacmanconf_path"
}

# Install Html Help Workshop

$html_help_workshop_url =  "http://web.archive.org/web/20160201063255/http://download.microsoft.com/download/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe"
$html_help_workshop_installer = "htmlhelp.exe"

$installed_hh = get-item -path "hkcu:\SOFTWARE\Microsoft\HTML Help Workshop" | foreach-object{$_.GetValue("InstallDir")}

if (! (($installed_hh) -and (test-path -path $installed_hh))) {
  install-package -url $html_help_workshop_url -download_file "$download_dir\\$html_help_workshop_installer" -install_dir ${env:ProgramFiles(x86)} -setup_cmd $html_help_workshop_installer
}
$hhctrl_ocx = "c:\Windows\System32\hhctrl.ocx"
if (!(test-path -path $hhctrl_ocx)) {
    write-host "Something's wrong with HTML Help Workshop, couldn't find $hhctrl_ocx."
    exit
}
$hhctrl_ocx = make-unixpath -path $hhctrl_ocx


# Install Inno Setup
if (!(test-path -path ${env:ProgramFiles(x86)}\inno)) {
    $inno_setup_url = "http://files.jrsoftware.org/is/5/innosetup-5.5.9-unicode.exe"
    $inno_setup_installer = "innosetup-5.5.9-unicode.exe"
    $inno_setup_args = " /verysilent /suppressmsgboxes /nocancel /norestart /dir=""${env:ProgramFiles(x86)}\inno"""
   install-package -url $inno_setup_url -download_file "$download_dir\$inno_setup_installer" -install_dir ${env:ProgramFiles(x86)} -setup_cmd $inno_setup_installer -setup_args $inno_setup_args
}

#if MSys2 isn't already installed, install it.
if (!(test-path -path $bash_path)) {
   Write-Host @"
Updating the new installation. A bash window will open. In that window accept the proposed installation and close the window when the update completes.

There will be a second update.
"@
   bash-command -command "pacman -Syyuu --noconfirm"
}

#Update the system.
Write-Host @"

Updating the installation..
"@

bash-command -command "pacman -Syyuu --noconfirm"

# Set up aliases for the parts of msys-devtools and mingw-w64-toolchain that
# we need:
$devel = "asciidoc autoconf autoconf2.13 autogen automake-wrapper bison diffstat diffutils dos2unix file flex gawk gettext gettext-devel git gperf grep groff intltool libltdl libtool m4 make man-db pacman pactoys-git patch patchutils perl pkgconf python python-setuptools rsync sed texinfo texinfo-tex wget xmlto"

if (!($x86_64)) {
    $toolchain = "binutils cmake crt-git gcc gcc-libs gdb headers-git libmangle-git libtool libwinpthread-git make tools-git winpthreads-git"

    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-libyaml-0.2.5-2-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-appstream-glib-0.8.3-1-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-swig-4.4.1-1-any.pkg.tar.zst --noconfirm --needed"
}
else {
    $toolchain = "appstream-glib binutils cmake crt-git gcc gcc-libs gdb headers-git libmangle-git libtool libwinpthread-git make swig tools-git winpthreads-git"
}

# Install the system and toolchain:

$msys_devel = make-pkgnames -prefix "msys/" -items $devel
bash-command -command "pacman -S $msys_devel --noconfirm --needed"

$mingw_toolchain = make-pkgnames -prefix $mingw_prefix -items $toolchain
bash-command -command "pacman -S $mingw_toolchain --noconfirm --needed"

# The mingw-w64-webkitgtk3 package is no longer supported by the msys2
# project so we have our own build on SourceForge.
Write-Host @"
Now we'll install a pre-built webkitgtk3 package we've created and placed in the GnuCash project on SourceForge. It will install several more dependencies from Mingw-w64's repository.

First we need to import the signing key for it. That might hang, so if it takes more than a few seconds open task manager, find gpg-agent.exe in the Details tab, and end the task. You may have to to this twice.
"@
$sourceforge_url = "https://downloads.sourceforge.net/gnucash/Dependencies/"
$signing_keyfile = "jralls_public_signing_key.asc"
$key_url = $sourceforge_url + $signing_keyfile
$key_id = "C1F4DE993CF5835F"
$webkit = "$arch_long-webkitgtk3-2.4.11-999.11-any.pkg.tar.zst"
$libsoup = "$arch_long-libsoup-2.74.3-4-any.pkg.tar.zst"
$webkit_url = $sourceforge_url + $webkit
$webkit_sig = $webkit_url + ".sig"
$libsoup_url = $sourceforge_url + $libsoup
$libsoup_sig = $libsoup_url + ".sig"
$download_unix = make-unixpath $download_dir
bash-command -command "curl -L -s -S -o $signing_keyfile $key_url"
bash-command -command "pacman-key --add $signing_keyfile"
bash-command -command "pacman-key --lsign-key  $key_id"
bash-command -command "curl -L -s -S -O --output-dir $download_unix $webkit_url"
bash-command -command "curl -L -s -S -O --output-dir $download_unix $webkit_sig"
bash-command -command "curl -L -s -S -O --output-dir $download_unix $libsoup_url"
bash-command -command "curl -L -s -S -O --output-dir $download_unix $libsoup_sig"
$ignorefile = ""
[IO.File]::WriteAllLines( "$msys2_root\etc\pacman.d\gnucash-ignores.pacman", $ignorefile)
bash-command -command "perl -ibak -pe 'BEGIN{undef $/;} s#[[]options[]]\R(Include = [^\R]*\R)?#[options]\nInclude = /etc/pacman.d/gnucash-ignores.pacman\n#smg' /etc/pacman.conf"

# Install the remaining dependencies.
$deps = "boost libgcrypt iso-codes libsecret docbook-xsl"
# Mingw-w64 has dropped 32-bit support of several packages that we need so we must install them from the archive.
if (!($x86_64)) {
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-boost-libs-1.90.0-3-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-boost-1.90.0-3-any.pkg.tar.zst --noconfirm --needed"
    # bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-icu-76.1-1-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-libgpg-error-1.60-1-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-libgcrypt-1.12.2-2-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-libmariadbclient-3.3.8-2-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-libsecret-0.21.2-2-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-pdcurses-4.4.0-1-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-harfbuzz-14.2.1-1-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-harfbuzz-icu-11.0.1-1-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "sed -E -i 's/#IgnorePkg\s*=/IgnorePkg = mingw-w64-i686-harfbuzz/' /etc/pacman.conf"
}
else {
    $deps += " icu libmariadbclient libsoup pdcurses"
}
# Mingw-64 didn't pull gtk3
if (!($x86_64)) {
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-libdatrie-0.2.14-1-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-libthai-0.1.30-1-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-pango-1.57.1-1-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-librsvg-2.62.0-1-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-gtk-update-icon-cache-3.24.51-2-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-adwaita-icon-theme-legacy-46.2-1-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-adwaita-icon-theme-49.0-1-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-atk-2.60.4-1-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-json-glib-1.10.8-2-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-egl-headers-1.5.r284.3ae2b7c-1-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-libepoxy-1.5.10-7-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-shared-mime-info-2.4-4-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-gtk3-3.24.51-2-any.pkg.tar.zst --noconfirm --needed"
}
# Mingw-64 didn't update libsoup when they reconfigure libxml2 so we need our own version on 32-bit builds.
if (!($x86_64)) {
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-cantarell-fonts-0.311-1-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-adobe-source-code-pro-fonts-2.042u%2B1.062i%2B1.026vf-1-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-gsettings-desktop-schemas-50.0-1-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-duktape-2.7.0-1-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-libproxy-0.5.9-1-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-glib-networking-2.80.1-3-any.pkg.tar.zst --noconfirm --needed"
    bash-command -command "pacman -U $download_unix/$libsoup --noconfirm --needed"
}
bash-command -command "pacman -U $download_unix/$webkit --noconfirm --needed"

# Mingw-64 didn't update libxslt require by aqbanking
if (!($x86_64)) {
    bash-command -command "pacman -U https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-libxslt-1.1.45-1-any.pkg.tar.zst --noconfirm --needed"
}

$mingw_deps = make-pkgnames -prefix $mingw_prefix -items $deps
bash-command -command "pacman -S $mingw_deps --noconfirm --needed"


$target_unix = make-unixpath $target_dir

Write-Host @"

Next we'll install the HTML Help Workshop includes and libraries into our MinGW directory.
"@

$htmlhelp_h = "$msys2_root/$mingw_path/include/htmlhelp.h"
if (!(test-path -path $htmlhelp_h)) {
    if (!$installed_hh) {
	$installed_hh = get-item -path "hkcu:\SOFTWARE\Microsoft\HTML Help Workshop" | foreach-object{$_.GetValue("InstallDir")}
    }
    $installed_hh = make-unixpath -path $installed_hh
    if (!$installed_hh) {
	Write-Host @"
****** ERROR ****
There was an error installing HTML Help Workshop. This will prevent building the documentation. If you didn't before, run setup-mingw64.ps1 in a PowerShell instance with Administrative priviledge. If you did that already, you may need to install HTML Help Workshop by hand.
****************
"@
    } else {
	bash-command -command "cp $installed_hh/include/htmlhelp.h $mingw_path/include"

	bash-command -command "$mingw_bin/gendef $hhctrl_ocx - > $mingw_path/lib/htmlhelp.def"
	bash-command -command "$mingw_bin/dlltool -k -d $mingw_path/lib/htmlhelp.def -l $mingw_path/lib/libhtmlhelp.a"
    }
    if (!(test-path -path $htmlhelp_h)) {
	Write-Host "HTML Help Workshop isn't correctly installed."
    }
}
Write-Host @"

Clone the gnucash-on-windows repository into the target source directory, patch jhbuild to disable its DESTDIR dance and set up jhbuildrc with our prefixes.
"@

if (!(test-path -path "$target_dir\\src")) {
  New-Item $target_dir\\src -type directory
}if (!(test-path -path "$target_dir\\src\\gnucash-on-windows.git")) {
  bash-command -command "git clone https://github.com/gnucash/gnucash-on-windows.git $target_unix/src/gnucash-on-windows.git"
}
if (!(test-path -path "$target_dir\\src\\gnucash-on-windows.git")) {
   write-host "Failed to clone the gnucash-on-windows repo, exiting."
   exit
}

pause

if (!(test-path -path "$target_dir\\src\\jhbuild.git")) {
  bash-command -command "git clone https://gitlab.gnome.org/GNOME/jhbuild $target_unix/src/jhbuild.git"
  bash-command -command "/usr/bin/patch -f -d $target_unix/src/jhbuild.git -p1 -i $target_unix/src/gnucash-on-windows.git/patches/jhbuild.patch"
}
if (!(test-path -path "$target_dir\\src\\jhbuild.git")) {
   write-host "Failed to clone the jhbuild repo, exiting."
   exit
}
if (!(test-path -path "$target_dir\\msys2\\usr\\bin\\jhbuild")) {
    $jhbuild = get-content "$target_dir\\src\\gnucash-on-windows.git\\jhbuild.in" |
    %{$_ -replace "@-BASE_DIR-@", "$target_unix"}
    [IO.File]::WriteAllLines("$target_dir\\msys2\\usr\\bin\\jhbuild", $jhbuild)
}

$jhbuildrc = get-content "$target_dir\\src\\gnucash-on-windows.git\\jhbuildrc.in" |
 %{$_ -replace "@-BASE_DIR-@", "$target_unix"} |
 %{$_ -replace "@-DOWNLOAD_DIR-@", "$download_unix"} |
 %{$_ -replace "@-ARCH-@", "$arch"}
 [IO.File]::WriteAllLines("$target_dir\\src\\gnucash-on-windows.git\\jhbuildrc", $jhbuildrc)

Write-Host @"


Your build environment is now ready to use. Open an MSys2/$arch shell from the start menu, cd to $target_unix, and run
jhbuild -f src/gnucash-on-windows.git/jhbuildrc build

Note that the build will not work with the plain MSys2 shell!
"@
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.