diff --git a/projects/sass-lang.com/libsass/package.yml b/projects/sass-lang.com/libsass/package.yml new file mode 100644 index 00000000..2b3c15c2 --- /dev/null +++ b/projects/sass-lang.com/libsass/package.yml @@ -0,0 +1,23 @@ +distributable: + url: https://github.com/sass/libsass/archive/refs/tags/{{version}}.tar.gz + strip-components: 1 +versions: + github: sass/libsass +build: + dependencies: + gnu.org/autoconf: '*' + gnu.org/automake: '*' + gnu.org/libtool: '*' + script: + - autoreconf -fvi + - ./configure $ARGS + - make --jobs {{ hw.concurrency }} install + env: + ARGS: + - --prefix={{prefix}} + - --disable-silent-rules + - --disable-dependency-tracking +test: + script: + - cc test.c -lsass -o test + - ./test | grep 'Compilation successful' diff --git a/projects/sass-lang.com/libsass/test.c b/projects/sass-lang.com/libsass/test.c new file mode 100644 index 00000000..b9b7c8d6 --- /dev/null +++ b/projects/sass-lang.com/libsass/test.c @@ -0,0 +1,26 @@ +#include +#include +#include + +int main() { + const char* source_string = "a { color:blue; &:hover { color:red; } }"; + struct Sass_Data_Context* data_ctx = sass_make_data_context(strdup(source_string)); + struct Sass_Options* options = sass_data_context_get_options(data_ctx); + sass_option_set_precision(options, 1); + sass_option_set_source_comments(options, false); + sass_data_context_set_options(data_ctx, options); + sass_compile_data_context(data_ctx); + struct Sass_Context* ctx = sass_data_context_get_context(data_ctx); + int err = sass_context_get_error_status(ctx); + + if (err != 0) { + const char* error_message = sass_context_get_error_message(ctx); + printf("Compilation error: %s\n", error_message); + return 1; + } else { + const char* output = sass_context_get_output_string(ctx); + printf("Compilation successful. Output:\n%s\n", output); + printf("%d\n", strcmp(output, "a {\\n color: blue; }\\n a:hover {\\n color: red; }\\n")); + return 0; + } +}