Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libsass 3.6.4 #4181

Merged
merged 3 commits into from
Jan 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions recipes/libsass/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"3.6.4":
sha256: f9484d9a6df60576e791566eab2f757a97fd414fce01dd41fc0a693ea5db2889
url: https://github.com/sass/libsass/archive/3.6.4.tar.gz
63 changes: 63 additions & 0 deletions recipes/libsass/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
from conans import ConanFile, AutoToolsBuildEnvironment, tools
from conans.errors import ConanInvalidConfiguration
import os


class LibsassConan(ConanFile):
name = "libsass"
license = "MIT"
homepage = "libsass.org"
url = "https://github.com/conan-io/conan-center-index"
description = "A C/C++ implementation of a Sass compiler"
topics = ("Sass", "LibSass", "compiler")
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True}

build_requires = "autoconf/2.69", "libtool/2.4.6"

_autotools = None

@property
def _source_subfolder(self):
return "source_subfolder"

def validate(self):
if self.settings.os not in ["Linux", "FreeBSD", "Macos"]:
raise ConanInvalidConfiguration("libsass supports only Linux, FreeBSD and Macos")

def source(self):
tools.get(**self.conan_data["sources"][self.version])
extracted_dir = self.name + "-" + self.version
tools.rename(extracted_dir, self._source_subfolder)

def _configure_autotools(self):
if self._autotools:
return self._autotools
self.run("autoreconf -fiv", run_environment=True)
self._autotools = AutoToolsBuildEnvironment(self)
args = []
args.append("--disable-tests")
args.append("--enable-%s" % ("shared" if self.options.shared else "static"))
args.append("--disable-%s" % ("static" if self.options.shared else "shared"))
self._autotools.configure(args=args)
return self._autotools

def build(self):
with tools.chdir(self._source_subfolder):
tools.save(path="VERSION", content="%s" % self.version)
autotools = self._configure_autotools()
autotools.make()

def package(self):
with tools.chdir(self._source_subfolder):
autotools = self._configure_autotools()
autotools.install()
self.copy("LICENSE", src=self._source_subfolder, dst="licenses")
tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
tools.remove_files_by_mask(self.package_folder, "*.la")

def package_info(self):
self.cpp_info.libs = ["sass"]
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs = ["dl", "m"]
9 changes: 9 additions & 0 deletions recipes/libsass/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.1)
project(test_package)


include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
17 changes: 17 additions & 0 deletions recipes/libsass/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from conans import ConanFile, CMake, tools
import os


class LibsassTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if not tools.cross_building(self):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
7 changes: 7 additions & 0 deletions recipes/libsass/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "sass.h"
#include <cstdio>

int main() {
printf("libsass version %s\t language version %s\n", libsass_version(), libsass_language_version());
return 0;
}
3 changes: 3 additions & 0 deletions recipes/libsass/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"3.6.4":
folder: all