Skip to content

Commit

Permalink
docs: fix WoA build script
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
BeRealQueally committed Jun 15, 2024
1 parent f43c70c commit b6362be
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 2 deletions.
10 changes: 8 additions & 2 deletions docs/DEVELOPERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ If you want to get a Deb package, run `cmake -DCPACK_GENERATOR=DEB` then `make`.

Same as normal Debian/Ubuntu, however, in order to build the GBinder backends, you will need `libgbinder-dev`, `glib2.0-dev`, and you will have to pass `-DLPAC_WITH_APDU_GBINDER=ON` when invoking `cmake`.

---

### macOS

Install [Homebrew](https://brew.sh/).
Run `cmake` and `make`, compiled output will be in `output` directory.

---

### Windows(x86_64)

Windows need libcurl.dll to run.
Expand All @@ -51,6 +55,8 @@ Require `gcc-core` `gcc-g++` `make` `cmake` `unzip` `wget` installed.
To run it outside Cygwin shell, you need copy `cygwin1.dll` to the program folder to distribute.
`cygwin1.dll` is located in `C:\cygwin64\bin\cygwin1.dll` (Default Cygwin installation location)

---

### Windows on ARM

#### Cross compile on Windows/Linux host(arm64,x86_64 and more architecture) with zig
Expand All @@ -60,15 +66,15 @@ Install [zig](https://ziglang.org/download/)
```bash
# clone this repo in the top-level folder

./scripts/build-ci.sh woa-zig
./scripts/build-woa.sh woa-zig
```

#### Cross compile on Linux x86_64 host(GNU toolchain)

```bash
# clone this repo in the top-level folder

./scripts/build-ci.sh woa-mingw
./scripts/build-woa.sh woa-mingw
```

#### Build on Native Windows on ARM(MSYS2)
Expand Down
68 changes: 68 additions & 0 deletions scripts/build-woa.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/bin/bash
set -euo pipefail
WORKSPACE="$(pwd)"
CURL_VERSION="8.6.0_1"
WOA_TOOLCHAIN_VERSION="2024-02-08"
MINGW_CURL_WIN64A_BLOB="https://curl.se/windows/dl-$CURL_VERSION/curl-$CURL_VERSION-win64a-mingw.zip"
MINGW32_TOOLCHAIN_BLOB="https://github.com/Windows-on-ARM-Experiments/mingw-woarm64-build/releases/download/$WOA_TOOLCHAIN_VERSION/aarch64-w64-mingw32-msvcrt-toolchain.tar.gz"


function download {
URL="$1"
SAVED_PATH="$(mktemp)"
SAVED_DIR="$(mktemp -d)"
wget --no-verbose "$URL" -O "$SAVED_PATH"
case "$URL" in
*.zip)
unzip -q -d "$SAVED_DIR" "$SAVED_PATH"
rm "$SAVED_PATH"
echo "$SAVED_DIR"
;;
*.tar.gz)
tar -C "$SAVED_DIR" --gzip --extract --file="$SAVED_PATH"
rm "$SAVED_PATH"
echo "$SAVED_DIR"
;;
*)
echo "$SAVED_PATH"
;;
esac
}

set -x

BUILD="$(mktemp -d)"
cd "$BUILD" || exit 1


case "${1:-}" in
woa-mingw)
TOOLCHAIN="$(download "$MINGW32_TOOLCHAIN_BLOB")"
cmake "$WORKSPACE" -DCMAKE_TOOLCHAIN_FILE=./cmake/linux-mingw64-woa.cmake "-DTOOLCHAIN_BIN_PATH=$TOOLCHAIN/bin"
make -j
CURL="$(download "$MINGW_CURL_WIN64A_BLOB")"
cp "$CURL"/curl-*-mingw/bin/libcurl-arm64.dll output/libcurl.dll
cp "$CURL"/curl-*-mingw/COPYING.txt output/libcurl-LICENSE
cp "$WORKSPACE/src/LICENSE" output/lpac-LICENSE
cp "$WORKSPACE/euicc/LICENSE" output/libeuicc-LICENSE
cp "$WORKSPACE/cjson/LICENSE" output/cjson-LICENSE
cp "$WORKSPACE/dlfcn-win32/LICENSE" output/dlfcn-win32-LICENSE
;;
woa-zig)
cmake "$WORKSPACE" -DCMAKE_TOOLCHAIN_FILE=./cmake/aarch64-windows-zig.cmake
make -j
CURL="$(download "$MINGW_CURL_WIN64A_BLOB")"
cp "$CURL"/curl-*-mingw/bin/libcurl-arm64.dll output/libcurl.dll
cp "$CURL"/curl-*-mingw/COPYING.txt output/libcurl-LICENSE
cp "$WORKSPACE/src/LICENSE" output/lpac-LICENSE
cp "$WORKSPACE/euicc/LICENSE" output/libeuicc-LICENSE
cp "$WORKSPACE/cjson/LICENSE" output/cjson-LICENSE
cp "$WORKSPACE/dlfcn-win32/LICENSE" output/dlfcn-win32-LICENSE
;;
*)
echo "Usage: $0 {woa-mingw,woa-zig}"
exit 1
;;
esac

rm -rf "$BUILD"

0 comments on commit b6362be

Please sign in to comment.