Skip to content

Commit

Permalink
Merge pull request #1847 from mgreter/bugfix/smartos-compilation
Browse files Browse the repository at this point in the history
Fix SmartOS compilation once and for all
  • Loading branch information
mgreter committed Jan 12, 2016
2 parents a6386bd + 7b670e4 commit c9f5a49
Show file tree
Hide file tree
Showing 46 changed files with 213 additions and 124 deletions.
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ CP ?= cp -a
MKDIR ?= mkdir
RMDIR ?= rmdir
WINDRES ?= windres
ifeq ($(OS),SunOS) # Solaris/Illumos flavors
INSTALL = ginstall
PREFIX = /opt/local
# Solaris/Illumos flavors
# ginstall from coreutils
ifeq ($(OS),SunOS)
INSTALL ?= ginstall
endif
INSTALL ?= install
CFLAGS ?= -Wall
Expand Down Expand Up @@ -134,7 +135,11 @@ ifneq ($(BUILD),shared)
endif

ifeq (,$(TRAVIS_BUILD_DIR))
PREFIX ?= /usr/local
ifeq ($(OS),SunOS)
PREFIX ?= /opt/local
else
PREFIX ?= /usr/local
endif
else
PREFIX ?= $(TRAVIS_BUILD_DIR)
endif
Expand Down
10 changes: 10 additions & 0 deletions docs/build-with-autotools.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ git clone https:/sass/sassc.git libsass/sassc
git clone https:/sass/sass-spec.git libsass/sass-spec
```

### Prerequisites

In order to run autotools you need a few tools installed on your system.
```bash
yum install automake libtool # RedHat Linux
emerge -a automake libtool # Gentoo Linux
pkgin install automake libtool # SmartOS
```


### Create configure script
```bash
cd libsass
Expand Down
18 changes: 18 additions & 0 deletions docs/build-with-makefiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@ $ ls libsass/lib
libsass.a libsass.so
```

### Install onto the system

We recommend to use [autotools to install](build-with-autotools.md) libsass onto the
system, since that brings all the benefits of using libtools as the main install method.
If you still want to install libsass via the makefile, you need to make sure that gnu
`install` utility (or compatible) is installed on your system.
```bash
yum install coreutils # RedHat Linux
emerge -a coreutils # Gentoo Linux
pkgin install coreutils # SmartOS
```

You can set the install location by setting `PREFIX`
```bash
PREFIX="/opt/local" make install
```


### Compling sassc

```bash
Expand Down
1 change: 1 addition & 0 deletions src/ast.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include "ast.hpp"
#include "context.hpp"
#include "node.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/base64vlq.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include "base64vlq.hpp"

namespace Sass {
Expand Down
1 change: 1 addition & 0 deletions src/bind.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include "bind.hpp"
#include "ast.hpp"
#include "context.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/color_maps.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include "ast.hpp"
#include "color_maps.hpp"

Expand Down
1 change: 1 addition & 0 deletions src/constants.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include "constants.hpp"

namespace Sass {
Expand Down
7 changes: 1 addition & 6 deletions src/context.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#ifdef _WIN32
#define PATH_SEP ';'
#else
#define PATH_SEP ':'
#endif

#include "sass.hpp"
#include <string>
#include <cstdlib>
#include <cstring>
Expand Down
1 change: 1 addition & 0 deletions src/cssize.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include <iostream>
#include <typeinfo>
#include <vector>
Expand Down
1 change: 1 addition & 0 deletions src/emitter.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include "util.hpp"
#include "context.hpp"
#include "output.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/environment.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include "ast.hpp"
#include "environment.hpp"

Expand Down
1 change: 1 addition & 0 deletions src/error_handling.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include "ast.hpp"
#include "prelexer.hpp"
#include "backtrace.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/eval.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include <cstdlib>
#include <cmath>
#include <iostream>
Expand Down
5 changes: 1 addition & 4 deletions src/expand.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#ifdef _MSC_VER
#pragma warning(disable : 4503)
#endif

#include "sass.hpp"
#include <iostream>
#include <typeinfo>

Expand Down
5 changes: 1 addition & 4 deletions src/extend.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#ifdef _MSC_VER
#pragma warning(disable : 4503)
#endif

#include "sass.hpp"
#include "extend.hpp"
#include "context.hpp"
#include "to_string.hpp"
Expand Down
39 changes: 14 additions & 25 deletions src/file.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
#ifdef _WIN32
#ifdef __MINGW32__
#ifndef off64_t
#define off64_t _off64_t /* Workaround for http://sourceforge.net/p/mingw/bugs/2024/ */
#endif
#endif
#include <direct.h>
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
# ifdef __MINGW32__
# ifndef off64_t
# define off64_t _off64_t /* Workaround for http://sourceforge.net/p/mingw/bugs/2024/ */
# endif
# endif
# include <direct.h>
# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
#else
#include <unistd.h>
#endif
#ifdef _MSC_VER
#define NOMINMAX
# include <unistd.h>
#endif

#include "sass.hpp"
#include <iostream>
#include <fstream>
#include <cctype>
Expand All @@ -26,32 +23,24 @@
#include "sass2scss.h"

#ifdef _WIN32
#include <windows.h>
# include <windows.h>

#ifdef _MSC_VER
#include <codecvt>
# ifdef _MSC_VER
# include <codecvt>
inline static std::string wstring_to_string(const std::wstring& wstr)
{
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> wchar_converter;
return wchar_converter.to_bytes(wstr);
}
#else // mingw(/gcc) does not support C++11's codecvt yet.
# else // mingw(/gcc) does not support C++11's codecvt yet.
inline static std::string wstring_to_string(const std::wstring &wstr)
{
int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL);
std::string strTo(size_needed, 0);
WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &strTo[0], size_needed, NULL, NULL);
return strTo;
}
#endif
#endif

#ifndef FS_CASE_SENSITIVE
#ifdef _WIN32
#define FS_CASE_SENSITIVE 0
#else
#define FS_CASE_SENSITIVE 1
#endif
# endif
#endif

namespace Sass {
Expand Down
1 change: 1 addition & 0 deletions src/functions.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include "functions.hpp"
#include "ast.hpp"
#include "context.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/inspect.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include <cmath>
#include <string>
#include <iostream>
Expand Down
1 change: 1 addition & 0 deletions src/lexer.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include <cctype>
#include <cstddef>
#include <iostream>
Expand Down
1 change: 1 addition & 0 deletions src/listize.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include <iostream>
#include <typeinfo>
#include <string>
Expand Down
1 change: 1 addition & 0 deletions src/memory_manager.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include "ast.hpp"
#include "memory_manager.hpp"

Expand Down
1 change: 1 addition & 0 deletions src/node.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include <vector>

#include "node.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/output.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include "ast.hpp"
#include "output.hpp"
#include "to_string.hpp"
Expand Down
25 changes: 13 additions & 12 deletions src/parser.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include <cstdlib>
#include <iostream>
#include <vector>
Expand Down Expand Up @@ -1198,7 +1199,7 @@ namespace Sass {
> >(position)))
{ return lhs; }
// parse the operator
bool left_ws = peek < css_comments >();
const char* left_ws = peek < css_comments >();
// parse the operator
enum Sass_OP op
= lex<kwd_eq>() ? Sass_OP::EQ
Expand All @@ -1210,11 +1211,11 @@ namespace Sass {
// we checked the possibilites on top of fn
: Sass_OP::EQ;
// parse the right hand side expression
bool right_ws = peek < css_comments >();
const char* right_ws = peek < css_comments >();
// parse the right hand side expression
Expression* rhs = parse_expression();
// return binary expression with a left and a right hand side
return SASS_MEMORY_NEW(ctx.mem, Binary_Expression, lhs->pstate(), { op, left_ws, right_ws }, lhs, rhs);
return SASS_MEMORY_NEW(ctx.mem, Binary_Expression, lhs->pstate(), { op, left_ws != 0, right_ws != 0 }, lhs, rhs);
}
// parse_relation

Expand All @@ -1236,10 +1237,10 @@ namespace Sass {

std::vector<Expression*> operands;
std::vector<Operand> operators;
bool left_ws = peek < css_comments >();
const char* left_ws = peek < css_comments >();
while (lex_css< exactly<'+'> >() || lex< sequence< negate< digit >, exactly<'-'> > >()) {
bool right_ws = peek < css_comments >();
operators.push_back({ lexed.to_string() == "+" ? Sass_OP::ADD : Sass_OP::SUB, left_ws, right_ws });
const char* right_ws = peek < css_comments >();
operators.push_back({ lexed.to_string() == "+" ? Sass_OP::ADD : Sass_OP::SUB, left_ws != 0, right_ws != 0 });
operands.push_back(parse_operators());
left_ws = peek < css_comments >();
}
Expand All @@ -1258,13 +1259,13 @@ namespace Sass {
std::vector<Expression*> operands; // factors
std::vector<Operand> operators; // ops
// lex operations to apply to lhs
bool left_ws = peek < css_comments >();
const char* left_ws = peek < css_comments >();
while (lex_css< class_char< static_ops > >()) {
bool right_ws = peek < css_comments >();
const char* right_ws = peek < css_comments >();
switch(*lexed.begin) {
case '*': operators.push_back({ Sass_OP::MUL, left_ws, right_ws }); break;
case '/': operators.push_back({ Sass_OP::DIV, left_ws, right_ws }); break;
case '%': operators.push_back({ Sass_OP::MOD, left_ws, right_ws }); break;
case '*': operators.push_back({ Sass_OP::MUL, left_ws != 0, right_ws != 0 }); break;
case '/': operators.push_back({ Sass_OP::DIV, left_ws != 0, right_ws != 0 }); break;
case '%': operators.push_back({ Sass_OP::MOD, left_ws != 0, right_ws != 0 }); break;
default: throw std::runtime_error("unknown static op parsed"); break;
}
operands.push_back(parse_factor());
Expand Down Expand Up @@ -1902,7 +1903,7 @@ namespace Sass {
call->predicate(predicate);
// parse mandatory block
call->block(parse_block());
// remove from stack
// return ast node
stack.pop_back();
// return ast node
return call;
Expand Down
1 change: 1 addition & 0 deletions src/plugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <dlfcn.h>
#endif

#include "sass.hpp"
#include <iostream>
#include "output.hpp"
#include "plugins.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/position.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include "position.hpp"

namespace Sass {
Expand Down
1 change: 1 addition & 0 deletions src/prelexer.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include <cctype>
#include <cstddef>
#include <iostream>
Expand Down
1 change: 1 addition & 0 deletions src/remove_placeholders.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include "remove_placeholders.hpp"
#include "context.hpp"
#include "inspect.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/sass.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include <cstdlib>
#include <cstring>
#include <vector>
Expand Down
41 changes: 41 additions & 0 deletions src/sass.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// must be the first include in all compile units
#ifndef SASS_SASS_H
#define SASS_SASS_H

// undefine extensions macro to tell sys includes
// that we do not want any macros to be exported
// mainly fixes an issue on SmartOS (SEC macro)
#undef __EXTENSIONS__

#ifdef _MSC_VER
#pragma warning(disable : 4005)
#endif

// aplies to MSVC and MinGW
#ifdef _WIN32
// we do not want the ERROR macro
# define NOGDI
// we do not want the min/max macro
# define NOMINMAX
#endif

// should we be case insensitive
// when dealing with files or paths
#ifndef FS_CASE_SENSITIVE
# ifdef _WIN32
# define FS_CASE_SENSITIVE 0
# else
# define FS_CASE_SENSITIVE 1
# endif
#endif

// path separation char
#ifndef PATH_SEP
# ifdef _WIN32
# define PATH_SEP ';'
# else
# define PATH_SEP ':'
# endif
#endif

#endif
1 change: 1 addition & 0 deletions src/sass_context.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include <cstring>
#include <stdexcept>
#include <sstream>
Expand Down
1 change: 1 addition & 0 deletions src/sass_functions.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "sass.hpp"
#include <cstring>
#include "util.hpp"
#include "context.hpp"
Expand Down
Loading

0 comments on commit c9f5a49

Please sign in to comment.