Closed robo9k closed 1 year ago
Looking at the static build flags explains missing symbols in https://github.com/robo9k/rust-magic-sys/pull/30#issuecomment-1337537973 and https://github.com/robo9k/rust-magic-sys/issues/34#issue-1549794589
It doesn't help explain https://github.com/robo9k/rust-magic-sys/issues/37#issue-1925130619 so that needs further investigation. There was another vcpkg workaround in https://github.com/robo9k/rust-magic-sys/pull/16#issuecomment-949094327
In general I believe the current way of building with the MAGIC_DIR
, MAGIC_STATIC
env is too simplistic in that it makes half-baked assumptions about the installed libmagic
library.
Instead we should lean in fully on pkg-config
and vcpkg
, so that users will have to configure those crates/binaries instead.
Maybe we could keep a MAGIC_LINK
env with auto|dynamic|static
which attempts to detect a sensible default for auto
or else passes dynamic/static to pkg-config
& vcpkg
.
This would mean a change in requirements (see #5 ) and thus in supported systems. I'll do some more research in #36
I'm still not sold entirely on #4 as I'd rather not pull in a whole submodule and possibly autotools
(crate) dependency.
Using apt-get
, brew
, vcpkg
is probably enough for the common cases.
See https://github.com/robo9k/rust-magic-sys/pull/39#issue-1931419619 for a series of pull requests that implement builds with GHA for this repo now
In order to see how viable #1 is I've tested this with GitHub Actions on their shared runners.
At the time of writing:
ubuntu-22.04
pkg-config
0.29.2-1ubuntu3libmagic1
1:5.41-3ubuntu0.1libmagig-dev
1:5.41-3ubuntu0.1macos-12
pkg-config
0.29.2_3libmagic
5.45brew
4.1.14windows-2022
libmagic
5.40#2vcpkg
2023-09-15-ac02a9f660977426b8ec6392919fbb1d51b10998While this did not actually test a build of
magic-sys
(with neitherpkg-config
nor(cargo) vcpkg
, it looks like at least GHA should be able to build with a hard requirement on