Skip to content

Instantly share code, notes, and snippets.

@h4tr3d
Created April 10, 2023 00:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h4tr3d/06dcc9d51e378a401fc9c48b397e40ce to your computer and use it in GitHub Desktop.
Save h4tr3d/06dcc9d51e378a401fc9c48b397e40ce to your computer and use it in GitHub Desktop.
Modification for AUR mingw-w64-ffmpeg-minimal to build both static and shared libraries
diff --git a/PKGBUILD b/PKGBUILD
index beb19b3..46ae6f1 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,7 +1,7 @@
# Maintainer: drakkan <nicola.murino at gmail dot com>
pkgname=mingw-w64-ffmpeg-minimal
pkgver=6.0
-pkgrel=1
+pkgrel=2
epoch=1
pkgdesc="Complete solution to record, convert and stream audio and video (mingw-w64)"
arch=('any')
@@ -20,6 +20,7 @@ _tag=3949db4d261748a9f34358a388ee255ad1a7f0c0
source=("git+https://git.ffmpeg.org/ffmpeg.git#tag=${_tag}")
sha256sums=('SKIP')
_architectures="i686-w64-mingw32 x86_64-w64-mingw32"
+_builds="shared static"
pkgver() {
cd ffmpeg
@@ -28,37 +29,40 @@ pkgver() {
build() {
for _arch in ${_architectures}; do
- mkdir -p "${srcdir}"/build-${_arch} && cd "${srcdir}"/build-${_arch}
+ for _build in ${_builds}; do
+ mkdir -p "${srcdir}"/build-${_arch}-${_build} && cd "${srcdir}"/build-${_arch}-${_build}
- "${srcdir}"/ffmpeg/configure \
- --prefix="/usr/${_arch}" \
- --enable-cross-compile \
- --cross-prefix="${_arch}-" \
- --target-os=mingw32 \
- --arch=${_arch%%-*} \
- --disable-debug \
- --disable-stripping \
- --enable-zlib \
- --enable-shared \
- --disable-doc \
- --disable-encoder=flac \
- --x86asmexe=yasm
-
- make
+ "${srcdir}"/ffmpeg/configure \
+ --prefix="/usr/${_arch}" \
+ --enable-cross-compile \
+ --cross-prefix="${_arch}-" \
+ --target-os=mingw32 \
+ --arch=${_arch%%-*} \
+ --disable-debug \
+ --disable-stripping \
+ --enable-zlib \
+ --disable-doc \
+ --disable-encoder=flac \
+ --x86asmexe=yasm \
+ --enable-${_build}
+ make
+ done
done
}
package() {
for _arch in ${_architectures}; do
- cd "${srcdir}"/build-${_arch}
- make DESTDIR="$pkgdir" install
+ for _build in ${_builds}; do
+ cd "${srcdir}"/build-${_arch}-${_build}
+ make DESTDIR="$pkgdir" install
- ${_arch}-strip -s "${pkgdir}"/usr/${_arch}/bin/*.exe
- ${_arch}-strip --strip-unneeded "${pkgdir}"/usr/${_arch}/bin/*.dll
- ${_arch}-strip -g "${pkgdir}"/usr/${_arch}/lib/*.a
+ ${_arch}-strip -s "${pkgdir}"/usr/${_arch}/bin/*.exe
+ ${_arch}-strip -g "${pkgdir}"/usr/${_arch}/lib/*.a
+ [ ${_build} == shared ] && ${_arch}-strip --strip-unneeded "${pkgdir}"/usr/${_arch}/bin/*.dll
- mv "${pkgdir}"/usr/${_arch}/bin/*.lib "${pkgdir}"/usr/${_arch}/lib/
- rm -rf "${pkgdir}"/usr/${_arch}/share
+ [ ${_build} == shared ] && mv "${pkgdir}"/usr/${_arch}/bin/*.lib "${pkgdir}"/usr/${_arch}/lib/
+ rm -rf "${pkgdir}"/usr/${_arch}/share
+ done
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment