machinekit / EMCApplication

Machinekit Featured Application for Enhanced Motion Controller from LinuxCNC
GNU General Public License v2.0
14 stars 11 forks source link

building Debian packages with docker #3

Open jallwine opened 4 years ago

jallwine commented 4 years ago

The MachineKit-HAL documentation does a great job explaining how to build Debian packages using docker. Is there a comparable process for EMCApplication?

cerna commented 4 years ago

@jallwine, not in written form. I was planning to implement automatic building in Github Actions, but somehow it is taking longer than expected (procrastination, not that it is somehow complicated).

The LinuxCNC builds natively, there is no support for cross building as far as I know. So I have been using QEMU. You will need to use either multiarch/qemu-user-static (last time I have tried it they were using older version of QEMU with missing one important syscall needed in gLibC), follow direction in this issue or install it from package (for Debian, use the SID version, it has no dependencies).

Then run for Debian 10 Buster and armhf:

 docker run --rm -it -v "$(pwd):/emca/emca" debian:buster@sha256:82c62e2f1ed6045d002f848c1ddd4d910161e1f5007398097ac0f8512d70a969 bash -i
dpkg --print-architecture && uname -m
apt update
apt upgrade
apt install build-essential fakeroot devscripts equivs sudo curl python python3
adduser mk
echo "ALL ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers
chown -R mk:mk /emca
su mk
curl -k \
  'https://dl.cloudsmith.io/public/machinekit/machinekit/cfg/setup/bash.deb.sh' \
  | sudo -E bash
curl -k \
  'https://dl.cloudsmith.io/public/machinekit/machinekit-hal/cfg/setup/bash.deb.sh' \
  | sudo -E bash
debian/configure machinekit-hal no-docs
Patch the debian/changelog last entry to include version line without the - before 1 (2.9.0~pre0.23503.1.git078075e92~buster)
Patch the debian/control file to include python3 specific packages
mk-build-deps -irs sudo
Patch the generated debian/rules file to include --with-python=python3 --with-boost-python=boost_python-py35 in configure stage and also other python2 specific commands
dpkg-buildpackage -us -uc
cp ../*.deb . 

In QEMU it can happen that the automatic @Cloudsmith-io script will have problem with importing keys (this is also reason why I am using the curl -k), so you may be forced to set it up manually: Machinekit repo example.

It takes a quite some time to compile it on my i7-8550u. And as you can see, there is some need for patching. (Basically to copy the LinuxCNC/linuxcnc#943 PR.) I will try to create PR addressing this soon.

The version line problem (2.9.0~pre0.23503.1.git078075e92~buster) is caused by later version of Debian packaging standard used and the fact that EMCApplication is using in-tree packaging, so the Debianization package version number is considered invalid.

I will also create a page in documentation (so I don't forget it again).


Another reason is to install version of Machinekit-HAL (machinekit-hal and machinekit-hal-dev) from before the Python 3 switch - which I just realized is not possible for you.

cerna commented 4 years ago

@jallwine, I have added basic documentation for EMCApplication to the Machinekit website.