{"id":14155194,"url":"https://github.com/mapbox/mason","last_synced_at":"2025-08-06T01:30:42.612Z","repository":{"id":19136925,"uuid":"22366871","full_name":"mapbox/mason","owner":"mapbox","description":"Cross platform package manager for C/C++ apps","archived":false,"fork":false,"pushed_at":"2024-05-08T10:17:22.000Z","size":3443,"stargazers_count":255,"open_issues_count":88,"forks_count":69,"subscribers_count":115,"default_branch":"master","last_synced_at":"2024-07-27T07:33:55.181Z","etag":null,"topics":["apt","binaries","cplusplus","cross-platform","cxx","deployment","dpkg","linux","npm","osx","packaging"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mapbox.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"contributing.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2014-07-29T03:50:06.000Z","updated_at":"2024-05-29T07:55:07.000Z","dependencies_parsed_at":"2022-08-21T00:10:15.101Z","dependency_job_id":"d6226add-cf76-4c0c-971b-dfeb12ee9932","html_url":"https://github.com/mapbox/mason","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fmason","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fmason/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fmason/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fmason/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mapbox","download_url":"https://codeload.github.com/mapbox/mason/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":215735785,"owners_count":15923388,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apt","binaries","cplusplus","cross-platform","cxx","deployment","dpkg","linux","npm","osx","packaging"],"created_at":"2024-08-17T08:02:26.612Z","updated_at":"2024-08-17T08:04:51.001Z","avatar_url":"https://github.com/mapbox.png","language":"Python","readme":"# Mason\n\n❌ **UNMAINTAINED: this project is no longer maintained and no additional development is planned. Nor is any kind of deprecation planned. Rather this code is now frozen. If you are depending on this module in any of your applications, it is recommended you remove the dependency and/or find a replacement solution**\n\nMason is a cross-platform, command-line package manager for C/C++ applications.\n\nMason is like:\n\n* [npm](https://github.com/npm/npm) because it installs packages in the current working directory (`./mason_packages`) rather than globally (and therefore does not require privileges for, or conflict with, system-wide packages)\n* [homebrew](http://brew.sh/) because it requires no use of `sudo` to install packages\n* [apt-get](https://linux.die.net/man/8/apt-get) or [yum](https://linux.die.net/man/8/yum) because it works on Linux\n\nMason is unlike:\n\n * all of the above...\n\n    Mason is a collection of bash scripts and does not depend on any specific runtime language, such as python, node.js, or ruby. It can build and publish a single set of binaries (\u003e= OS X 10.8 and \u003e= Ubuntu Precise), publish header-only files, and install packages. Mason has integrations with [Travis CI](https://travis-ci.com) and [Amazon S3](https://aws.amazon.com/s3) for automated build and deployment.\n\n    Mason strongly prefers static libraries over shared libraries and has zero understanding of dependency trees: it leaves complete control to the developer for how packages relate.\n\nMason works on both **OS X** and **Linux**.\n\n[![Build Status](https://travis-ci.com/mapbox/mason.svg?branch=master)](https://travis-ci.com/mapbox/mason)\n\n# Table of Contents\n\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [Usage](#usage)\n- [Creating a package](#creating-a-package)\n    - [Prerequisites](#prerequisites)\n    - [Getting started](#getting-started)\n    - [System packages](#system-packages)\n- [Releasing a package](#releasing-a-package)\n- [Using a package](#using-a-package)\n- [Mason internals](#mason-internals)\n    - [Mason scripts](#mason-scripts)\n    - [Mason variables](#mason-variables)\n    - [Mason functions](#mason-functions)\n- [Troubleshooting](#troubleshooting)\n\n## Installation\n\nThere are three recommended ways to install mason, via:\n\n* [Curl](#curl)\n* [Submodule](#submodule)\n* [mason.cmake](#masoncmake)\n\n#### Curl\n\nTo install mason locally:\n\n```sh\nmkdir ./mason\ncurl -sSfL https://github.com/mapbox/mason/archive/v0.23.0.tar.gz | tar -z --extract --strip-components=1 --exclude=\"*md\" --exclude=\"test*\" --directory=./mason\n```\n\nThen you can use the `mason` command like: `./mason/mason install \u003cpackage\u003e \u003cversion\u003e`\n\nTo install mason globally (to /tmp):\n\n```sh\ncurl -sSfL https://github.com/mapbox/mason/archive/v0.23.0.tar.gz | tar -z --extract --strip-components=1 --exclude=\"*md\" --exclude=\"test*\" --directory=/tmp\n```\n\nThen you can use the `mason` command like: `/tmp/mason install \u003cpackage\u003e \u003cversion\u003e`\n\n#### Submodule\n\nMason can also be added as a submodule to your repository. This is helpful for other contributors to get set up quickly.\n\nOptionally a convention when using submodules, is to place the submodule at a path starting with `.` to make the directory hidden to most file browsers. If you want your mason folder hidden then make sure to include the final part of the following command `.mason/` so your submodule path has the leading `.` instead of just being `mason/`.\n\n```bash\ngit submodule add git@github.com:mapbox/mason.git .mason/\n```\n\nThis will append a few lines to your `.gitmodules` file. Make sure to change the `url` parameter to `https` instead of `git@github` ssh protocol.\n\n```\n[submodule \".mason\"]\n    path = .mason\n    url = https://github.com/mapbox/mason.git\n```\n\nUpdate your `Makefile` to point to the mason scripts and provide an installation script for the necessary dependencies. The following installs two Mason packages with the `make mason_packages` command.\n\n```Make\nMASON ?= .mason/mason\n\n$(MASON):\n    git submodule update --init\n\nmason_packages: $(MASON)\n    $(MASON) install geometry 0.7.0\n    $(MASON) install variant 1.1.0\n```\n\n#### mason.cmake\n\nCopy the https://raw.githubusercontent.com/mapbox/mason/master/mason.cmake into your cmake project. A common convention is to place it at `\u003cyour project\u003e/cmake/mason`\n\n```\nmkdir cmake\nwget -O cmake/mason.cmake https://raw.githubusercontent.com/mapbox/mason/master/mason.cmake\n````\n\nThen in your `CmakeLists.txt` install packages like:\n\n```cmake\nmason_use(\u003cpackage name\u003e VERSION \u003cpackage version\u003e HEADER_ONLY)\n```\n\n_Note: Leave out `HEADER_ONLY` if the package is a [precompiled library](https://github.com/mapbox/cpp/blob/master/glossary.md#precompiled-library). You can see if a package is `HEADER_ONLY` by looking inside the `script.sh` for `MASON_HEADER_ONLY=true` like https://github.com/mapbox/mason/blob/68871660b74023234fa96d482898c820a55bd4bf/scripts/geometry/0.9.0/script.sh#L5_\n\n## Configuration\n\nBy default Mason publishes packages to a Mapbox-managed S3 bucket. If you want to publish to a different bucket we recommend taking the following steps:\n\n1. Fork Mason and rename it to `mason-{your_org}`\n2. Set [`MASON_BUCKET`](https://github.com/mapbox/mason/blob/2765e4ab50ca2c1865048e8403ef28b696228f7b/mason.sh#L6) to your own S3 bucket\n3. Publish packages to the new location\n\n## Usage\n\nMost commands are structured like this:\n\n```bash\nmason \u003ccommand\u003e \u003clibrary\u003e \u003cversion\u003e\n```\n\nThe `command` can be one of the following\n\n* [install](#install) - installs the specified library/version\n* [remove](#remove) - removes the specified library/version\n* [build](#build) - forces a build from source (= skip pre-built binary detection)\n* [publish](#publish) - uploads packages to the S3 bucket\n* [prefix](#prefix) - prints the absolute path to the library installation directory\n* [version](#version) - prints the actual version of the library (only useful when version is `system`)\n* [cflags](#cflags) - prints C/C++ compiler flags\n* [ldflags](#ldflags) - prints linker flags\n* [link](#link) - creates symlinks for packages in `mason_packages/.link`\n* [trigger](#trigger) - trigger a build and publish operation on Travis CI\n\n#### install\n\n```bash\n$ mason install libuv 0.11.29\n* Downloading binary package osx-10.10/libuv/0.11.29.tar.gz...\n######################################################################## 100.0%\n* Installed binary package at /Users/user/mason_packages/osx-10.10/libuv/0.11.29\n```\n\nInstalls [libuv](https://github.com/joyent/libuv) into the current folder in the `mason_packages` directory. Libraries are versioned by platform and version number, so you can install several different versions of the same library along each other. Similarly, you can also install libraries for different platforms alongside each other, for example library binaries for OS X and iOS.\n\nThe `install` command first checks if the specified library/version is already present for this platform, and if so, exits. This means you can run it multiple times (e.g. as part of a configuration script) without doing unnecessary work.\n\nNext, Mason checks whether there are pre-built binaries available in the S3 bucket for the current platform. If that is the case, they are downloaded and unzipped and the installation is complete.\n\nIf no pre-built binaries are available, Mason is going to build the library according to the script in the `mason_packages/.build` folder, and install into the platform- and library-specific directory.\n\n#### remove\n\n```bash\n$ mason remove libuv 0.11.29\n* Removing existing package...\n/Users/user/mason_packages/osx-10.10/libuv/0.11.29/include/uv-darwin.h\n[...]\n/Users/user/mason_packages/osx-10.10/libuv/0.11.29\n```\n\nRemoves the specified library/version from the package directory.\n\n#### build\n\nThis command works like the `install` command, except that it *doesn't* check for existing library installations, and that it *doesn't* check for pre-built binaries, i.e. it first removes the current installation and *always* builds the library from source. This is useful when you are working on a build script and want to fresh builds.\n\n#### publish\n\nCreates a gzipped tarball of the specified platform/library/version and uploads it to the `mason-binaries` S3 bucket. If you want to use this feature, you need write access to the bucket and need to specify the environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`.\n\n#### prefix\n\n```bash\n~ $ mason prefix libuv 0.11.29\n/Users/user/mason_packages/osx-10.10/libuv/0.11.29\n```\n\nThis prints the absolute path to the installation directory of the the library/version. Likely, this folder has the typical `include` and `lib` folders.\n\n#### version\n\n```bash\n~ $ mason version zlib system\n1.2.11\n```\n\nThis prints the version of the library, which is only useful when version is `system`. See [System packages](#system-packages) for more details.\n\n#### cflags\n\n```bash\n~ $ mason cflags libuv 0.11.29\n-I/Users/user/mason_packages/osx-10.10/libuv/0.11.29/include\n```\n\nPrints the C/C++ compiler flags that are required to compile source code with this library. Likely, this is just the include path, but may also contain other flags.\n\n#### ldflags\n\n```bash\n~ $ mason ldflags libuv 0.11.29\n-L/Users/user/mason_packages/osx-10.10/libuv/0.11.29/lib -luv -lpthread -ldl\n```\n\nPrints the linker flags that are required to link against this library.\n\n#### link\n\n```bash\n~ $ mason link libuv 0.11.29\n```\n\nThis command only works if the package has already been installed. When run it symlinks the versioned `lib`, `include`, `share`, and `bin` folders of the package into a shared structure that is unversioned. For example if `mason prefix libuv 0.11.29` was `./mason_packages/osx-10.10/libuv/0.11.29` then the library would become available at `./mason_packages/.link/lib/libuv.a`\n\n#### trigger\n\nIn order to ensure that all pre-built binaries are consistent and reproducible, we perform the final build and publish operation on Travis CI.\n\nFirst set the `MASON_TRAVIS_TOKEN` environment variable. You can do this either by installing the `travis` gem and running `travis token` or by using `curl` to hit the Travis api directly. See details on this below. **WARNING: be careful to keep this token safe. Cycling it requires emailing support@travis-ci.com. Giving someone an access token is like giving them full access to your Travis account.**\n\nOnce you are set up with your `MASON_TRAVIS_TOKEN` then use the `trigger` command to kick off a build:\n\n```bash\n./mason trigger \u003cpackage name\u003e \u003cpackage version\u003e\n```\n\nRun this command from the root of a local mason repository checkout. It makes a request to the Travis API to build and publish the specified version of the package, using the Travis configuration in `./scripts/${MASON_NAME}/${MASON_VERSION}/.travis.yml`.\n\n1) Using curl and travis api to generate MASON_TRAVIS_TOKEN\n\nFirst generate a github personal access token that has `repo` scope by going to https://github.com/settings/tokens. More details at https://help.github.com/articles/creating-an-access-token-for-command-line-use/.\n\nThen set that in your environment and run:\n\n```sh\nGITHUB_TOKEN=\u003cgithub token\u003e\n\ncurl -s -i https://api.travis-ci.com/auth/github \\\n    -H \"User-Agent: Travis/1.0\" \\\n    -H \"Content-Type: application/json\" \\\n    -H \"Accept: application/vnd.travis-ci.2+json\" \\\n    -H \"Host: api.travis-ci.com\" \\\n    -d \"{\\\"github_token\\\": \\\"${GITHUB_TOKEN}\\\"}\"\n```\n\n2) Use the travis command\n\nFor details see https://docs.travis-ci.com/user/triggering-builds and https://github.com/travis-ci/travis.rb#readme\n\n## Creating a package\n\n### Prerequisites\n\nBefore getting started you should be able to answer the following questions.\n\n**What are you packaging?**\n\nThere are different steps that you will need to follow depending on the type of library you are packaging. For example, there are fewer steps you need to take if you are creating a package of header-only code. Packaging compiled code has more steps because you'll need to tell Mason how to build your binaries. Another type of package is a [System package](#system-package) which has a unique process as well.\n\n**Are there previous versions already published?**\n\nCheck the [list of packages](https://github.com/mapbox/mason/tree/master/scripts) to see if a previous version of your package exists. It's helpful to copy scripts from a previous version rather than creating code from scratch.\n\n**Where can Mason download your code?**\n\nEvery package needs to tell Mason where to download the code that it will build and publish, for example:\n\n - `https://github.com/mapbox/geometry.hpp/archive/v0.9.2.tar.gz` for a Github release: [geometry 0.9.2](https://github.com/mapbox/geometry.hpp/releases/tag/v0.9.2)\n - `https://github.com/mapbox/geometry.hpp/archive/b0e41cc5635ff8d50e7e1edb73cadf1d2a7ddc83.zip` for pre-release code hosted on Github: [geometry b0e41cc](https://github.com/mapbox/geometry.hpp/tree/b0e41cc5635ff8d50e7e1edb73cadf1d2a7ddc83)\n\n_Note: Your code doesn't need to be hosted on Github in order for Mason to work. Your code can be hosted anywhere. Another common location is [SourceForge](#https://sourceforge.net/)._\n\n### Getting started\n\nThese are just basic steps to help get you started. Depending on the complexity of building your code, you might have to review the [Mason scripts](#mason-scripts) section to get a better idea of how to further configure Mason to be able to create your package.\n\n1. Create a new directory for your package.\n\n    From inside your `mason` checkout, create a directory named `${package}/${version}`. For example, if you have a library named `your-lib` that is version `0.1.0` you would:\n\n    ```bash\n    mkdir -p scripts/your-lib/0.1.0\n    ```\n\n2. Add scripts for building and publishing your package.\n\n    Each package must have the following two files: `script.sh` and `.travis.yml`. Copy these two files from a previous version of your package.\n\n    If no previous version of your package exists, it is recommended to copy a simple package that has mostly boiler plate code:\n\n     - [geometry](https://github.com/mapbox/mason/tree/master/scripts/geometry/0.9.2) for header-only code\n     - [libpng](https://github.com/mapbox/mason/tree/master/scripts/libpng/1.6.32) for building and packaging binaries\n\n    For example, if you're creating the first package of a library named `your-lib` that is version `0.1.0` you would copy scripts from the `geometry` package:\n\n    ```bash\n    cp -r scripts/geometry/0.9.1 scripts/your-lib/0.1.0\n    ```\n\n3. Edit Mason variables in `script.sh`.\n\n    You **must** set the follow Mason variables:\n\n    - `MASON_NAME`: set to the name of your package, e.g. `your-lib`\n    - `MASON_VERSION`: set to the package version, e.g. `0.1.0`\n    - `MASON_BUILD_PATH`: set to the location Mason will use to store header files or binaries before it packages and publishes them\n\n    You **may** also need to set the follow Mason variables:\n\n    - Other [Mason variables](#mason-variables)\n\n4. Override Mason functions in `script.sh`.\n\n    You **must** override the follow Mason functions:\n\n    - `mason_load_source`: you must call `mason_download` and update its parameters:\n        - url (first parameter): set to the location of your source code archive, e.g. `https://github.com/mapbox/your-lib/archive/v${MASON_VERSION}.tar.gz`\n        - checksum (second parameter): set to the checksum you get back after running a checksum function on the source code you want to download. The easiest way to get this checksum is to run `./mason build your-lib 0.1.0` (after setting the `mason_download` url) which will fail with an error message that will contain the correct checksum\n    - `mason_compile`\n        - for header-only see [geometry 0.9.2](https://github.com/mapbox/mason/blob/a7e35b0f632a8b2f0e338acc9dda0cff04d2f752/scripts/geometry/0.9.2/script.sh#L19) for an example\n        - for code that needs to be compiled see [zlib 1.2.8](https://github.com/mapbox/mason/blob/a7e35b0f632a8b2f0e338acc9dda0cff04d2f752/scripts/zlib/1.2.8/script.sh#L20) for an example\n\n    You **may** also need to override the follow Mason functions:\n\n    - Other [Mason functions](#mason-functions)\n\n### System packages\n\nSome packages ship with operating systems or can be easily installed with operating-specific package managers. For example, `libpng` is available on most systems and the version you're using doesn't really matter since it is mature and hasn't added any significant new APIs in recent years.\n\nThe following `script.sh` contains the script code for packaging your system's `libpng`. _Note: To understande this code, make sure to review the [Mason scripts](#mason-scripts) section._\n\n```bash\n#!/usr/bin/env bash\n\nMASON_NAME=libpng\nMASON_VERSION=system\nMASON_SYSTEM_PACKAGE=true\n\n. ${MASON_DIR}/mason.sh\n\nif [ ! $(pkg-config libpng --exists; echo $?) = 0 ]; then\n    mason_error \"Cannot find libpng with pkg-config\"\n    exit 1\nfi\n\nfunction mason_system_version {\n    mkdir -p \"${MASON_PREFIX}\"\n    cd \"${MASON_PREFIX}\"\n    if [ ! -f version ]; then\n        echo \"#include \u003cpng.h\u003e\n#include \u003cstdio.h\u003e\n#include \u003cassert.h\u003e\nint main() {\n    assert(PNG_LIBPNG_VER == png_access_version_number());\n    printf(\\\"%s\\\", PNG_LIBPNG_VER_STRING);\n    return 0;\n}\n\" \u003e version.c \u0026\u0026 ${CC:-cc} version.c $(mason_cflags) $(mason_ldflags) -o version\n    fi\n    ./version\n}\n\nfunction mason_compile {\n    :\n}\n\nfunction mason_cflags {\n    pkg-config libpng --cflags\n}\n\nfunction mason_ldflags {\n    pkg-config libpng --libs\n}\n\nmason_run \"$@\"\n```\n\nSystem packages are marked with `MASON_SYSTEM_PACKAGE=true`. We're also first using `pkg-config` to check whether the library is present at all. The `mason_system_version` function creates a small executable which outputs the actual version. It is the only thing that is cached in the installation directory.\n\nWe have to override the `mason_cflags` and `mason_ldflags` commands since the regular commands return flags for static libraries, but in the case of system packages, we want to dynamically link against the package.\n\n## Releasing a package\n\nHere is an example workflow to help get you started:\n\n1. Create an annotated tag in git for the code you want to package.\n\n    Annotated tags can be stored, checksummed, signed and verified with GNU Privacy Guard (GPG) in Github. To create an annotated tag specify `-a` when running the `tag` command, for example:\n\n    `git tag -a v0.1.0 -m \"version 0.1.0\"`\n\n2. Share your new tag.\n\n    You have to explicitly push your new tag to a shared Github server. This is the location we will share with Mason when specifying where to download the code to be packaged. Using our example above we would run:\n\n    `git push origin v0.1.0`\n\n    (Or you can push all tags: `git push --tags`.)\n\n3. Create a package.\n\n    We recommend working in a new branch before creating a package. For example if you want to call your new package `my_new_package` version `0.1.0` you could create and checkout a branch like this:\n\n    `git checkout -b my_new_package-0.1.0`\n\n    Now follow the instructions in the [Getting started](#getting-started) section for creating a new package.\n\n4. Test your package.\n\n    Even though we will eventually build the package using Travis, it's a good idea to build locally to check for errors.\n\n     `./mason build my_new_package 0.1.0`\n\n5. Push changes to remote.\n\n    Once you can build, push your changes up to Github remote so that Travis will know what to build and publish in the next step.\n\n    `git push origin my_new_package-0.1.0`\n\n6. Build and Publish your package.\n\n    Use Mason's `trigger` command to tell Travis to build, test, and publish your new package to the S3 bucket specified in `mason.sh`.\n\n    `./mason trigger my_new_package 0.1.0`\n\n7. Check S3 to verify whether your package exists.\n\n## Using a package\n\nMason has two clients for installing and working with packages:\n\n* **Mason cli** - comes bundled with the Mason project, see [Usage](#usage) for commands\n\n    For example [hpp-skel](https://github.com/mapbox/hpp-skel) uses the Mason cli client and requires that the Mason version in [scripts/setup.sh](https://github.com/mapbox/hpp-skel/blob/044187fdfc441cf9db57a3c1b03972eee6882a9b/scripts/setup.sh#L6) be updated in order to stay up-to-date with the latest available packages.\n\n* **[mason-js](https://github.com/mapbox/mason-js)** - a separate Node.js client with its own installation and usage instructions\n\n    For example [node-cpp-skel](https://github.com/mapbox/node-cpp-skel) uses the mason-js client and pulls packages directly from S3.\n\n_Note: The install command syntax will differ depending on the client you use._\n\n## Mason internals\n\n### Mason scripts\n\nThe `script.sh` file in each package is structured like the following example:\n\n```bash\n#!/usr/bin/env bash\n\n# This is required for every package.\nMASON_NAME=libuv\nMASON_VERSION=0.11.29\n\n# This is required if Mason will need to build a static library. Specify the relative path in the\n# installation directory.\nMASON_LIB_FILE=lib/libuv.a\n\n# You can specify the relative path to the pkg-config file if Mason needs to build your code before\n# packaging. If the library doesn't have a pkg-config file, you will need to override the functions\n# `mason_cflags` and `mason_ldflags`.\nMASON_PKGCONFIG_FILE=lib/pkgconfig/libuv.pc\n\n# This is required when you need to load the build system to build your code before packaging. You\n# con't need this line if you are packaging header-only code.\n. ${MASON_DIR}/mason.sh\n\n# Overriding this Mason function is required for all pakcages so Mason knows where to obtain your\n# source code. This function also caches downloaded tarballs in the mason_packages/.cache folder.\nfunction mason_load_source {\n    mason_download \\\n        https://github.com/joyent/libuv/archive/v0.11.29.tar.gz \\\n        5bf49a8652f680557cbaf335a160187b2da3bf7f\n\n    # This unpacks the archive into the `mason_packages/.build` folder. If the tarball is BZip2\n    # compressed, you can also use `mason_extract_tar_bz2` instead.\n    mason_extract_tar_gz\n\n    # This variable contains the path to the unpacked folder inside the `.build` directory.\n    export MASON_BUILD_PATH=${MASON_ROOT}/.build/${MASON_NAME}-${MASON_VERSION}\n}\n\n# Override this Mason function if you need to run code before compiling, e.g. a script that\n# generates configuration files.\nfunction mason_prepare_compile {\n    ./autogen.sh\n}\n\n# It is required to override the `mason_compile` function because it performs the actual build of\n# the source code (or just copies header files into a package folder to be published later for\n# header-only code). This is an example of how you would configure and make a static library.\nfunction mason_compile {\n    # You must set the build system's installation prefix to `MASON_PREFIX`. For cross-platform\n    # builds, you have to specify the `MASON_HOST_ARG`, which is empty for regular builds and is set\n    # to the correct host platform for cross-compiles e.g. iOS builds use `--host=arm-apple-darwin`.\n    ./configure \\\n        --prefix=${MASON_PREFIX} \\\n        ${MASON_HOST_ARG} \\\n        --enable-static \\\n        --disable-shared \\\n        --disable-dependency-tracking\n\n    # If the build system supports building concurrently, you can tell it do do so by providing the\n    # number of parallel tasks from `MASON_CONCURRENCY`.\n    make install -j${MASON_CONCURRENCY}\n}\n\n# Tell Mason how to clean up the build folder. This is required for multi-architecture builds. e.g.\n# iOS builds perform a Simulator (Intel architecture) build first, then an iOS (ARM architecture)\n# build. The results are `lipo`ed into one universal archive file.\nfunction mason_clean {\n    make clean\n}\n\n# Run everything.\nmason_run \"$@\"\n```\n\n### Mason variables\n\nName | Description\n---|---\n`MASON_DIR` | The directory where Mason itself is installed. Defaults to the current directory.\n`MASON_ROOT` | Absolute path the `mason_packages` directory. Example: `/Users/user/mason_packages`.\n`MASON_PLATFORM` | Platform of the current invocation. Currently one of `osx`, `ios`, `android`, or `linux`.\n`MASON_PLATFORM_VERSION` | Version of the platform. It must include the architecture if the produced binaries are architecture-specific (e.g. on Linux). Example: `10.10`\n`MASON_NAME` | Name specified in the `script.sh` file. Example: `libuv`\n`MASON_VERSION` | Version specified in the `script.sh` file. Example: `0.11.29`\n`MASON_SLUG` | Combination of the name and version. Example: `libuv-0.11.29`\n`MASON_PREFIX` | Absolute installation path. Example: `/Users/user/mason_packages/osx-10.10/libuv/0.11.29`\n`MASON_BUILD_PATH` | Absolute path to the build root. Example: `/Users/user/mason_packages/.build/libuv-0.11.29`\n`MASON_BUCKET` | S3 bucket that is used for storing pre-built binary packages. Example: `mason-binaries`\n`MASON_BINARIES` | Relative path to the gzipped tarball in the `.binaries` directory. Example: `osx-10.10/libuv/0.11.29.tar.gz`\n`MASON_BINARIES_PATH` | Absolute path to the gzipped tarball. Example: `/Users/user/mason_packages/.binaries/osx-10.10/libuv/0.11.29.tar.gz`\n`MASON_CONCURRENCY` | Number of CPU cores. Example: `8`\n`MASON_HOST_ARG` | Cross-compilation arguments. Example: `--host=x86_64-apple-darwin`\n`MASON_LIB_FILE` | Relative path to the library file in the install directory. Example: `lib/libuv.a`\n`MASON_PKGCONFIG_FILE` | Relative path to the pkg-config file in the install directory.  Example: `lib/pkgconfig/libuv.pc`\n`MASON_XCODE_ROOT` | OS X specific; Path to the Xcode Developer directory. Example: `/Applications/Xcode.app/Contents/Developer`\n`MASON_HEADER_ONLY` | Set to `true` to specify this library as header-only, which bypasses building binaries (default `false`)\n\n### Mason functions\n\nThese are common Mason function that you might need to override in your package's `script.sh` file depending on the type of library you are packaging. See https://github.com/mapbox/mason/blob/master/mason.sh to view how these functions are implemented by default. There you will find even more `mason_`-functions that you might find useful to override.\n\n - `mason_pkgconfig`\n - `mason_cflags`\n - `mason_ldflags`\n - `mason_static_libs`\n\n## Troubleshooting\n\nDownloaded source tarballs are cached in `mason_packages/.cache`. If for some reason the initial download failed, but it still left a file in that directory, make sure you delete the partial download there.\n","funding_links":[],"categories":["npm"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Fmason","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmapbox%2Fmason","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Fmason/lists"}