cargo-c
cargo-c copied to clipboard
Use /mingw64 as default prefix on MSYS2/MinGW64
Currently, the --prefix
has to be specified explicitly:
https://github.com/lu-zero/cargo-c/blob/97a9d532dbcc4e59dee5631fa459202e76db556f/.github/workflows/example-project.yml#L116
It would be great if /mingw64
could be used as default on MSYS2/MinGW64, since /usr/local
doesn't seem to be searched by default.
it requires to know that you are in mingw64 reliably and I'm afraid it is not straightforward, but if you come up with a patch for it I'd be happy to merge it. :)
I have no idea, but I hope that somebody will come up with a solution eventually!
FWIW, when packaging for MSYS2, we always have to specify the prefix explicitly, as there are many MinGW environments, not just /mingw64
...
/ucrt64
is the new default btw, but don't know if that affects the setup-msys2
action defaults yet - if it does, you can't be installing mingw-w64-x86_64-*
packages explicitly in your workflow above (without specifying your msystem
is mingw64
), it is much better to use the pacboy
route and install e.g. agnostic rust:p
which will pick the package for the matching environment...
If you're inside a MSYS2 shell (like the setup-msys2 action should be), one just uses $MINGW_PREFIX
(w/ MSYS2_ARG_CONV_EXCL so it doesn't get converted to an absolute DOS path).
So parts of your action would ideally be something like:
- name: Install MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: ucrt64
install: >-
make
pacboy: >-
pkg-config:p
rust:p
This makes it easy to switch/add more msystem
s to the CI matrix.
And finally
- name: Install C API for example project
working-directory: example-project
run: |
MSYS2_ARG_CONV_EXCL="--prefix=" \
cargo cinstall --verbose --release --prefix=${MINGW_PREFIX}
I'd remove the --target
because that one should be figured out automatically, no? This should make this step completely agnostic of the chosen msystem
...
Ideally, you'll want to add a matrix to also test e.g. clangarm64 eventually as well (no runners available just yet), so please add support for aarch64-pc-windows-gnullvm
to cargo-c
;) @lu-zero
If you can provide a patch for it and a ci item to test it would be great :)