msys2

Started by Andrew Dunstanover 7 years ago1 messages
#1Andrew Dunstan
andrew@dunslane.net
1 attachment(s)

Disclaimer: I might have done things in not the best way - I'll happily
accept correction.

Here is some information about building on msys2, the rewrite of msys,
plus a proposal for a couple of tiny changes to support it.

The simplest way to install msys2 is via the chocolatey package manager
(See <https://chocolatey.org/docs/installation&gt;)

    choco install -y msys2

Alternatively, download the installer and run it.

Once that's done, fire up an Msys2 shell and use its package manager to
install the required tools:

    pacman -S msys/bison \

        msys/flex \

        msys/make \

        msys/git \

        msys/perl \

        msys/ccache \

        msys/diffutils \

        mingw-w64-x86_64-toolchain \

        mingw-w64-i686-toolchain

If you want to run a buildfarm animal, there are a few other things you
will also need:

    pacman -S msys/perl-libwww msys/perl-Crypt-SSLeay msys/tar

If you want to run TAP tests, you need to install IPC::Run somewhere and
point PERL5LIB at it. There is no pacman package available. You will
also need:

    pacman -S msys/perl-Test-Simple msys/perl-Test-Harness

And there are a few very useful things it makes sense to install:

    pacman -S msys/vim msys/patch

Pre-build setup:

For 64 bit builds:

    unset MSYSTEM_CHOST # or export MSYSTEM_CHOST=x86_64-w64-mingw32

    export MSYSTEM=MINGW64

    export PATH=/mingw64/bin:$PATH

For 32 bit builds

    unset MSYSTEM_CHOST # or export MSYSTEM_CHOST=i686-w64-mingw32

    export MSYSTEM=MINGW32

    export PATH=/mingw32/bin:$PATH

build:

    ./configure --with-template=win32 ...

Things that fail:

* configure without a tamplate - there is a simple fix for this,
included in the attached patch
* pg_upgrade test - I was clearly not thorough enough with my fix in
commit 608a71095. It occurred to me that rather than using `uname
-s` and  putting "MINGW*|MSYS*" everywhere, it might be better to
use the "host_os" value from Makefile.global. The patch does it that
way, falling back to uname if necessary. But I'm with doing it the
other way of people prefer. Yes, I know I should use backticks
instead of $().
* the pg_dump TAP test 010_dump_connstr.pl chokes badly on $dname3 and
$dbname4. The commands complain about too many arguments. It seems
weird because jacana is doing this just fine.
* 32 bit builds only fail the circle regression test like this:

    *** C:/tools/msys64/home/Administrator/bf/root/HEAD/pgsql/src/test/regress/expected/circle.out	2018-10-03 18:52:44.137775400 +0000
    --- C:/tools/msys64/home/administrator/bf/root/HEAD/pgsql.build/src/test/regress/results/circle.out	2018-10-05 20:59:45.424014300 +0000
    ***************
    *** 109,116 ****
         WHERE (c1.f1 < c2.f1) AND ((c1.f1 <-> c2.f1) > 0)
         ORDER BY distance, area(c1.f1), area(c2.f1);
        five |      one       |      two       |     distance
    ! ------+----------------+----------------+------------------
    !       | <(3,5),0>      | <(1,2),3>      | 0.60555127546399
             | <(3,5),0>      | <(5,1),3>      | 1.47213595499958
             | <(100,200),10> | <(100,1),115>  |               74
             | <(100,200),10> | <(1,2),100>    | 111.370729772479
    --- 109,116 ----
         WHERE (c1.f1 < c2.f1) AND ((c1.f1 <-> c2.f1) > 0)
         ORDER BY distance, area(c1.f1), area(c2.f1);
        five |      one       |      two       |     distance
    ! ------+----------------+----------------+-------------------
    !       | <(3,5),0>      | <(1,2),3>      | 0.605551275463989
             | <(3,5),0>      | <(5,1),3>      |  1.47213595499958
             | <(100,200),10> | <(100,1),115>  |                74
             | <(100,200),10> | <(1,2),100>    |  111.370729772479

cheers

andrew

Attachments:

msys2-changes.patchtext/x-patch; name=msys2-changes.patchDownload
diff --git a/configure b/configure
index 0448c6b..a0a6989 100755
--- a/configure
+++ b/configure
@@ -2945,6 +2945,7 @@ dragonfly*) template=netbsd ;;
  linux*|gnu*|k*bsd*-gnu)
            template=linux ;;
    mingw*) template=win32 ;;
+    msys*) template=win32 ;;
   netbsd*) template=netbsd ;;
  openbsd*) template=openbsd ;;
  solaris*) template=solaris ;;
diff --git a/configure.in b/configure.in
index 23b5bb8..11be746 100644
--- a/configure.in
+++ b/configure.in
@@ -67,6 +67,7 @@ dragonfly*) template=netbsd ;;
  linux*|gnu*|k*bsd*-gnu)
            template=linux ;;
    mingw*) template=win32 ;;
+    msys*) template=win32 ;;
   netbsd*) template=netbsd ;;
  openbsd*) template=openbsd ;;
  solaris*) template=solaris ;;
diff --git a/src/bin/pg_upgrade/Makefile b/src/bin/pg_upgrade/Makefile
index adb0d5d..8b76650 100644
--- a/src/bin/pg_upgrade/Makefile
+++ b/src/bin/pg_upgrade/Makefile
@@ -37,7 +37,7 @@ clean distclean maintainer-clean:
 	       pg_upgrade_dump_*.custom pg_upgrade_*.log
 
 check: test.sh all
-	MAKE=$(MAKE) bindir=$(bindir) libdir=$(libdir) EXTRA_REGRESS_OPTS="$(EXTRA_REGRESS_OPTS)" $(SHELL) $< --install
+	MAKE=$(MAKE) bindir=$(bindir) libdir=$(libdir) EXTRA_REGRESS_OPTS="$(EXTRA_REGRESS_OPTS)" $(SHELL) HOST_OS=$(host_os) $< --install
 
 # installcheck is not supported because there's no meaningful way to test
 # pg_upgrade against a single already-running server
diff --git a/src/bin/pg_upgrade/test.sh b/src/bin/pg_upgrade/test.sh
index f895663..28f8a2e 100644
--- a/src/bin/pg_upgrade/test.sh
+++ b/src/bin/pg_upgrade/test.sh
@@ -30,11 +30,12 @@ standard_initdb() {
 	../../test/regress/pg_regress --config-auth "$PGDATA"
 }
 
-# Establish how the server will listen for connections
-testhost=`uname -s`
+# Establish how the server will listen for connections.
+# Fall back to uname if necessary
+testhost=${HOST_OS:-$(uname -s)}
 
 case $testhost in
-	MINGW*|MSYS*)
+	MINGW*)
 		LISTEN_ADDRESSES="localhost"
 		PGHOST=localhost
 		;;