msys2 / MSYS2-packages

Package scripts for MSYS2.
https://packages.msys2.org
BSD 3-Clause "New" or "Revised" License
1.29k stars 489 forks source link

Building a Windows installer package from a MinGW package #3042

Open s5bug opened 2 years ago

s5bug commented 2 years ago

I'm working on an update to the PKGBUILD for ffmpeg, to update ffmpeg to 5.0.1 and enable quite a few more features. I'd like to be able to use this to build a package I can replace my existing Windows-side ffmpeg with.

image

Is this something Msys2 can do for me automatically?

Biswa96 commented 2 years ago

Do you mean like a standalone installer like GIMP or Inkscape does from msys2/mingw packages? or a pacman pacakge .tar.zst file which can be installed with pacman -U command?

s5bug commented 2 years ago

mingw-makepkg already does the latter right? Currently, I'm meaning the former (or at least a zip that can be directly extracted to C:\Program Files\ffmpeg without issues).

Biswa96 commented 2 years ago

mingw-makepkg already does the latter right?

Yes.

Currently, I'm meaning the former

I am not familiar with creating installer. Others may help with that part. I have seen multiple ways to do it. msys2 creates installer using this repository https://github.com/msys2/msys2-installer. Simple SFX file can also be utilized using this method https://superuser.com/questions/283698/create-7-zip-sfx-executable

Biswa96 commented 2 years ago

Speaking of ffmpeg, the official ffmpeg page provide some link with simple 7zip files here https://ffmpeg.org/download.html#build-windows

1480c1 commented 2 years ago

Another option would be to get the resulting tar.zst (or whatever it is) and untar the specific folders you need, so something like

mkdir temp
cd temp
tar xf  ../*.tar.zst mingw64/{bin,include,lib}

and then zipping it, however, if your binaries requires other shared libraries, unless you are willing to mess around with ntldd, you could try something with pactree and bsdtar with something like

pactree -us mingw-w64-x86_64-ffmpeg |
    sort -u |
    pacman -Sddp - |
    xargs -n 1 sh -c  'curl -Ls "$1" | bsdtar -xv mingw64/bin mingw64/include mingw64/lib' _ 

and strip out the .exes that aren't from ffmpeg from the resulting mingw64/bin folder and zip up the insides of mingw64

s5bug commented 2 years ago

Yes, I'm aware that FFmpeg provides builds: my next goal is to build Kdenlive with support for Hardware Acceleration on my GPU. So, I need FFmpeg in a Mingw64 environment