Alien-libssh

 view release on metacpan or  search on metacpan

.claude/skills/alien-libssh-core/SKILL.md  view on Meta::CPAN


`PkgConfig` does probe *and* gather for both paths — on share it reads the
`libssh.pc` the CMake install drops into the prefix. A hand-rolled `sys` gather
covers only the system path and leaves a share install with empty `cflags`.

## The share build is static, and the .pc lies about it

Three facts an implementer keeps re-discovering:

1. **Out-of-source is mandatory.** libssh's
   `MacroEnsureOutOfSourceBuild.cmake` refuses to configure inside the source
   tree; `meta->prop->{out_of_source} = 1` makes `Build::CMake` honour that.
   The `build` list is *one* cmake command (an array ref) followed by
   `%{make}` and `%{make} install` — a flat list is N separate commands.
2. **`-DBUILD_SHARED_LIBS=OFF`.** A shared `libssh.so` in the Alien prefix is
   invisible to the runtime linker, so an XS consumer compiles and then dies on
   `libssh.so.4: cannot open shared object file`. Static avoids the rpath game.
3. **The generated `libssh.pc` has no `Libs.private`.** Static linking therefore
   needs libssh's own dependencies appended: `-lcrypto -lz` (OpenSSL is the
   crypto backend, `WITH_ZLIB` defaults on). The `after 'gather'` hook in
   `alienfile` adds them to `libs` and `libs_static` — it must run *after*

alienfile  view on Meta::CPAN


  # start_url alone does nothing: without a fetch hook Alien::Build reaches the
  # download phase with no way to act on it and dies with "No hooks registered
  # for fetch", so the advertised fallback never existed on a box without a
  # system libssh.
  plugin 'Fetch::Local';
  plugin 'Extract' => 'tar.xz';
  plugin 'Build::CMake';

  # libssh refuses to configure in its own source tree
  # (cmake/Modules/MacroEnsureOutOfSourceBuild.cmake compares CMAKE_SOURCE_DIR
  # against CMAKE_BINARY_DIR). Build::CMake builds in the extracted directory
  # itself unless told otherwise, which is why the source path used to be '..'
  # -- a directory nothing ever created or changed into.
  meta->prop->{out_of_source} = 1;

  # One command. A flat list is a sequence of separate commands to
  # Alien::Build, so the arguments were each exec'd as a program of their own;
  # and the make steps were absent, leaving a configure that built nothing.
  # plugin_build_cmake.args carries the generator, PIC, install prefix and
  # libdir, so only the libssh-specific switches are spelled out here.



( run in 1.071 second using v1.01-cache-2.11-cpan-5c0b1e786e0 )