Skip to content

Commit

Permalink
some readme updates + action yml update to run in container (hopefully)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlre249 committed Sep 19, 2024
1 parent ccb9aaa commit ad614cf
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 45 deletions.
29 changes: 6 additions & 23 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,10 @@ env:
BUILD_TYPE: Release

jobs:
build-and-push-docker:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
file: src/windows/Dockerfile.win32dyn
tags: ghcr.io/${{ github.repository }}/usb-creator-mxe:latest
build:
runs-on: ghcr.io/${{ github.repository }}/usb-creator-mxe:latest
runs-on: ubuntu-latest
container: ghcr.io/${{ github.repository }}/usb-creator-mxe:latest

steps:
- name: Checkout code
Expand All @@ -48,6 +27,10 @@ jobs:
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Run NSIS
run: |
i686-w64-mingw32.shared-makensis ${{github.workspace}}/build/unraid-usb-creator.nsi
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/mxe-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch: # Enables manual triggering of the workflow via a button push

jobs:
build-and-push:
build-and-push-docker:
runs-on: ubuntu-latest

steps:
Expand All @@ -25,5 +25,5 @@ jobs:
uses: docker/build-push-action@v3
with:
push: true
file: Dockerfile.win32dyn
file: src/windows/Dockerfile.win32dyn
tags: ghcr.io/${{ github.repository }}/usb-creator-mxe:latest
44 changes: 24 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ git clone --depth 1 https://github.com/unraid/usb-creator-next
#### Build and install the software

```
cd rpi-imager
cd usb-creator-next
mkdir -p build
cd build
cmake ../src
Expand All @@ -86,30 +86,34 @@ sudo make install

### Windows

#### Get Windows dependencies

- Get the Qt online installer from: https://www.qt.io/download-open-source
During installation, choose a Qt 5.x with Mingw32 32-bit toolchain and CMake.

- If using the official Qt distribution that does NOT have schannel (Windows native SSL library) support, compile OpenSSL libraries ( https://wiki.qt.io/Compiling_OpenSSL_with_MinGW ) and copy the libssl/crypto DLLs to C:\qt\5.x\mingw73_32\bin the include files to C:\qt\5.x\mingw73_32\include and the import library files to C:\qt\5.x\mingw73_32\lib
#### Cross-compile for Windows with Docker + MXE

- For building installer get Nullsoft scriptable install system: https://nsis.sourceforge.io/Download
Prerequisite: [Docker](https://www.docker.com/)

- It is assumed you already have a proper code signing certificate, and signtool.exe from the Windows SDK installed.
If NOT and are you only compiling for your own personal use, comment out all lines mentioning signtool from CMakelists.txt and the .nsi installer script.
Dockerfile: src/windows/Dockerfile.win32dyn

#### Building on Windows
To build the image (might take a few hours) and start a new container in interactive mode:
```
docker build --force-rm -f Dockerfile.win32dyn -t unraid/usb-creator:win32dyn .
docker run --rm -it unraid/usb-creator:win32dyn
```

Building can be done manually using the command-line, using "cmake", "make", etc., but if you are not that familar with setting up a proper Windows build environment (setting paths, etc.), it is easiest to use the Qt creator GUI instead.
Or, to pull the image from GitHub and start a new container in interactive mode:
```
docker pull ghcr.io/unraid/usb-creator-next/usb-creator-mxe:latest
docker run --rm -it ghcr.io/unraid/usb-creator-next/usb-creator-mxe:latest
```

- Download source .zip from github and extract it to a folder on disk
- Open src/CMakeLists.txt in Qt creator.
- For builds you distribute to others, make sure you choose "Release" in the toolchain settings and not the debug flavour.
- Menu "Build" -> "Build all"
- Result will be in build_unraid-usb-creator_someversion
- Go to the BUILD folder, right click on the .nsi script "Compile NSIS script", to create installer.
Then, inside the container:
```
git clone https://github.com/unraid/usb-creator-next
cd usb-creator-next
mkdir build
cd build
cmake ../src -DQt5_DIR=/opt/mxe/usr/i686-w64-mingw32.shared/qt5/lib/cmake/Qt5 -DCMAKE_BUILD_TYPE=Release
i686-w64-mingw32.shared-makensis
Note: the CMake integration in Qt Creator is a bit flaky at times. If you made any custom changes to the CMakeLists.txt file and it subsequently gets in an endless loop where it never finishes the "configures" stage while re-processing the file, delete "build_unraid-usb-creator_someversion" directory and try again.
```

#### Signing

Expand Down Expand Up @@ -144,7 +148,7 @@ For distribution to others:
E.g.:

```sh
cd build-rpi-imager-Desktop_Qt_5_14_1_clang_64bit-Release/
cd build-usb-creator-next-Desktop_Qt_5_14_1_clang_64bit-Release/
codesign --deep --force --verify --verbose --sign "YOUR KEYID" --options runtime unraid-usb-creator.app
mv unraid-usb-creator.app "Unraid USB Creator.app"
create-dmg "Unraid USB Creator.dmg" "Unraid USB Creator.app"
Expand Down

0 comments on commit ad614cf

Please sign in to comment.