From 0301e33c02ef0afac59353d64ab022078424dfdc Mon Sep 17 00:00:00 2001 From: Alexander Kozhinov Date: Mon, 10 Apr 2023 22:39:52 +0200 Subject: [PATCH] nodejs: add v18 Signed-off-by: Alexander Kozhinov --- recipes/nodejs/all/conandata.yml | 22 ++++++++++++++++++ recipes/nodejs/all/conanfile.py | 39 ++++++++++++++++++-------------- recipes/nodejs/config.yml | 2 ++ 3 files changed, 46 insertions(+), 17 deletions(-) diff --git a/recipes/nodejs/all/conandata.yml b/recipes/nodejs/all/conandata.yml index 21b79e6148a9bf..0681cc81e538a7 100644 --- a/recipes/nodejs/all/conandata.yml +++ b/recipes/nodejs/all/conandata.yml @@ -47,3 +47,25 @@ sources: "armv8": url: "https://nodejs.org/dist/v16.3.0/node-v16.3.0-darwin-arm64.tar.gz" sha256: "aeac294dbe54a4dfd222eedfbae704b185c40702254810e2c5917f6dbc80e017" + "18.15.0": + Windows: + "x86_64": + url: "https://nodejs.org/dist/v18.15.0/node-v18.15.0-win-x64.zip" + sha256: "118fbcae58bc8c53cbe97a10c019734ed90685da8dda98aa0b0f4aeead42a647" + Linux: + "x86_64": + url: "https://nodejs.org/dist/v18.15.0/node-v18.15.0-linux-x64.tar.xz" + sha256: "c8c5fa53ce0c0f248e45983e86368e0b1daf84b77e88b310f769c3cfc12682ef" + "armv7": + url: "https://nodejs.org/dist/v18.15.0/node-v18.15.0-linux-armv7l.tar.xz" + sha256: "baad3cdf1365f46bf837635554b10bc3e320799e69ac26e07df1fcde0c1738c7" + "armv8": + url: "https://nodejs.org/dist/v18.15.0/node-v18.15.0-linux-arm64.tar.xz" + sha256: "98ea6ed0a1ae55334ab2c03c34d5e52c6dc3dee8f236c0afc08ab1c964506633" + Macos: + "x86_64": + url: "https://nodejs.org/dist/v18.15.0/node-v18.15.0-darwin-x64.tar.gz" + sha256: "76add174d2d3f98da08907412e82add7352b8cb6f639324d352a65c084b99c7e" + "armv8": + url: "https://nodejs.org/dist/v18.15.0/node-v18.15.0-darwin-arm64.tar.gz" + sha256: "bd302a689c3c34e2b61d86b97de66d26a335881a17af09b6a0a4bb1019df56e4" diff --git a/recipes/nodejs/all/conanfile.py b/recipes/nodejs/all/conanfile.py index c0927a5e704167..90bf79c9e006e5 100644 --- a/recipes/nodejs/all/conanfile.py +++ b/recipes/nodejs/all/conanfile.py @@ -1,19 +1,22 @@ import os -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.scm import Version +from conan.tools.files import copy, get +from conan.errors import ConanInvalidConfiguration -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.59.0" class NodejsConan(ConanFile): name = "nodejs" description = "nodejs binaries for use in recipes" - topics = ("conan", "node", "nodejs") + topics = ("node", "nodejs") url = "https://github.com/conan-io/conan-center-index" homepage = "https://nodejs.org" license = "MIT" - settings = "os", "arch" + settings = "os", "arch", "compiler" no_copy_source = True + short_paths = True @property def _source_subfolder(self): @@ -21,28 +24,30 @@ def _source_subfolder(self): @property def _nodejs_arch(self): - if str(self.settings.os) == "Linux": - if str(self.settings.arch).startswith("armv7"): + if str(self.info.settings.os) == "Linux": + if str(self.info.settings.arch).startswith("armv7"): return "armv7" - if str(self.settings.arch).startswith("armv8") and "32" not in str(self.settings.arch): + if str(self.info.settings.arch).startswith("armv8") and "32" not in str(self.info.settings.arch): return "armv8" - return str(self.settings.arch) + return str(self.info.settings.arch) def validate(self): - if (not (self.version in self.conan_data["sources"]) or - not (str(self.settings.os) in self.conan_data["sources"][self.version]) or - not (self._nodejs_arch in self.conan_data["sources"][self.version][str(self.settings.os)] ) ): + if not self.version in self.conan_data["sources"] or \ + not str(self.info.settings.os) in self.conan_data["sources"][self.version] or \ + not self._nodejs_arch in self.conan_data["sources"][self.version][str(self.info.settings.os)]: raise ConanInvalidConfiguration("Binaries for this combination of architecture/version/os not available") - def build(self): - tools.get(**self.conan_data["sources"][self.version][str(self.settings.os)][self._nodejs_arch], destination=self._source_subfolder, strip_root=True) + if Version(self.version) >= "18.0.0": + if str(self.info.settings.compiler) == "gcc" and Version(self.info.settings.compiler.version) < "8.3": + raise ConanInvalidConfiguration("Binaries for this combination of architecture/version/os not available") + + def source(self): + get(self, **self.conan_data["sources"][self.version][str(self.info.settings.os)][self._nodejs_arch], destination=self._source_subfolder, strip_root=True) def package(self): self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) self.copy(pattern="*", src=os.path.join(self._source_subfolder, "bin"), dst="bin") - self.copy(pattern="node.exe", src=self._source_subfolder, dst="bin") - self.copy(pattern="npm", src=self._source_subfolder, dst="bin") - self.copy(pattern="npx", src=self._source_subfolder, dst="bin") + self.copy(pattern="*", src=os.path.join(self._source_subfolder, "lib"), dst="lib") def package_info(self): self.cpp_info.includedirs = [] diff --git a/recipes/nodejs/config.yml b/recipes/nodejs/config.yml index 8a3ed6b7b72667..e973a099243f74 100644 --- a/recipes/nodejs/config.yml +++ b/recipes/nodejs/config.yml @@ -5,3 +5,5 @@ versions: folder: all "16.3.0": folder: all + "18.15.0": + folder: all