@@ -17,10 +17,11 @@ jobs:
1717 target : x86_64-unknown-linux-gnu
1818 output : linux-x64
1919 ext : so
20- - os : windows -latest
20+ - os : ubuntu -latest
2121 target : x86_64-pc-windows-gnu
2222 output : win-x64
2323 ext : dll
24+ is_cross : true
2425 - os : macos-latest
2526 target : aarch64-apple-darwin
2627 output : osx-arm64
@@ -39,46 +40,23 @@ jobs:
3940 ref : ${{ github.event.inputs.libsql_ref }}
4041 path : libsql
4142
42- - name : Setup MSYS2 for Windows
43- if : matrix.os == 'windows-latest'
44- uses : msys2/setup-msys2@v2
45- with :
46- update : true
47- install : mingw-w64-x86_64-toolchain gcc make base-devel
48- msystem : mingw64
49- path-type : inherit
43+ - name : Install MinGW for cross-compilation
44+ if : matrix.is_cross == true
45+ run : |
46+ sudo apt-get update
47+ sudo apt-get install -y mingw-w64
5048
5149 - name : Setup Rust
5250 uses : dtolnay/rust-toolchain@stable
5351 with :
5452 targets : ${{ matrix.target }}
5553
56- - name : Setup Windows GNU toolchain
57- if : matrix.os == 'windows-latest'
58- run : |
59- # Install the GNU target and toolchain
60- rustup target add x86_64-pc-windows-gnu
61- rustup toolchain install stable-x86_64-pc-windows-gnu
62- # Configure cargo for Windows
63- mkdir -p .cargo
64- echo "[net]" >> .cargo/config.toml
65- echo "git-fetch-with-cli = true" >> .cargo/config.toml
66-
67- - name : Build libSQL (Windows)
68- if : matrix.os == 'windows-latest'
69- working-directory : libsql/bindings/c
70- env :
71- CC : gcc
72- AR : ar
73- run : cargo build --release --target ${{ matrix.target }}
74-
75- - name : Build libSQL (Unix)
76- if : matrix.os != 'windows-latest'
54+ - name : Build libSQL
7755 working-directory : libsql/bindings/c
7856 run : cargo build --release --target ${{ matrix.target }}
7957
8058 - name : Create shared library (Linux)
81- if : matrix.os == 'ubuntu-latest'
59+ if : matrix.os == 'ubuntu-latest' && matrix.target == 'x86_64-unknown-linux-gnu'
8260 run : |
8361 cd libsql/target/${{ matrix.target }}/release
8462 ar -x libsql_experimental.a
@@ -87,13 +65,12 @@ jobs:
8765 cp libsql.so ${{ github.workspace }}/artifacts/${{ matrix.output }}/native/
8866
8967 - name : Create shared library (Windows)
90- if : matrix.os == 'windows-latest'
91- shell : msys2 {0}
68+ if : matrix.target == 'x86_64-pc-windows-gnu'
9269 run : |
9370 cd libsql/target/${{ matrix.target }}/release
94- # Extract object files and create DLL
71+ # Extract object files and create DLL using MinGW
9572 ar -x libsql_experimental.a
96- gcc -shared -o libsql.dll *.o \
73+ x86_64-w64-mingw32- gcc -shared -o libsql.dll *.o \
9774 -Wl,--export-all-symbols \
9875 -lws2_32 -ladvapi32 -luserenv -lbcrypt -lntdll -lcrypt32 \
9976 -lsecur32 -lkernel32 -lole32 -loleaut32 -luuid -lncrypt \
0 commit comments