meson icon indicating copy to clipboard operation
meson copied to clipboard

structured_sources: Allow build_tgt to be added as source

Open sp1ritCS opened this issue 1 year ago • 10 comments

In some cases, there is a need to use a built library as a "source" for another target. Specifically Java JAR might want to contain their own native JNI libraries in order to provide a single file "executable".

I'm kind of surprised this works out of the box without any further changes 🙃

sp1ritCS avatar Jun 25 '24 10:06 sp1ritCS

Can you please extend a test?

tristan957 avatar Jul 09 '24 22:07 tristan957

@tristan957 added

seems like this needs at least java 9. Is it enough to bump the dependency('jni') or do I need to add another mechanism the skip the builds for java 1.8?

sp1ritCS avatar Jul 10 '24 09:07 sp1ritCS

I don't think you need a whole new test for this. I would extend this one: https://github.com/mesonbuild/meson/tree/master/test%20cases/java/9%20jni. What do you think?

tristan957 avatar Jul 10 '24 14:07 tristan957

@dcbaker is there any other place that would be a good test in addition to this? Not sure if there is a more generic structured_sources test.

tristan957 avatar Jul 10 '24 14:07 tristan957

I don't think you need a whole new test for this. I would extend this one: https://github.com/mesonbuild/meson/tree/master/test%20cases/java/9%20jni. What do you think?

I've thought about it, but it doesn't really work well with how the test is structured in src/ and lib/. As first we need to generate the native headers in the src/ tree, then compile the library (lib/) that is then again needed in src/ for the structured_sources call.

One could generate the native headers in lib/, but then your throwing long paths around and I'd want to avoid that.

sp1ritCS avatar Jul 10 '24 15:07 sp1ritCS

If you see a good way to refactor the existing test, that would be fine.

tristan957 avatar Jul 10 '24 15:07 tristan957

We need to get the image jobs to pass. Not your fault. I'm working on fixing Fedora.

tristan957 avatar Jul 11 '24 18:07 tristan957

If you rebase on master, you should pick up the Fedora CI fixes. I think msys2 will also start to pass.

tristan957 avatar Jul 15 '24 19:07 tristan957

Status report:

  • Arch is failing due to mirror issues
  • openSUSE & Ubuntu have issues with "dub" dependencies (no idea what that is or how to fix it)
  • Fedora has issues with zlib

sp1ritCS avatar Jul 16 '24 12:07 sp1ritCS

I have added a PR to really fix the fedora test at #13436

tristan957 avatar Jul 16 '24 15:07 tristan957