Skip to content

Commit

Permalink
nodejs: add v18
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Kozhinov <[email protected]>
  • Loading branch information
KozhinovAlexander committed Apr 10, 2023
1 parent 539f6fe commit 0301e33
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 17 deletions.
22 changes: 22 additions & 0 deletions recipes/nodejs/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
39 changes: 22 additions & 17 deletions recipes/nodejs/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,48 +1,53 @@
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):
return os.path.join(self.source_folder, "source_subfolder")

@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 = []
Expand Down
2 changes: 2 additions & 0 deletions recipes/nodejs/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ versions:
folder: all
"16.3.0":
folder: all
"18.15.0":
folder: all

0 comments on commit 0301e33

Please sign in to comment.