From 0a9ba898f8b4bdd1f7a7e84e58e6e6df85bcf85d Mon Sep 17 00:00:00 2001 From: Eric Lemanissier Date: Fri, 8 Jan 2021 21:30:54 +0100 Subject: [PATCH 1/3] libsass 3.6.4 --- recipes/libsass/all/conandata.yml | 4 ++ recipes/libsass/all/conanfile.py | 62 +++++++++++++++++++ .../libsass/all/test_package/CMakeLists.txt | 9 +++ recipes/libsass/all/test_package/conanfile.py | 17 +++++ .../libsass/all/test_package/test_package.cpp | 7 +++ recipes/libsass/config.yml | 3 + 6 files changed, 102 insertions(+) create mode 100644 recipes/libsass/all/conandata.yml create mode 100644 recipes/libsass/all/conanfile.py create mode 100644 recipes/libsass/all/test_package/CMakeLists.txt create mode 100644 recipes/libsass/all/test_package/conanfile.py create mode 100644 recipes/libsass/all/test_package/test_package.cpp create mode 100644 recipes/libsass/config.yml diff --git a/recipes/libsass/all/conandata.yml b/recipes/libsass/all/conandata.yml new file mode 100644 index 0000000000000..f6de4756c1cae --- /dev/null +++ b/recipes/libsass/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "3.6.4": + sha256: f9484d9a6df60576e791566eab2f757a97fd414fce01dd41fc0a693ea5db2889 + url: https://github.com/sass/libsass/archive/3.6.4.tar.gz diff --git a/recipes/libsass/all/conanfile.py b/recipes/libsass/all/conanfile.py new file mode 100644 index 0000000000000..6edf49d7db91f --- /dev/null +++ b/recipes/libsass/all/conanfile.py @@ -0,0 +1,62 @@ +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 + with tools.chdir(self._source_subfolder): + 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, configure_dir=self._source_subfolder) + return self._autotools + + def build(self): + autotools = self._configure_autotools() + autotools.make() + + def package(self): + 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"] + diff --git a/recipes/libsass/all/test_package/CMakeLists.txt b/recipes/libsass/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..e97ecc6c7a569 --- /dev/null +++ b/recipes/libsass/all/test_package/CMakeLists.txt @@ -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}) diff --git a/recipes/libsass/all/test_package/conanfile.py b/recipes/libsass/all/test_package/conanfile.py new file mode 100644 index 0000000000000..fcc20e0984e32 --- /dev/null +++ b/recipes/libsass/all/test_package/conanfile.py @@ -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) diff --git a/recipes/libsass/all/test_package/test_package.cpp b/recipes/libsass/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..f726b99f6f31e --- /dev/null +++ b/recipes/libsass/all/test_package/test_package.cpp @@ -0,0 +1,7 @@ +#include "sass.h" +#include + +int main() { + printf("libsass version %s\t language version %s\n", libsass_version(), libsass_language_version()); + return 0; +} diff --git a/recipes/libsass/config.yml b/recipes/libsass/config.yml new file mode 100644 index 0000000000000..24cababa1cadd --- /dev/null +++ b/recipes/libsass/config.yml @@ -0,0 +1,3 @@ +versions: + "3.6.4": + folder: all From 61f1e648de955161c59f695f5a9508a884799975 Mon Sep 17 00:00:00 2001 From: Eric Lemanissier Date: Fri, 8 Jan 2021 22:19:34 +0100 Subject: [PATCH 2/3] set version in binary --- recipes/libsass/all/conanfile.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/recipes/libsass/all/conanfile.py b/recipes/libsass/all/conanfile.py index 6edf49d7db91f..4d4d5de663378 100644 --- a/recipes/libsass/all/conanfile.py +++ b/recipes/libsass/all/conanfile.py @@ -34,23 +34,25 @@ def source(self): def _configure_autotools(self): if self._autotools: return self._autotools - with tools.chdir(self._source_subfolder): - self.run("autoreconf -fiv", run_environment=True) + 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, configure_dir=self._source_subfolder) + self._autotools.configure(args=args) return self._autotools def build(self): - autotools = self._configure_autotools() - autotools.make() + with tools.chdir(self._source_subfolder): + tools.save(path="VERSION", content="%s" % self.version) + autotools = self._configure_autotools() + autotools.make() def package(self): - autotools = self._configure_autotools() - autotools.install() + 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") From a57ee7446181df13abaf64f3dccf2d2e5dfd4522 Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Sat, 9 Jan 2021 09:23:39 +0100 Subject: [PATCH 3/3] Update recipes/libsass/all/conanfile.py Co-authored-by: theirix --- recipes/libsass/all/conanfile.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/recipes/libsass/all/conanfile.py b/recipes/libsass/all/conanfile.py index 4d4d5de663378..13b26e6c8ae61 100644 --- a/recipes/libsass/all/conanfile.py +++ b/recipes/libsass/all/conanfile.py @@ -60,5 +60,4 @@ def package(self): def package_info(self): self.cpp_info.libs = ["sass"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs = ["dl"] - + self.cpp_info.system_libs = ["dl", "m"]