You are not logged in.

#1 2023-06-06 21:09:44

cdwijs
Member
Registered: 2010-04-24
Posts: 289

PKGBUILD cross compiling sigrok/pulseview for windows, best practices?

Hi All,

I would like to create a PKGBUILD that cross-compiles sigrok and pulseview for windows on an arch linux system.
Ideally, this should create a Windows installer, just like the ones that can be downloaded from the sigrok site:
https://sigrok.org/download/binary/puls … taller.exe

The PKGBUILD should run the steps as outlines here:
http://sigrok.org/gitweb/?p=sigrok-util … ec;hb=HEAD

As this doesn't produce a Linux binary, I wonder how I should deal with the package() part of the PKGBUILD.

What is the best way to use makepkg to automate cross compiling Windows binaries on Arch linux? Are there PKGBUILDs in the AUR that do this?

Cheers,
Cedric

Offline

#2 2023-06-06 21:34:50

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,105
Website

Re: PKGBUILD cross compiling sigrok/pulseview for windows, best practices?

cdwijs wrote:

As this doesn't produce a Linux binary, I wonder how I should deal with the package() part of the PKGBUILD.

What does one have to do with the other?  Packages are not required to contain any binary.  However, I'm not at all clear why you want to create an arch package for windows-only content.  If you don't want to build a package, the a PKGBUILD is the wrong tool for the job.

cdwijs wrote:

What is the best way to use makepkg to automate cross compiling Windows binaries on Arch linux?

This is about the most extreme form of an X-Y question (well, at least after "what's the best way to use a chainsaw to slice hot-out-of-the-oven lasagna?").

cdwijs wrote:

Are there PKGBUILDs in the AUR that do this?

There shouldn't be.  If you have a use for a package file, the a PKGBUILD might be the way to go, but this would never be posted to the AUR because it's not an arch package ... you'd need to start a WUR for that.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2023-06-07 04:59:26

cdwijs
Member
Registered: 2010-04-24
Posts: 289

Re: PKGBUILD cross compiling sigrok/pulseview for windows, best practices?

Trilby wrote:

However, I'm not at all clear why you want to create an arch package for windows-only content.

The Sigrok project does not support building the program from source on Windows, they only support cross compiling from Linux: https://sigrok.org/wiki/Windows#Native_ … sing_MSYS2  The goal is not to obtain an Arch Linux package, the goal is to make building the Windows installer easier. I don't want to create an arch package.

Trilby wrote:

If you don't want to build a package, the a PKGBUILD is the wrong tool for the job.

In principle I agree. But makepkg does do a lot of stuff I need for this job:
- It checks if all the build dependencies are installed on the system, and gives the user a list of packages to install if they are absent.
- It checks if the runtime dependencies are installed on the system, and gives the user a list of packages to install if they are absent. As the user doesn't run the Windows binary, this is not needed.
- It downloads the sourcecode and checks the integrity of the downloaded files.
- It apply's patches if required.
- It runs the required commands to build the program.
- It runs the required commands to install the program without actually installing it into the real system. This confines the generated files to subfolders under the PKGBUILD.
- It packages the generated files into an arch linux package. This is not needed.

Trilby wrote:

This is about the most extreme form of an X-Y question (well, at least after "what's the best way to use a chainsaw to slice hot-out-of-the-oven lasagna?").

What is the best tool for this job?

Trilby wrote:

If you have a use for a package file, the a PKGBUILD might be the way to go, but this would never be posted to the AUR because it's not an arch package

I would like to be able to tell other users to just download the PKGBUILD file, run makepkg, install the list of missing packages, run makepkg again, and end up with the desired Windows installer.

Trilby wrote:

you'd need to start a WUR for that.

What is a WUR?

Offline

#4 2023-06-07 07:33:40

Lone_Wolf
Forum Moderator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,616

Re: PKGBUILD cross compiling sigrok/pulseview for windows, best practices?

WUR probably means Windows User Repository which doesn't exist as far as I know.

You do realize MSYS2 is a 'distro' that allows running linux on windows OS ?
You should look at https://sigrok.org/wiki/Windows#Cross-compile_using_MXE

In theory you could use the sigrok-cross-mingw script to base a PKGBUILD on. You would have to create packages for everything it needs which isn't present in aur or repos .

The first step for such a PKGBUILD would be to run the script as user and check what is needed to get it to compile succesfully.


- It packages the generated files into an arch linux package. This is not needed.

Archlinux packages are archives which make transferring the built files to other systems easier .
makepkg.conf supports many lots of types of archives, zip is one of them and is well-supported on windows .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#5 2023-06-07 11:48:25

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,105
Website

Re: PKGBUILD cross compiling sigrok/pulseview for windows, best practices?

cdwijs wrote:

But makepkg does do a lot of stuff I need for this job:...

No, makepkg doesn't really do much of any of that.  The code that you'd have to put into the PKGBUILD would do that.  A PKGBUILD is just a shell script that is run by makepkg.  So just write a script to do what you need, e.g., (ignoring the elements of your list that you say are needed, but then note are not needed):

cdwijs wrote:

- It checks if all the build dependencies are installed on the system, and gives the user a list of packages to install if they are absent.

pacman -S --asdeps $depends

cdwijs wrote:

- It downloads the sourcecode and checks the integrity of the downloaded files.

curl -O $upstreamurl
sha256sum -c $checksumlist

cdwijs wrote:

- It apply's patches if required.

Well, no, makepkg doesn't do this *at all*.  But it would not be uncommon for a PKGBUILD to include commands like `patch` or `sed` for this purpose.  And those are the exact same commands you'd use without a PKGBUILD

cdwijs wrote:

- It runs the required commands to build the program.
- It runs the required commands to install the program without actually installing it into the real system. This confines the generated files to subfolders under the PKGBUILD.

As above, no it doesn't.  The PKGBUILD may include commands like `configure` and `make` and `make install`, and as above, you can use those yourself. (Though I doubt you'd want to `make install` at all).

Really, a PKGBUILD and makepkg will just get in your way here.  Just put the commands you need to run into a script and be done with it.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB