Skip to content

Commit

Permalink
Merge pull request #748 from davidgiven/windows
Browse files Browse the repository at this point in the history
Switch from MSYS builds to WSL/Fedora builds.
  • Loading branch information
davidgiven authored Mar 31, 2024
2 parents 968b90d + 8f9c12b commit cda93d5
Show file tree
Hide file tree
Showing 39 changed files with 23,200 additions and 212 deletions.
101 changes: 46 additions & 55 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,61 +46,52 @@ jobs:
name: ${{ github.event.repository.name }}.${{ github.sha }}
path: fluxengine/FluxEngine.pkg

#build-windows:
# runs-on: windows-latest
# defaults:
# run:
# shell: msys2 {0}
# steps:
# - uses: msys2/setup-msys2@v2
# with:
# update: true
# msystem: MINGW32
# install: >-
# diffutils
# make
# mingw-w64-i686-binutils
# mingw-w64-i686-fmt
# mingw-w64-i686-gcc
# mingw-w64-i686-libusb
# mingw-w64-i686-nsis
# mingw-w64-i686-pkg-config
# mingw-w64-i686-protobuf
# mingw-w64-i686-python
# mingw-w64-i686-sqlite3
# mingw-w64-i686-wxWidgets
# mingw-w64-i686-zlib
# mingw-w64-i686-png2ico
# vim
# zip
# - name: update-protobuf
# run: |
# pacman -U --noconfirm https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-protobuf-21.9-1-any.pkg.tar.zst
# - uses: actions/checkout@v2
# with:
# repository: 'davidgiven/fluxengine'
# path: 'fluxengine'
# - uses: actions/checkout@v2
# with:
# repository: 'davidgiven/fluxengine-testdata'
# path: 'fluxengine-testdata'
# - name: build
# run: MAGICK_TIME_LIMIT=100 make -j`nproc` -C fluxengine
build-windows:
runs-on: windows-latest

# - name: nsis
# run: |
# cd fluxengine
# strip fluxengine.exe -o fluxengine-stripped.exe
# strip fluxengine-gui.exe -o fluxengine-gui-stripped.exe
# makensis -v2 -nocd -dOUTFILE=fluxengine-installer.exe extras/windows-installer.nsi
steps:
- name: setup WSL
run: |
curl -L https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL/releases/download/39.0.1/Fedora-Remix-for-WSL-SL_39.0.1.0_x64_arm64.msixbundle -o fedora.msixbundle
unzip fedora.msixbundle Fedora-Remix-for-WSL-SL_39.0.1.0_x64.msix
unzip Fedora-Remix-for-WSL-SL_39.0.1.0_x64.msix install.tar.gz
wsl --update
wsl --import fedora fedora install.tar.gz
wsl --set-default fedora
wsl sh -c 'dnf -y install https://github.com/rpmsphere/noarch/raw/master/r/rpmsphere-release-38-1.noarch.rpm'
wsl sh -c 'dnf -y install --setop=install_weak_deps=False gcc gcc-c++ protobuf-c-compiler protobuf-devel fmt-devel systemd-devel sqlite-devel wxGTK-devel mingw32-gcc mingw32-gcc-c++ mingw32-zlib-static mingw32-protobuf-static mingw32-sqlite-static mingw32-wxWidgets3-static mingw32-libpng-static mingw32-libjpeg-static mingw32-libtiff-static mingw32-nsis png2ico'
- name: fix line endings
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v4
with:
repository: 'davidgiven/fluxengine'
path: 'fluxengine'

- uses: actions/checkout@v4
with:
repository: 'davidgiven/fluxengine-testdata'
path: 'fluxengine-testdata'

- name: run
run: |
wsl sh -c 'make -C fluxengine BUILDTYPE=windows -j$(nproc)'
- name: nsis
run: |
wsl sh -c 'cd fluxengine && strip fluxengine.exe -o fluxengine-stripped.exe'
wsl sh -c 'cd fluxengine && strip fluxengine-gui.exe -o fluxengine-gui-stripped.exe'
wsl sh -c 'cd fluxengine && makensis -v2 -nocd -dOUTFILE=fluxengine-installer.exe extras/windows-installer.nsi'
# - name: zip
# run: |
# cd fluxengine
# zip -9 fluxengine-windows.zip fluxengine.exe fluxengine-gui.exe upgrade-flux-file.exe brother120tool.exe brother240tool.exe FluxEngine.cydsn/CortexM3/ARM_GCC_541/Release/FluxEngine.hex fluxengine-installer.exe
- name: zip
run: |
wsl sh -c 'cd fluxengine && zip -9 fluxengine-windows.zip fluxengine.exe fluxengine-gui.exe upgrade-flux-file.exe brother120tool.exe brother240tool.exe FluxEngine.cydsn/CortexM3/ARM_GCC_541/Release/FluxEngine.hex fluxengine-installer.exe'
# - name: Upload build artifacts
# uses: actions/upload-artifact@v2
# with:
# name: ${{ github.event.repository.name }}.${{ github.sha }}
# path: fluxengine/fluxengine-windows.zip
- name: Upload build artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ github.event.repository.name }}.${{ github.sha }}
path: fluxengine/fluxengine-windows.zip
149 changes: 70 additions & 79 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,85 +10,76 @@ on:
- "master"

jobs:
#dev-release:
# runs-on: windows-latest
# defaults:
# run:
# shell: msys2 {0}
# steps:
# - uses: msys2/setup-msys2@v2
# with:
# update: true
# msystem: MINGW32
# install: >-
# diffutils
# make
# mingw-w64-i686-binutils
# mingw-w64-i686-fmt
# mingw-w64-i686-gcc
# mingw-w64-i686-libusb
# mingw-w64-i686-nsis
# mingw-w64-i686-pkg-config
# mingw-w64-i686-protobuf
# mingw-w64-i686-python
# mingw-w64-i686-sqlite3
# mingw-w64-i686-wxWidgets
# mingw-w64-i686-zlib
# mingw-w64-i686-png2ico
# vim
# zip
# - uses: actions/checkout@v3

# - name: update-protobuf
# run: |
# pacman -U --noconfirm https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-protobuf-21.9-1-any.pkg.tar.zst

# - name: build
# run: |
# MAGICK_TIME_LIMIT=100 make -j`nproc`

# - name: nsis
# run: |
# strip fluxengine.exe -o fluxengine-stripped.exe
# strip fluxengine-gui.exe -o fluxengine-gui-stripped.exe
# makensis -v2 -nocd -dOUTFILE=fluxengine-installer.exe extras/windows-installer.nsi

# - name: zip
# run: |
# zip -9 fluxengine.zip fluxengine.exe fluxengine-gui.exe upgrade-flux-file.exe brother120tool.exe brother240tool.exe FluxEngine.cydsn/CortexM3/ARM_GCC_541/Release/FluxEngine.hex

# - name: date
# run: |
# echo "RELEASE_DATE=$(date --rfc-3339=date)" >> ${GITHUB_ENV}

# - name: tag
# uses: EndBug/latest-tag@latest
# with:
# tag-name: dev
# force-branch: false
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# - name: delete-old-assets
# uses: mknejp/delete-release-assets@v1
# with:
# token: ${{ github.token }}
# tag: dev
# assets: |
# fluxengine.zip
# fluxengine-installer.exe
# fail-if-no-assets: false

# - name: release
# uses: softprops/action-gh-release@v1
# with:
# name: Development build ${{ env.RELEASE_DATE }}
# files: |
# fluxengine.zip
# fluxengine-installer.exe
# tag_name: dev
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
dev-release:
runs-on: windows-latest

steps:
- name: setup WSL
run: |
curl -L https://github.com/WhitewaterFoundry/Fedora-Remix-for-WSL/releases/download/39.0.1/Fedora-Remix-for-WSL-SL_39.0.1.0_x64_arm64.msixbundle -o fedora.msixbundle
unzip fedora.msixbundle Fedora-Remix-for-WSL-SL_39.0.1.0_x64.msix
unzip Fedora-Remix-for-WSL-SL_39.0.1.0_x64.msix install.tar.gz
wsl --update
wsl --import fedora fedora install.tar.gz
wsl --set-default fedora
wsl sh -c 'dnf -y install https://github.com/rpmsphere/noarch/raw/master/r/rpmsphere-release-38-1.noarch.rpm'
wsl sh -c 'dnf -y install --setop=install_weak_deps=False gcc gcc-c++ protobuf-c-compiler protobuf-devel fmt-devel systemd-devel sqlite-devel wxGTK-devel mingw32-gcc mingw32-gcc-c++ mingw32-zlib-static mingw32-protobuf-static mingw32-sqlite-static mingw32-wxWidgets3-static mingw32-libpng-static mingw32-libjpeg-static mingw32-libtiff-static mingw32-nsis png2ico'
- name: fix line endings
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v4
with:
repository: 'davidgiven/fluxengine'

- name: run
run: |
wsl sh -c 'make BUILDTYPE=windows -j$(nproc)'
- name: nsis
run: |
wsl sh -c 'strip fluxengine.exe -o fluxengine-stripped.exe'
wsl sh -c 'strip fluxengine-gui.exe -o fluxengine-gui-stripped.exe'
wsl sh -c 'makensis -v2 -nocd -dOUTFILE=fluxengine-installer.exe extras/windows-installer.nsi'
- name: zip
run: |
wsl sh -c 'zip -9 fluxengine-windows.zip fluxengine.exe fluxengine-gui.exe upgrade-flux-file.exe brother120tool.exe brother240tool.exe FluxEngine.cydsn/CortexM3/ARM_GCC_541/Release/FluxEngine.hex fluxengine-installer.exe'
- name: date
run: |
echo "RELEASE_DATE=$(date --rfc-3339=date)" >> ${GITHUB_ENV}
- name: tag
uses: EndBug/latest-tag@latest
with:
tag-name: dev
force-branch: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: delete-old-assets
uses: mknejp/delete-release-assets@v1
with:
token: ${{ github.token }}
tag: dev
assets: |
fluxengine.zip
fluxengine-installer.exe
fail-if-no-assets: false

- name: release
uses: softprops/action-gh-release@v1
with:
name: Development build ${{ env.RELEASE_DATE }}
files: |
fluxengine.zip
fluxengine-installer.exe
tag_name: dev
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-macos:
runs-on: macos-latest
Expand Down
41 changes: 36 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,37 @@
CC = gcc
CXX = g++ -std=c++17
CFLAGS = -g -O3
LDFLAGS =
export BUILDTYPE
BUILDTYPE ?= host

OBJ = .obj
ifeq ($(BUILDTYPE),windows)
MINGW = i686-w64-mingw32-
CC = $(MINGW)gcc
CXX = $(MINGW)g++ -std=c++17
CFLAGS += -g -O3
CXXFLAGS += \
-fext-numeric-literals \
-Wno-deprecated-enum-float-conversion \
-Wno-deprecated-enum-enum-conversion
LDFLAGS += -static
AR = $(MINGW)ar
PKG_CONFIG = $(MINGW)pkg-config -static
WINDRES = $(MINGW)windres
WX_CONFIG = /usr/i686-w64-mingw32/sys-root/mingw/bin/wx-config-3.0 --static=yes
EXT = .exe
else
CC = gcc
CXX = g++ -std=c++17
CFLAGS = -g -O3
LDFLAGS =
AR = ar
PKG_CONFIG = pkg-config
endif

HOSTCC = gcc
HOSTCXX = g++ -std=c++17
HOSTCFLAGS = -g -O3
HOSTLDFLAGS =

REALOBJ = .obj
OBJ = $(REALOBJ)/$(BUILDTYPE)
DESTDIR ?=
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
Expand Down Expand Up @@ -54,6 +82,9 @@ README.md: $(OBJ)/scripts/+mkdocindex/+mkdocindex$(EXT)
.PHONY: install install-bin
install:: all install-bin

clean::
$(hide) rm -rf $(REALOBJ)

install-bin:
@echo "INSTALL"
$(hide) install -D -v "$(OBJ)/src+fluxengine/src+fluxengine" "$(DESTDIR)$(BINDIR)/fluxengine"
Expand Down
Loading

0 comments on commit cda93d5

Please sign in to comment.