zephyr-sdk/PKGBUILD

119 lines
3.9 KiB
Bash
Raw Normal View History

2018-07-12 01:54:21 +03:00
# Maintainer: Alexei Colin <ac@alexeicolin.com>
pkgname=zephyr-sdk
2022-12-06 15:38:05 +02:00
pkgver=0.15.2
2021-01-24 20:08:51 +02:00
pkgrel=1
2018-07-12 01:54:21 +03:00
pkgdesc="SDK for Zephyr real-time operating system"
arch=('x86_64')
url="https://www.zephyrproject.org/"
license=('Apache')
2020-03-01 05:01:12 +02:00
# Some of these are dependencies of Zephyr RTOS, but instructions for Zephyr
# tell user to pip install, so let's add them here instead. (See
# zephyr/scripts/requirements.txt in Zephyr distribution)
2020-07-18 18:48:22 +03:00
# Missing (not packaged for Arch): junit2html, canopen, sphinx-tabs
2023-01-25 16:26:45 +02:00
depends=('python-docutils>=0.14'
2020-07-18 18:48:22 +03:00
'python-pyaml>=5.1'
'python-ply>=3.10' 'python-pip' 'python-setuptools' 'python-wheel'
'python-pyelftools>=0.24' 'python-pyserial' 'python-pykwalify'
2023-01-25 16:26:45 +02:00
'python-pillow' 'python-anytree' 'python-packaging'
'python-progress' 'python-pyserial'
'python-pytest' 'python-colorama'
2023-01-25 16:26:45 +02:00
'python-coverage'
'python-sphinx>=1.7.5'
2020-07-18 18:48:22 +03:00
'python-west>=0.7.2'
2023-01-25 16:26:45 +02:00
'ninja' 'gperf'
2018-07-12 01:54:21 +03:00
'doxygen' 'dfu-util' 'dtc' 'cmake>=3.8.2')
optdepends=('pyocd: programming and debugging ARM MCUs')
2022-09-08 16:55:26 +03:00
makedepends=('patchelf' 'wget')
2022-04-12 12:01:38 +03:00
source=("https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${pkgver}/zephyr-sdk-${pkgver}_linux-x86_64.tar.gz"
2020-03-01 05:01:12 +02:00
"zephyrrc"
)
2022-12-06 15:38:05 +02:00
sha256sums=('8e3572fbca9f9ba18a4436c00d680af34a85e239f7fe66c7988da85571a0d23d'
2022-09-08 16:55:26 +03:00
'7a1257272c64bdec281283d391e3149cece065935c9e8394d6bece32d0f6fc05')
2018-07-12 01:54:21 +03:00
options=(!strip)
install=$pkgname.install
2020-07-18 18:47:02 +03:00
_installdir=opt/zephyr-sdk
2018-07-12 01:54:21 +03:00
_setupsh=setup.sh
build() {
cd "$srcdir"
}
package ()
{
cd "$srcdir"
2022-04-12 12:01:38 +03:00
mkdir -p $pkgdir/opt
echo ">>> Unpacking...."
cp -a $srcdir/zephyr-sdk-$pkgver $pkgdir/$_installdir
2018-07-12 01:54:21 +03:00
# Add a flag to not relocate executables, because the path to pkgdir is invalid after installation
# -R disables relocation, -S saves the relocation script so that it can be run manually.
2022-04-12 12:01:38 +03:00
sed -i 's#\(\./zephyr-sdk-\${HOSTTYPE}-hosttools-standalone-[0-9.]\+sh\)#\1 -R -S#' $pkgdir/$_installdir/$_setupsh
2018-07-12 01:54:21 +03:00
2022-04-12 23:57:39 +03:00
# Disables sanboxing on systems where libseccomp is available
sed -i 's/xargs -n100 file/xargs -n100 file -S/' $pkgdir/$_installdir/zephyr-sdk-x86_64-hosttools-standalone-*.sh
2020-03-01 05:01:12 +02:00
install -Dm644 zephyrrc $pkgdir/usr/share/zephyr-sdk/zephyrrc
cd $pkgdir/$_installdir
######### NOTE: we are in $_installdir after this point
2022-04-12 23:57:39 +03:00
./$_setupsh -h -t all
2020-07-18 18:48:22 +03:00
# Manually install the CMake module, because upstream paths are no good:
# file installed into $HOME and path is the package build path. Upstream
# needs to support overridable path for the module and a -prefix argumnent
# to distinguish destination copy dir from final system install path.
local _cmake_fname=$(echo -n /$_installdir | md5sum | cut -d' ' -f1)
local _cmake_module_path="$pkgdir/usr/lib/cmake/Zephyr-sdk"
mkdir -p "$_cmake_module_path"
echo "/$_installdir" > "$_cmake_module_path/${_cmake_fname}"
2020-03-01 05:01:12 +02:00
echo ">>>"
echo ">>> Ignore the environment variable values printed above, instead do this:"
echo ">>> cp /usr/share/zephyr-sdk/zephyrrc ~/.zephyrrc"
echo ">>>"
# Strip package build path from prefix path
2020-07-18 18:47:02 +03:00
sed -i "s@\(relocate_sdk.py\s\+\)${pkgdir}/${_installdir} ${pkgdir}/${_installdir}@\1 /${_installdir} /${_installdir}@g" relocate_sdk.sh
./relocate_sdk.sh
rm zephyr-sdk-*-hosttools-standalone-*.sh
2022-04-12 23:57:39 +03:00
rm relocate_sdk.{py,sh}
rm setup.sh
2018-07-12 01:54:21 +03:00
}
# Manual test procedure: get Zephyr Kernel, build an example, and run in Qemu:
#
# $ wget https://github.com/zephyrproject-rtos/zephyr/archive/master.tar.gz
# $ tar xf master.tar.gz
2019-08-31 19:00:30 +03:00
# $ cd zephyr-master
# $ source zephyr-env.sh
2020-03-01 05:01:12 +02:00
# $ cd samples/hello_world
# $ mkdir build && cd build
2021-01-24 20:08:51 +02:00
# $ cmake -GNinja -DBOARD=qemu_cortex_a53 ..
# $ ninja run
2020-03-01 05:01:12 +02:00
# Alternative using West:
#
# $ west init testws
# $ cd testws
# $ west update
# $ cd zephyr
2021-01-24 20:08:51 +02:00
# $ west build --pristine=always -b qemu_cortex_a53 samples/hello_world
2020-07-18 18:48:22 +03:00
# $ cd build
# $ ninja run
2020-03-01 05:01:12 +02:00
2020-07-18 18:48:22 +03:00
# Expected output for -b qemu_cortex_m3:
2020-03-01 05:01:12 +02:00
#
2021-01-24 20:08:51 +02:00
# *** Booting Zephyr OS version 2.4.99 ***
# Hello World! qemu_cortex_a53
2020-03-01 05:01:12 +02:00
# More info: https://docs.zephyrproject.org/latest/getting_started/index.html