wkhtmltopdf / packaging

Packaging of wkhtmltopdf releases
https://wkhtmltopdf.org/downloads.html#stable
305 stars 138 forks source link

Don't use QEMU if host platform is the same as target #85

Closed nstuardod closed 3 years ago

nstuardod commented 3 years ago

Check the machine hardware name and don't require QEMU if building for the same hardware as the host. So basically this allows to build armhf on an armhf machine, or AArch64 on AArch64. In some cases, this can be faster than using QEMU on AMD64 machines.

ashkulz commented 3 years ago

Thanks for the contribution!

Is there some provider who provides access to such machines on an hourly basis? I'd like to verify at least one such "native" build works. Also, from what I understand most of the machines are underpowered so a qemu build is still faster.

ashkulz commented 3 years ago

As an alternative, how about adding --no-qemu and --qemu=OVERRIDE flags, which deletes/changes the qemu key for all targets in main() so the rest of the code doesn't need to deal with this?

nstuardod commented 3 years ago

AFAIK AWS offers EC2 instances with AArch64 processors but I don't know how well they perform on workloads like this one.

By the way, just to check how fast (or slow) would a native ARM build perform, I ran an armhf build on a Raspberry Pi 3B running Ubuntu 20.04.1. Before starting, I had to build an fpm image and create a 256MB swap partition to avoid an OOM situation since this machine has only 1GB of memory. The results are interesting: 2 hours, 27 minutes and 33 seconds.

nstuardod commented 3 years ago

As an alternative, how about adding --no-qemu and --qemu=OVERRIDE flags, which deletes/changes the qemu key for all targets in main() so the rest of the code doesn't need to deal with this?

I decided to reimplement it as you suggest, with both arguments overriding whatever is written in build.yml. I kept the original behavior for convenience though.

nstuardod commented 3 years ago

Dropped due to excessive force pushes. I will open a new PR after cleaning my code.