Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
Build: Adding libsass.gyp in a separate dir.
Browse files Browse the repository at this point in the history
* Turned out it isn't a bug, it's a feature!
  * npm/npm#7780
  • Loading branch information
am11 committed Mar 29, 2015
1 parent 6a169d2 commit e75de50
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 151 deletions.
77 changes: 31 additions & 46 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,6 @@
'src/custom_function_bridge.cpp',
'src/custom_importer_bridge.cpp',
'src/sass_context_wrapper.cpp',
'src/libsass/ast.cpp',
'src/libsass/base64vlq.cpp',
'src/libsass/bind.cpp',
'src/libsass/cencode.c',
'src/libsass/constants.cpp',
'src/libsass/context.cpp',
'src/libsass/contextualize.cpp',
'src/libsass/cssize.cpp',
'src/libsass/emitter.cpp',
'src/libsass/error_handling.cpp',
'src/libsass/eval.cpp',
'src/libsass/expand.cpp',
'src/libsass/extend.cpp',
'src/libsass/file.cpp',
'src/libsass/functions.cpp',
'src/libsass/inspect.cpp',
'src/libsass/json.cpp',
'src/libsass/node.cpp',
'src/libsass/output.cpp',
'src/libsass/parser.cpp',
'src/libsass/plugins.cpp',
'src/libsass/position.cpp',
'src/libsass/prelexer.cpp',
'src/libsass/remove_placeholders.cpp',
'src/libsass/sass.cpp',
'src/libsass/sass2scss.cpp',
'src/libsass/sass_context.cpp',
'src/libsass/sass_functions.cpp',
'src/libsass/sass_util.cpp',
'src/libsass/sass_values.cpp',
'src/libsass/source_map.cpp',
'src/libsass/to_c.cpp',
'src/libsass/to_string.cpp',
'src/libsass/units.cpp',
'src/libsass/utf8_string.cpp',
'src/libsass/util.cpp',
'src/sass_types/boolean.cpp',
'src/sass_types/color.cpp',
'src/sass_types/error.cpp',
Expand All @@ -57,17 +21,38 @@
'include_dirs': [
'<!(node -e "require(\'nan\')")',
],
'cflags!': [
'-fno-exceptions'
],
'cflags_cc!': [
'-fno-exceptions'
],
'cflags_cc': [
'-fexceptions',
'-frtti'
],
'conditions': [
['libsass_ext == ""', {
'dependencies': [
'src/libsass.gyp:libsass',
]
}],
['libsass_ext == "auto"', {
'cflags_cc': [
'<!(pkg-config --cflags libsass)',
],
'link_settings': {
'ldflags': [
'<!(pkg-config --libs-only-other --libs-only-L libsass)',
],
'libraries': [
'<!(pkg-config --libs-only-l libsass)',
],
}
}],
['libsass_ext == "yes"', {
'cflags_cc': [
'<(libsass_cflags)',
],
'link_settings': {
'ldflags': [
'<(libsass_ldflags)',
],
'libraries': [
'<(libsass_library)',
],
}
}],
['OS=="mac"', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [
Expand Down
94 changes: 0 additions & 94 deletions libsass.gyp

This file was deleted.

5 changes: 4 additions & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ function afterBuild(options) {
*/

function build(options) {
var args = [path.join('node_modules', 'pangyp', 'bin', 'node-gyp'), 'rebuild'].concat(options.args);
var args = [path.join('node_modules', 'pangyp', 'bin', 'node-gyp'), 'rebuild'].concat(
['libsass_ext', 'libsass_cflags', 'libsass_ldflags', 'libsass_library'].map(function(subject) {
return ['--', subject, '=', process.env[subject.toUpperCase()] || ''].join('');
})).concat(options.args);

console.log(['Building:', process.sass.runtime.execPath].concat(args).join(' '));

Expand Down
4 changes: 1 addition & 3 deletions src/custom_function_bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
#define CUSTOM_FUNCTION_BRIDGE_H

#include <nan.h>
#include "libsass/sass_context.h"
#include <sass_context.h>
#include "callback_bridge.h"


using namespace v8;


class CustomFunctionBridge : public CallbackBridge<Sass_Value*> {
public:
CustomFunctionBridge(NanCallback* cb, bool is_sync) : CallbackBridge<Sass_Value*>(cb, is_sync) {}
Expand Down
5 changes: 1 addition & 4 deletions src/custom_importer_bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@
#define CUSTOM_IMPORTER_BRIDGE_H

#include <nan.h>
#include "libsass/sass_context.h"
#include <sass_context.h>
#include "callback_bridge.h"


using namespace v8;


typedef Sass_Import** SassImportList;


class CustomImporterBridge : public CallbackBridge<SassImportList> {
public:
CustomImporterBridge(NanCallback* cb, bool is_sync) : CallbackBridge<SassImportList>(cb, is_sync) {}
Expand Down
88 changes: 88 additions & 0 deletions src/libsass.gyp
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
'targets': [
{
'target_name': 'libsass',
'type': 'static_library',
'sources': [
'libsass/ast.cpp',
'libsass/base64vlq.cpp',
'libsass/bind.cpp',
'libsass/cencode.c',
'libsass/constants.cpp',
'libsass/context.cpp',
'libsass/contextualize.cpp',
'libsass/cssize.cpp',
'libsass/emitter.cpp',
'libsass/error_handling.cpp',
'libsass/eval.cpp',
'libsass/expand.cpp',
'libsass/extend.cpp',
'libsass/file.cpp',
'libsass/functions.cpp',
'libsass/inspect.cpp',
'libsass/json.cpp',
'libsass/node.cpp',
'libsass/output.cpp',
'libsass/parser.cpp',
'libsass/plugins.cpp',
'libsass/position.cpp',
'libsass/prelexer.cpp',
'libsass/remove_placeholders.cpp',
'libsass/sass.cpp',
'libsass/sass2scss.cpp',
'libsass/sass_context.cpp',
'libsass/sass_functions.cpp',
'libsass/sass_util.cpp',
'libsass/sass_values.cpp',
'libsass/source_map.cpp',
'libsass/to_c.cpp',
'libsass/to_string.cpp',
'libsass/units.cpp',
'libsass/utf8_string.cpp',
'libsass/util.cpp'
],
'cflags!': [
'-fno-exceptions'
],
'cflags_cc!': [
'-fno-exceptions'
],
'cflags_cc': [
'-fexceptions',
'-frtti'
],
'direct_dependent_settings': {
'include_dirs': [ 'libsass' ],
},
'conditions': [
['OS=="mac"', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [
'-std=c++11',
'-stdlib=libc++'
],
'OTHER_LDFLAGS': [],
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'GCC_ENABLE_CPP_RTTI': 'YES',
'MACOSX_DEPLOYMENT_TARGET': '10.7'
}
}],
['OS=="win"', {
'msvs_settings': {
'VCCLCompilerTool': {
'AdditionalOptions': [
'/GR',
'/EHsc'
]
}
}
}],
['OS!="win"', {
'cflags_cc+': [
'-std=c++0x'
]
}]
]
}
]
}
2 changes: 1 addition & 1 deletion src/sass_context_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <nan.h>
#include <stdlib.h>
#include <condition_variable>
#include "libsass/sass_context.h"
#include <sass_context.h>
#include "custom_function_bridge.h"
#include "custom_importer_bridge.h"

Expand Down
2 changes: 1 addition & 1 deletion src/sass_types/factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define SASS_TYPES_FACTORY_H

#include <nan.h>
#include "../libsass/sass_values.h"
#include <sass_values.h>
#include "value.h"

namespace SassTypes
Expand Down
2 changes: 1 addition & 1 deletion src/sass_types/value.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define SASS_TYPES_VALUE_H

#include <nan.h>
#include "../libsass/sass_values.h"
#include <sass_values.h>

namespace SassTypes
{
Expand Down

0 comments on commit e75de50

Please sign in to comment.