Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ lib
glyphs
spec
node_modules
mason_packages
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule ".mason"]
path = .mason
url = https://github.com/mapbox/mason.git
1 change: 1 addition & 0 deletions .mason
Submodule .mason added at 4c71c8
140 changes: 88 additions & 52 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,69 +1,105 @@
language: cpp
# Prevent Travis from exporting CXX after matrix env
language: c

sudo: false

matrix:
include:
# Coverage
- os: osx
compiler: clang
env: NODE_VERSION="0.10" COVERAGE=true
# Linux
- os: linux
compiler: clang
env: NODE_VERSION="0.10"
- os: linux
compiler: clang
env: NODE_VERSION="0.12"
# OS X
- os: osx
compiler: clang
env: NODE_VERSION="0.10"
- os: osx
compiler: clang
env: NODE_VERSION="0.12"
# Coverage
- os: osx
compiler: clang
env:
- NODE_EXE: "node"
- NODE_VERSION: 0.10
- COVERAGE: true
- CXXFLAGS: "--coverage"
- LDFLAGS: "--coverage"
# Linux
- os: linux
compiler: clang
env:
- CXX: clang++-3.5
- NODE_EXE: "node"
- NODE_VERSION: 0.10
addons:
apt:
sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.5' ]
packages: [ 'clang-3.5', 'libstdc++-4.9-dev', 'libstdc++6' ]
- os: linux
compiler: clang
env:
- CXX: clang++-3.5
- NODE_EXE: "node"
- NODE_VERSION: 0.12
addons:
apt:
sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.5' ]
packages: [ 'clang-3.5', 'libstdc++-4.9-dev', 'libstdc++6' ]
- os: linux
compiler: clang
env:
- CXX: clang++-3.5
- NODE_EXE: "iojs"
- NODE_VERSION: 2.3
addons:
apt:
sources: [ 'ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.5' ]
packages: [ 'clang-3.5', 'libstdc++-4.9-dev', 'libstdc++6' ]
# OS X
- os: osx
compiler: clang
env:
- NODE_EXE: "node"
- NODE_VERSION: 0.10
- os: osx
compiler: clang
env:
- NODE_EXE: "node"
- NODE_VERSION: 0.12
- os: osx
compiler: clang
env:
- NODE_EXE: "iojs"
- NODE_VERSION: 2.3

env:
global:
- JOBS: "8"
- BUILD: '/tmp/fontnik-build'
- PKG_CONFIG_PATH: '/tmp/fontnik-build/lib/pkgconfig'
- secure: "XV0lekmfgT+D9t0ZTIU+UJF6g+p3cBQMO6T6C9lkoKTC0YbtLtxSFtBahD/4PjL86DMJgTaf1nBmxqOxbrfkcpJUxnLe3r8u4Z2L/+7+QSACLNktlIfWNSO+33WxKNb4mVw6jMFZIo4ZurF016MXYzLzjpxRELW2oO2STUs2m44="
- secure: "CQNHbxw8yHlAdUVbKokHzHmj7C+duXP3mifWOkZm9GKw4myWsRFhhoSYZmOSkgj9EWfYYkedrqEr9+GaMg9rkVJuO/7jzn6S+M7CFXKJju6MoZEDO6WcFva4M8pw6IFb9q22GcQ+OsE8/i0DwchTokyFkNb3fpwWuwROUPQ/nWg="
- secure: "XV0lekmfgT+D9t0ZTIU+UJF6g+p3cBQMO6T6C9lkoKTC0YbtLtxSFtBahD/4PjL86DMJgTaf1nBmxqOxbrfkcpJUxnLe3r8u4Z2L/+7+QSACLNktlIfWNSO+33WxKNb4mVw6jMFZIo4ZurF016MXYzLzjpxRELW2oO2STUs2m44="
- secure: "CQNHbxw8yHlAdUVbKokHzHmj7C+duXP3mifWOkZm9GKw4myWsRFhhoSYZmOSkgj9EWfYYkedrqEr9+GaMg9rkVJuO/7jzn6S+M7CFXKJju6MoZEDO6WcFva4M8pw6IFb9q22GcQ+OsE8/i0DwchTokyFkNb3fpwWuwROUPQ/nWg="

before_install:
- export COVERAGE=${COVERAGE:-false}
# here we set up the node version on the fly based on the matrix value.
# This is done manually so that it is easy to flip the 'language' to
# objective-c in another branch (to run the same travis.yml on OS X)
- git clone https://github.com/creationix/nvm.git ../.nvm
- source ../.nvm/nvm.sh
- nvm install $NODE_VERSION
- nvm use $NODE_VERSION
- node --version
- npm --version
- if [[ ${COVERAGE} == true ]]; then
brew update;
brew install pyenv;
eval "$(pyenv init -)";
pyenv install 2.7.6;
pyenv global 2.7.6;
pyenv rehash;
pip install cpp-coveralls;
pyenv rehash;
fi;
- export PATH="$BUILD/bin:$PATH"
- ./deps/travis_build.sh
- export COVERAGE=${COVERAGE:-false}
- if [[ ${COVERAGE} == true ]]; then
brew update;
brew install pyenv;
eval "$(pyenv init -)";
pyenv install 2.7.6;
pyenv global 2.7.6;
pyenv rehash;
pip install cpp-coveralls;
pyenv rehash;
fi;
- ./scripts/install_node.sh

install:
- if [[ ${COVERAGE} == true ]]; then
export LDFLAGS="--coverage" && export CXXFLAGS="--coverage" && npm install --build-from-source --debug --clang=1;
- if [[ ${COVERAGE} == true ]]; then
npm install --build-from-source --debug --clang;
else
npm install --build-from-source --clang=1;
npm install --build-from-source --clang;
fi;

