sassc 1.8.0.pre2 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/ext/libsass/contrib/plugin.cpp +4 -1
- data/ext/libsass/docs/README.md +20 -0
- data/ext/libsass/docs/api-context-example.md +45 -0
- data/ext/libsass/docs/api-context-internal.md +152 -0
- data/ext/libsass/docs/api-context.md +268 -0
- data/ext/libsass/docs/api-doc.md +160 -0
- data/ext/libsass/docs/api-function-example.md +58 -0
- data/ext/libsass/docs/api-function-internal.md +8 -0
- data/ext/libsass/docs/api-function.md +48 -0
- data/ext/libsass/docs/api-importer-example.md +1345 -0
- data/ext/libsass/docs/api-importer-internal.md +15 -0
- data/ext/libsass/docs/api-importer.md +84 -0
- data/ext/libsass/docs/api-value-example.md +0 -0
- data/ext/libsass/docs/api-value-internal.md +76 -0
- data/ext/libsass/docs/api-value.md +125 -0
- data/ext/libsass/docs/build-on-darwin.md +27 -0
- data/ext/libsass/docs/build-on-gentoo.md +55 -0
- data/ext/libsass/docs/build-on-windows.md +139 -0
- data/ext/libsass/docs/build-shared-library.md +35 -0
- data/ext/libsass/docs/build-with-autotools.md +68 -0
- data/ext/libsass/docs/build-with-makefiles.md +50 -0
- data/ext/libsass/docs/build-with-mingw.md +107 -0
- data/ext/libsass/docs/build-with-visual-studio.md +90 -0
- data/ext/libsass/docs/build.md +97 -0
- data/ext/libsass/docs/compatibility-plan.md +48 -0
- data/ext/libsass/docs/contributing.md +17 -0
- data/ext/libsass/docs/custom-functions-internal.md +120 -0
- data/ext/libsass/docs/implementations.md +49 -0
- data/ext/libsass/docs/plugins.go +47 -0
- data/ext/libsass/docs/setup-environment.md +68 -0
- data/ext/libsass/docs/source-map-internals.md +51 -0
- data/ext/libsass/docs/trace.md +26 -0
- data/ext/libsass/docs/triage.md +17 -0
- data/ext/libsass/docs/unicode.md +39 -0
- data/ext/libsass/include/sass/context.h +1 -0
- data/ext/libsass/include/sass/functions.h +1 -1
- data/ext/libsass/src/ast.cpp +12 -2
- data/ext/libsass/src/ast.hpp +10 -2
- data/ext/libsass/src/bind.cpp +0 -2
- data/ext/libsass/src/debug.hpp +4 -0
- data/ext/libsass/src/debugger.hpp +2 -1
- data/ext/libsass/src/emitter.cpp +2 -0
- data/ext/libsass/src/eval.cpp +5 -7
- data/ext/libsass/src/expand.cpp +8 -1
- data/ext/libsass/src/functions.cpp +19 -4
- data/ext/libsass/src/inspect.cpp +17 -0
- data/ext/libsass/src/json.cpp +1 -1
- data/ext/libsass/src/parser.cpp +10 -1
- data/ext/libsass/src/prelexer.cpp +1 -1
- data/ext/libsass/src/sass_context.cpp +1 -0
- data/ext/libsass/src/sass_values.cpp +1 -1
- data/lib/sassc/version.rb +1 -1
- data/test/native_test.rb +1 -1
- metadata +37 -4
@@ -0,0 +1,15 @@
|
|
1
|
+
```C
|
2
|
+
// External import entry
|
3
|
+
struct Sass_Import {
|
4
|
+
char* rel;
|
5
|
+
char* abs;
|
6
|
+
char* source;
|
7
|
+
char* srcmap;
|
8
|
+
};
|
9
|
+
|
10
|
+
// Struct to hold importer callback
|
11
|
+
struct Sass_C_Import_Descriptor {
|
12
|
+
Sass_C_Import_Fn function;
|
13
|
+
void* cookie;
|
14
|
+
};
|
15
|
+
```
|
@@ -0,0 +1,84 @@
|
|
1
|
+
By using custom importers, Sass stylesheets can be implemented in any possible way, such as by being loaded via a remote server. Please note: this feature is experimental and is implemented differently than importers in Ruby Sass. Imports must be relative to the parent import context and therefore we need to pass this information to the importer callback. This is currently done by passing the complete import string/path of the previous import context.
|
2
|
+
|
3
|
+
## Return Imports
|
4
|
+
|
5
|
+
You actually have to return a list of imports, since some importers may want to import multiple files from one import statement (ie. a glob/star importer). The memory you pass with source and srcmap is taken over by LibSass and freed automatically when the import is done. You are also allowed to return `0` instead of a list, which will tell LibSass to handle the import by itself (as if no custom importer was in use).
|
6
|
+
|
7
|
+
```C
|
8
|
+
struct Sass_Import** rv = sass_make_import_list(1);
|
9
|
+
rv[0] = sass_make_import(rel, abs, source, srcmap);
|
10
|
+
```
|
11
|
+
|
12
|
+
Every import will then be included in LibSass. You are allowed to only return a file path without any loaded source. This way you can ie. implement rewrite rules for import paths and leave the loading part for LibSass.
|
13
|
+
|
14
|
+
### Basic Usage
|
15
|
+
|
16
|
+
```C
|
17
|
+
#include "sass/functions.h"
|
18
|
+
```
|
19
|
+
|
20
|
+
## Sass Importer API
|
21
|
+
|
22
|
+
```C
|
23
|
+
// Forward declaration
|
24
|
+
struct Sass_Import;
|
25
|
+
|
26
|
+
// Forward declaration
|
27
|
+
struct Sass_C_Import_Descriptor;
|
28
|
+
|
29
|
+
// Typedef defining the custom importer callback
|
30
|
+
typedef struct Sass_C_Import_Descriptor (*Sass_C_Import_Callback);
|
31
|
+
// Typedef defining the importer c function prototype
|
32
|
+
typedef struct Sass_Import** (*Sass_C_Import_Fn) (const char* url, const char* prev, void* cookie);
|
33
|
+
|
34
|
+
// Creators for custom importer callback (with some additional pointer)
|
35
|
+
// The pointer is mostly used to store the callback into the actual function
|
36
|
+
Sass_C_Import_Callback sass_make_importer (Sass_C_Import_Fn, void* cookie);
|
37
|
+
|
38
|
+
// Getters for import function descriptors
|
39
|
+
Sass_C_Import_Fn sass_import_get_function (Sass_C_Import_Callback fn);
|
40
|
+
void* sass_import_get_cookie (Sass_C_Import_Callback fn);
|
41
|
+
|
42
|
+
// Deallocator for associated memory
|
43
|
+
void sass_delete_importer (Sass_C_Import_Callback fn);
|
44
|
+
|
45
|
+
// Creator for sass custom importer return argument list
|
46
|
+
struct Sass_Import** sass_make_import_list (size_t length);
|
47
|
+
// Creator for a single import entry returned by the custom importer inside the list
|
48
|
+
struct Sass_Import* sass_make_import_entry (const char* path, char* source, char* srcmap);
|
49
|
+
struct Sass_Import* sass_make_import (const char* rel, const char* abs, char* source, char* srcmap);
|
50
|
+
|
51
|
+
// set error message to abort import and to print out a message (path from existing object is used in output)
|
52
|
+
struct Sass_Import* sass_import_set_error(struct Sass_Import* import, const char* message, size_t line, size_t col);
|
53
|
+
|
54
|
+
// Setters to insert an entry into the import list (you may also use [] access directly)
|
55
|
+
// Since we are dealing with pointers they should have a guaranteed and fixed size
|
56
|
+
void sass_import_set_list_entry (struct Sass_Import** list, size_t idx, struct Sass_Import* entry);
|
57
|
+
struct Sass_Import* sass_import_get_list_entry (struct Sass_Import** list, size_t idx);
|
58
|
+
|
59
|
+
// Getters for import entry
|
60
|
+
const char* sass_import_get_rel_path (struct Sass_Import*);
|
61
|
+
const char* sass_import_get_abs_path (struct Sass_Import*);
|
62
|
+
const char* sass_import_get_source (struct Sass_Import*);
|
63
|
+
const char* sass_import_get_srcmap (struct Sass_Import*);
|
64
|
+
// Explicit functions to take ownership of these items
|
65
|
+
// The property on our struct will be reset to NULL
|
66
|
+
char* sass_import_take_source (struct Sass_Import*);
|
67
|
+
char* sass_import_take_srcmap (struct Sass_Import*);
|
68
|
+
|
69
|
+
// Getters for import error entries
|
70
|
+
size_t sass_import_get_error_line (struct Sass_Import*);
|
71
|
+
size_t sass_import_get_error_column (struct Sass_Import*);
|
72
|
+
const char* sass_import_get_error_message (struct Sass_Import*);
|
73
|
+
|
74
|
+
// Deallocator for associated memory (incl. entries)
|
75
|
+
void sass_delete_import_list (struct Sass_Import**);
|
76
|
+
// Just in case we have some stray import structs
|
77
|
+
void sass_delete_import (struct Sass_Import*);
|
78
|
+
```
|
79
|
+
|
80
|
+
### More links
|
81
|
+
|
82
|
+
- [Sass Importer Example](api-importer-example.md)
|
83
|
+
- [Sass Importer Internal](api-importer-internal.md)
|
84
|
+
|
File without changes
|
@@ -0,0 +1,76 @@
|
|
1
|
+
```C
|
2
|
+
struct Sass_Unknown {
|
3
|
+
enum Sass_Tag tag;
|
4
|
+
};
|
5
|
+
|
6
|
+
struct Sass_Boolean {
|
7
|
+
enum Sass_Tag tag;
|
8
|
+
bool value;
|
9
|
+
};
|
10
|
+
|
11
|
+
struct Sass_Number {
|
12
|
+
enum Sass_Tag tag;
|
13
|
+
double value;
|
14
|
+
char* unit;
|
15
|
+
};
|
16
|
+
|
17
|
+
struct Sass_Color {
|
18
|
+
enum Sass_Tag tag;
|
19
|
+
double r;
|
20
|
+
double g;
|
21
|
+
double b;
|
22
|
+
double a;
|
23
|
+
};
|
24
|
+
|
25
|
+
struct Sass_String {
|
26
|
+
enum Sass_Tag tag;
|
27
|
+
char* value;
|
28
|
+
};
|
29
|
+
|
30
|
+
struct Sass_List {
|
31
|
+
enum Sass_Tag tag;
|
32
|
+
enum Sass_Separator separator;
|
33
|
+
size_t length;
|
34
|
+
// null terminated "array"
|
35
|
+
union Sass_Value** values;
|
36
|
+
};
|
37
|
+
|
38
|
+
struct Sass_Map {
|
39
|
+
enum Sass_Tag tag;
|
40
|
+
size_t length;
|
41
|
+
struct Sass_MapPair* pairs;
|
42
|
+
};
|
43
|
+
|
44
|
+
struct Sass_Null {
|
45
|
+
enum Sass_Tag tag;
|
46
|
+
};
|
47
|
+
|
48
|
+
struct Sass_Error {
|
49
|
+
enum Sass_Tag tag;
|
50
|
+
char* message;
|
51
|
+
};
|
52
|
+
|
53
|
+
struct Sass_Warning {
|
54
|
+
enum Sass_Tag tag;
|
55
|
+
char* message;
|
56
|
+
};
|
57
|
+
|
58
|
+
union Sass_Value {
|
59
|
+
struct Sass_Unknown unknown;
|
60
|
+
struct Sass_Boolean boolean;
|
61
|
+
struct Sass_Number number;
|
62
|
+
struct Sass_Color color;
|
63
|
+
struct Sass_String string;
|
64
|
+
struct Sass_List list;
|
65
|
+
struct Sass_Map map;
|
66
|
+
struct Sass_Null null;
|
67
|
+
struct Sass_Error error;
|
68
|
+
struct Sass_Warning warning;
|
69
|
+
};
|
70
|
+
|
71
|
+
struct Sass_MapPair {
|
72
|
+
union Sass_Value* key;
|
73
|
+
union Sass_Value* value;
|
74
|
+
};
|
75
|
+
```
|
76
|
+
|
@@ -0,0 +1,125 @@
|
|
1
|
+
`Sass_Values` are used to pass values and their types between the implementer and LibSass. Sass knows various different value types (including nested arrays and hash-maps). If you implement a binding to another programming language, you have to find a way to convert `Sass_Values` between the targeted language and C. `Sass_Values` are currently only used by custom functions.
|
2
|
+
|
3
|
+
### Basic Usage
|
4
|
+
|
5
|
+
```C
|
6
|
+
#include "sass_values.h"
|
7
|
+
```
|
8
|
+
|
9
|
+
```C
|
10
|
+
// Type for Sass values
|
11
|
+
enum Sass_Tag {
|
12
|
+
SASS_BOOLEAN,
|
13
|
+
SASS_NUMBER,
|
14
|
+
SASS_COLOR,
|
15
|
+
SASS_STRING,
|
16
|
+
SASS_LIST,
|
17
|
+
SASS_MAP,
|
18
|
+
SASS_NULL,
|
19
|
+
SASS_ERROR,
|
20
|
+
SASS_WARNING
|
21
|
+
};
|
22
|
+
|
23
|
+
// Tags for denoting Sass list separators
|
24
|
+
enum Sass_Separator {
|
25
|
+
SASS_COMMA,
|
26
|
+
SASS_SPACE
|
27
|
+
};
|
28
|
+
```
|
29
|
+
|
30
|
+
### Sass Value API
|
31
|
+
|
32
|
+
```C
|
33
|
+
// Forward declaration
|
34
|
+
union Sass_Value;
|
35
|
+
|
36
|
+
// Return the sass tag for a generic sass value
|
37
|
+
// Check is needed before accessing specific values!
|
38
|
+
enum Sass_Tag sass_value_get_tag (const union Sass_Value* v);
|
39
|
+
|
40
|
+
// Check value to be of a specific type
|
41
|
+
// Can also be used before accessing properties!
|
42
|
+
bool sass_value_is_null (const union Sass_Value* v);
|
43
|
+
bool sass_value_is_number (const union Sass_Value* v);
|
44
|
+
bool sass_value_is_string (const union Sass_Value* v);
|
45
|
+
bool sass_value_is_boolean (const union Sass_Value* v);
|
46
|
+
bool sass_value_is_color (const union Sass_Value* v);
|
47
|
+
bool sass_value_is_list (const union Sass_Value* v);
|
48
|
+
bool sass_value_is_map (const union Sass_Value* v);
|
49
|
+
bool sass_value_is_error (const union Sass_Value* v);
|
50
|
+
bool sass_value_is_warning (const union Sass_Value* v);
|
51
|
+
|
52
|
+
// Getters and setters for Sass_Number
|
53
|
+
double sass_number_get_value (const union Sass_Value* v);
|
54
|
+
void sass_number_set_value (union Sass_Value* v, double value);
|
55
|
+
const char* sass_number_get_unit (const union Sass_Value* v);
|
56
|
+
void sass_number_set_unit (union Sass_Value* v, char* unit);
|
57
|
+
|
58
|
+
// Getters and setters for Sass_String
|
59
|
+
const char* sass_string_get_value (const union Sass_Value* v);
|
60
|
+
void sass_string_set_value (union Sass_Value* v, char* value);
|
61
|
+
|
62
|
+
// Getters and setters for Sass_Boolean
|
63
|
+
bool sass_boolean_get_value (const union Sass_Value* v);
|
64
|
+
void sass_boolean_set_value (union Sass_Value* v, bool value);
|
65
|
+
|
66
|
+
// Getters and setters for Sass_Color
|
67
|
+
double sass_color_get_r (const union Sass_Value* v);
|
68
|
+
void sass_color_set_r (union Sass_Value* v, double r);
|
69
|
+
double sass_color_get_g (const union Sass_Value* v);
|
70
|
+
void sass_color_set_g (union Sass_Value* v, double g);
|
71
|
+
double sass_color_get_b (const union Sass_Value* v);
|
72
|
+
void sass_color_set_b (union Sass_Value* v, double b);
|
73
|
+
double sass_color_get_a (const union Sass_Value* v);
|
74
|
+
void sass_color_set_a (union Sass_Value* v, double a);
|
75
|
+
|
76
|
+
// Getter for the number of items in list
|
77
|
+
size_t sass_list_get_length (const union Sass_Value* v);
|
78
|
+
// Getters and setters for Sass_List
|
79
|
+
enum Sass_Separator sass_list_get_separator (const union Sass_Value* v);
|
80
|
+
void sass_list_set_separator (union Sass_Value* v, enum Sass_Separator value);
|
81
|
+
// Getters and setters for Sass_List values
|
82
|
+
union Sass_Value* sass_list_get_value (const union Sass_Value* v, size_t i);
|
83
|
+
void sass_list_set_value (union Sass_Value* v, size_t i, union Sass_Value* value);
|
84
|
+
|
85
|
+
// Getter for the number of items in map
|
86
|
+
size_t sass_map_get_length (const union Sass_Value* v);
|
87
|
+
// Getters and setters for Sass_List keys and values
|
88
|
+
union Sass_Value* sass_map_get_key (const union Sass_Value* v, size_t i);
|
89
|
+
void sass_map_set_key (union Sass_Value* v, size_t i, union Sass_Value*);
|
90
|
+
union Sass_Value* sass_map_get_value (const union Sass_Value* v, size_t i);
|
91
|
+
void sass_map_set_value (union Sass_Value* v, size_t i, union Sass_Value*);
|
92
|
+
|
93
|
+
// Getters and setters for Sass_Error
|
94
|
+
char* sass_error_get_message (const union Sass_Value* v);
|
95
|
+
void sass_error_set_message (union Sass_Value* v, char* msg);
|
96
|
+
|
97
|
+
// Getters and setters for Sass_Warning
|
98
|
+
char* sass_warning_get_message (const union Sass_Value* v);
|
99
|
+
void sass_warning_set_message (union Sass_Value* v, char* msg);
|
100
|
+
|
101
|
+
// Creator functions for all value types
|
102
|
+
union Sass_Value* sass_make_null (void);
|
103
|
+
union Sass_Value* sass_make_boolean (bool val);
|
104
|
+
union Sass_Value* sass_make_string (const char* val);
|
105
|
+
union Sass_Value* sass_make_number (double val, const char* unit);
|
106
|
+
union Sass_Value* sass_make_color (double r, double g, double b, double a);
|
107
|
+
union Sass_Value* sass_make_list (size_t len, enum Sass_Separator sep);
|
108
|
+
union Sass_Value* sass_make_map (size_t len);
|
109
|
+
union Sass_Value* sass_make_error (const char* msg);
|
110
|
+
union Sass_Value* sass_make_warning (const char* msg);
|
111
|
+
|
112
|
+
// Generic destructor function for all types
|
113
|
+
// Will release memory of all associated Sass_Values
|
114
|
+
// Means we will delete recursively for lists and maps
|
115
|
+
void sass_delete_value (union Sass_Value* val);
|
116
|
+
|
117
|
+
// Make a deep cloned copy of the given sass value
|
118
|
+
union Sass_Value* sass_clone_value (const union Sass_Value* val);
|
119
|
+
```
|
120
|
+
|
121
|
+
### More links
|
122
|
+
|
123
|
+
- [Sass Value Example](api-value-example.md)
|
124
|
+
- [Sass Value Internal](api-value-internal.md)
|
125
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
To install LibSass, make sure the OS X build tools are installed:
|
2
|
+
|
3
|
+
xcode-select --install
|
4
|
+
|
5
|
+
## Homebrew
|
6
|
+
|
7
|
+
To install homebrew, see [http://brew.sh](http://brew.sh)
|
8
|
+
|
9
|
+
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
10
|
+
|
11
|
+
You can install the latest version of LibSass quite easily with brew.
|
12
|
+
|
13
|
+
brew install --HEAD libsass
|
14
|
+
|
15
|
+
To update this, do:
|
16
|
+
|
17
|
+
brew reinstall --HEAD libsass
|
18
|
+
|
19
|
+
Brew will build static and shared libraries, and a `libsass.pc` file in `/usr/local/lib/pkgconfig`.
|
20
|
+
|
21
|
+
To use `libsass.pc`, make sure this path is in your `PKG_CONFIG_PATH`
|
22
|
+
|
23
|
+
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
|
24
|
+
|
25
|
+
## Manually
|
26
|
+
|
27
|
+
See the linux instructions [Building-with-autotools](build-with-autotools.md) or [Building-with-makefiles](build-with-makefiles.md)
|
@@ -0,0 +1,55 @@
|
|
1
|
+
Here are two ebuilds to compile LibSass and sassc on gentoo linux. If you do not know how to use these ebuilds, you should probably read the gentoo wiki page about [portage overlays](http://wiki.gentoo.org/wiki/Overlay).
|
2
|
+
|
3
|
+
## www-misc/libsass/libsass-9999.ebuild
|
4
|
+
```ebuild
|
5
|
+
EAPI=4
|
6
|
+
|
7
|
+
inherit eutils git-2 autotools
|
8
|
+
|
9
|
+
DESCRIPTION="A C/C++ implementation of a Sass compiler."
|
10
|
+
HOMEPAGE="http://libsass.org/"
|
11
|
+
EGIT_PROJECT='libsass'
|
12
|
+
EGIT_REPO_URI="https://github.com/sass/libsass.git"
|
13
|
+
LICENSE="MIT"
|
14
|
+
SLOT="0"
|
15
|
+
KEYWORDS=""
|
16
|
+
IUSE=""
|
17
|
+
DEPEND=""
|
18
|
+
RDEPEND="${DEPEND}"
|
19
|
+
DEPEND="${DEPEND}"
|
20
|
+
|
21
|
+
pkg_pretend() {
|
22
|
+
# older gcc is not supported
|
23
|
+
local major=$(gcc-major-version)
|
24
|
+
local minor=$(gcc-minor-version)
|
25
|
+
[[ "${MERGE_TYPE}" != "binary" && ( $major > 4 || ( $major == 4 && $minor < 5 ) ) ]] && \
|
26
|
+
die "Sorry, but gcc earlier than 4.5 will not work for LibSass."
|
27
|
+
}
|
28
|
+
|
29
|
+
src_prepare() {
|
30
|
+
eautoreconf
|
31
|
+
}
|
32
|
+
```
|
33
|
+
|
34
|
+
## www-misc/sassc/sassc-9999.ebuild
|
35
|
+
```ebuild
|
36
|
+
EAPI=4
|
37
|
+
|
38
|
+
inherit eutils git-2 autotools
|
39
|
+
|
40
|
+
DESCRIPTION="Command Line Tool for LibSass."
|
41
|
+
HOMEPAGE="http://libsass.org/"
|
42
|
+
EGIT_PROJECT='sassc'
|
43
|
+
EGIT_REPO_URI="https://github.com/sass/sassc.git"
|
44
|
+
LICENSE="MIT"
|
45
|
+
SLOT="0"
|
46
|
+
KEYWORDS=""
|
47
|
+
IUSE=""
|
48
|
+
DEPEND="www-misc/libsass"
|
49
|
+
RDEPEND="${DEPEND}"
|
50
|
+
DEPEND="${DEPEND}"
|
51
|
+
|
52
|
+
src_prepare() {
|
53
|
+
eautoreconf
|
54
|
+
}
|
55
|
+
```
|
@@ -0,0 +1,139 @@
|
|
1
|
+
We support builds via MingGW and via Visual Studio Community 2013.
|
2
|
+
Both should be considered experimental (MinGW was better tested)!
|
3
|
+
|
4
|
+
## Building via MingGW (makefiles)
|
5
|
+
|
6
|
+
First grab the latest [MinGW for windows] [1] installer. Once it is installed, you can click on continue or open the Installation Manager via `bin\mingw-get.exe`.
|
7
|
+
|
8
|
+
You need to have the following components installed:
|
9
|
+
![Visualization of components installed in the interface](https://cloud.githubusercontent.com/assets/282293/5525466/947bf396-89e6-11e4-841d-4aa916f14de1.png)
|
10
|
+
|
11
|
+
Next we need to install [git for windows] [2]. You probably want to check the option to add it to the global path, but you do not need to install the unix tools.
|
12
|
+
|
13
|
+
If you want to run the spec test-suite you also need [ruby] [3] and a few gems available. Grab the [latest installer] [3] and make sure to add it the global path. Then install the missing gems:
|
14
|
+
|
15
|
+
```bash
|
16
|
+
gem install minitest
|
17
|
+
```
|
18
|
+
|
19
|
+
### Mount the mingw root directory
|
20
|
+
|
21
|
+
As mentioned in the [MinGW Getting Started](http://www.mingw.org/wiki/Getting_Started#toc5) guide, you should edit `C:\MinGW\msys\1.0\etc\fstab` to contain the following line:
|
22
|
+
|
23
|
+
```
|
24
|
+
C:\MinGW /mingw
|
25
|
+
```
|
26
|
+
|
27
|
+
### Starting a "MingGW" console
|
28
|
+
|
29
|
+
Create a batch file with this content:
|
30
|
+
```bat
|
31
|
+
@echo off
|
32
|
+
set PATH=C:\MinGW\bin;%PATH%
|
33
|
+
REM only needed if not already available
|
34
|
+
set PATH=%PROGRAMFILES%\git\bin;%PATH%
|
35
|
+
REM C:\MinGW\msys\1.0\msys.bat
|
36
|
+
cmd
|
37
|
+
```
|
38
|
+
|
39
|
+
Execute it and make sure these commands can be called: `git`, `mingw32-make`, `rm` and `gcc`! Once this is all set, you should be ready to compile `libsass`!
|
40
|
+
|
41
|
+
### Get the sources
|
42
|
+
|
43
|
+
```bash
|
44
|
+
# using git is preferred
|
45
|
+
git clone https://github.com/sass/libsass.git
|
46
|
+
# only needed for sassc and/or testsuite
|
47
|
+
git clone https://github.com/sass/sassc.git libsass/sassc
|
48
|
+
git clone https://github.com/sass/sass-spec.git libsass/sass-spec
|
49
|
+
```
|
50
|
+
|
51
|
+
### Decide for static or shared library
|
52
|
+
|
53
|
+
`libsass` can be built and linked as a `static` or as a `shared` library. The default is `static`. To change it you can set the `BUILD` environment variable:
|
54
|
+
|
55
|
+
```bat
|
56
|
+
set BUILD="shared"
|
57
|
+
```
|
58
|
+
|
59
|
+
### Compile the library
|
60
|
+
```bash
|
61
|
+
mingw32-make -C libsass
|
62
|
+
```
|
63
|
+
|
64
|
+
### Results can be found in
|
65
|
+
```bash
|
66
|
+
$ ls libsass/lib
|
67
|
+
libsass.a libsass.dll libsass.so
|
68
|
+
```
|
69
|
+
|
70
|
+
### Run the spec test-suite
|
71
|
+
```bash
|
72
|
+
mingw32-make -C libsass test_build
|
73
|
+
```
|
74
|
+
|
75
|
+
## Building via MingGW 64bit (makefiles)
|
76
|
+
Building libass to dll on window 64bit.
|
77
|
+
|
78
|
+
+ downloads [MinGW64 for windows7 64bit](http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/4.9.2/threads-win32/seh/x86_64-4.9.2-release-win32-seh-rt_v3-rev0.7z/download) , and unzip to "C:\mingw64".
|
79
|
+
|
80
|
+
+ Create a batch file with this content:
|
81
|
+
|
82
|
+
```bat
|
83
|
+
@echo off
|
84
|
+
set PATH=C:\mingw64\bin;%PATH%
|
85
|
+
set CC=gcc
|
86
|
+
REM only needed if not already available
|
87
|
+
set PATH=%PROGRAMFILES%\Git\bin;%PATH%
|
88
|
+
REM C:\MinGW\msys\1.0\msys.bat
|
89
|
+
cmd
|
90
|
+
```
|
91
|
+
|
92
|
+
+ By default , mingw64 dll will depends on "mingwm10.dll、 libgcc_s_dw2-1.dll" , we can modify Makefile to fix this:(add "-static")
|
93
|
+
|
94
|
+
``` bash
|
95
|
+
lib/libsass.dll: $(COBJECTS) $(OBJECTS) $(RCOBJECTS)
|
96
|
+
$(MKDIR) lib
|
97
|
+
$(CXX) -shared $(LDFLAGS) -o $@ $(COBJECTS) $(OBJECTS) $(RCOBJECTS) $(LDLIBS) -s -static -Wl,--subsystem,windows,--out-implib,lib/libsass.a
|
98
|
+
```
|
99
|
+
|
100
|
+
+ Compile the library
|
101
|
+
|
102
|
+
```bash
|
103
|
+
mingw32-make -C libsass
|
104
|
+
```
|
105
|
+
|
106
|
+
By the way , if you are using java jna , [JNAerator](http://jnaerator.googlecode.com/) is a good tool.
|
107
|
+
|
108
|
+
## Building via Visual Studio Community 2013
|
109
|
+
|
110
|
+
Open a Visual Studio 2013 command prompt:
|
111
|
+
- `VS2013 x86 Native Tools Command Prompt`
|
112
|
+
|
113
|
+
Note: When I installed the community edition, I only got the 2012 command prompts. I copied them from the Startmenu to the Desktop and adjusted the paths from `Visual Studio 11.0` to `Visual Studio 12.0`. Since `libsass` uses some `C++11` features, you need at least a MSVC 2013 compiler (v120).
|
114
|
+
|
115
|
+
### Get the source
|
116
|
+
```bash
|
117
|
+
# using git is preferred
|
118
|
+
git clone https://github.com/sass/libsass.git
|
119
|
+
git clone https://github.com/sass/sassc.git libsass/sassc
|
120
|
+
# only needed if you want to run the testsuite
|
121
|
+
git clone https://github.com/sass/sass-spec.git libsass/sass-spec
|
122
|
+
```
|
123
|
+
|
124
|
+
### Compile sassc
|
125
|
+
|
126
|
+
Sometimes `msbuild` seems not available from the command prompt. Just search for it and add it to the global path. It seems to be included in the .net folders too.
|
127
|
+
|
128
|
+
```bat
|
129
|
+
cd libsass
|
130
|
+
REM set PATH=%PATH%;%PROGRAMFILES%\MSBuild\12.0\Bin
|
131
|
+
msbuild /m:4 /p:Configuration=Release win\libsass.sln
|
132
|
+
REM running the spec test-suite manually (needs ruby and minitest gem)
|
133
|
+
ruby sass-spec\sass-spec.rb -c win\bin\sassc.exe -s --ignore-todo sass-spec/spec
|
134
|
+
cd ..
|
135
|
+
```
|
136
|
+
|
137
|
+
[1]: http://sourceforge.net/projects/mingw/files/latest/download?source=files
|
138
|
+
[2]: https://msysgit.github.io/
|
139
|
+
[3]: http://rubyinstaller.org/
|