I am trying to build this PKGBUILD for ARM in docker.
Is there other way to build for ARM if I have not ARM devices?
PKGBUILD
pkgname=anki-arm64-git
pkgver=2.1.46
pkgrel=2
pkgdesc="Helps you remember facts (like words/phrases in a foreign language) efficiently"
url="http://ankisrs.net/"
license=('AGPL3')
arch=('any')
provides=('anki')
conflicts=('anki' 'anki20' 'anki-official-binary-bundle' 'anki-git')
depends=(
# anki and aqt
'python-beautifulsoup4'
'python-requests'
'python-wheel'
# anki
'python-pysocks' # requests[socks]
'python-decorator'
'python-protobuf'
# 'python-orjson'
'python-distro'
# aqt
'python-send2trash'
'python-markdown'
'python-jsonschema'
'python-pyaudio'
'python-pyqtwebengine'
'python-flask'
'python-flask-cors'
'python-waitress'
'python-pyqt5'
)
makedepends=(
'base-devel'
'curl'
'git'
'clang'
'rust'
'cargo'
'rsync'
'python-pip'
'nodejs'
# PyQt5
'python-pyqt5'
'python-pyqt3d'
'python-pyqt5-networkauth'
'python-pyqtchart'
'python-pyqtdatavisualization'
'python-pyqtpurchasing'
'python-pyqtwebengine'
)
optdepends=(
'lame: record sound'
'mpv: play sound. prefered over mplayer'
'mplayer: play sound'
)
source=(
$pkgname::git+https://github.com/dae/anki.git
#ankitects-anki-core-i18n-master.tar.gz::https://github.com/ankitects/anki-core-i18n/tarball/master
#ankitects-anki-desktop-ftl-master.tar.gz::https://github.com/ankitects/anki-desktop-ftl/tarball/master
#ankitects-anki-desktop-i18n-master.tar.gz::https://github.com/ankitects/anki-desktop-i18n/tarball/master
)
sha512sums=('SKIP')
pkgver() {
cd "$pkgname"
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
prepare() {
cd "$pkgname"
# Disable foring a specific bazel version to build with
rm .bazelversion
# Put translations in place.
#ln -sf "$srcdir"/ankitects-anki-core-i18n-*/ rslib/ftl/repo
#ln -sf "$srcdir"/ankitects-anki-desktop-ftl-*/ qt/ftl/repo
#ln -sf "$srcdir"/ankitects-anki-desktop-i18n-*/ qt/po/repo
}
build() {
export BAZELISK_VER=1.9.0
curl -L https://github.com/bazelbuild/bazelisk/releases/download/v${BAZELISK_VER}/bazelisk-linux-arm64 -o ./bazel
chmod +x bazel && mv bazel /usr/local/bin/
cd "$pkgname"
echo "build --action_env=PYTHON_SITE_PACKAGES=/usr/lib/python3.9/site-packages" >> user.bazelrc
rm -rf bazel-dist
bazel build -k --config opt dist
}
package() {
cd "$pkgname"
PIP_CONFIG_FILE=/dev/null pip install --isolated --root="$pkgdir" --ignore-installed --no-deps bazel-bin/pylib/anki/anki-*.whl bazel-bin/qt/aqt/aqt-*.whl
install -Dm755 qt/runanki.py "$pkgdir"/usr/bin/anki
install -Dm644 qt/linux/anki.desktop "$pkgdir"/usr/share/applications/anki.desktop
install -Dm644 qt/linux/anki.png "$pkgdir"/usr/share/pixmaps/anki.png
}
I run following github workflow to build it
build.yml
name: Docker Image CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: |
sudo apt-get install -q -y qemu binfmt-support qemu-user-static
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
wget https://osdn.net/projects/manjaro-arm/storage/.rootfs/Manjaro-ARM-aarch64-latest.tar.gz
mkdir manjaro-fs
tar -xvf Manjaro-ARM-aarch64-latest.tar.gz -C manjaro-fs/
cd manjaro-fs/
echo "nameserver 8.8.8.8" > etc/resolv.conf
cp ../Dockerfile .
cp ../PKGBUILD .
sudo docker build --tag manjaro-rootfs:latest .
This is Dockerfile file building it.
Dockerfile
## Create rootfs from scratch
FROM scratch
ADD . /
RUN uname -a
## Update and install the base and sudo packages
## RUN pacman-mirrors -gf
RUN pacman-mirrors --country Germany,France,Austria \
&& pacman-key --init \
&& pacman-key --populate \
&& pacman -Syyuu --noconfirm base sudo manjaro-release
## Add new user account
RUN whoami
RUN pacman -Sy --noconfirm rsync curl git rust cargo nodejs
RUN pacman -Sy --noconfirm python-pyqt5 python-pyqt3d python-pyqt5-networkauth python-pyqtchart python-pyqtdatavisualization python-pyqtpurchasing python-pyqtwebengine
RUN pacman -Sy --noconfirm --needed base-devel
RUN pacman -S --needed --noconfirm sudo
RUN useradd -m -G wheel -s /bin/bash manjaro
RUN passwd -d manjaro
RUN sed -i -e "/root ALL=(ALL) ALL/a manjaro ALL=(ALL) ALL" -e "s/# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/" /etc/sudoers
RUN echo "exec su - manjaro" > /root/.bash_profile
USER manjaro
RUN whoami
RUN pwd
RUN cp PKGBUILD $HOME
RUN cd $HOME
RUN makepkg
But I get these errors. I have tried ti chown
and chmod change the file permission like in Dockerfile but didn’t work.
RUN chmod o+w .
Errors
Step 17/19 : RUN cp PKGBUILD $HOME
---> Running in a5962de5733e
Removing intermediate container a5962de5733e
---> ac2c739b43fe
Step 18/19 : RUN cd $HOME
---> Running in 2cd1199bccd1
Removing intermediate container 2cd1199bccd1
---> d7ab7875e081
Step 19/19 : RUN makepkg
---> Running in 0ecc0390ae64
==> ERROR: You do not have write permission for the directory $BUILDDIR (/).
Aborting...
The command '/bin/sh -c makepkg' returned a non-zero code: 11