before_script:
- ulimit -c unlimited -S
- ulimit -a

script:
- npm test
- if [[ ${COVERAGE} == true ]]; then cpp-coveralls --exclude node_modules --exclude tests --build-root build --gcov-options '\-lp' --exclude doc --exclude build/Debug/obj/gen; fi;
- npm test
- if [[ ${COVERAGE} == true ]]; then
cpp-coveralls --exclude node_modules --exclude tests --build-root build --gcov-options '\-lp' --exclude doc --exclude build/Debug/obj/gen;
fi;

after_success:
- ./deps/travis_publish.sh
- ./scripts/travis_publish.sh

git:
submodules: true
53 changes: 40 additions & 13 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,50 @@
'./include',
'./vendor/agg/include',
'<(SHARED_INTERMEDIATE_DIR)/',
'<!@(pkg-config freetype2 --cflags-only-I | sed s/-I//g)',
'<!@(pkg-config protobuf --cflags-only-I | sed s/-I//g)',
'<!@(mason cflags boost ${BOOST_VERSION} | sed s/-I//g)',
'<!@(mason cflags freetype ${FREETYPE_VERSION} | sed s/-I//g)',
'<!@(mason cflags protobuf ${PROTOBUF_VERSION} | sed s/-I//g)',
"<!(node -e \"require('nan')\")"
],
'libraries': [
'<!@(pkg-config freetype2 --libs --static)',
'<!@(pkg-config protobuf --libs --static)'
'<!@(mason static_libs freetype ${FREETYPE_VERSION})',
'<!@(mason static_libs protobuf ${PROTOBUF_VERSION})'
],
'conditions': [
['OS=="mac"', {
'xcode_settings': {
'CLANG_CXX_LIBRARY': 'libc++',
'CLANG_CXX_LANGUAGE_STANDARD': 'c++1y',
'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'GCC_ENABLE_CPP_RTTI': 'YES',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem necessary so I dropped it.

'OTHER_CPLUSPLUSFLAGS': [
'-Wall',
'-Wextra',
'-Wshadow',
'-Wno-variadic-macros',
'-Wno-unused-parameter',
'-Wno-unused-variable',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two are here because of unused variables and parameters in 3rd party libs.

'-Wno-sign-compare',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only in here because protobuf can't count properly.

],
'GCC_WARN_PEDANTIC': 'YES',
'GCC_WARN_UNINITIALIZED_AUTOS': 'YES_AGGRESSIVE',
'MACOSX_DEPLOYMENT_TARGET': '10.9',
},
}, {
'cflags_cc': [
'-std=c++14',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If only -std=c++11 is required, should I compile this with -std=c++14 anyway?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't have to, but probably doesn't affect the outcome.

'-Wall',
'-Wextra',
'-Wno-variadic-macros',
'-Wno-unused-parameter',
'-Wno-unused-variable',
'-Wno-sign-compare',
'-frtti',
'-fexceptions',
],
}],
],
'xcode_settings': {
'MACOSX_DEPLOYMENT_TARGET': '10.8',
'OTHER_CPLUSPLUSFLAGS': ['-Wshadow','-std=c++11', '-stdlib=libc++', '-Wno-unused-variable'],
'GCC_ENABLE_CPP_RTTI': 'YES',
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES'
},
'cflags_cc!': ['-fno-rtti', '-fno-exceptions'],
'cflags_cc' : ['-std=c++11','-Wshadow'],
'cflags_c' : ['-std=c99']
},
{
'target_name': 'action_after_build',
Expand Down
23 changes: 0 additions & 23 deletions deps/build_boost.sh

This file was deleted.

40 changes: 0 additions & 40 deletions deps/build_freetype.sh

This file was deleted.

31 changes: 0 additions & 31 deletions deps/build_protobuf.sh

This file was deleted.

10 changes: 0 additions & 10 deletions deps/travis_build.sh

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"font-inspect": "./bin/font-inspect"
},
"scripts": {
"install": "node-pre-gyp install --fallback-to-build",
"install": ". ./scripts/install_mason.sh && node-pre-gyp install --fallback-to-build",
"test": "node_modules/.bin/mocha -R spec"
},
"binary": {
Expand Down
29 changes: 29 additions & 0 deletions scripts/install_mason.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

# This script is sourced, so do not set -e or -o pipefail here. Doing so would
# bleed into Travis' wrapper script, which messes with their workflow, e.g.
# preventing after_failure scripts to be triggered.

case `uname -s` in
'Darwin') JOBS=$((`sysctl -n hw.ncpu` + 2)) ;;
'Linux') JOBS=$((`nproc` + 2)) ;;
*) JOBS=2 ;;
esac

export JOBS

git submodule update --init .mason

export PATH="`pwd`/.mason:${PATH}"
export MASON_DIR="`pwd`/.mason"

export BOOST_VERSION=1.58.0
export FREETYPE_VERSION=2.6
export PROTOBUF_VERSION=2.6.1

mason install boost ${BOOST_VERSION}
mason install freetype ${FREETYPE_VERSION}
mason install protobuf ${PROTOBUF_VERSION}

# Add protoc to $PATH
export PATH="`mason prefix protobuf ${PROTOBUF_VERSION}`/bin:${PATH}"
12 changes: 12 additions & 0 deletions scripts/install_node.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -e
set -o pipefail

git clone https://github.com/creationix/nvm.git ../.nvm
source ../.nvm/nvm.sh

nvm install ${NODE_EXE} ${NODE_VERSION}

${NODE_EXE} --version
npm --version
File renamed without changes.