tpoechtrager / osxcross

Mac OS X cross toolchain for Linux, FreeBSD, OpenBSD and Android (Termux)
GNU General Public License v2.0
2.92k stars 329 forks source link

Consider implementing/mocking pkgutil #435

Open ivan-aksamentov opened 1 month ago

ivan-aksamentov commented 1 month ago

When cross-compiling OpenBLAS using osxcross, I receive this error:

pkgutil: not found

Relevant makefile snippet in OpenBLAS:

https://github.com/OpenMathLib/OpenBLAS/blob/8a0cd5fcef1194b94b5c2469b4a0e1c88050f36d/Makefile.system#L429-L432

Would be nice if osxcross added a mock, or a true implementation of this tool.

ivan-aksamentov commented 1 month ago

For the time being, as a workaround, for OpenBLAS I managed to mock the executable with a bash script:

#!/usr/bin/env sh

# This script mocks 'pkgutil' macOS tool to provide predefined outputs for Xcode package information

if [ "$1" = "--pkg-info" ]; then
  if [ "$2" = "com.apple.pkg.Xcode" ]; then
    echo "version: 12.3.1"
  elif [ "$2" = "com.apple.pkg.CLTools_Executables" ]; then
    echo "version: 15.0.0"
  else
    echo "No package info available."
  fi
fi