mason icon indicating copy to clipboard operation
mason copied to clipboard

Allow `mason install` to work without scripts?

Open springmeyer opened this issue 9 years ago • 5 comments
trafficstars

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-install script 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_FILE among other modifications. Hmmmm...

/cc @ericfischer @TheMarex (maintainers on two repos that are using the manual method to install, but this is brittle)

springmeyer avatar Jun 07 '16 21:06 springmeyer

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.

kkaefer avatar Jun 10 '16 08:06 kkaefer

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)

kkaefer avatar Jul 28 '16 11:07 kkaefer

Implemented in GL Native in https://github.com/mapbox/mapbox-gl-native/pull/7981

kkaefer avatar Feb 08 '17 17:02 kkaefer

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.

springmeyer avatar Mar 07 '17 00:03 springmeyer

Bash client first draft is in https://github.com/mapbox/mason/tree/client. More tasks are in https://github.com/mapbox/mason/projects/1

kkaefer avatar Mar 08 '17 21:03 kkaefer