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

openssh/9.1p1: Added openssh recipe #19031

Merged
merged 20 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
790eff1
openssh: Added openssh recipe
klausholstjacobsen Aug 3, 2023
9862da7
Update zlib dependency range
klausholstjacobsen Aug 27, 2023
b884537
Empty commit for pipeline re-run
klausholstjacobsen Oct 8, 2023
43c13b1
openssh: Disbaled zlib version check during configure
klausholstjacobsen Oct 8, 2023
e4932e1
Simplify conditional patching & test package
AbrilRBS Oct 25, 2023
6a57f80
Update recipes/openssh/all/conanfile.py
klausholstjacobsen Feb 29, 2024
c6fc558
Update recipes/openssh/all/conanfile.py
klausholstjacobsen Feb 29, 2024
a3a2864
Update recipes/openssh/all/conanfile.py
klausholstjacobsen Feb 29, 2024
fda3a87
openssh: Updated recipe according to PR discusion and suggestions
klausholstjacobsen Mar 1, 2024
b739ad4
openssh:: Fixed imports and indentation
klausholstjacobsen Mar 4, 2024
2fd4f79
openssh: Fixed configure args
klausholstjacobsen Mar 4, 2024
593e0ed
openssh: removed support for old version 8.1p1
klausholstjacobsen Mar 4, 2024
a0011e5
Update recipes/openssh/all/conanfile.py
klausholstjacobsen Mar 7, 2024
be9056d
openssh: Added support for libressl
klausholstjacobsen Mar 7, 2024
ee43fc7
Update recipes/openssh/all/conanfile.py
klausholstjacobsen Mar 22, 2024
44aca14
Update recipes/openssh/all/conanfile.py
klausholstjacobsen Mar 26, 2024
f2be9c6
Update recipes/openssh/all/conanfile.py
klausholstjacobsen Mar 26, 2024
34e9a33
openssh: Updated with_pam default value
klausholstjacobsen Mar 26, 2024
c6b5a00
Limited use of virtualrunenv in build scope. Applied suggestions
franramirez688 Apr 1, 2024
2692da4
Solved implicit function declarations errors
franramirez688 Apr 1, 2024
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
7 changes: 7 additions & 0 deletions recipes/openssh/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
sources:
"9.6p1":
url: "https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.6p1.tar.gz"
sha256: "910211c07255a8c5ad654391b40ee59800710dd8119dd5362de09385aa7a777c"
"9.1p1":
url: "https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.1p1.tar.gz"
sha256: "19f85009c7e3e23787f0236fbb1578392ab4d4bf9f8ec5fe6bc1cd7e8bfdd288"
klausholstjacobsen marked this conversation as resolved.
Show resolved Hide resolved
130 changes: 130 additions & 0 deletions recipes/openssh/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import cross_building
from conan.tools.env import VirtualBuildEnv, VirtualRunEnv
from conan.tools.files import copy, get, rmdir, export_conandata_patches
from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps
from conan.tools.layout import basic_layout
from os.path import join

required_conan_version = ">=1.54.0"


class PackageConan(ConanFile):
name = "openssh"
description = "The OpenSSH (portable) suite of secure connectivity tools"
license = "SSH-OpenSSH"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://www.openssh.com/portable.html"
topics = ("security", "cryptography", "login", "keychain", "file-sharing", "ssh")
package_type = "application"
settings = "os", "arch", "compiler", "build_type"
options = {
"with_libcrypto": [None, "libressl", "openssl"],
"with_pam": [None, "openpam"],
klausholstjacobsen marked this conversation as resolved.
Show resolved Hide resolved
"with_selinux": [True, False],
"with_libedit": [True, False],
"with_sandbox": ["auto", "no", "capsicum", "darwin", "rlimit", "seccomp_filter", "systrace", "pledge"]
klausholstjacobsen marked this conversation as resolved.
Show resolved Hide resolved
}
default_options = {
"with_libcrypto": "openssl",
"with_pam": None,
"with_selinux": False,
"with_libedit": False,
"with_sandbox": "auto"
klausholstjacobsen marked this conversation as resolved.
Show resolved Hide resolved
}

