瀏覽代碼

enable windows for cosmocc (#3248)

* enable windows for cosmocc

* use newest xmake core

* fix cosmocc

* update ci
ruki 1 年之前
父節點
當前提交
b5cff0d153
共有 3 個文件被更改,包括 18 次插入5 次删除
  1. 1 1
      .github/workflows/mingw_msys2.yml
  2. 12 3
      .github/workflows/windows.yml
  3. 5 1
      packages/c/cosmocc/xmake.lua

+ 1 - 1
.github/workflows/mingw_msys2.yml

@@ -33,7 +33,7 @@ jobs:
       - name: Prepare
         shell: msys2 {0}
         run: |
-          git clone https://github.com/xmake-io/xmake.git --recurse-submodules -b dev
+          git clone https://github.com/xmake-io/xmake.git --recurse-submodules -b master
           cd xmake
           ./configure
           make -j4

+ 12 - 3
.github/workflows/windows.yml

@@ -35,11 +35,20 @@ jobs:
 
       - name: Tests
         run: |
-          git clone https://github.com/xmake-io/xmake.git -b master xmakesrc
+          git clone https://github.com/xmake-io/xmake.git --recurse-submodules -b master xmakesrc
+          cd xmakesrc/core
+          xmake
+          cd ../..
+          Copy-Item ./xmakesrc/core/build/xmake.exe ./xmakesrc/xmake
+          Copy-Item ./xmakesrc/scripts/xrepo.bat ./xmakesrc/xmake
+          Copy-Item ./xmakesrc/scripts/xrepo.ps1 ./xmakesrc/xmake
+          $Env:XMAKE_MAIN_REPO = "https://github.com/xmake-io/xmake-repo.git"
           $Env:XMAKE_PROGRAM_DIR = $(Resolve-Path ./xmakesrc/xmake)
+          Set-Item -Path Env:Path -Value ($Env:XMAKE_PROGRAM_DIR + ";" + $Env:Path)
+          xmake --version
           if ("${{ matrix.os }}" -eq "windows-2019") {
-            xmake l ./scripts/test.lua -vD -a ${{ matrix.arch }} -k ${{ matrix.kind }} --runtimes=${{ matrix.runtimes }} --vs_sdkver=10.0.19041.0 --linkjobs=2
+            xmake l ./scripts/test.lua -vD -a ${{ matrix.arch }} -k ${{ matrix.kind }} --runtimes=${{ matrix.runtimes }} --vs_sdkver=10.0.19041.0 --linkjobs=2 cosmocc
           } else {
-            xmake l ./scripts/test.lua -vD -a ${{ matrix.arch }} -k ${{ matrix.kind }} --runtimes=${{ matrix.runtimes }} --linkjobs=2
+            xmake l ./scripts/test.lua -vD -a ${{ matrix.arch }} -k ${{ matrix.kind }} --runtimes=${{ matrix.runtimes }} --linkjobs=2 cosmocc
           }
 

+ 5 - 1
packages/c/cosmocc/xmake.lua

@@ -7,7 +7,11 @@ package("cosmocc")
              "https://github.com/xmake-mirror/cosmopolitan/releases/download/$(version)/cosmocc-$(version).zip")
     add_versions("3.2.4", "d2fa6dbf6f987310494581deff5b915dbdc5ca701f20f7613bb0dcf1de2ee511")
 
-    on_install("@macosx", "@linux", "@bsd", "@cygwin", "@msys", function (package)
+    on_install("@windows", "@macosx", "@linux", "@bsd", "@cygwin", "@msys", function (package)
+        if is_host("windows") then
+            import("lib.detect.find_tool")
+            assert(find_tool("sh"), "cosmocc need sh/bash, please install it first!")
+        end
         os.cp("*", package:installdir(), {symlink = true})
     end)