Giter Site home page Giter Site logo

mapbox / mason Goto Github PK

View Code? Open in Web Editor NEW
254.0 117.0 101.0 3.36 MB

Cross platform package manager for C/C++ apps

License: BSD 2-Clause "Simplified" License

Shell 42.97% CMake 0.53% Makefile 0.01% C 0.01% Python 56.50%
cplusplus packaging cxx cross-platform linux osx apt dpkg npm binaries

mason's Introduction

Mason

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

Mason is a cross-platform, command-line package manager for C/C++ applications.

Mason is like:

  • 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)
  • homebrew because it requires no use of sudo to install packages
  • apt-get or yum because it works on Linux

Mason is unlike:

  • all of the above...

    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 (>= OS X 10.8 and >= Ubuntu Precise), publish header-only files, and install packages. Mason has integrations with Travis CI and Amazon S3 for automated build and deployment.

    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.

Mason works on both OS X and Linux.

Build Status

Table of Contents

Installation

There are three recommended ways to install mason, via:

Curl

To install mason locally:

mkdir ./mason
curl -sSfL https://github.com/mapbox/mason/archive/v0.23.0.tar.gz | tar -z --extract --strip-components=1 --exclude="*md" --exclude="test*" --directory=./mason

Then you can use the mason command like: ./mason/mason install <package> <version>

To install mason globally (to /tmp):

curl -sSfL https://github.com/mapbox/mason/archive/v0.23.0.tar.gz | tar -z --extract --strip-components=1 --exclude="*md" --exclude="test*" --directory=/tmp

Then you can use the mason command like: /tmp/mason install <package> <version>

Submodule

Mason can also be added as a submodule to your repository. This is helpful for other contributors to get set up quickly.

Optionally 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/.

git submodule add [email protected]:mapbox/mason.git .mason/

This will append a few lines to your .gitmodules file. Make sure to change the url parameter to https instead of git@github ssh protocol.

[submodule ".mason"]
    path = .mason
    url = https://github.com/mapbox/mason.git

Update 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.

MASON ?= .mason/mason

$(MASON):
    git submodule update --init

mason_packages: $(MASON)
    $(MASON) install geometry 0.7.0
    $(MASON) install variant 1.1.0

mason.cmake

Copy the https://raw.githubusercontent.com/mapbox/mason/master/mason.cmake into your cmake project. A common convention is to place it at <your project>/cmake/mason

mkdir cmake
wget -O cmake/mason.cmake https://raw.githubusercontent.com/mapbox/mason/master/mason.cmake

Then in your CmakeLists.txt install packages like:

mason_use(<package name> VERSION <package version> HEADER_ONLY)

Note: Leave out HEADER_ONLY if the package is a precompiled library. You can see if a package is HEADER_ONLY by looking inside the script.sh for MASON_HEADER_ONLY=true like

MASON_HEADER_ONLY=true

Configuration

By 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:

  1. Fork Mason and rename it to mason-{your_org}
  2. Set MASON_BUCKET to your own S3 bucket
  3. Publish packages to the new location

Usage

Most commands are structured like this:

mason <command> <library> <version>

The command can be one of the following

  • install - installs the specified library/version
  • remove - removes the specified library/version
  • build - forces a build from source (= skip pre-built binary detection)
  • publish - uploads packages to the S3 bucket
  • prefix - prints the absolute path to the library installation directory
  • version - prints the actual version of the library (only useful when version is system)
  • cflags - prints C/C++ compiler flags
  • ldflags - prints linker flags
  • link - creates symlinks for packages in mason_packages/.link
  • trigger - trigger a build and publish operation on Travis CI

install

$ mason install libuv 0.11.29
* Downloading binary package osx-10.10/libuv/0.11.29.tar.gz...
######################################################################## 100.0%
* Installed binary package at /Users/user/mason_packages/osx-10.10/libuv/0.11.29

Installs 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.

The 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.

Next, 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.

If 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.

remove

$ mason remove libuv 0.11.29
* Removing existing package...
/Users/user/mason_packages/osx-10.10/libuv/0.11.29/include/uv-darwin.h
[...]
/Users/user/mason_packages/osx-10.10/libuv/0.11.29

Removes the specified library/version from the package directory.

build

This 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.

publish

Creates 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.

prefix

~ $ mason prefix libuv 0.11.29
/Users/user/mason_packages/osx-10.10/libuv/0.11.29

This prints the absolute path to the installation directory of the the library/version. Likely, this folder has the typical include and lib folders.

version

~ $ mason version zlib system
1.2.11

This prints the version of the library, which is only useful when version is system. See System packages for more details.

cflags

~ $ mason cflags libuv 0.11.29
-I/Users/user/mason_packages/osx-10.10/libuv/0.11.29/include

Prints 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.

ldflags

~ $ mason ldflags libuv 0.11.29
-L/Users/user/mason_packages/osx-10.10/libuv/0.11.29/lib -luv -lpthread -ldl

Prints the linker flags that are required to link against this library.

link

~ $ mason link libuv 0.11.29

This 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

trigger

In order to ensure that all pre-built binaries are consistent and reproducible, we perform the final build and publish operation on Travis CI.

First 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 [email protected]. Giving someone an access token is like giving them full access to your Travis account.

Once you are set up with your MASON_TRAVIS_TOKEN then use the trigger command to kick off a build:

./mason trigger <package name> <package version>

Run 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.

  1. Using curl and travis api to generate MASON_TRAVIS_TOKEN

First 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/.

Then set that in your environment and run:

GITHUB_TOKEN=<github token>

