mirror of
https://github.com/mapbox/node-fontnik.git
synced 2026-01-18 15:54:55 +00:00
use mason to handle dependencies
This commit is contained in:
parent
6b7b9abf96
commit
a11332e419
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@ lib
|
||||
glyphs
|
||||
spec
|
||||
node_modules
|
||||
mason_packages
|
||||
|
||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule ".mason"]
|
||||
path = .mason
|
||||
url = https://github.com/mapbox/mason.git
|
||||
1
.mason
Submodule
1
.mason
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 4c71c8614fd888058408994841a470271268821a
|
||||
140
.travis.yml
140
.travis.yml
@ -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
binding.gyp
53
binding.gyp
@ -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',
|
||||
'OTHER_CPLUSPLUSFLAGS': [
|
||||
'-Wall',
|
||||
'-Wextra',
|
||||
'-Wshadow',
|
||||
'-Wno-variadic-macros',
|
||||
'-Wno-unused-parameter',
|
||||
'-Wno-unused-variable',
|
||||
'-Wno-sign-compare',
|
||||
],
|
||||
'GCC_WARN_PEDANTIC': 'YES',
|
||||
'GCC_WARN_UNINITIALIZED_AUTOS': 'YES_AGGRESSIVE',
|
||||
'MACOSX_DEPLOYMENT_TARGET': '10.9',
|
||||
},
|
||||
}, {
|
||||
'cflags_cc': [
|
||||
'-std=c++14',
|
||||
'-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',
|
||||
|
||||
23
deps/build_boost.sh
vendored
23
deps/build_boost.sh
vendored
@ -1,23 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
build_dir="$(pwd)"
|
||||
|
||||
NAME="boost"
|
||||
PKGURL="http://softlayer-dal.dl.sourceforge.net/project/boost/boost/1.55.0/boost_1_55_0.tar.bz2"
|
||||
PKGBASE=$(basename $PKGURL)
|
||||
|
||||
mkdir -p /tmp/${NAME}
|
||||
wget ${PKGURL} -O - | tar -xj --strip-components=1 -C /tmp/${NAME}
|
||||
cd /tmp/${NAME}
|
||||
|
||||
./bootstrap.sh
|
||||
|
||||
./b2 -d0 \
|
||||
--prefix=${BUILD} \
|
||||
--with-system --with-filesystem \
|
||||
-sHAVE_ICU=0 \
|
||||
link=static \
|
||||
variant=release \
|
||||
cxxflags="-fPIC" \
|
||||
install
|
||||
40
deps/build_freetype.sh
vendored
40
deps/build_freetype.sh
vendored
@ -1,40 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
build_dir="$(pwd)"
|
||||
|
||||
NAME="freetype"
|
||||
PKGURL="http://download.savannah.gnu.org/releases/freetype/freetype-2.5.3.tar.bz2"
|
||||
PKGBASE=$(basename $PKGURL)
|
||||
|
||||
mkdir -p /tmp/${NAME}
|
||||
wget ${PKGURL} -O - | tar -vxj --strip-components=1 -C /tmp/${NAME}
|
||||
cd /tmp/${NAME}
|
||||
|
||||
export PATH="/usr/local/bin:$PATH"
|
||||
export CXXFLAGS="$CXXFLAGS -fPIC"
|
||||
export CFLAGS="$CFLAGS -fPIC"
|
||||
|
||||
# NOTE: --with-zlib=yes means external, non-bundled zip will be used
|
||||
./configure \
|
||||
--prefix=${BUILD} \
|
||||
--enable-static \
|
||||
--disable-shared \
|
||||
--with-zlib=yes \
|
||||
--with-bzip2=no \
|
||||
--with-harfbuzz=no \
|
||||
--with-png=no \
|
||||
--with-quickdraw-toolbox=no \
|
||||
--with-quickdraw-carbon=no \
|
||||
--with-ats=no \
|
||||
--with-fsref=no \
|
||||
--with-fsspec=no \
|
||||
|
||||
make
|
||||
make install
|
||||
|
||||
# clear out shared libs
|
||||
rm -f ${BUILD}/lib/{*.so,*.dylib}
|
||||
|
||||
cd $build_dir
|
||||
|
||||
31
deps/build_protobuf.sh
vendored
31
deps/build_protobuf.sh
vendored
@ -1,31 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
build_dir="$(pwd)"
|
||||
|
||||
NAME="protobuf"
|
||||
PKGURL="https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz"
|
||||
PKGBASE=$(basename $PKGURL)
|
||||
|
||||
mkdir -p /tmp/${NAME}
|
||||
wget ${PKGURL} -O - | tar -vxz --strip-components=1 -C /tmp/${NAME}
|
||||
cd /tmp/${NAME}
|
||||
|
||||
export PATH="/usr/local/bin:$PATH"
|
||||
export CXXFLAGS="$CXXFLAGS -fPIC"
|
||||
export CFLAGS="$CFLAGS -fPIC"
|
||||
|
||||
./configure \
|
||||
--prefix=${BUILD} \
|
||||
--enable-static \
|
||||
--disable-shared \
|
||||
--disable-dependency-tracking
|
||||
|
||||
make
|
||||
make install
|
||||
|
||||
# clear out shared libs
|
||||
rm -f ${BUILD}/lib/{*.so,*.dylib}
|
||||
|
||||
cd $build_dir
|
||||
10
deps/travis_build.sh
vendored
10
deps/travis_build.sh
vendored
@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test
|
||||
sudo apt-get update
|
||||
sudo apt-get install gcc-4.8 g++-4.8
|
||||
|
||||
mkdir -p $BUILD
|
||||
./deps/build_boost.sh
|
||||
./deps/build_protobuf.sh 1>> build.log
|
||||
./deps/build_freetype.sh 1>> build.log
|
||||
@ -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": {
|
||||
|
||||
29
scripts/install_mason.sh
Executable file
29
scripts/install_mason.sh
Executable file
@ -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
scripts/install_node.sh
Executable file
12
scripts/install_node.sh
Executable file
@ -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
|
||||
Loading…
x
Reference in New Issue
Block a user