mason
mason copied to clipboard
Allow `mason install` to work without scripts?
I'm pondering the best, most lightweight, method to recommend installing mason packages on CI systems.
Installing mason with git clone -b master --single-branch https://github.com/mapbox/mason.git brings down > 2.7 MB of data and this will likely grow over time.
That is not a lot, but much more than is needed to install a package, which can currently be done as simply as:
PACKAGE_URL="https://mason-binaries.s3.amazonaws.com/${TRAVIS_OS_NAME}-x86_64/${MASON_NAME}/${MASON_VERSION}.tar.gz"
travis_retry wget --quiet -O - ${PACKAGE_URL} | tar -xz
For packages representing libraries most usecases will want/need the main mason command in order to query for cflags and ldflags. But for command line tools these features are unnecessary.
Two ideas (with command line tools in mind):
- Write a very small
mason-installscript that CI systems could download and use to install a package:./mason-install clang 3.8.0. It would not work for header-only libs (would put them in the wrong location) - Modify the existing mason binary to work for installs without needing the
script/metadata around.- This would require disabling the checks for
MASON_LIB_FILEamong other modifications. Hmmmm...
- This would require disabling the checks for
/cc @ericfischer @TheMarex (maintainers on two repos that are using the manual method to install, but this is brittle)
I think we could support header only libaries by just using two different commands; We know when a library is header only, and it's very unlikely that they change from header-only to pre-compiled.
Another thing to consider is supporting downloads from CMake, along the lines of mason.cmake: Right now it runs mason as a subprocess, but ideally we can get rid of that by using something like:
mason_use_library(gtest 1.7.0)
mason_use_headers(rapidjson 1.0.2)
Once we're moving from a mason script that knows both how to build and how to use a package to a two part system with one part only building packages, and the other only downloading them, we should also include the flags in a file so we don't have to invoke parts of the build system to obtain flags.
This is partially implemented in https://github.com/mapbox/mason/pull/176:
If the package has a mason.ini file, it doesn't require mason to be present at all. You can add packages like this: mason_use(variant VERSION 1.1.1 HEADER_ONLY), then use MASON_CONFIG_variant_INCLUDE_DIRS or target_add_mason_package(target PUBLIC variant)
Implemented in GL Native in https://github.com/mapbox/mapbox-gl-native/pull/7981
Per chat: next step here is to split the mason bash client into a) light install client/consumer that download packages and parses only mason.ini and b) heavy install frontend that knows how to build packages. The install client will no longer fallback to source compiles.
Bash client first draft is in https://github.com/mapbox/mason/tree/client. More tasks are in https://github.com/mapbox/mason/projects/1