Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate bdist ZIP members via Meson #199

Merged
merged 8 commits into from
Dec 4, 2023
Merged

Conversation

bgilbert
Copy link
Member

@bgilbert bgilbert commented Dec 4, 2023

Generate VERSIONS.md and the licenses directory as Meson artifacts. Meson knows which subprojects are enabled in the current build. When we add additional platforms, they'll have different dependencies, so Meson is in a better position to produce these files.

Give up on maintaining some sort of logical order for the dependency list, and sort VERSIONS.md alphabetically. The order was always fairly arbitrary.

Move postprocessing of native binaries into Meson, adding support for Linux and macOS. Link to debuginfo using a bare filename rather than an absolute path, causing gdb to enable directory search semantics for finding the debuginfo. On Linux and macOS, also update the slidetool and JNI RPATHs to match the bdist directory layout.

For convenience, wrap the OpenSlide import library as a Meson object, and set the Meson project version from the pkgver.

We're about to use that name for something else.

Signed-off-by: Benjamin Gilbert <[email protected]>
It's convenient for Meson to also know the version number.  Meson can
retrieve the version number from a command, so implement one that reads
an environment variable set by build.sh, with an autogenerated fallback
in case Meson is invoked directly.

Then have build.sh read the default version number from the same command,
rather than calculating it independently.

Signed-off-by: Benjamin Gilbert <[email protected]>
Meson knows what subprojects we're using in this build, which will vary
by platform.  Rather than syncing that information back into build.sh,
just generate VERSIONS.md from Meson.  For overridden subprojects that
are Git repos, get the version string from `git describe`.

Meson already has the compiler version string, so use that rather than
fetching it from the compiler.  For Binutils we still need to fetch the
version string directly.  Detect the linker command in Meson (specified in
the cross file, with a fallback to PATH) and pass it via an environment
variable so we don't need an explicit command-line argument.

Also add support for detecting the Clang version for macOS.

Give up on maintaining some sort of logical order for the dependency list,
and sort alphabetically.  The order was always fairly arbitrary.

Meson passes the MESONINTROSPECT env var to many external command
invocations, giving the correct invocation of `meson introspect`.
However, this doesn't happen for custom targets, so collect the value
via a run_command() invocation and then pass it to the custom target.

Set build_always_stale to ensure we don't package an out-of-date
VERSIONS.md.

Bump the minimum Meson version for `meson introspect --compilers` support.

Signed-off-by: Benjamin Gilbert <[email protected]>
mypy assumes argparse.Namespace object attributes have type Any, but the
types of arguments often matter for typechecking the program as a whole.
Add a TypedArgs base class which can be subclassed to hold a typed field
for each command-line argument, with validation wrappers that verify that
the argument configuration passed to parser.add_argument() matches the
corresponding field type.

Also add a pre-commit check to ensure argparse isn't invoked directly.

Signed-off-by: Benjamin Gilbert <[email protected]>
The latter is supported by Meson >= 1.1.0, which we're now requiring.

Signed-off-by: Benjamin Gilbert <[email protected]>
Create split debuginfo and check exported symbols in Meson rather than in
the build.sh wrapper.  Support all three platforms.  Link to debuginfo
using a bare filename rather than an absolute path, causing gdb to enable
directory search semantics for finding the debuginfo.  On Linux and macOS,
also update the slidetool and JNI RPATHs to match the bdist directory
layout.

To do this, the Meson custom_target needs to be able to find the slidetool
executable in the build directory.  Backport an OpenSlide commit to store
the exe object in a Meson variable.

Also add a Meson rule to copy openslide.jar to the artifacts directory,
so build.sh only has to look for output artifacts in one place.

Signed-off-by: Benjamin Gilbert <[email protected]>
Built import libraries cannot normally be referenced via a Meson object;
they're just a side effect of building a DLL.  Add a custom target that
copies the OpenSlide import library to a new location and returns a
reference that can be used as an input to other artifacts.  Use that copy
when building the bdist ZIP.

Signed-off-by: Benjamin Gilbert <[email protected]>
Meson knows what subprojects we're using in this build, which will vary by
platform.  Rather than syncing that information back into build.sh,
generate the licenses directory from Meson.

Set build_always_stale to ensure we don't package an out-of-date licenses
directory.

Signed-off-by: Benjamin Gilbert <[email protected]>
@openslide-bot
Copy link
Contributor

DCO signed off ✔️

All commits have been signed off. You have certified to the terms of the Developer Certificate of Origin, version 1.1. In particular, you certify that this contribution has not been developed using information obtained under a non-disclosure agreement or other license terms that forbid you from contributing it under the GNU Lesser General Public License, version 2.1.

@bgilbert bgilbert merged commit 0908955 into openslide:main Dec 4, 2023
12 checks passed
@bgilbert bgilbert deleted the components branch December 4, 2023 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants