mirror of
https://github.com/ivabus/pantry
synced 2024-11-09 18:15:18 +03:00
new file: projects/sass-lang.com/libsass/package.yml
new file: projects/sass-lang.com/libsass/test.c
This commit is contained in:
parent
7fdd2b4d17
commit
4da91634f7
23
projects/sass-lang.com/libsass/package.yml
Normal file
23
projects/sass-lang.com/libsass/package.yml
Normal file
|
@ -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'
|
26
projects/sass-lang.com/libsass/test.c
Normal file
26
projects/sass-lang.com/libsass/test.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include <sass/context.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue