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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -2
  3. data/ext/libsass/contrib/plugin.cpp +4 -1
  4. data/ext/libsass/docs/README.md +20 -0
  5. data/ext/libsass/docs/api-context-example.md +45 -0
  6. data/ext/libsass/docs/api-context-internal.md +152 -0
  7. data/ext/libsass/docs/api-context.md +268 -0
  8. data/ext/libsass/docs/api-doc.md +160 -0
  9. data/ext/libsass/docs/api-function-example.md +58 -0
  10. data/ext/libsass/docs/api-function-internal.md +8 -0
  11. data/ext/libsass/docs/api-function.md +48 -0
  12. data/ext/libsass/docs/api-importer-example.md +1345 -0
  13. data/ext/libsass/docs/api-importer-internal.md +15 -0
  14. data/ext/libsass/docs/api-importer.md +84 -0
  15. data/ext/libsass/docs/api-value-example.md +0 -0
  16. data/ext/libsass/docs/api-value-internal.md +76 -0
  17. data/ext/libsass/docs/api-value.md +125 -0
  18. data/ext/libsass/docs/build-on-darwin.md +27 -0
  19. data/ext/libsass/docs/build-on-gentoo.md +55 -0
  20. data/ext/libsass/docs/build-on-windows.md +139 -0
  21. data/ext/libsass/docs/build-shared-library.md +35 -0
  22. data/ext/libsass/docs/build-with-autotools.md +68 -0
  23. data/ext/libsass/docs/build-with-makefiles.md +50 -0
  24. data/ext/libsass/docs/build-with-mingw.md +107 -0
  25. data/ext/libsass/docs/build-with-visual-studio.md +90 -0
  26. data/ext/libsass/docs/build.md +97 -0
  27. data/ext/libsass/docs/compatibility-plan.md +48 -0
  28. data/ext/libsass/docs/contributing.md +17 -0
  29. data/ext/libsass/docs/custom-functions-internal.md +120 -0
  30. data/ext/libsass/docs/implementations.md +49 -0
  31. data/ext/libsass/docs/plugins.go +47 -0
  32. data/ext/libsass/docs/setup-environment.md +68 -0
  33. data/ext/libsass/docs/source-map-internals.md +51 -0
  34. data/ext/libsass/docs/trace.md +26 -0
  35. data/ext/libsass/docs/triage.md +17 -0
  36. data/ext/libsass/docs/unicode.md +39 -0
  37. data/ext/libsass/include/sass/context.h +1 -0
  38. data/ext/libsass/include/sass/functions.h +1 -1
  39. data/ext/libsass/src/ast.cpp +12 -2
  40. data/ext/libsass/src/ast.hpp +10 -2
  41. data/ext/libsass/src/bind.cpp +0 -2
  42. data/ext/libsass/src/debug.hpp +4 -0
  43. data/ext/libsass/src/debugger.hpp +2 -1
  44. data/ext/libsass/src/emitter.cpp +2 -0
  45. data/ext/libsass/src/eval.cpp +5 -7
  46. data/ext/libsass/src/expand.cpp +8 -1
  47. data/ext/libsass/src/functions.cpp +19 -4
  48. data/ext/libsass/src/inspect.cpp +17 -0
  49. data/ext/libsass/src/json.cpp +1 -1
  50. data/ext/libsass/src/parser.cpp +10 -1
  51. data/ext/libsass/src/prelexer.cpp +1 -1
  52. data/ext/libsass/src/sass_context.cpp +1 -0
  53. data/ext/libsass/src/sass_values.cpp +1 -1
  54. data/lib/sassc/version.rb +1 -1
  55. data/test/native_test.rb +1 -1
  56. metadata +37 -4
