Build multiplatform from MacOS

This commit is contained in:
Iván Izaguirre 2024-02-13 22:50:44 +01:00
parent 5fe1dc4fdf
commit 94c85a460a
3 changed files with 46 additions and 13 deletions

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
cd "$( dirname $0)" cd "$( dirname $0)"
docker build . -t apple2builder docker build . -t apple2builder --platform linux/amd64
mkdir -p ${PWD}/build mkdir -p ${PWD}/build
docker run --rm -it -v ${PWD}/build:/build apple2builder docker run --rm -it -v ${PWD}/build:/build apple2builder

27
dockerbuild/build_all.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
cd "$( dirname $0)"
mkdir -p ${PWD}/build
# MacOS builds
echo "Building MacOS console frontend"
CGO_ENABLED=1 go build -tags static -ldflags "-s -w" ../frontend/console
mv console build/izapple2console_mac_arm64
echo "Building MacOS SDL frontend"
CGO_ENABLED=1 go build -tags static -ldflags "-s -w" ../frontend/a2sdl
mv a2sdl build/izapple2sdl_mac_arm64
echo "Building MacOS Fyne frontend"
CGO_ENABLED=1 go build -tags static -ldflags "-s -w" ../frontend/a2fyne
mv a2fyne build/izapple2fyne_mac_arm64
# Linux and Windows dockerized builds
echo "Building docker container for the Linux and Windows builds"
docker build . -t apple2builder --platform linux/amd64
docker run --rm -it -v ${PWD}/build:/build apple2builder
cd build
cp ../../README.md .
zip izapple2sdl_windows_amd64.zip izapple2sdl_windows_amd64.exe README-SDL.txt README.md SDL2.dll

View File

@ -3,40 +3,46 @@ cd /tmp
git clone https://github.com/ivanizag/izapple2 git clone https://github.com/ivanizag/izapple2
# Build izapple2console for Linux # Build izapple2console for Linux
echo "Building Linux console frontend"
cd /tmp/izapple2/frontend/console cd /tmp/izapple2/frontend/console
go build . env CGO_ENABLED=1 go build -tags static -ldflags "-s -w" .
chown --reference /build console chown --reference /build console
cp console /build/izapple2console cp console /build/izapple2console_linux_amd64
# Build izapple2console.exe for Windows # Build izapple2console.exe for Windows
echo "Building Windows console frontend"
cd /tmp/izapple2/frontend/console cd /tmp/izapple2/frontend/console
env CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows CGO_LDFLAGS="-L/usr/x86_64-w64-mingw32/lib" CGO_FLAGS="-I/usr/x86_64-w64-mingw32/include -D_REENTRANT" go build -o izapple2console.exe . env CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows CGO_LDFLAGS="-L/usr/x86_64-w64-mingw32/lib" CGO_FLAGS="-I/usr/x86_64-w64-mingw32/include -D_REENTRANT" go build -tags static -ldflags "-s -w" -o izapple2console.exe .
chown --reference /build izapple2console.exe chown --reference /build izapple2console.exe
cp izapple2console.exe /build cp izapple2console.exe /build/izapple2console_windows_amd64.exe
# Build izapple2sdl for Linux # Build izapple2sdl for Linux
echo "Building Linux SDL frontend"
cd /tmp/izapple2/frontend/a2sdl cd /tmp/izapple2/frontend/a2sdl
go build . env CGO_ENABLED=1 go build -tags static -ldflags "-s -w" .
chown --reference /build a2sdl chown --reference /build a2sdl
cp a2sdl /build/izapple2sdl cp a2sdl /build/izapple2sdl_linux_amd64
# Build izapple2sdl.exe for Windows # Build izapple2sdl.exe for Windows
echo "Building Windows SDL frontend"
cd /tmp/izapple2/frontend/a2sdl cd /tmp/izapple2/frontend/a2sdl
env CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows CGO_LDFLAGS="-L/usr/x86_64-w64-mingw32/lib -lSDL2" CGO_FLAGS="-I/usr/x86_64-w64-mingw32/include -D_REENTRANT" go build -o izapple2sdl.exe . env CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows CGO_LDFLAGS="-L/usr/x86_64-w64-mingw32/lib -lSDL2" CGO_FLAGS="-I/usr/x86_64-w64-mingw32/include -D_REENTRANT" go build -tags static -ldflags "-s -w" -o izapple2sdl.exe .
chown --reference /build izapple2sdl.exe chown --reference /build izapple2sdl.exe
cp izapple2sdl.exe /build cp izapple2sdl.exe /build/izapple2sdl_windows_amd64.exe
# Build izapple2fyne for Linux # Build izapple2fyne for Linux
echo "Building Linux Fyne frontend"
cd /tmp/izapple2/frontend/a2fyne cd /tmp/izapple2/frontend/a2fyne
go build . env CGO_ENABLED=1 go build -tags static -ldflags "-s -w" .
chown --reference /build a2fyne chown --reference /build a2fyne
cp a2fyne /build/izapple2fyne cp a2fyne /build/izapple2fyne_linux_amd64
# Build izapple2fyne.exe for Windows # Build izapple2fyne.exe for Windows
echo "Building Windows Fyne frontend"
cd /tmp/izapple2/frontend/a2fyne cd /tmp/izapple2/frontend/a2fyne
env CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows CGO_LDFLAGS="-L/usr/x86_64-w64-mingw32/lib " CGO_FLAGS="-I/usr/x86_64-w64-mingw32/include -D_REENTRANT" go build -o izapple2fyne.exe . env CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows CGO_LDFLAGS="-L/usr/x86_64-w64-mingw32/lib " CGO_FLAGS="-I/usr/x86_64-w64-mingw32/include -D_REENTRANT" go build -tags static -ldflags "-s -w" -o izapple2fyne.exe .
chown --reference /build izapple2fyne.exe chown --reference /build izapple2fyne.exe
cp izapple2fyne.exe /build cp izapple2fyne.exe /build/izapple2fyne_windows_amd64.exe
# Copy SDL2 Runtime # Copy SDL2 Runtime