Skip to content
ocx
install

Cross-build with foreign-platform content

Use PLATFORM to provision a package or a project toolchain for a platform other than the host, for example to bundle linux/arm64 content.

Pass PLATFORM to ocx_package or ocx_project. The default comes from OCX_DEFAULT_PLATFORM, and empty means the host.

The commands below come from the foreign_platform test fixture, which runs in find_ocx’s own test suite.

tests/fixtures/foreign_platform/CMakeLists.txt
set(OCX_ALLOW_FLOATING ON)
ocx_package(NAME JQ_ARM PACKAGE ocx.sh/jqlang/jq:latest PLATFORM linux/arm64 NO_ROOT)

A foreign platform exports content, not commands. Foreign binaries cannot execute, so OCX_<NAME>_RUN is not defined and passing BINS is an error.

Use these variables instead:

  • OCX_<NAME>_PATHS lists the content paths.
  • OCX_<NAME>_ENV_<KEY> holds each environment value the package sets.

The fixture checks that the paths exist.

tests/fixtures/foreign_platform/CMakeLists.txt
foreach(dir IN LISTS OCX_JQ_ARM_PATHS)
if(NOT EXISTS "${dir}")
message(FATAL_ERROR "foreign_platform fixture: env path '${dir}' does not exist")
endif()
endforeach()

The harness runs this fixture on Linux hosts only. For the signatures, see ocx_project and ocx_package. Needs addressed: problem 6 of the use-case research.