From 9faf29a74cfa8ba8d263ef7a6a15aebd641e8b56 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Mon, 11 Sep 2023 19:34:00 +0200 Subject: [PATCH] Add libsass 3.6.4 This is a direct copy of https://github.com/lazka/libsass/tree/meson which I've created for gtk back in the days. There is an open PR for adding meson support upstream in https://github.com/sass/libsass/pull/3073 but the project is considered deprecated and hasn't seen a commit in over a year, so there is not much hope for progress there. There is a newer 3.6.5 release out, but I wanted to copy things as is from my fork first and look at updating it later. --- releases.json | 8 ++ subprojects/libsass.wrap | 9 ++ .../packagefiles/libsass/include/meson.build | 14 +++ subprojects/packagefiles/libsass/meson.build | 25 ++++ .../packagefiles/libsass/src/meson.build | 107 ++++++++++++++++++ 5 files changed, 163 insertions(+) create mode 100644 subprojects/libsass.wrap create mode 100644 subprojects/packagefiles/libsass/include/meson.build create mode 100644 subprojects/packagefiles/libsass/meson.build create mode 100644 subprojects/packagefiles/libsass/src/meson.build diff --git a/releases.json b/releases.json index 6beccfb4f..a30c58365 100644 --- a/releases.json +++ b/releases.json @@ -1468,6 +1468,14 @@ "1.6.17-2" ] }, + "libsass": { + "dependency_names": [ + "libsass" + ], + "versions": [ + "3.6.4-1" + ] + }, "libsndfile": { "dependency_names": [ "sndfile" diff --git a/subprojects/libsass.wrap b/subprojects/libsass.wrap new file mode 100644 index 000000000..2c060ec16 --- /dev/null +++ b/subprojects/libsass.wrap @@ -0,0 +1,9 @@ +[wrap-file] +directory = libsass-3.6.4 +source_url = https://github.com/sass/libsass/archive/refs/tags/3.6.4.tar.gz +source_filename = libsass-3.6.4.tar.gz +source_hash = f9484d9a6df60576e791566eab2f757a97fd414fce01dd41fc0a693ea5db2889 +patch_directory = libsass + +[provide] +libsass = libsass_dep diff --git a/subprojects/packagefiles/libsass/include/meson.build b/subprojects/packagefiles/libsass/include/meson.build new file mode 100644 index 000000000..98598c31c --- /dev/null +++ b/subprojects/packagefiles/libsass/include/meson.build @@ -0,0 +1,14 @@ +install_headers('sass.h', 'sass2scss.h') + +version_conf_data = configuration_data() +version_conf_data.set('PACKAGE_VERSION', meson.project_version()) + +version_h = configure_file( + input: 'sass/version.h.in', + output: 'version.h', + configuration: version_conf_data) + +install_headers( + 'sass/base.h', 'sass/context.h', 'sass/functions.h', 'sass/values.h', + version_h, + subdir: 'sass') diff --git a/subprojects/packagefiles/libsass/meson.build b/subprojects/packagefiles/libsass/meson.build new file mode 100644 index 000000000..72ec5c7e3 --- /dev/null +++ b/subprojects/packagefiles/libsass/meson.build @@ -0,0 +1,25 @@ +project('libsass', 'c', 'cpp', + version: '3.6.4', + meson_version : '>= 0.48.0', + default_options: [ + 'c_std=c99', + 'cpp_std=c++11', + 'buildtype=debugoptimized', + ]) + +add_project_arguments( + '-DLIBSASS_VERSION="@0@"'.format(meson.project_version()), + language: ['cpp']) + +cpp = meson.get_compiler('cpp') +if cpp.get_id() != 'msvc' + add_project_arguments( + cpp.get_supported_arguments(['-Wno-non-virtual-dtor']), + language: ['cpp']) +endif + +inc = include_directories('include') +winres_path = files(join_paths('res', 'resource.rc')) + +subdir('include') +subdir('src') diff --git a/subprojects/packagefiles/libsass/src/meson.build b/subprojects/packagefiles/libsass/src/meson.build new file mode 100644 index 000000000..0a4414038 --- /dev/null +++ b/subprojects/packagefiles/libsass/src/meson.build @@ -0,0 +1,107 @@ +cpp_sources = [ + 'ast.cpp', + 'ast_values.cpp', + 'ast_supports.cpp', + 'ast_sel_cmp.cpp', + 'ast_sel_unify.cpp', + 'ast_sel_super.cpp', + 'ast_sel_weave.cpp', + 'ast_selectors.cpp', + 'context.cpp', + 'constants.cpp', + 'fn_utils.cpp', + 'fn_miscs.cpp', + 'fn_maps.cpp', + 'fn_lists.cpp', + 'fn_colors.cpp', + 'fn_numbers.cpp', + 'fn_strings.cpp', + 'fn_selectors.cpp', + 'color_maps.cpp', + 'environment.cpp', + 'ast_fwd_decl.cpp', + 'bind.cpp', + 'file.cpp', + 'util.cpp', + 'util_string.cpp', + 'json.cpp', + 'units.cpp', + 'values.cpp', + 'plugins.cpp', + 'source.cpp', + 'position.cpp', + 'lexer.cpp', + 'parser.cpp', + 'parser_selectors.cpp', + 'prelexer.cpp', + 'eval.cpp', + 'eval_selectors.cpp', + 'expand.cpp', + 'listize.cpp', + 'cssize.cpp', + 'extender.cpp', + 'extension.cpp', + 'stylesheet.cpp', + 'output.cpp', + 'inspect.cpp', + 'emitter.cpp', + 'check_nesting.cpp', + 'remove_placeholders.cpp', + 'sass.cpp', + 'sass_values.cpp', + 'sass_context.cpp', + 'sass_functions.cpp', + 'sass2scss.cpp', + 'backtrace.cpp', + 'operators.cpp', + 'ast2c.cpp', + 'c2ast.cpp', + 'to_value.cpp', + 'source_map.cpp', + 'error_handling.cpp', + 'memory/allocator.cpp', + 'memory/shared_ptr.cpp', + 'utf8_string.cpp', + 'base64vlq.cpp', +] + +c_sources = [ + 'cencode.c', +] + +sass_sources = cpp_sources + c_sources + +if host_machine.system() == 'windows' + windows = import('windows') + sass_sources += [windows.compile_resources(winres_path)] +endif + +dl_dep = cpp.find_library('dl', required : false) + +libsass = shared_library( + 'sass', + sass_sources, + dependencies: [dl_dep], + c_args: ['-DADD_EXPORTS'], + cpp_args: ['-DADD_EXPORTS'], + include_directories: inc, + install: true) + +libsass_dep = declare_dependency( + link_with: libsass, + include_directories: [inc]) + +conf_data = configuration_data() +conf_data.set('prefix', get_option('prefix')) +conf_data.set('exec_prefix', '${prefix}') +conf_data.set('libdir', join_paths('${exec_prefix}', get_option('libdir'))) +conf_data.set('includedir', join_paths('${prefix}', get_option('includedir'))) +conf_data.set('VERSION', meson.project_version()) + +pkg_install_dir = join_paths(get_option('libdir'), 'pkgconfig') + +configure_file( + input: 'support/libsass.pc.in', + output: 'libsass.pc', + configuration: conf_data, + install_dir: pkg_install_dir)