curl -s -i https://api.travis-ci.com/auth/github \
    -H "User-Agent: Travis/1.0" \
    -H "Content-Type: application/json" \
    -H "Accept: application/vnd.travis-ci.2+json" \
    -H "Host: api.travis-ci.com" \
    -d "{\"github_token\": \"${GITHUB_TOKEN}\"}"
  1. Use the travis command

For details see https://docs.travis-ci.com/user/triggering-builds and https://github.com/travis-ci/travis.rb#readme

Creating a package

Prerequisites

Before getting started you should be able to answer the following questions.

What are you packaging?

There 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 which has a unique process as well.

Are there previous versions already published?

Check the list of packages 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.

Where can Mason download your code?

Every package needs to tell Mason where to download the code that it will build and publish, for example:

  • 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/archive/b0e41cc5635ff8d50e7e1edb73cadf1d2a7ddc83.zip for pre-release code hosted on Github: geometry b0e41cc

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.

Getting started

These 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 section to get a better idea of how to further configure Mason to be able to create your package.

  1. Create a new directory for your package.

    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:

    mkdir -p scripts/your-lib/0.1.0
  2. Add scripts for building and publishing your package.

    Each package must have the following two files: script.sh and .travis.yml. Copy these two files from a previous version of your package.

    If no previous version of your package exists, it is recommended to copy a simple package that has mostly boiler plate code:

    • geometry for header-only code
    • libpng for building and packaging binaries

    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:

    cp -r scripts/geometry/0.9.1 scripts/your-lib/0.1.0
  3. Edit Mason variables in script.sh.

    You must set the follow Mason variables:

    • MASON_NAME: set to the name of your package, e.g. your-lib
    • MASON_VERSION: set to the package version, e.g. 0.1.0
    • MASON_BUILD_PATH: set to the location Mason will use to store header files or binaries before it packages and publishes them

    You may also need to set the follow Mason variables:

  4. Override Mason functions in script.sh.

    You must override the follow Mason functions:

    • mason_load_source: you must call mason_download and update its parameters:
      • 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
      • 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
    • mason_compile

    You may also need to override the follow Mason functions:

System packages

Some 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.

The 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 section.

#!/usr/bin/env bash

MASON_NAME=libpng
MASON_VERSION=system
MASON_SYSTEM_PACKAGE=true

. ${MASON_DIR}/mason.sh

if [ ! $(pkg-config libpng --exists; echo $?) = 0 ]; then
    mason_error "Cannot find libpng with pkg-config"
    exit 1
fi

function mason_system_version {
    mkdir -p "${MASON_PREFIX}"
    cd "${MASON_PREFIX}"
    if [ ! -f version ]; then
        echo "#include <png.h>
#include <stdio.h>
#include <assert.h>
int main() {
    assert(PNG_LIBPNG_VER == png_access_version_number());
    printf(\"%s\", PNG_LIBPNG_VER_STRING);
    return 0;
}
" > version.c && ${CC:-cc} version.c $(mason_cflags) $(mason_ldflags) -o version
    fi
    ./version
}

function mason_compile {
    :
}

function mason_cflags {
    pkg-config libpng --cflags
}

function mason_ldflags {
    pkg-config libpng --libs
}

mason_run "$@"

System 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.

We 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.

Releasing a package

Here is an example workflow to help get you started:

  1. Create an annotated tag in git for the code you want to package.

    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:

    git tag -a v0.1.0 -m "version 0.1.0"

  2. Share your new tag.

    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:

    git push origin v0.1.0

    (Or you can push all tags: git push --tags.)

  3. Create a package.

    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:

    git checkout -b my_new_package-0.1.0

    Now follow the instructions in the Getting started section for creating a new package.

  4. Test your package.

    Even though we will eventually build the package using Travis, it's a good idea to build locally to check for errors.

    ./mason build my_new_package 0.1.0

  5. Push changes to remote.

    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.

    git push origin my_new_package-0.1.0

  6. Build and Publish your package.

    Use Mason's trigger command to tell Travis to build, test, and publish your new package to the S3 bucket specified in mason.sh.

    ./mason trigger my_new_package 0.1.0

  7. Check S3 to verify whether your package exists.

Using a package

Mason has two clients for installing and working with packages:

  • Mason cli - comes bundled with the Mason project, see Usage for commands

    For example hpp-skel uses the Mason cli client and requires that the Mason version in scripts/setup.sh be updated in order to stay up-to-date with the latest available packages.

  • mason-js - a separate Node.js client with its own installation and usage instructions

    For example node-cpp-skel uses the mason-js client and pulls packages directly from S3.

Note: The install command syntax will differ depending on the client you use.

Mason internals

Mason scripts

The script.sh file in each package is structured like the following example:

#!/usr/bin/env bash

# This is required for every package.
MASON_NAME=libuv
MASON_VERSION=0.11.29

# This is required if Mason will need to build a static library. Specify the relative path in the
# installation directory.
MASON_LIB_FILE=lib/libuv.a

# You can specify the relative path to the pkg-config file if Mason needs to build your code before
# packaging. If the library doesn't have a pkg-config file, you will need to override the functions
# `mason_cflags` and `mason_ldflags`.
MASON_PKGCONFIG_FILE=lib/pkgconfig/libuv.pc

# This is required when you need to load the build system to build your code before packaging. You
# con't need this line if you are packaging header-only code.
. ${MASON_DIR}/mason.sh

# Overriding this Mason function is required for all pakcages so Mason knows where to obtain your
# source code. This function also caches downloaded tarballs in the mason_packages/.cache folder.
function mason_load_source {
    mason_download \
        https://github.com/joyent/libuv/archive/v0.11.29.tar.gz \
        5bf49a8652f680557cbaf335a160187b2da3bf7f

    # This unpacks the archive into the `mason_packages/.build` folder. If the tarball is BZip2
    # compressed, you can also use `mason_extract_tar_bz2` instead.
    mason_extract_tar_gz

    # This variable contains the path to the unpacked folder inside the `.build` directory.
    export MASON_BUILD_PATH=${MASON_ROOT}/.build/${MASON_NAME}-${MASON_VERSION}
}

# Override this Mason function if you need to run code before compiling, e.g. a script that
# generates configuration files.
function mason_prepare_compile {
    ./autogen.sh
}

# It is required to override the `mason_compile` function because it performs the actual build of
# the source code (or just copies header files into a package folder to be published later for
# header-only code). This is an example of how you would configure and make a static library.
function mason_compile {
    # You must set the build system's installation prefix to `MASON_PREFIX`. For cross-platform
    # builds, you have to specify the `MASON_HOST_ARG`, which is empty for regular builds and is set
    # to the correct host platform for cross-compiles e.g. iOS builds use `--host=arm-apple-darwin`.
    ./configure \
        --prefix=${MASON_PREFIX} \
        ${MASON_HOST_ARG} \
        --enable-static \
        --disable-shared \
        --disable-dependency-tracking

    # If the build system supports building concurrently, you can tell it do do so by providing the
    # number of parallel tasks from `MASON_CONCURRENCY`.
    make install -j${MASON_CONCURRENCY}
}

# Tell Mason how to clean up the build folder. This is required for multi-architecture builds. e.g.
# iOS builds perform a Simulator (Intel architecture) build first, then an iOS (ARM architecture)
# build. The results are `lipo`ed into one universal archive file.
function mason_clean {
    make clean
}

# Run everything.
mason_run "$@"

Mason variables

Name Description
MASON_DIR The directory where Mason itself is installed. Defaults to the current directory.
MASON_ROOT Absolute path the mason_packages directory. Example: /Users/user/mason_packages.
MASON_PLATFORM Platform of the current invocation. Currently one of osx, ios, android, or linux.
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
MASON_NAME Name specified in the script.sh file. Example: libuv
MASON_VERSION Version specified in the script.sh file. Example: 0.11.29
MASON_SLUG Combination of the name and version. Example: libuv-0.11.29
MASON_PREFIX Absolute installation path. Example: /Users/user/mason_packages/osx-10.10/libuv/0.11.29
MASON_BUILD_PATH Absolute path to the build root. Example: /Users/user/mason_packages/.build/libuv-0.11.29
MASON_BUCKET S3 bucket that is used for storing pre-built binary packages. Example: mason-binaries
MASON_BINARIES Relative path to the gzipped tarball in the .binaries directory. Example: osx-10.10/libuv/0.11.29.tar.gz
MASON_BINARIES_PATH Absolute path to the gzipped tarball. Example: /Users/user/mason_packages/.binaries/osx-10.10/libuv/0.11.29.tar.gz
MASON_CONCURRENCY Number of CPU cores. Example: 8
MASON_HOST_ARG Cross-compilation arguments. Example: --host=x86_64-apple-darwin
MASON_LIB_FILE Relative path to the library file in the install directory. Example: lib/libuv.a
MASON_PKGCONFIG_FILE Relative path to the pkg-config file in the install directory. Example: lib/pkgconfig/libuv.pc
MASON_XCODE_ROOT OS X specific; Path to the Xcode Developer directory. Example: /Applications/Xcode.app/Contents/Developer
MASON_HEADER_ONLY Set to true to specify this library as header-only, which bypasses building binaries (default false)

Mason functions

These 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.

  • mason_pkgconfig
  • mason_cflags
  • mason_ldflags
  • mason_static_libs

Troubleshooting

Downloaded 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.

mason's People

Contributors

1ec5 avatar artemp avatar bhousel avatar brunoabinader avatar camilleanne avatar daniel-j-h avatar danpat avatar e-n-f avatar flippmoke avatar ingalls avatar ivovandongen avatar jfirebaugh avatar joto avatar kevinkreiser avatar kkaefer avatar lightmare avatar ljbade avatar mapsam avatar mikemorris avatar mourner avatar nagineni avatar oxidase avatar rclark avatar ryanbaumann avatar springmeyer avatar themarex avatar tmpsantos avatar tpikonen avatar wesleyac avatar yhahn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mason's Issues

gdal build pain point: libtool

Gdal uses libtool to handle linking, but libtool breaks when you are trying to test building a package locally which breaks the gdal build. This is because the .la (libtool archives) contain invalid absolute paths from travis builds.

We have a few options to workaround this:

  • disable GDAL libtool usage: works from building a libgdal.a but not libgdal.so
  • try to post-build edit the .la files to use relative paths

Error looks like:

libtool: link: warning: library `/Users/dane/projects/mason/gdal-1.11.1-big-pants/mason_packages/osx-10.10/libtiff/4.0.4beta/lib/libtiff.la' was moved.
grep: /Users/travis/build/mapbox/mason/mason_packages/osx-10.10/jpeg_turbo/1.4.0/lib/libjpeg.la: No such file or directory
sed: /Users/travis/build/mapbox/mason/mason_packages/osx-10.10/jpeg_turbo/1.4.0/lib/libjpeg.la: No such file or directory
libtool: link: `/Users/travis/build/mapbox/mason/mason_packages/osx-10.10/jpeg_turbo/1.4.0/lib/libjpeg.la' is not a valid libtool archive
make[1]: *** [libgdal.la] Error 1
make: *** [check-lib] Error 2

Discover dynamic shared library dependencies

Could be useful for node-pre-gyp: add validate command that checks for portability of shared libraries

  • win-ldd Google Code and #6
  • dumpbin /DEPENDENTS, MSDN: "Dumps the names of the DLLs from which the image imports functions. Does not dump the names of the imported functions. Only the /HEADERS DUMPBIN option is available for use on files produced with the /GL compiler option."
  • for running processes: tasklist /m MSDN: Tasklist. Filter to cmd.exe: tasklist /m /fi "imagename eq cmd.exe"

Mason mixes up something when building libuv

I was trying to get latest libuv 0.10.32 into mapbox-gl-native but was getting strange linker errors:

input file lib-ios/libuv.a is not a fat file
Non-fat file: lib-ios/libuv.a is architecture: x86_64
* Creating Universal Binary...
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: ../lib-ios/libuv.a and ../lib-isim/libuv.a have the same architectures (x86_64) and can't be in the same fat output file
make: *** [config-ios.gypi] Error 1

@springmeyer mentioned that it might be a mason bug

Scripts to easily update all packages

As the number of packages (and package variations) grow we should start adding scripts to make dev easier across all branches.

Ideas:

  • Script to clone or rebase all branches locally (representing packages) - 01997a0
  • Script to kick travis (to trigger rebuilds) for a list of packages (For example after changes to the master/mason.sh that might set new compiler flags you'd want to rebuild lots of packages) - 78b0113

With the two above scripts in place you could, for example, 1) get all packages, 2) make a set of batch changes to all local files like changing travis.yml build details, then 3) refresh all packages.

GCC support for Android

We should be able to select either clang or GCC in Android builds.

That way we can run GCC on Travis to see if it picks up different mistakes from clang (like currently done with Linux builds).

This will need the mason.sh to be changed.

Remove sqllite dependency from libnu

Capturing from mapbox/mapbox-gl-native#689

From @artemp:

@ljbade @springmeyer @mikemorris @incanus @jfirebaugh - we should use nunicode 1.5.1
Removing those lines from CMakeLists.txt should avoid building sqlite3 ext

56a57,69
> find_package(Sqlite3)
> 
> if(CMAKE_BUILD_TYPE MATCHES PROF)
>   add_subdirectory(tests/prof)
>   
>   if(SQLITE3_FOUND)
>       add_subdirectory(sqlite3/prof)
>   endif(SQLITE3_FOUND)
> endif(CMAKE_BUILD_TYPE MATCHES PROF)
> 
> if(SQLITE3_FOUND)
>   add_subdirectory(sqlite3)
> endif(SQLITE3_FOUND)

MASON_DIR refers to master only

I have a need to refer to files in the branch that holds the script.sh file. On Travis this maps to ~/build/mapbox/mason but likely different in other contexts.

There is the variable MASON_DIR which maps to ~/mason.sh which is where mason master branch is checked out.

There is no way to get the script.sh branch as far as I can see.

/cc @springmeyer

Way to query mason for env variables

A way to get at any of the MASON environment variables would be nice, so I added this in a2b2dae

Realizing now that it works on OS X but not on ubuntu precise (which returns nothing) so will need to find a better solution.

Adapt win-ldd to find dependents

Adapt win-ldd to find DLLs the inspected DLL relies on.

TODO:

  • output full path, that can be used in other tools, e.g. gyp. Q: What's the output, if file cannot be located? Return code > 0?
  • command line switch to omit system DLLs, e.g. everything from C:\Windows

Possible use cases:

  • packing: find DLLs that have to be included
  • error hunting: find out which DLLs are missing

zlib on windows

Recording some findings:

  • zlib 1.2.8 + libtiff 4.x fails in this test because it basically appears that tiffs that have zlib compression cannot be opened. The errors you see from libtiff are:
ZIPSetupDecode: (null)

First I tried upgrading to libtiff HEAD and building gdal against this external libtiff (thinking I had a version clash) and that changed the error to:

ZipSetupDecode: .

But the tiff still could not be opened. After reading http://www.asmail.be/msg0054830467.html I got the idea of downgrading to zlib 1.2.5 since that is what the libpng windows visual studio files use. I could not find zlib 1.2.5 at http://zlib.net/ but was able to download it from http://sourceforge.net/projects/libpng/files/zlib/1.2.5/. Now things work:

multi-os for travis

@kkaefer .travis.yml files have multi-os in the config but it is not working yet: I presume that we still need to email travis support to enable? Confirm my hunch is right and I'll go ahead and do that.

Android ports needing work

High level ticket to track apps that don't work yet on android but likely could/should if needed.

libjpeg-turbo

Currently stuck on what looks like an outdated config.sub/config.guess:

checking build system type... x86_64-unknown-linux-gnu
checking host system type... Invalid configuration `arm-linux-androideabi': system `androideabi' not recognized
configure: error: /bin/bash ./config.sub arm-linux-androideabi failed

https://travis-ci.org/mapbox/mason/jobs/48413479#L155

webp

Can't remember the error - would need to re-enable travis android builds to take a look.

/usr/local/bin/mason: line 54: /usr/local/bin/mason.sh: No such file or directory

Installed like

git clone https://github.com/mapbox/mason.git ~/.mason
sudo ln -s ~/.mason/mason /usr/local/bin/mason

then hit this error trying to mason install libpng 1.6.13 on a Ubuntu 14.04 VM

