Skip to content

Add two scripts to generate universal2 artifacts for macOS#795

Draft
komaldesai13 wants to merge 14 commits intoansible:develfrom
komaldesai13:macoc_universal2_buils
Draft

Add two scripts to generate universal2 artifacts for macOS#795
komaldesai13 wants to merge 14 commits intoansible:develfrom
komaldesai13:macoc_universal2_buils

Conversation

@komaldesai13
Copy link
Copy Markdown
Contributor

@komaldesai13 komaldesai13 commented Feb 3, 2026

SUMMARY

This patch adds two shell scripts for building OpenSSL and libssh for use in the Python packaging process.

  1. build-libssh-macos.sh: which takes openssl version, libssh version and macos arch as input and generate artifacts.

  2. merge-universal2.sh: merges x86 and arm64 artifacts and generates a universal2 libssh build for macOS.

ISSUE TYPE
  • Feature Pull Request
ADDITIONAL INFORMATION

@packit-as-a-service

This comment was marked as outdated.

@webknjaz webknjaz self-requested a review February 4, 2026 12:46
@webknjaz

This comment was marked as resolved.

@webknjaz webknjaz changed the title Draft :added script to generate universal2 macos artifacst Add two scripts to generate universal2 artifacts for macOS Feb 4, 2026
Comment thread packaging/macos/build-libssh-macos.sh Outdated
Comment thread packaging/macos/build-libssh-macos.sh Outdated
Comment thread packaging/macos/build-libssh-macos.sh Outdated
Comment thread packaging/macos/build-libssh-macos.sh Outdated
Comment thread packaging/macos/build-libssh-macos.sh Outdated
Comment thread packaging/macos/merge-universal2.sh Outdated
Comment thread packaging/macos/merge-universal2.sh Outdated
Comment thread packaging/macos/merge-universal2.sh Outdated
Comment thread packaging/macos/merge-universal2.sh Outdated
Comment thread packaging/macos/merge-universal2.sh Outdated
@webknjaz
Copy link
Copy Markdown
Member

webknjaz commented Feb 5, 2026

@komaldesai13 could you see if it'd be possible to replace

"brew install libssh", # @0.9.4 # pinning the version does not work
with your scripts and run cibuildwheel locally? Perhaps, brew uninstall libssh before doing that. Pay attention at whether your scripts leave Git in a dirty state or create untracked files in the working directory. We should strive to unify compiling these components in the same manner so the version numbers could be updated once in the repository and influence both macOS and GNU/Linux build scripts.

@webknjaz
Copy link
Copy Markdown
Member

@KB-perByte let's not create merge commits in this branch — we'll have to remember to clean them up, which may complicate the process depending on @komaldesai13's experience with using Git.

@komaldesai13 komaldesai13 force-pushed the macoc_universal2_buils branch 2 times, most recently from b97c58b to ba132d6 Compare February 16, 2026 17:53
komaldesai13 and others added 4 commits February 19, 2026 16:39
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
@webknjaz webknjaz force-pushed the macoc_universal2_buils branch from 6ab4ccf to 913bd33 Compare February 19, 2026 15:39
@webknjaz
Copy link
Copy Markdown
Member

@komaldesai13 best avoid adding merge commits into this branch.

@komaldesai13 komaldesai13 force-pushed the macoc_universal2_buils branch from 660f4ea to 7616ccf Compare March 5, 2026 09:03
@komaldesai13 komaldesai13 force-pushed the macoc_universal2_buils branch from c2746cf to 780281a Compare March 5, 2026 09:08
Comment thread packaging/.DS_Store Outdated
Comment thread .DS_Store Outdated
Comment thread packaging/pep517_backend/_cython_configuration.py Outdated
Comment thread packaging/pep517_backend/_cython_configuration.py
Comment thread pyproject.toml Outdated
Comment thread packaging/rpm/ansible-pylibssh.spec
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another leftover?

Comment thread pyproject.toml Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need yet another config with duplicate data in it — it's better to use the single source of configuration.

  -  Shared OpenSSL installer script
  -  Explicit library list in merge script
  -  Removed macOS logic from build backend (security fix)
  -  Pre-built artifacts with download-first approach
  -  Fixed duplicate build-frontend to use "build"
@komaldesai13 komaldesai13 force-pushed the macoc_universal2_buils branch from c02b818 to 58f1632 Compare April 27, 2026 20:13
Comment thread pyproject.toml
]

[tool.cibuildwheel.macos.environment]
# delocate (bundled with cibuildwheel v3) enforces that the wheel's
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is all of this lost?

Comment thread pyproject.toml
# make
# make install/strip
# working_directory: libssh/build
"bash {project}/build-scripts/macos/cibuildwheel-before-build.sh",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how I feel about building the deps as a part of the wheel build process. The whole point of the pre-cached artifacts is that they are built separately and don't waste resources every time the project is being build.

Comment thread .gitignore
sdist/
var/
wheels/
wheelhouse/
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part is coming from a centralized template, I wouldn't put changes in the middle of it unless the upstream got the same changes.

Comment thread .gitignore
.installed.cfg

# macOS build artifacts
.macos-static-deps-path*
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would it be here?

Comment thread .gitignore
*.manifest
*.spec
# Exception: Allow RPM spec files
!packaging/rpm/*.spec
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely unrelated. Plus, it's unnecessary since the file is already being tracked.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it may make sense to have this but not globally — scope it to the respective folder. Though, this must be a standalone change as it has absolutely nothing to do with the goal of this PR and only distracts from whatever that goal is.

Comment thread .gitignore
/src/pylibsshext/_scm_version.py

# macOS
.DS_Store
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mustn't exist in the project. The contributors must add this to their global gitignore as this is something that is coming from the contrib system and is unrelated to the project.


echo "Installing OpenSSL to ${INSTALL_PREFIX}..."
# Install only software and SSL directories (skip docs)
make install_sw install_ssldirs
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@webknjaz ,
this has reusing logic of this script , but creating generic script for macos and manylinux , instead enhancing manylinux script

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was needed in the context of containers. With macOS, we probably need to think of an in-tree location for the built lib cache. I'd reuse PyCA's ideas, of course, instead of reinventing the wheel.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe out of the tree.. Anyway, there's separation between building the deps and using them. For using them (while building the wheels), I'd expect us to pre-download the deps like so: https://github.com/pyca/cryptography/blob/43897cbe22d304a93d6e8736fd386516baa9781d/.github/workflows/wheel-builder.yml#L212-L220. I originally expected that this PR would only contain a minimal patch for building the deps and storing them as GHA artifacts but not embed that into the wheel building process just yet.

It seems like we may want to think of a mechanism for pointing to the place where the pre-built deps live. The manylinux config just sets the respective env vars and the macOS one should too. But I was hoping to avoid growing the scope indefinitely.

Comment on lines +94 to +98
gh release upload libssh-v0.12.0-openssl-3.5.0 \
build-scripts/macos/build/arm64/libssh-*.tar.gz \
build-scripts/macos/build/arm64/libssh-*.tar.gz.sha256 \
build-scripts/macos/build/x86_64/libssh-*.tar.gz \
build-scripts/macos/build/x86_64/libssh-*.tar.gz.sha256
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just saw this. We should definitely not publish releases with other projects in here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants