kind: manual

sources:
- kind: git
  url: upstream:linux
  track: v4.11
  ref: a351e9b9fc24e982ec2f0e76379a49826036da1

depends:
- filename: gnu-toolchain/stage2.bst
  type: build
- gnu-toolchain/fhs-dirs.bst

variables:
  kernel-arch: unsupported

arches:
  armv5:
    variables:
      kernel-arch: arm
  armv7b:
    variables:
      kernel-arch: arm
  armv7l:
    variables:
      kernel-arch: arm
  armv7lhf:
    variables:
      kernel-arch: arm
  armv8l64:
    variables:
      kernel-arch: arm64
  armv8b64:
    variables:
      kernel-arch: arm64
  ppc64b:
    variables:
      kernel-arch: powerpc
  ppc64l:
    variables:
      kernel-arch: powerpc
  x86_32:
    variables:
      kernel-arch: i386
  x86_64:
    variables:
      kernel-arch: x86_64

environment:
  PATH: /usr/bin:/bin:/usr/sbin:/sbin:/tools/bin:/tools/sbin

config:
  install-commands:
  - |
    if [ '%{kernel-arch}' == 'unsupported' ]; then
        echo "Error: unsupported architecture: %{bst-target-arch}" >&2
        exit 1
    fi
    ARCH=%{kernel-arch} make INSTALL_HDR_PATH=dest headers_install
  - install -d "%{install-root}%{includedir}"
  - cp -r dest/include/* "%{install-root}%{includedir}"