/usr/local/bin/mason: line 54: /usr/local/bin/mason.sh: No such file or directory

Running the follow from home directory works fine however.

./.mason/mason build libpng 1.6.13

Travis not building?

For some reason Travis stopped picking up and building commits to boringssl branch yesterday.

Tried again this morning and it still isn't working.

@springmeyer Do you know what is going on?

cached scripts are never invalidated

Cached scripts (in mason_packages/.scripts) are never redownloaded. This makes it easy to get into a situation where an install fails with cryptic errors and the solution is to clear the .scripts directory. The README says "If you update script in the Mason repository, and your changes aren't getting applied, make sure you delete the script from that directory." but this assumes that "you" is the same person, and that's the exception, not the rule.

What is the rationale for having a separate branch for each install script? Why not just check the scripts into the master branch like homebrew does? That would ensure they get update automatically by mason selfupdate, and it seems like it would be more convenient for mason development as well.

cc @springmeyer @kkaefer

Mesa 10.3.5 swrast_dri.so segfaults

Tested mapbox-gl-native against mesa-10.3.5 and it looks like there's a segfault coming from swrast_dri.so that I haven't seen running against mesa-10.3.1.

Traceback (most recent call last):
  File "./../../test/suite/bin/server.py", line 29, in <module>
    server.serve_forever()
  File "/usr/lib/python2.7/SocketServer.py", line 225, in serve_forever
    r, w, e = select.select([self], [], [], poll_interval)
select.error: (4, 'Interrupted system call')
./scripts/run_tests.sh: line 8: 16664 Segmentation fault      (core dumped) ${TEST}
The program crashed with exit code 139. We're now trying to output the core dump.
[New LWP 16664]
[New LWP 16667]
[New LWP 16672]
[New LWP 17472]
[New LWP 17473]
[New LWP 16673]
[New LWP 16666]
[New LWP 16669]
[New LWP 16668]
[New LWP 16678]
[New LWP 17471]
[New LWP 17474]
[New LWP 16670]
[New LWP 16671]

