ruki пре 4 година
родитељ
комит
561ce094ac

+ 1 - 1
.github/workflows/mingw.yml → .github/workflows/mingw_macos.yml

@@ -1,4 +1,4 @@
-name: MingW
+name: MingW (MacOS)
 
 on:
   pull_request:

+ 49 - 0
.github/workflows/mingw_msys2.yml

@@ -0,0 +1,49 @@
+name: MingW (Msys2)
+
+on:
+  push:
+  pull_request:
+
+jobs:
+  build:
+    runs-on: windows-latest
+    strategy:
+      fail-fast: false
+      matrix:
+        include: [
+            { msystem: MINGW64, kind: static, arch: x86_64, prefix: /mingw64 },
+            { msystem: MINGW64, kind: shared, arch: x86_64, prefix: /mingw64 },
+            { msystem: MINGW32, kind: static, arch: i686,   prefix: /mingw32 },
+            { msystem: MINGW32, kind: shared, arch: i686,   prefix: /mingw32 }
+        ]
+
+    steps:
+
+      - uses: actions/checkout@v1
+      - uses: msys2/setup-msys2@v2
+        with:
+          msystem: ${{ matrix.msystem }}
+          install: git base-devel unzip mingw-w64-${{ matrix.arch }}-toolchain
+          update: true
+
+      - name: Prepare
+        shell: msys2 {0}
+        run: |
+          git clone https://github.com/xmake-io/xmake.git --recurse-submodules -b dev
+          cd xmake
+          make build
+          make install PREFIX=${{ matrix.prefix }}
+          xmake --version
+          cd ..
+          git reset --hard HEAD
+          git clean -fdx
+
+      - name: Tests
+        shell: msys2 {0}
+        run: |
+          if [ "${{ matrix.arch }}" == "x86_64" ]; then
+            xmake l ./scripts/test.lua -vD -p mingw -a x86_64 -k ${{ matrix.kind }}
+          else
+            xmake l ./scripts/test.lua -vD -p mingw -a i386 -k ${{ matrix.kind }}
+          fi
+

+ 3 - 3
packages/p/pcre/xmake.lua

@@ -9,7 +9,7 @@ package("pcre")
     add_versions("8.40", "99e19194fa57d37c38e897d07ecb3366b18e8c395b36c6d555706a7f1df0a5d4")
     add_versions("8.41", "0e914a3a5eb3387cad6ffac591c44b24bc384c4e828643643ebac991b57dfcc5")
 
-    if is_host("windows") then
+    if is_host("windows") and not is_plat("mingw") then
         add_deps("cmake")
     end
 
@@ -25,7 +25,7 @@ package("pcre")
     end)
 
     on_install("windows", function (package)
-        local configs = {}
+        local configs = {"-DPCRE_BUILD_TESTS=OFF"}
         table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
         table.insert(configs, "-DPCRE_SUPPORT_JIT=" .. (package:config("jit") and "ON" or "OFF"))
         local bitwidth = package:config("bitwidth") or "8"
@@ -39,7 +39,7 @@ package("pcre")
         import("package.tools.cmake").install(package, configs)
     end)
 
-    on_install("macosx", "linux", "mingw@linux,macosx", function (package)
+    on_install("macosx", "linux", "mingw", function (package)
         local configs = {}
         if package:config("shared") then
             table.insert(configs, "--enable-shared=yes")

+ 10 - 0
packages/z/zlib/xmake.lua

@@ -16,6 +16,16 @@ package("zlib")
         os.cp("*.h", package:installdir("include"))
     end)
 
+    on_install("mingw@windows", function (package)
+        if is_subhost("msys") then
+            io.gsub("win32/Makefile.gcc", "\nCC =.-\n",      "\nCC=" .. (package:build_getenv("cc") or "") .. "\n")
+            io.gsub("win32/Makefile.gcc", "\nAR =.-\n",      "\nAR=" .. (package:build_getenv("ar") or "") .. "\n")
+            import("package.tools.make").build(package, {"-f", "win32/Makefile.gcc", "libz.a"})
+            os.cp("libz.a", package:installdir("lib"))
+            os.cp("*.h", package:installdir("include"))
+        end
+    end)
+
     on_install("linux", "macosx", function (package)
         import("package.tools.autoconf").install(package, {"--static"})
     end)