Skip to content

Commit 98a4419

Browse files
authored
Try msys2 (#580)
* Try msys2 * Try to get everythin from msys2 * Try to go further * Attempt to fix go vet * Add back all jobs
1 parent 6d41afd commit 98a4419

3 files changed

Lines changed: 52 additions & 26 deletions

File tree

.github/workflows/cd.yml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -277,30 +277,42 @@ jobs:
277277

278278
build_windows_x86_64:
279279
runs-on: windows-latest
280+
defaults:
281+
run:
282+
shell: msys2 {0}
280283
steps:
281284
- uses: actions/checkout@v4
282285
with:
283286
submodules: true
284287
- uses: actions/setup-go@v5
285288
with:
286289
go-version: '1.25.0'
287-
- run: echo "VERSION=$(echo ${{ github.event.release.tag_name }} | cut -c 2-)" >> $GITHUB_ENV
288-
- run: choco install wget make hashdeep --ignore-checksums
289-
- run: wget --no-check-certificate http://www.openal-soft.org/openal-binaries/openal-soft-1.21.0-bin.zip
290-
- run: wget https://github.com/electron/rcedit/releases/download/v1.1.1/rcedit-x64.exe
291-
- run: curl -L -o mingw64.zip https://github.com/brechtsanders/winlibs_mingw/releases/download/13.2.0posix-17.0.6-11.0.1-ucrt-r5/winlibs-x86_64-posix-seh-gcc-13.2.0-llvm-17.0.6-mingw-w64ucrt-11.0.1-r5.zip
292-
- run: unzip mingw64.zip
293-
- run: 7z x openal-soft-1.21.0-bin.zip -o/c/
294-
- run: echo "CGO_CFLAGS=-I/c/openal-soft-1.21.0-bin/include/" >> $GITHUB_ENV
295-
- run: echo "CGO_LDFLAGS=-L/c/openal-soft-1.21.0-bin/libs/Win64/" >> $GITHUB_ENV
296-
- run: cp "mingw64/bin/libwinpthread-1.dll" .
297-
- run: cp /c/openal-soft-1.21.0-bin/bin/Win64/soft_oal.dll OpenAL32.dll
290+
- uses: msys2/setup-msys2@v2
291+
with:
292+
msystem: UCRT64
293+
update: true
294+
path-type: inherit
295+
install: >-
296+
mingw-w64-ucrt-x86_64-toolchain
297+
mingw-w64-ucrt-x86_64-openal
298+
make
299+
p7zip
300+
mingw-w64-ucrt-x86_64-rcedit
301+
- run: echo "VERSION=$(echo ${{ github.event.release.tag_name }} | cut -c 2-)" >> "$GITHUB_ENV"
302+
- run: cp /ucrt64/bin/rcedit.exe ./rcedit-x64
303+
- run: cp /ucrt64/lib/libopenal.dll.a ./libOpenAL32.dll.a
304+
- run: echo "CGO_LDFLAGS=-L$PWD" >> "$GITHUB_ENV"
305+
- run: cp /ucrt64/bin/libgcc_s_seh-1.dll .
306+
- run: cp /ucrt64/bin/libmysofa.dll .
307+
- run: cp /ucrt64/bin/libopenal-1.dll .
308+
- run: cp /ucrt64/bin/libstdc++-6.dll .
309+
- run: cp /ucrt64/bin/libwinpthread-1.dll .
310+
- run: cp /ucrt64/bin/zlib1.dll .
298311
- run: cp /c/Windows/System32/VCRUNTIME140.dll .
299-
- run: PATH="/c/mingw64/bin:$PATH"
300312
- run: mkdir -p ./Ludo-Windows-x86_64-${VERSION}/
301313
- run: cp *.dll ./Ludo-Windows-x86_64-${VERSION}/
302314
- run: OS=Windows ARCH=x86_64 VERSION=$VERSION make zip
303-
- run: hashdeep -c sha256 Ludo-Windows-x86_64-${VERSION}.zip > Ludo-Windows-x86_64-${VERSION}.zip.sha256
315+
- run: sha256sum Ludo-Windows-x86_64-${VERSION}.zip > Ludo-Windows-x86_64-${VERSION}.zip.sha256
304316

305317
- name: Upload Release Asset
306318
uses: alexellis/upload-assets@0.2.2

.github/workflows/ci.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -197,26 +197,32 @@ jobs:
197197

198198
build_windows_x86_64:
199199
runs-on: windows-latest
200+
defaults:
201+
run:
202+
shell: msys2 {0}
200203
steps:
201204
- uses: actions/checkout@v4
202205
with:
203206
submodules: true
204207
- uses: actions/setup-go@v5
205208
with:
206209
go-version: '1.25.0'
207-
- run: echo "/c/Users/runneradmin/go/bin" >> $GITHUB_PATH
210+
- uses: msys2/setup-msys2@v2
211+
with:
212+
msystem: UCRT64
213+
update: true
214+
path-type: inherit
215+
install: >-
216+
mingw-w64-ucrt-x86_64-toolchain
217+
mingw-w64-ucrt-x86_64-openal
218+
- run: echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
208219
- run: go install honnef.co/go/tools/cmd/staticcheck@latest
209-
- run: choco install wget --ignore-checksums
210-
- run: curl -L -o mingw64.zip https://github.com/brechtsanders/winlibs_mingw/releases/download/13.2.0posix-17.0.6-11.0.1-ucrt-r5/winlibs-x86_64-posix-seh-gcc-13.2.0-llvm-17.0.6-mingw-w64ucrt-11.0.1-r5.zip
211-
- run: unzip mingw64.zip
212-
- run: wget --no-check-certificate http://www.openal-soft.org/openal-binaries/openal-soft-1.21.0-bin.zip
213-
- run: 7z x openal-soft-1.21.0-bin.zip -o/c/
214-
- run: echo "CGO_CFLAGS=-I/c/openal-soft-1.21.0-bin/include/" >> $GITHUB_ENV
215-
- run: echo "CGO_LDFLAGS=-L/c/openal-soft-1.21.0-bin/libs/Win64/" >> $GITHUB_ENV
216-
- run: cp "mingw64/bin/libwinpthread-1.dll" .
217-
- run: PATH="/c/mingw64/bin:$PATH"
220+
# golang.org/x/mobile/exp/audio/al hardcodes -lOpenAL32 on Windows,
221+
# while the MSYS2 package installs libopenal.dll.a.
222+
- run: cp /ucrt64/lib/libopenal.dll.a ./libOpenAL32.dll.a
223+
- run: echo "CGO_LDFLAGS=-L$PWD" >> "$GITHUB_ENV"
218224
- run: go get .
219-
#- run: go test -v -race ./...
220-
#- run: go vet ./...
225+
- run: go test -v -race ./...
226+
- run: go vet ./...
221227
- run: staticcheck ./...
222228
- run: go build -v -ldflags '-H=windowsgui'

libretro/libretro_windows.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
package libretro
22

3+
/*
4+
#include <stdint.h>
5+
6+
static void *symbol_from_addr(uintptr_t addr) {
7+
return (void *)addr;
8+
}
9+
*/
10+
import "C"
311
import (
412
"syscall"
513
"unsafe"
@@ -11,7 +19,7 @@ type DlHandle = *syscall.DLL
1119
// DlSym loads a symbol from a dynamic library
1220
func DlSym(handle DlHandle, name string) unsafe.Pointer {
1321
proc := handle.MustFindProc(name)
14-
return unsafe.Pointer(proc.Addr())
22+
return C.symbol_from_addr(C.uintptr_t(proc.Addr()))
1523
}
1624

1725
// DlOpen opens a dynamic library

0 commit comments

Comments
 (0)