Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Windows also build Linux native lib so it can run on WSL #651

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions native/Dockerfile-win-dockcross
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
FROM dockcross/windows-shared-x64
ARG IMAGE
FROM dockcross/$IMAGE

ARG GO_VERSION=1.22.1
ARG GO_ARCHIVE_CHECKSUM=aab8e15785c997ae20f9c88422ee35d962c4562212bb0f879d052a35c8307c7f

ENV DEFAULT_DOCKCROSS_IMAGE native-windows-cross-compile
ENV DEFAULT_DOCKCROSS_IMAGE native-${IMAGE}-cross-compile

RUN wget https://go.dev/dl/go$GO_VERSION.linux-amd64.tar.gz
RUN echo "$GO_ARCHIVE_CHECKSUM go$GO_VERSION.linux-amd64.tar.gz" | sha256sum --check --status
Expand Down
15 changes: 11 additions & 4 deletions native/wsl.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
#!/bin/bash
#!/bin/bash -x

docker build -f Dockerfile-win-dockcross -t native-windows-cross-compile .
docker build -f Dockerfile-win-dockcross --build-arg IMAGE=windows-shared-x64 -t native-windows-shared-x64-cross-compile .
docker build -f Dockerfile-win-dockcross --build-arg IMAGE=linux-x64 -t native-linux-x64-cross-compile .

docker run --rm native-windows-cross-compile > compress/build/native/native-windows-cross-compile
mkdir -p compress/build/native/

compress/build/native/native-windows-cross-compile \
docker run --rm native-windows-shared-x64-cross-compile > compress/build/native/native-windows-shared-x64-cross-compile
docker run --rm native-linux-x64-cross-compile > compress/build/native/native-linux-x64-cross-compile

compress/build/native/native-windows-shared-x64-cross-compile --image native-windows-shared-x64-cross-compile \
bash -c "cd compress/compress-jni &&
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -buildmode=c-shared -o ../build/native/compress_jni.dll compress-jni.go"

compress/build/native/native-linux-x64-cross-compile --image native-linux-x64-cross-compile \
bash -c "cd compress/compress-jni &&
CGO_ENABLED=1 go build -buildmode=c-shared -o ../build/native/libcompress_jni.so compress-jni.go"
Loading