@@ -0,0 +1,35 @@
1
+ This page is mostly intended for people that want to build a system library that gets distributed via RPMs or other means. This is currently in a experimental phase, as we currently do not really guarantee any ABI forward compatibility. The C API was rewritten to make this possible in the future, but we want to wait some more time till we can call this final and stable.
2
+
3
+ Building via autotools
4
+ --
5
+
6
+ You want to build a system library only via autotools, since it will create the proper `libtool` files to make it loadable on multiple systems. We hope this works correctly, but nobody of the `libsass` core team has much knowledge in this area. Therefore we are open for comments or improvements by people that have more experience in that matter (like package maintainers from various linux distributions).
7
+
8
+ ```bash
9
+ apt-get install autoconf libtool
10
+ git clone https://github.com/sass/libsass.git
11
+ cd libsass
12
+ autoreconf --force --install
13
+ ./configure \
14
+ --disable-tests \
15
+ --disable-static \
16
+ --enable-shared \
17
+ --prefix=/usr
18
+ make -j5 install
19
+ cd ..
20
+ ```
21
+
22
+ This should install these files
23
+ ```bash
24
+ # $ ls -la /usr/lib/libsass.*
25
+ /usr/lib/libsass.la
26
+ /usr/lib/libsass.so -> libsass.so.0.0.9
27
+ /usr/lib/libsass.so.0 -> libsass.so.0.0.9
28
+ /usr/lib/libsass.so.0.0.9
29
+ # $ ls -la /usr/include/sass*
30
+ /usr/include/sass.h
31
+ /usr/include/sass2scss.h
32
+ /usr/include/sass_context.h
33
+ /usr/include/sass_functions.h
34
+ /usr/include/sass_values.h
35
+ ```
@@ -0,0 +1,68 @@
1
+ ### Get the sources
2
+ ```bash
3
+ # using git is preferred
4
+ git clone https://github.com/sass/libsass.git
5
+ # only needed for sassc and/or testsuite
6
+ git clone https://github.com/sass/sassc.git libsass/sassc
7
+ git clone https://github.com/sass/sass-spec.git libsass/sass-spec
8
+ ```
9
+
10
+ ### Create configure script
11
+ ```bash
12
+ cd libsass
13
+ autoreconf --force --install
14
+ cd ..
15
+ ```
16
+
17
+ ### Create custom makefiles
18
+ ```bash
19
+ cd libsass
20
+ ./configure \
21
+ --disable-tests \
22
+ --disable-shared \
23
+ --prefix=/usr
24
+ cd ..
25
+ ```
26
+
27
+ ### Build the library
28
+ ```bash
29
+ make -C libsass -j5
30
+ ```
31
+
32
+ ### Install the library
33
+ The library will be installed to the location given as `prefix` to `configure`. This is standard behavior for autotools and not `libsass` specific.
34
+ ```bash
35
+ make -C libsass -j5 install
36
+ ```
37
+
38
+ ### Configure options
39
+ The `configure` script is created by autotools. To get an overview of available options you can call `./configure --help`. When you execute this script, it will create specific makefiles, which you then use via the regular make command.
40
+
41
+ There are some `libsass` specific options:
42
+
43
+ ```
44
+ Optional Features:
45
+ --enable-tests enable testing the build
46
+ --enable-coverage enable coverage report for test suite
47
+ --enable-shared build shared libraries [default=yes]
48
+ --enable-static build static libraries [default=yes]
49
+
50
+ Optional Packages:
51
+ --with-sassc-dir=<dir> specify directory of sassc sources for
52
+ testing (default: sassc)
53
+ --with-sass-spec-dir=<dir> specify directory of sass-spec for testing
54
+ (default: sass-spec)
55
+ ```
56
+
57
+ ### Build sassc and run spec test-suite
58
+
59
+ ```bash
60
+ cd libsass
61
+ autoreconf --force --install
62
+ ./configure \
63
+ --enable-tests \
64
+ --enable-shared \
65
+ --prefix=/usr
66
+ make -j5 test_build
67
+ cd ..
68
+ ```
@@ -0,0 +1,50 @@
1
+ ### Get the sources
2
+ ```bash
3
+ # using git is preferred
4
+ git clone https://github.com/sass/libsass.git
5
+ # only needed for sassc and/or testsuite
6
+ git clone https://github.com/sass/sassc.git libsass/sassc
7
+ git clone https://github.com/sass/sass-spec.git libsass/sass-spec
8
+ ```
9
+
10
+ ### Decide for static or shared library
11
+
12
+ `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:
13
+
14
+ ```bash
15
+ export BUILD="shared"
16
+ ```
17
+
18
+ Alternatively you can also define it directly when calling make:
19
+
20
+ ```bash
21
+ BUILD="shared" make ...
22
+ ```
23
+
24
+ ### Compile the library
25
+ ```bash
26
+ make -C libsass -j5
27
+ ```
28
+
29
+ ### Results can be found in
30
+ ```bash
31
+ $ ls libsass/lib
32
+ libsass.a libsass.so
33
+ ```
34
+
35
+ ### Compling sassc
36
+
37
+ ```bash
38
+ # Let build know library location
39
+ export SASS_LIBSASS_PATH="`pwd`/libsass"
40
+ # Invokes the sassc makefile
41
+ make -C libsass -j5 sassc
42
+ ```
43
+
44
+ ### Run the spec test-suite
45
+
46
+ ```bash
47
+ # needs ruby available
48
+ # also gem install minitest
49
+ make -C libsass -j5 test_build
50
+ ```
@@ -0,0 +1,107 @@
1
+ ## Building LibSass with MingGW (makefiles)
2
+
3
+ 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`.
4
+
5
+ You need to have the following components installed:
6
+ ![](https://cloud.githubusercontent.com/assets/282293/5525466/947bf396-89e6-11e4-841d-4aa916f14de1.png)
7
+
8
+ 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.
9
+
10
+ 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:
11
+
12
+ ```bash
13
+ gem install minitest
14
+ ```
15
+
16
+ ### Mount the mingw root directory
17
+
18
+ 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:
19
+
20
+ ```
21
+ C:\MinGW /mingw
22
+ ```
23
+
24
+ ### Starting a "MingGW" console
25
+
26
+ Create a batch file with this content:
27
+ ```bat
28
+ @echo off
29
+ set PATH=C:\MinGW\bin;%PATH%
30
+ REM only needed if not already available
31
+ set PATH=%PROGRAMFILES%\git\bin;%PATH%
32
+ REM C:\MinGW\msys\1.0\msys.bat
33
+ cmd
34
+ ```
35
+
36
+ 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`!
37
+
38
+ ### Get the sources
39
+
40
+ ```bash
41
+ # using git is preferred
42
+ git clone https://github.com/sass/libsass.git
43
+ # only needed for sassc and/or testsuite
44
+ git clone https://github.com/sass/sassc.git libsass/sassc
45
+ git clone https://github.com/sass/sass-spec.git libsass/sass-spec
46
+ ```
47
+
48
+ ### Decide for static or shared library
49
+
50
+ `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:
51
+
52
+ ```bat
53
+ set BUILD="shared"
54
+ ```
55
+
56
+ ### Compile the library
57
+ ```bash
58
+ mingw32-make -C libsass
59
+ ```
60
+
61
+ ### Results can be found in
62
+ ```bash
63
+ $ ls libsass/lib
64
+ libsass.a libsass.dll libsass.so
65
+ ```
66
+
67
+ ### Run the spec test-suite
68
+ ```bash
69
+ mingw32-make -C libsass test_build
70
+ ```
71
+
72
+ ## Building via MingGW 64bit (makefiles)
73
+ Building libass to dll on window 64bit.
74
+
75
+ Download [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".
76
+
77
+ Create a batch file with this content:
78
+
79
+ ```bat
80
+ @echo off
81
+ set PATH=C:\mingw64\bin;%PATH%
82
+ set CC=gcc
83
+ REM only needed if not already available
84
+ set PATH=%PROGRAMFILES%\Git\bin;%PATH%
85
+ REM C:\MinGW\msys\1.0\msys.bat
86
+ cmd
87
+ ```
88
+
89
+ By default, mingw64 dll will depends on "​m​i​n​g​w​m​1​0​.​d​l​l​、​ ​l​i​b​g​c​c​_​s​_​d​w​2​-​1​.​d​l​l​", we can modify Makefile to fix this:(add "-static")
90
+
91
+ ``` bash
92
+ lib/libsass.dll: $(COBJECTS) $(OBJECTS) $(RCOBJECTS)
93
+ $(MKDIR) lib
94
+ $(CXX) -shared $(LDFLAGS) -o $@ $(COBJECTS) $(OBJECTS) $(RCOBJECTS) $(LDLIBS) -s -static -Wl,--subsystem,windows,--out-implib,lib/libsass.a
95
+ ```
96
+
97
+ Compile the library
98
+
99
+ ```bash
100
+ mingw32-make -C libsass
101
+ ```
102
+
103
+ By the way, if you are using java jna, [JNAerator](http://jnaerator.googlecode.com/) is a good tool.
104
+
105
+ [1]: http://sourceforge.net/projects/mingw/files/latest/download?source=files
106
+ [2]: https://msysgit.github.io/
107
+ [3]: http://rubyinstaller.org/
@@ -0,0 +1,90 @@
1
+ ## Building LibSass with Visual Studio
2
+
3
+ ### Requirements:
4
+
5
+ The minimum requirement to build LibSass with Visual Studio is "Visual Studio 2013 Express for Desktop".
6
+
7
+ Additionally, it is recommended to have `git` installed and available in `PATH`, so to deduce the `libsass` version information. For instance, if GitHub for Windows (https://windows.github.com/) is installed, the `PATH` will have an entry resembling: `X:\Users\<YOUR_NAME>\AppData\Local\GitHub\PortableGit_<SOME_GUID>\cmd\` (where `X` is the drive letter of system drive). If `git` is not available, inquiring the LibSass version will result in `[NA]`.
8
+
9
+ ### Build Steps:
10
+
11
+ #### From Visual Studio:
12
+
13
+ On opening the `win\libsass.sln` solution and build (Ctrl+Shift+B) to build `libsass.dll`.
14
+
15
+ To Build LibSass as a static Library, it is recommended to set an environment variable `LIBSASS_STATIC_LIB` before launching the project:
16
+
17
+ ```cmd
18
+ cd path\to\libsass
19
+ SET LIBSASS_STATIC_LIB=1
20
+ ::
21
+ :: or in PowerShell:
22
+ :: $env:LIBSASS_STATIC_LIB=1
23
+ ::
24
+ win\libsass.sln
25
+ ```
26
+
27
+ Visual Studio will form the filtered source tree as shown below:
28
+
29
+ ![image](https://cloud.githubusercontent.com/assets/3840695/9298985/aae9e072-44bf-11e5-89eb-e7995c098085.png)
30
+
31
+ `Header Files` contains the .h and .hpp files, while `Source Files` covers `.c` and `.cpp`. The other used headers/sources will appear under `External Dependencies`.
32
+
33
+ If there is a LibSass code file appearing under External Dependencies, it can be changed by altering the `win\libsass.vcxproj.filters` file or dragging in Solution Explorer.
34
+
35
+ #### From Command Prompt:
36
+
37
+ Notice that in the following commands:
38
+
39
+ * If the platform is 32-bit Windows, replace `ProgramFiles(x86)` with `ProgramFiles`.
40
+ * To build with Visual Studio 2015, replace `12.0` with `14.0` in the aforementioned command.
41
+
42
+ Open a command prompt:
43
+
44
+ To build dynamic/shared library (`libsass.dll`):
45
+
46
+ ```cmd
47
+ :: debug build:
48
+ "%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild" win\libsass.sln
49
+
50
+ :: release build:
51
+ "%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild" win\libsass.sln ^
52
+ /p:Configuration=Release
53
+ ```
54
+
55
+ To build static library (`libsass.lib`):
56
+
57
+ ```cmd
58
+ :: debug build:
59
+ "%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild" win\libsass.sln ^
60
+ /p:LIBSASS_STATIC_LIB=1
61
+
62
+ :: release build:
63
+ "%ProgramFiles(x86)%\MSBuild\12.0\Bin\MSBuild" win\libsass.sln ^
64
+ /p:LIBSASS_STATIC_LIB=1 /p:Configuration=Release
65
+ ```
66
+
67
+ #### From PowerShell:
68
+
69
+ To build dynamic/shared library (`libsass.dll`):
70
+
71
+ ```powershell
72
+ # debug build:
73
+ &"${env:ProgramFiles(x86)}\MSBuild\12.0\Bin\MSBuild" win\libsass.sln
74
+
75
+ # release build:
76
+ &"${env:ProgramFiles(x86)}\MSBuild\12.0\Bin\MSBuild" win\libsass.sln `
77
+ /p:Configuration=Release
78
+ ```
79
+
80
+ To build static library (`libsass.lib`):
81
+
82
+ ```powershell
83
+ # build:
84
+ &"${env:ProgramFiles(x86)}\MSBuild\12.0\Bin\MSBuild" win\libsass.sln `
85
+ /p:LIBSASS_STATIC_LIB=1
86
+
87
+ # release build:
88
+ &"${env:ProgramFiles(x86)}\MSBuild\12.0\Bin\MSBuild" win\libsass.sln `
89
+ /p:LIBSASS_STATIC_LIB=1 /p:Configuration=Release
90
+ ```
@@ -0,0 +1,97 @@
1
+ `libsass` is only a library and does not do much on its own. You need an implementation that you can use from the [command line] [6]. Or some [[bindings|Implementations]] to use it within your favorite programming language. You should be able to get [`sassc`] [6] running by following the instructions in this guide.
2
+
3
+ Before starting, see [setup dev environment](setup-environment.md).
4
+
5
+ Building on different Operating Systems
6
+ --
7
+
8
+ We try to keep the code as OS independent and standard compliant as possible. Reading files from the file-system has some OS depending code, but will ultimately fall back to a posix compatible implementation. We do use some `C++11` features, but are so far only committed to use `unordered_map`. This means you will need a pretty recent compiler on most systems (gcc 4.5 seems to be the minimum).
9
+
10
+ ### Building on Linux (and other *nix flavors)
11
+
12
+ Linux is the main target for `libsass` and we support two ways to build `libsass` here. The old plain makefiles should still work on most systems (including MinGW), while the autotools build is preferred if you want to create a [system library] (experimental).
13
+
14
+ - [Building with makefiles] [1]
15
+ - [Building with autotools] [2]
16
+
17
+ ### Building on Windows (experimental)
18
+
19
+ Windows build support was added very recently and should be considered experimental. Credits go to @darrenkopp and @am11 for their work on getting `libsass` and `sassc` to compile with visual studio!
20
+
21
+ - [Building with MinGW] [3]
22
+ - [Building with Visual Studio] [11]
23
+
24
+ ### Building on Max OS X (untested)
25
+
26
+ Works the same as on linux, but you can also install LibSass via `homebrew`.
27
+
28
+ - [Building on Mac OS X] [10]
29
+
30
+ ### Building a system library (experimental)
31
+
32
+ Since `libsass` is a library, it makes sense to install it as a shared library on your system. On linux this means creating a `.so` library via autotools. This should work pretty well already, but we are not yet committed to keep the ABI 100% stable. This should be the case once we increase the version number for the library to 1.0.0 or higher. On Windows you should be able get a `dll` by creating a shared build with MinGW. There is currently no target in the MSVC project files to do this.
33
+
34
+ - [Building shared system library] [4]
35
+
36
+ Compiling with clang instead of gcc
37
+ --
38
+
39
+ To use clang you just need to set the appropriate environment variables:
40
+
41
+ ```bash
42
+ export CC=/usr/bin/clang
43
+ export CXX=/usr/bin/clang++
44
+ ```
45
+
46
+ Running the spec test-suite
47
+ --
48
+
49
+ We constantly and automatically test `libsass` against the official [spec test-suite] [5]. To do this we need to have a test-runner (which is written in ruby) and a command-line tool ([`sassc`] [6]) to run the tests. Therefore we need to additionally compile `sassc`. To do this, the build files of all three projects need to work together. This may not have the same quality for all build flavors. You definitely need to have ruby (2.1?) installed (version 1.9 seems to cause problems at least on windows). You also need some gems installed:
50
+
51
+ ```bash
52
+ ruby -v
53
+ gem install minitest
54
+ # should be optional
55
+ gem install minitap
56
+ ```
57
+
58
+ Including the LibSass version
59
+ --
60
+
61
+ There is a function in `libsass` to query the current version. This has to be defined at compile time. We use a C macro for this, which can be defined by calling `g++ -DLIBSASS_VERSION="\"x.y.z.\""`. The two quotes are necessary, since it needs to end up as a valid C string. Normally you do not need to do anything if you use the makefiles or autotools. They will try to fetch the version via git directly. If you only have the sources without the git repo, you can pass the version as an environment variable to `make` or `configure`:
62
+
63
+ ```
64
+ export LIBSASS_VERSION="x.y.z."
65
+ ```
66
+
67
+ Continuous Integration
68
+ --
69
+
70
+ We use two CI services to automatically test all commits against the latest [spec test-suite] [5].
71
+
72
+ - [LibSass on Travis-CI (linux)][7]
73
+ [![Build Status](https://travis-ci.org/sass/libsass.png?branch=master)](https://travis-ci.org/sass/libsass)
74
+ - [LibSass on AppVeyor (windows)][8]
75
+ [![Build status](https://ci.appveyor.com/api/projects/status/github/sass/libsass?svg=true)](https://ci.appveyor.com/project/mgreter/libsass-513/branch/master)
76
+
77
+ Why not using CMake?
78
+ --
79
+
80
+ There were some efforts to get `libsass` to compile with CMake, which should make it easier to create build files for linux and windows. Unfortunately this was not completed. But we are certainly open for PRs!
81
+
82
+ Miscellaneous
83
+ --
84
+
85
+ - [Ebuilds for Gentoo Linux](build-on-gentoo.md)
86
+
87
+ [1]: build-with-makefiles.md
88
+ [2]: build-with-autotools.md
89
+ [3]: build-with-mingw.md
90
+ [4]: build-shared-library.md
91
+ [5]: https://github.com/sass/sass-spec
92
+ [6]: https://github.com/sass/sassc
93
+ [7]: https://github.com/sass/libsass/blob/master/.travis.yml
94
+ [8]: https://github.com/sass/libsass/blob/master/appveyor.yml
95
+ [9]: implementations.md
96
+ [10]: build-on-darwin.md
97
+ [11]: build-with-visual-studio.md