Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 49 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,49 @@ jobs:
- name: Dependencies
run: |
sudo apt-get update
sudo apt-get install -y libxml2-dev libusb-1.0-0-dev help2man

sudo apt-get install -y libxml2-dev libusb-1.0-0-dev meson ninja-build help2man

- name: Configure
run: |
# Get current Meson version string (e.g. "1.5.1")
meson_version="$(meson --version 2>/dev/null | awk -F. '{print $1 "." $2}')"

# Convert version to comparable integer, e.g. "0.45" -> 45, "1.5" -> 105
version_to_num() {
local major minor
IFS='.' read -r major minor <<<"$1"
printf "%d%02d" "$major" "$minor"
}

current="$(version_to_num "$meson_version_short")"
threshold="$(version_to_num "1.1")"
# According to https://mesonbuild.com/Build-options.html for versions < 1.1 we should use
# meson_options.txt for build options
if (( current < threshold )); then
if [[ -f "meson.options" ]]; then
echo "Detected Meson $meson_version (< 1.1) - renaming meson.options -> meson_options.txt"
mv -f meson.options meson_options.txt
fi
fi

meson setup build

- name: Build
run: make
run: meson compile -C build

- name: Run tests
run: make tests
run: meson test -C build

- name: Generate man pages
run: make manpages
run: meson compile manpages -C build

- name: Package
run: |
mkdir dist
cp `pkg-config --variable=libdir libusb-1.0`/libusb-1.0.so.0 dist
chmod 0644 dist/*
cp qdl dist
cp ./build/qdl dist
patchelf --set-rpath '$ORIGIN' dist/qdl

- name: Upload artifact
Expand All @@ -67,16 +93,19 @@ jobs:

- name: Dependencies
run: |
brew install libxml2 help2man
brew install libxml2 meson ninja help2man

- name: Configure
run: meson setup build

- name: Build
run: make
run: meson compile -C build

- name: Generate man pages
run: make manpages
run: meson compile manpages -C build

- name: Run tests
run: make tests
run: meson test -C build

- name: Package
run: |
Expand All @@ -85,7 +114,7 @@ jobs:
cp `pkg-config --variable=libdir libusb-1.0`/libusb-1.0.0.dylib dist
cp `pkg-config --variable=libdir liblzma`/liblzma.5.dylib dist
chmod 0644 dist/*
cp qdl dist
cp ./build/qdl dist

if uname -a | grep -q arm64; then
LIBUSB_DIR=/opt/homebrew/opt/libusb/lib
Expand Down Expand Up @@ -132,23 +161,27 @@ jobs:
git
help2man
mingw-w64-x86_64-gcc
mingw-w64-x86_64-make
mingw-w64-x86_64-pkg-config
mingw-w64-x86_64-meson
mingw-w64-x86_64-ninja
mingw-w64-x86_64-libxml2
mingw-w64-x86_64-libusb

- name: Configure
run: meson setup build
shell: msys2 {0}

- name: Build
run: |
git config --global core.autocrlf true
make
meson compile -C build
shell: msys2 {0}

- name: Generate man pages
run: make manpages
run: meson compile manpages -C build
shell: msys2 {0}

- name: Run tests
run: make tests
run: meson test -C build
shell: msys2 {0}

- name: Package
Expand All @@ -165,7 +198,7 @@ jobs:
Copy-Item (Join-Path $BIN_DIR "liblzma-5.dll") $DistDir
Copy-Item (Join-Path $BIN_DIR "libiconv-2.dll") $DistDir

Copy-Item "qdl.exe" $DistDir
Copy-Item "./build/qdl.exe" $DistDir

- name: Upload artifact
uses: actions/upload-artifact@v4
Expand Down
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
*.1
/build/
/tests/data/*.elf
/tests/data/*.bin
/tests/data/*.img
*.o
qdl
qdl-ramdump
ks
*.exe
compile_commands.json
.cache
.version.h
version.h
scripts
.scripts
.checkpatch-camelcase.git.
91 changes: 0 additions & 91 deletions Makefile

This file was deleted.

38 changes: 22 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,27 @@ loader and use this to flash images.
### Linux

```bash
sudo apt install libxml2 libusb-1.0-0-dev help2man
make
sudo apt install libxml2 libusb-1.0-0-dev meson ninja-build help2man
meson setup build
meson compile -C build
```

### MacOS

For Homebrew users,

```bash
brew install libxml2 pkg-config libusb help2man
make
brew install libxml2 libusb meson ninja help2man
meson setup build
meson compile -C build
```

For MacPorts users

```bash
sudo port install libxml2 pkgconfig libusb help2man
make
sudo port install libxml2 libusb meson ninja help2man
meson setup build
meson compile -C build
```

### Windows
Expand All @@ -42,16 +45,17 @@ pacman -S base-devel --needed
pacman -S git
pacman -S help2man
pacman -S mingw-w64-x86_64-gcc
pacman -S mingw-w64-x86_64-make
pacman -S mingw-w64-x86_64-pkg-config
pacman -S mingw-w64-x86_64-meson
pacman -S mingw-w64-x86_64-ninja
pacman -S mingw-w64-x86_64-libusb
pacman -S mingw-w64-x86_64-libxml2
```

Then use the `make` tool to build QDL:
Then use the `meson` tool to build QDL:

```bash
make
meson setup build
meson compile -C build
```

## Use QDL
Expand Down Expand Up @@ -215,18 +219,19 @@ served, in order to reach Firehose mode.

## Run tests

To run the integration test suite for QDL, use the `make tests` target:
To run the integration test suite for QDL, use the `meson` tool with `test`
param:

```bash
make tests
meson test -C build
```

## Generate man pages

Manpages can be generated using `make manpages` target:
Manpages can be generated using `manpages` target:

```bash
make manpages
meson compile manpages -C build
```

## Contributing
Expand All @@ -238,7 +243,7 @@ and submit the pull request.
The preferred coding style for this tool is [Linux kernel coding style](https://www.kernel.org/doc/html/v6.15/process/coding-style.html).

Before creating a commit, please ensure that your changes adhere to the coding style
by using the `make check-cached` target, for example:
by using the `meson compile check-cached -C build` target, for example:

```bash
$ git status
Expand All @@ -248,7 +253,8 @@ Changes to be committed:
modified: qdl.c
modified: qdl.h

$ make check-cached
$ meson compile check-cached -C build
[0/1] Running external command check-cached (wrapped by meson to set env)
Running checkpatch on staged changes...
ERROR: trailing whitespace
#28: FILE: qdl.h:32:
Expand Down
Loading
Loading