Test more platforms with Appveyor

- C build with MinGW32
- C build with MSYS2/MinGW64
- Perl build with ActivePerl
diff --git a/appveyor.yml b/appveyor.yml
index 69bebbb..eb0d9b0 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -18,10 +18,17 @@
     LUCY_DEBUG: 1
   matrix:
     - CLOWNFISH_HOST: c
+      BUILD_ENV: msys2
+      MSYSTEM: MINGW64
+    - CLOWNFISH_HOST: c
+      BUILD_ENV: mingw32
+    - CLOWNFISH_HOST: c
+      BUILD_ENV: msvc
       MSVC_VERSION: 10
     - CLOWNFISH_HOST: c
+      BUILD_ENV: msvc
       MSVC_VERSION: 12
-#    - CLOWNFISH_HOST: perl
+    - CLOWNFISH_HOST: perl
 
 build: off
 
diff --git a/devel/bin/appveyor-build.bat b/devel/bin/appveyor-build.bat
index 7620f38..5798496 100644
--- a/devel/bin/appveyor-build.bat
+++ b/devel/bin/appveyor-build.bat
@@ -15,6 +15,11 @@
 rem See the License for the specific language governing permissions and
 rem limitations under the License.
 
+if "%BUILD_ENV%" == "msys2" goto test_msys2
+
+rem Install Clownfish.
+git clone -q --depth 1 https://git-wip-us.apache.org/repos/asf/lucy-clownfish.git
+
 if "%CLOWNFISH_HOST%" == "c" goto test_c
 if "%CLOWNFISH_HOST%" == "perl" goto test_perl
 
@@ -26,6 +31,14 @@
 rem Needed to find DLL.
 path C:\install\bin;%path%
 
+if "%BUILD_ENV%" == "msvc" goto test_msvc
+if "%BUILD_ENV%" == "mingw32" goto test_mingw32
+
+echo unknown BUILD_ENV: %BUILD_ENV%
+exit /b 1
+
+:test_msvc
+
 if "%MSVC_VERSION%" == "10" goto msvc_10
 
 call "C:\Program Files (x86)\Microsoft Visual Studio %MSVC_VERSION%.0\VC\vcvarsall.bat" amd64
@@ -36,23 +49,49 @@
 
 :msvc_build
 
-rem Install Clownfish.
-cd \projects
-git clone -q --depth 1 https://git-wip-us.apache.org/repos/asf/lucy-clownfish.git
 cd lucy-clownfish\runtime\c
 call configure && nmake || exit /b
 call install --prefix C:\install
 
-cd \projects\lucy\c
+cd ..\..\..\c
 call configure --clownfish-prefix C:\install && nmake && nmake test
 
 exit /b
 
+:test_mingw32
+
+path C:\MinGW\bin;%path%
+
+cd lucy-clownfish\compiler\c
+call configure && mingw32-make || exit /b
+cd ..\..\runtime\c
+call configure && mingw32-make || exit /b
+call install --prefix C:\install
+
+cd ..\..\..\c
+call configure --clownfish-prefix C:\install && mingw32-make && mingw32-make test
+
+exit /b
+
+:test_msys2
+
+C:\msys64\usr\bin\sh -lc "cd /c/projects/lucy && devel/bin/travis-test.sh"
+
+exit /b
+
 :test_perl
 
+path C:\MinGW\bin;%path%
+call ppm install dmake
+
 perl -V
 
-cd perl
+cd lucy-clownfish\compiler\perl
+perl Build.PL && call Build install || exit /b
+cd ..\..\runtime\perl
+perl Build.PL && call Build install || exit /b
+
+cd ..\..\..\perl
 perl Build.PL && call Build && call Build test
 
 exit /b
diff --git a/devel/bin/travis-test.sh b/devel/bin/travis-test.sh
index 6e9c494..6f245d8 100755
--- a/devel/bin/travis-test.sh
+++ b/devel/bin/travis-test.sh
@@ -21,7 +21,8 @@
 # Print all commands before executing.
 set -x
 
-install_dir="$TRAVIS_BUILD_DIR/install"
+build_dir="$(pwd)"
+install_dir="$build_dir/install_dir"
 
 # Fetch Clownfish.
 git clone -q --depth 1 https://git-wip-us.apache.org/repos/asf/lucy-clownfish.git
@@ -33,6 +34,9 @@
     make -j
     ./install.sh --prefix "$install_dir"
 
+    # Needed to find DLL on Windows.
+    export PATH="$install_dir/bin:$PATH"
+
     cd ../../../c
     ./configure --clownfish-prefix "$install_dir"
     make -j test
@@ -59,9 +63,9 @@
 test_go() {
     export GOPATH="$install_dir"
     mkdir -p "$install_dir/src/git-wip-us.apache.org/repos/asf"
-    ln -s "$TRAVIS_BUILD_DIR/lucy-clownfish" \
+    ln -s "$build_dir/lucy-clownfish" \
         "$install_dir/src/git-wip-us.apache.org/repos/asf/lucy-clownfish.git"
-    ln -s "$TRAVIS_BUILD_DIR" \
+    ln -s "$build_dir" \
         "$install_dir/src/git-wip-us.apache.org/repos/asf/lucy.git"
 
     # Install Clownfish.