|
Packit Service |
7770af |
We support builds via MingGW and via Visual Studio Community 2013.
|
|
Packit Service |
7770af |
Both should be considered experimental (MinGW was better tested)!
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
## Building via MingGW (makefiles)
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
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`.
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
You need to have the following components installed:
|
|
Packit Service |
7770af |
![Visualization of components installed in the interface](https://cloud.githubusercontent.com/assets/282293/5525466/947bf396-89e6-11e4-841d-4aa916f14de1.png)
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
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.
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
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:
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
```bash
|
|
Packit Service |
7770af |
gem install minitest
|
|
Packit Service |
7770af |
```
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
### Mount the mingw root directory
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
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:
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
```
|
|
Packit Service |
7770af |
C:\MinGW /mingw
|
|
Packit Service |
7770af |
```
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
### Starting a "MingGW" console
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
Create a batch file with this content:
|
|
Packit Service |
7770af |
```bat
|
|
Packit Service |
7770af |
@echo off
|
|
Packit Service |
7770af |
set PATH=C:\MinGW\bin;%PATH%
|
|
Packit Service |
7770af |
REM only needed if not already available
|
|
Packit Service |
7770af |
set PATH=%PROGRAMFILES%\git\bin;%PATH%
|
|
Packit Service |
7770af |
REM C:\MinGW\msys\1.0\msys.bat
|
|
Packit Service |
7770af |
cmd
|
|
Packit Service |
7770af |
```
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
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`!
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
### Get the sources
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
```bash
|
|
Packit Service |
7770af |
# using git is preferred
|
|
Packit Service |
7770af |
git clone https://github.com/sass/libsass.git
|
|
Packit Service |
7770af |
# only needed for sassc and/or testsuite
|
|
Packit Service |
7770af |
git clone https://github.com/sass/sassc.git libsass/sassc
|
|
Packit Service |
7770af |
git clone https://github.com/sass/sass-spec.git libsass/sass-spec
|
|
Packit Service |
7770af |
```
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
### Decide for static or shared library
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
`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:
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
```bat
|
|
Packit Service |
7770af |
set BUILD="shared"
|
|
Packit Service |
7770af |
```
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
### Compile the library
|
|
Packit Service |
7770af |
```bash
|
|
Packit Service |
7770af |
mingw32-make -C libsass
|
|
Packit Service |
7770af |
```
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
### Results can be found in
|
|
Packit Service |
7770af |
```bash
|
|
Packit Service |
7770af |
$ ls libsass/lib
|
|
Packit Service |
7770af |
libsass.a libsass.dll libsass.so
|
|
Packit Service |
7770af |
```
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
### Run the spec test-suite
|
|
Packit Service |
7770af |
```bash
|
|
Packit Service |
7770af |
mingw32-make -C libsass test_build
|
|
Packit Service |
7770af |
```
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
## Building via MingGW 64bit (makefiles)
|
|
Packit Service |
7770af |
Building libass to dll on window 64bit.
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
+ 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".
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
+ Create a batch file with this content:
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
```bat
|
|
Packit Service |
7770af |
@echo off
|
|
Packit Service |
7770af |
set PATH=C:\mingw64\bin;%PATH%
|
|
Packit Service |
7770af |
set CC=gcc
|
|
Packit Service |
7770af |
REM only needed if not already available
|
|
Packit Service |
7770af |
set PATH=%PROGRAMFILES%\Git\bin;%PATH%
|
|
Packit Service |
7770af |
REM C:\MinGW\msys\1.0\msys.bat
|
|
Packit Service |
7770af |
cmd
|
|
Packit Service |
7770af |
```
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
+ By default , mingw64 dll will depends on "mingwm10.dll、 libgcc_s_dw2-1.dll" , we can modify Makefile to fix this:(add "-static")
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
``` bash
|
|
Packit Service |
7770af |
lib/libsass.dll: $(COBJECTS) $(OBJECTS) $(RCOBJECTS)
|
|
Packit Service |
7770af |
$(MKDIR) lib
|
|
Packit Service |
7770af |
$(CXX) -shared $(LDFLAGS) -o $@ $(COBJECTS) $(OBJECTS) $(RCOBJECTS) $(LDLIBS) -s -static -Wl,--subsystem,windows,--out-implib,lib/libsass.a
|
|
Packit Service |
7770af |
```
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
+ Compile the library
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
```bash
|
|
Packit Service |
7770af |
mingw32-make -C libsass
|
|
Packit Service |
7770af |
```
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
By the way , if you are using java jna , [JNAerator](http://jnaerator.googlecode.com/) is a good tool.
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
## Building via Visual Studio Community 2013
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
Open a Visual Studio 2013 command prompt:
|
|
Packit Service |
7770af |
- `VS2013 x86 Native Tools Command Prompt`
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
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).
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
### Get the source
|
|
Packit Service |
7770af |
```bash
|
|
Packit Service |
7770af |
# using git is preferred
|
|
Packit Service |
7770af |
git clone https://github.com/sass/libsass.git
|
|
Packit Service |
7770af |
git clone https://github.com/sass/sassc.git libsass/sassc
|
|
Packit Service |
7770af |
# only needed if you want to run the testsuite
|
|
Packit Service |
7770af |
git clone https://github.com/sass/sass-spec.git libsass/sass-spec
|
|
Packit Service |
7770af |
```
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
### Compile sassc
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
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.
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
```bat
|
|
Packit Service |
7770af |
cd libsass
|
|
Packit Service |
7770af |
REM set PATH=%PATH%;%PROGRAMFILES%\MSBuild\12.0\Bin
|
|
Packit Service |
7770af |
msbuild /m:4 /p:Configuration=Release win\libsass.sln
|
|
Packit Service |
7770af |
REM running the spec test-suite manually (needs ruby and minitest gem)
|
|
Packit Service |
7770af |
ruby sass-spec\sass-spec.rb -V 3.4 -c win\bin\sassc.exe -s --impl libsass sass-spec/spec
|
|
Packit Service |
7770af |
cd ..
|
|
Packit Service |
7770af |
```
|
|
Packit Service |
7770af |
|
|
Packit Service |
7770af |
[1]: http://sourceforge.net/projects/mingw/files/latest/download?source=files
|
|
Packit Service |
7770af |
[2]: https://msysgit.github.io/
|
|
Packit Service |
7770af |
[3]: http://rubyinstaller.org/
|