def package_id(self):
del self.info.settings.compiler
del self.info.settings.build_type

def export_sources(self):
export_conandata_patches(self)

def configure(self):
self.settings.rm_safe("compiler.libcxx")
self.settings.rm_safe("compiler.cppstd")

def layout(self):
basic_layout(self, src_folder="src")

def requirements(self):
self.requires("zlib/[>=1.2.11 <2]")
if self.options.with_libcrypto == "openssl":
self.requires("openssl/[>=1.1 <=3.1]")
elif self.options.with_libcrypto == "libressl":
self.requires("libressl/3.5.3")
if self.options.with_pam == "openpam":
self.requires("openpam/20190224")
klausholstjacobsen marked this conversation as resolved.
Show resolved Hide resolved
if self.options.with_libedit:
self.requires("editline/3.1")

def validate(self):
if self.settings.os in ["baremetal", "Windows"]:
raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.settings.os}.")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def generate(self):
env = VirtualBuildEnv(self)
env.generate()

ad = AutotoolsDeps(self)
ad.generate()

tc = AutotoolsToolchain(self)
tc.configure_args.append("--without-zlib-version-check")

if self.options.with_selinux:
tc.configure_args.append("--with-selinux")

if self.options.with_pam:
tc.configure_args.append("--with-pam")

if self.options.with_libedit:
editline = self.dependencies["editline"]
tc.configure_args.append("--with-libedit={}".format(editline.package_folder))

if self.options.with_libcrypto == "openssl":
openssl = self.dependencies["openssl"]
tc.configure_args.append("--with-ssl-dir={}".format(openssl.package_folder))
elif self.options.with_libcrypto == "libressl":
libressl = self.dependencies["libressl"]
tc.configure_args.append("--with-ssl-dir={}".format(libressl.package_folder))
else:
tc.configure_args.append("--without-openssl")

if self.options.with_sandbox != 'auto':
tc.configure_args.append("--with-sandbox={}".format(self.options.with_sandbox))
franramirez688 marked this conversation as resolved.
Show resolved Hide resolved

tc.generate()

def build(self):
autotools = Autotools(self)
env = VirtualRunEnv(self)
klausholstjacobsen marked this conversation as resolved.
Show resolved Hide resolved
with env.vars().apply():
autotools.configure()

autotools.make()

def package(self):
autotools = Autotools(self)

install_target = 'install-nokeys' if cross_building(self) else 'install'
autotools.install(target=install_target)

copy(self, "LICENCE", src=self.source_folder, dst=join(self.package_folder, "licenses"), ignore_case=True)
copy(self, "*", src=join(self.package_folder, "libexec"), dst=join(self.package_folder, "bin"), ignore_case=True)

rmdir(self, join(self.package_folder, "etc"))
rmdir(self, join(self.package_folder, "var"))
rmdir(self, join(self.package_folder, "share"))
rmdir(self, join(self.package_folder, "libexec"))

def package_info(self):
self.cpp_info.includedirs = []
self.cpp_info.libdirs = []

bindir = join(self.package_folder, "bin")
self.runenv_info.prepend_path("PATH", bindir)
18 changes: 18 additions & 0 deletions recipes/openssh/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from conan import ConanFile
from conan.tools.build import can_run


class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "VirtualRunEnv"
test_type = "explicit"

def requirements(self):
self.requires(self.tested_reference_str)

def build(self):
pass

def test(self):
if can_run(self):
self.run("ssh -Q help", env="conanrun")
5 changes: 5 additions & 0 deletions recipes/openssh/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
versions:
"9.6p1":
folder: all
"9.1p1":
folder: all
Loading