warning: Can't read pathname for load map: Input/output error.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7fff69eb0000
Core was generated by `./test_headless'.
Program terminated with signal 11, Segmentation fault.
#0  0x00007f9aa0077e75 in lp_setup_bin_triangle () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so

Thread 14 (Thread 0x7f9a9a4ea700 (LWP 16671)):
#0  0x00007f9aa8193d84 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007f9aa006ea43 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#2  0x00007f9aa818fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#3  0x00007f9aa56f24bd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x0000000000000000 in ?? ()

Thread 13 (Thread 0x7f9a9aeeb700 (LWP 16670)):
#0  0x00007f9aa8193d84 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007f9aa006ea43 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#2  0x00007f9aa818fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#3  0x00007f9aa56f24bd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x0000000000000000 in ?? ()

Thread 12 (Thread 0x7f9a986e7700 (LWP 17474)):
#0  0x00007f9aa8193d84 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x000000000050af27 in uv_cond_wait (cond=0x12f8cc8, mutex=0x12f8ca0) at src/unix/thread.c:322
#2  0x00000000004784ab in uv_chan_receive ()
#3  0x0000000000477c59 in uv__worker_thread_loop ()
#4  0x00000000005101a3 in uv__thread_start (ctx_v=0x230be90) at src/uv-common.c:322
#5  0x00007f9aa818fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#6  0x00007f9aa56f24bd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#7  0x0000000000000000 in ?? ()

Thread 11 (Thread 0x7f9a972e5700 (LWP 17471)):
#0  0x00007f9aa8193d84 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x000000000050af27 in uv_cond_wait (cond=0x12f8cc8, mutex=0x12f8ca0) at src/unix/thread.c:322
#2  0x00000000004784ab in uv_chan_receive ()
#3  0x0000000000477c59 in uv__worker_thread_loop ()
#4  0x00000000005101a3 in uv__thread_start (ctx_v=0x2b785a0) at src/uv-common.c:322
#5  0x00007f9aa818fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#6  0x00007f9aa56f24bd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#7  0x0000000000000000 in ?? ()

Thread 10 (Thread 0x7f9a95de2700 (LWP 16678)):
#0  0x00007f9aa56ee6d9 in syscall () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00000000005146e2 in uv__epoll_wait (epfd=10, events=0x7f9a95ddecd0, nevents=1024, timeout=-1) at src/unix/linux-syscalls.c:282
#2  0x0000000000511733 in uv__io_poll (loop=0x17d00a0, timeout=-1) at src/unix/linux-core.c:187
#3  0x0000000000501a39 in uv_run (loop=0x17d00a0, mode=UV_RUN_DEFAULT) at src/unix/core.c:317
#4  0x0000000000531b40 in mbgl::thread_init(void*) ()
#5  0x00000000005101a3 in uv__thread_start (ctx_v=0x15d8e90) at src/uv-common.c:322
#6  0x00007f9aa818fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#7  0x00007f9aa56f24bd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x0000000000000000 in ?? ()

Thread 9 (Thread 0x7f9a9c2ed700 (LWP 16668)):
#0  0x00007f9aa8193d84 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007f9aa006ea43 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#2  0x00007f9aa818fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#3  0x00007f9aa56f24bd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x0000000000000000 in ?? ()

Thread 8 (Thread 0x7f9a9b8ec700 (LWP 16669)):
#0  0x00007f9aa8193d84 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007f9aa006ea43 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#2  0x00007f9aa818fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#3  0x00007f9aa56f24bd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x0000000000000000 in ?? ()

Thread 7 (Thread 0x7f9a9d6ef700 (LWP 16666)):
#0  0x00007f9aa8193d84 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007f9aa006ea43 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#2  0x00007f9aa818fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#3  0x00007f9aa56f24bd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x0000000000000000 in ?? ()

Thread 6 (Thread 0x7f9a990e8700 (LWP 16673)):
#0  0x00007f9aa8193d84 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007f9aa006ea43 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#2  0x00007f9aa818fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#3  0x00007f9aa56f24bd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x0000000000000000 in ?? ()

Thread 5 (Thread 0x7f9a97ce6700 (LWP 17473)):
#0  0x00007f9aa8193d84 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x000000000050af27 in uv_cond_wait (cond=0x12f8cc8, mutex=0x12f8ca0) at src/unix/thread.c:322
#2  0x00000000004784ab in uv_chan_receive ()
#3  0x0000000000477c59 in uv__worker_thread_loop ()
#4  0x00000000005101a3 in uv__thread_start (ctx_v=0x2edbc10) at src/uv-common.c:322
#5  0x00007f9aa818fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#6  0x00007f9aa56f24bd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#7  0x0000000000000000 in ?? ()

Thread 4 (Thread 0x7f9a968e4700 (LWP 17472)):
#0  0x00007f9aa8193d84 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x000000000050af27 in uv_cond_wait (cond=0x12f8cc8, mutex=0x12f8ca0) at src/unix/thread.c:322
#2  0x00000000004784ab in uv_chan_receive ()
#3  0x0000000000477c59 in uv__worker_thread_loop ()
#4  0x00000000005101a3 in uv__thread_start (ctx_v=0x12fe840) at src/uv-common.c:322
#5  0x00007f9aa818fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#6  0x00007f9aa56f24bd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#7  0x0000000000000000 in ?? ()

Thread 3 (Thread 0x7f9a99ae9700 (LWP 16672)):
#0  0x00007f9aa8193d84 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007f9aa006ea43 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#2  0x00007f9aa818fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#3  0x00007f9aa56f24bd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7f9a9ccee700 (LWP 16667)):
#0  0x00007f9aa8193d84 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007f9aa006ea43 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#2  0x00007f9aa818fe9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#3  0x00007f9aa56f24bd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7f9aa08a2780 (LWP 16664)):
#0  0x00007f9aa0077e75 in lp_setup_bin_triangle () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#1  0x00007f9aa00789d0 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#2  0x00007f9aa0078b61 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#3  0x00007f9aa0079785 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#4  0x00007f9aa008e591 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#5  0x00007f9aa008ec02 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#6  0x00007f9aa00853d7 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#7  0x00007f9aa0086f67 in draw_pipeline_run () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#8  0x00007f9aa0113fa5 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#9  0x00007f9aa0114103 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#10 0x00007f9aa0096387 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#11 0x00007f9aa008fc27 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#12 0x00007f9aa008ff66 in draw_vbo () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#13 0x00007f9aa006dc41 in ?? () from /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
#14 0x00007f9a9f4cd84b in st_draw_vbo () from /usr/lib/x86_64-linux-gnu/dri/libgallium.so
#15 0x00007f9a9fca6a57 in ?? () from /usr/lib/x86_64-linux-gnu/dri/libdricore.so
#16 0x00007f9a9fca6dac in ?? () from /usr/lib/x86_64-linux-gnu/dri/libdricore.so
#17 0x00000000004d4720 in mbgl::FillBucket::drawElements(mbgl::PlainShader&) ()
#18 0x00000000005008f7 in mbgl::Painter::renderFill(mbgl::FillBucket&, mbgl::util::ptr<mbgl::StyleLayer>, mbgl::Tile::ID const&, std::array<float, 16ul> const&) ()
#19 0x00000000004d44f8 in mbgl::FillBucket::render(mbgl::Painter&, mbgl::util::ptr<mbgl::StyleLayer>, mbgl::Tile::ID const&, std::array<float, 16ul> const&) ()
#20 0x00000000004b9fa8 in mbgl::VectorTileData::render(mbgl::Painter&, mbgl::util::ptr<mbgl::StyleLayer>, std::array<float, 16ul> const&) ()
#21 0x000000000048714f in mbgl::Painter::renderTileLayer(mbgl::Tile const&, mbgl::util::ptr<mbgl::StyleLayer>, std::array<float, 16ul> const&) ()
#22 0x000000000048f37d in mbgl::Source::render(mbgl::Painter&, mbgl::util::ptr<mbgl::StyleLayer>) ()
#23 0x0000000000486849 in mbgl::Painter::renderLayer(mbgl::util::ptr<mbgl::StyleLayer>, mbgl::Tile::ID const*, std::array<float, 16ul> const*) ()
#24 0x0000000000485cba in mbgl::Painter::renderLayers(mbgl::util::ptr<mbgl::StyleLayerGroup>) ()
#25 0x0000000000485498 in mbgl::Painter::render(mbgl::Style const&, std::set<mbgl::util::ptr<mbgl::StyleSource>, std::less<mbgl::util::ptr<mbgl::StyleSource> >, std::allocator<mbgl::util::ptr<mbgl::StyleSource> > > const&, mbgl::TransformState, unsigned long) ()
#26 0x00000000004701d6 in mbgl::Map::render() ()
#27 0x000000000046fc70 in mbgl::Map::run() ()
#28 0x000000000041de85 in HeadlessTest_render_Test::TestBody() ()
#29 0x000000000045d103 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ()
#30 0x000000000044c951 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ()
#31 0x0000000000432327 in testing::Test::Run() ()
#32 0x000000000043317c in testing::TestInfo::Run() ()
#33 0x00000000004339a5 in testing::TestCase::Run() ()
#34 0x000000000043ba2b in testing::internal::UnitTestImpl::RunAllTests() ()
#35 0x0000000000459663 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ()
#36 0x000000000044f041 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ()
#37 0x000000000043b6d7 in testing::UnitTest::Run() ()
#38 0x000000000041a990 in main ()

https://travis-ci.org/mapbox/mapbox-gl-native/jobs/47706355

Culling packages

Packages that can be deleted:

  • nunicode != latest version (1.5.1)
  • libpng != latest version

getting platform params on arch linux fails

By default lsb-release isn't installed on Arch, so trying to get release info that way fails right off the bat. After manually installing it, arch creates two files in /etc/:

[preet@s etc]$ cat arch-release
Arch Linux release

[preet@s etc]$ cat lsb-release
LSB_VERSION=1.4
DISTRIB_ID=Arch
DISTRIB_RELEASE=rolling
DISTRIB_DESCRIPTION="Arch Linux"

Mason fails when it tries to read in arch-release. Maybe detect if the string "LSB_VERSION" is in the file before trying to read in the release info? Or just specify the full name 'lsb-release' (are there distros where its named differently?)

pkg-config: to support or not?

pkg-config is useful when it works. Yet it has serious problems, including:

  • It is written in C so the binary is arch-dependent making its use in a cross-compiled environment painful at best or impossible without resorting to www.qemu.org tricks.
  • It appears to have bugs when built 32bit and run on a 64 bit OS X: mapnik/mapnik-packaging#134 (comment)
  • It generates hard-coded/absolute paths in the .pc files making tarballs of built artifacts hard to share in a portable way.

We need to care about pkg-config in two ways:

  • pkg-config may be a build dependency for Mason source compiles (e.g. harfbuzz needs pkg-config to find freetype)
  • apps that depend on mason packages may call out to pkg-config like mapbox-gl-native

So I think we have two options:

workarounds

Workaround all the limitations by:

  • Source compiles:
    • compiling and using only the host arch of pkg-config when cross-compiling (like this mess)
    • Require that the host machine have pkg-config already installed. (Note: this would be simple but I've avoided it because the HOST pkg-config is going to be looking by default in the wrong place for dependencies and even after setting PKG_CONFIG_PATH the wrong dependencies might get picked up).
  • Binary install:
    • overriding the hardcoded paths by using --define-variable=prefix, etc.
    • provide our own fake pkg-config shell script that provides the right things either by wrapping pkg-config or truly faking it

ban pkg-config

Or we could try to purge all dependence on pkg-config by:

  • patching or otherwise avoiding the need for pkg-config when building any deps that depend on it
  • having the mason itself be a build dependency of apps that use its tarballs and something like mason --libs libuv could replace pkg-config --libs libuv, or;
  • just ensure a very sane layout of lib and include folders that apps using mason packages could easily predict.

Refs:

OS X improvements

My opinion is:

  1. Mason package versioning on OS X should not use ${MASON_PLATFORM_VERSION} when versioning binaries for OSX. So instead of ./mason_packages/osx-${MASON_PLATFORM_VERSION} or ./mason_packages/osx-10.10 packages should be stored in: ./mason_packages/osx-${ARCH}. We should then enforce a minimum OS X version Mason will build for and stick to it. I propose 10.8 and we'd then enforce all packages are built with -mmacosx-version-min=10.8.

  2. We should not support 32 bit OS X since it is such a rare platform these days. I propose:

diff --git a/mason.sh b/mason.sh
index 78d76ba..385b587 100644
--- a/mason.sh
+++ b/mason.sh
@@ -37,7 +37,7 @@ if [ ${MASON_PLATFORM} = 'osx' ]; then

     MASON_SDK_ROOT=${MASON_XCODE_ROOT}/Platforms/MacOSX.platform/Developer
     MASON_SDK_PATH="${MASON_SDK_ROOT}/SDKs/MacOSX${MASON_PLATFORM_VERSION}.sdk"
-    export MASON_CFLAGS="-mmacosx-version-min=${MASON_PLATFORM_VERSION} -isysroot ${MASON_SDK_PATH} -arch i386 -arch x86_64"
+    export MASON_CFLAGS="-mmacosx-version-min=${MASON_PLATFORM_VERSION} -isysroot ${MASON_SDK_PATH} -arch x86_64"

Document development environment?

@kkaefer @springmeyer How do your have a development environment set up for working locally and testing build scripts before pushing? Since mason always pulls from remote branches, I'm finding myself frequently pushing to "live" branches just to test code, which feels wrong. I'd like be able to easily work on build scripts locally, and maybe establish some sort of convention around -dev or similar branch names for remote testing.

cc does not exist on android

The version check for system zlib is too brittle on android since cc does not exist:

/home/ubuntu/mapbox-gl-native/mason_packages/.scripts/zlib-system.sh: line 56: cc: command not found
/home/ubuntu/mapbox-gl-native/mason_packages/.scripts/zlib-system.sh: line 58: ./version: No such file or directory

openssl linking broken on OSX

Seeing:

Undefined symbols for architecture x86_64:
  "_OPENSSL_ia32cap_P", referenced from:
      _sha1_block_data_order in libcrypto.a(sha1-x86_64.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [link_app.] Error 1
make[1]: *** [rc4test] Error 2

Design of system packages

A ticket to discuss how to design "system" packages for mason, which are a very unique kind of package. This is a place for @kkaefer and @springmeyer to sync up on goals and others to read to get some background on why system packages are tricky.

My understanding is that a system package:

  • makes it possible to declare an explicit dependency on something like zlib without installing a custom version. (**This can be very important because something like zlib is often a dependency of so many apps that mixing a custom version of zlib would be a path to ABI conflicts and much pain).
  • still allows mason to report cflags and ldflags for where the system's zlib is located such that a build system can depend on mason to supply platform-specific flags.
  • does not get published since there is nothing binary to publish. Therefore the script.sh does all the work dynamically on each system.

But one challenge remains: is it safe to put the -L/path and -I/path of the system package on the compile and link paths? This can result in conflicts with other system libraries that you might be intending to statically link.

I ran into a situation like this with libpq (postgres client library) on OS X, which is the motivation for trying to have mason cflags and mason ldflags return symlinks to the location of a system package rather than the real location (4e14abb). However, due to the nature of the postgres build system I ultimately found I could not avoid -L/usr/lib ending up on the link flags, even if mason did not put it there. So my changes were not enough. And in addition they were not correct for every platform and therefore caused other unintended breakages downstream in mbgl which I'm sorry about.

@kkaefer has made some progress further cleaning up the zlib-system package (https://github.com/mapbox/mason/commits/zlib-system). Hopefully we'll be in good shape now and we can keep the symlinking addition. Or we can remove it. Let's discuss.

Build boringssl-d3bcf13 with -fPIC

/usr/bin/ld: /home/travis/build/mapbox/node-mapbox-gl-native/vendor/mapbox-gl-native/mason_packages/linux-linux-x86_64/boringssl/a6aabff2e6e95a71b2f966447eebd53e57d8bf83/lib/libboringssl.a(a_int.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/home/travis/build/mapbox/node-mapbox-gl-native/vendor/mapbox-gl-native/mason_packages/linux-linux-x86_64/boringssl/a6aabff2e6e95a71b2f966447eebd53e57d8bf83/lib/libboringssl.a: could not read symbols: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@springmeyer should CFLAGS be set through gyp or just passed to make here?

Determine if a lib has been built with /MT or /MD

One way is to use dumpbin's /DIRECTIVES option to find which runtime libraries the objects in the .lib want to link with:

dumpbin /directives foo.lib

Look for instances of the runtime libraries specified here (MSDN: CRT Library Features).

For example, you might see:
/DEFAULTLIB:MSVCRTD (module compiled with /MDd)
/DEFAULTLIB:MSVCRT (module compiled with /MD)
/DEFAULTLIB:LIBCMT (module compiled with /MT)

There will probably be many /DEFAULTLIB directives, so you can search using terms like:

dumpbin /DIRECTIVES foo.lib | find /i "msvcr"

x86 support for android

mason.sh needs to be changed to support selecting between arm and x86 arch for Android builds.

Here is what I think will work for x86:
mason.sh

Need to be able to pass in variable like MASON_ARCH?

Android support

  • Add android platform details - 71b5d89
  • Initialize NDK with target API level/etc (should this be configurable?) - a46b86f
  • Ponder how versioning should work: ndk version / api level / toolchain / etc (went with API level)
  • Add android build to travis configs for all deps of mapbox-gl-native:
    • libpng
    • libuv
    • libsqlite
    • openssl
    • curl

shouldn't require being installed at ~/.mason

I cloned the repository to ~/Development/mason and symlinked /usr/local/bin/mason to there. When I run make in mapbox-gl-native I get:

/usr/local/bin/mason: line 44: /Users/john/.mason/mason.sh: No such file or directory
/usr/local/bin/mason: line 51: mason_step: command not found
mkdir: /.scripts: Permission denied

curl: (22) The requested URL returned error: 404 Not Found
bash: /.scripts/.sh: No such file or directory
make: *** [config.gypi] Error 127

Single Linux binary

Related to #38

@mikemorris was running into problems where he was building everything from source since the only binaries Travis publish are for Ubuntu 12.04

Since Linux binaries are backwards compatible it makes sense to just switch to a single binary for all Linux x64 distros.

If we get feedback that some binary does not work on another distro like Fedora or such (although it should just work OK) we can revisit this.

Always set -std=c++11

We should only support >= c++11 for compiling C++ packages. So this is a ticket reminder for adding -std=c++11 soon for linux in the same was as we added -fPIC 2a955a1.

Windows: geos x64 compile complains about x86/x64 mismatch after successfull x86 build

fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'

Steps to reproduce:

  • compile x86: nmake /A /F makefile.vc MSVC_VER=1800
  • clean: nmake /F makefile.vc MSVC_VER=1800 clean
  • compile x64: nmake /A /F makefile.vc MSVC_VER=1800 WIN64=YES
  • error about x86/x64 mismatch, even though using /A (nmake options): "Forces build of all evaluated targets, even if not out-of-date with respect to dependents. Does not force build of unrelated targets."

Solution:
Manually deleted all *.obj files and then reissued nmake /A /F makefile.vc MSVC_VER=1800 WIN64=YES

Maybe using /B could solve it too (nmake options): "Forces build even if timestamps are equal. Recommended only for very fast systems (resolution of two seconds or less)."

Build boringssl locally

Need to rework the boringssl script a bit to conform to mason conventions better, be able to build locally and figure out why libcrypto.a ends up as a malformed archive. Tracked down the original locations of dependencies currently on the boringssl-d3bcf13 branch:

Is there an existing best practice for building gyp projects @springmeyer?

Currently tracking in https://github.com/mapbox/mason/tree/boringssl-d3bcf13-local/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.