From 52a8792739f4531b567452c712c7c3a8e31f61a9 Mon Sep 17 00:00:00 2001 From: Raed Rizqie Date: Sun, 27 Jul 2025 19:05:27 +0800 Subject: [PATCH] libmpeg2: update to 0.5.1 - remove mingw32 - install license file --- .../0001-fix-bootstrap.mingw.patch | 11 --- mingw-w64-libmpeg2-git/PKGBUILD | 59 --------------- .../0001-use-system-getopt.patch | 18 +++++ .../0002-libmpeg2-fix-deprecated.patch | 18 +++-- ...ine-breaking-mingw-w64-GCC-5.1.0-C99.patch | 0 .../0004-stringop-overflow.patch | 40 +++++++++++ mingw-w64-libmpeg2/PKGBUILD | 71 +++++++++++++++++++ 7 files changed, 142 insertions(+), 75 deletions(-) delete mode 100644 mingw-w64-libmpeg2-git/0001-fix-bootstrap.mingw.patch delete mode 100644 mingw-w64-libmpeg2-git/PKGBUILD create mode 100644 mingw-w64-libmpeg2/0001-use-system-getopt.patch rename {mingw-w64-libmpeg2-git => mingw-w64-libmpeg2}/0002-libmpeg2-fix-deprecated.patch (63%) rename {mingw-w64-libmpeg2-git => mingw-w64-libmpeg2}/0003-do-not-AC_C_ALWAYS_INLINE-it-redefines-inline-breaking-mingw-w64-GCC-5.1.0-C99.patch (100%) create mode 100644 mingw-w64-libmpeg2/0004-stringop-overflow.patch create mode 100644 mingw-w64-libmpeg2/PKGBUILD diff --git a/mingw-w64-libmpeg2-git/0001-fix-bootstrap.mingw.patch b/mingw-w64-libmpeg2-git/0001-fix-bootstrap.mingw.patch deleted file mode 100644 index 5967bc5569..0000000000 --- a/mingw-w64-libmpeg2-git/0001-fix-bootstrap.mingw.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- libmpeg2-svn-r1206/bootstrap.orig 2013-07-31 05:25:50.960371100 +0000 -+++ libmpeg2-svn-r1206/bootstrap 2013-07-31 05:26:09.387711100 +0000 -@@ -14,8 +14,6 @@ - # The latest version of this script can be found at the following place: - # http://sam.zoy.org/autotools/ - --# Die if an error occurs --set -e - - # Guess whether we are using configure.ac or configure.in - if test -f configure.ac; then diff --git a/mingw-w64-libmpeg2-git/PKGBUILD b/mingw-w64-libmpeg2-git/PKGBUILD deleted file mode 100644 index a6024f71aa..0000000000 --- a/mingw-w64-libmpeg2-git/PKGBUILD +++ /dev/null @@ -1,59 +0,0 @@ -# Maintainer: Alexey Pavlov -# Contributor: Ray Donnelly - -_realname=libmpeg2 -pkgbase=mingw-w64-${_realname}-git -pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}-git" -pkgver=r1108.946bf4b -pkgrel=2 -pkgdesc="Library for decoding MPEG-1 and MPEG-2 video streams (mingw-w64)" -arch=('any') -mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64') -url="https://libmpeg2.sourceforge.io/" -license=("GPL2") -provides=("${MINGW_PACKAGE_PREFIX}-${_realname}") -conflicts=("${MINGW_PACKAGE_PREFIX}-${_realname}-svn") -replaces=("${MINGW_PACKAGE_PREFIX}-${_realname}-svn") -makedepends=("${MINGW_PACKAGE_PREFIX}-cc" "git" "${MINGW_PACKAGE_PREFIX}-autotools") -depends=("${MINGW_PACKAGE_PREFIX}-cc-libs") -source=("${_realname}"::"git+https://code.videolan.org/videolan/libmpeg2.git" - 0001-fix-bootstrap.mingw.patch - 0002-libmpeg2-fix-deprecated.patch - 0003-do-not-AC_C_ALWAYS_INLINE-it-redefines-inline-breaking-mingw-w64-GCC-5.1.0-C99.patch) -sha256sums=('SKIP' - '0ba11aa8ee1aa185dec49790d6c12ed364345fe2ea78616caafa96f1cbd91766' - '4dca32a82a5845f4fcbc26d79ae4fdc5d9ab27cca5c2ae5ea5fa9078a0077eb6' - '8beb78faac22b9a6c37b4ff23663cd83ce894443c02337e427729acd8bd6cce0') - -pkgver() { - cd "${srcdir}/${_realname}" - printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" -} - -prepare() { - cd "${srcdir}"/${_realname} - patch -p1 -i "${srcdir}"/0001-fix-bootstrap.mingw.patch - patch -p1 -i "${srcdir}"/0002-libmpeg2-fix-deprecated.patch - patch -p1 -i "${srcdir}"/0003-do-not-AC_C_ALWAYS_INLINE-it-redefines-inline-breaking-mingw-w64-GCC-5.1.0-C99.patch - - ./bootstrap -} - -build() { - mkdir -p build-${MSYSTEM} && cd build-${MSYSTEM} - - ../${_realname}/configure \ - --prefix=${MINGW_PREFIX} \ - --build=${MINGW_CHOST} \ - --host=${MINGW_CHOST} \ - --enable-shared \ - --enable-static \ - --disable-sdl - - make -} - -package() { - cd "${srcdir}"/build-${MSYSTEM} - make DESTDIR="${pkgdir}" install -} diff --git a/mingw-w64-libmpeg2/0001-use-system-getopt.patch b/mingw-w64-libmpeg2/0001-use-system-getopt.patch new file mode 100644 index 0000000000..88d222710a --- /dev/null +++ b/mingw-w64-libmpeg2/0001-use-system-getopt.patch @@ -0,0 +1,18 @@ +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -5,11 +5,11 @@ + libvo = $(top_builddir)/libvo/libvo.a $(LIBVO_LIBS) + + bin_PROGRAMS = mpeg2dec extract_mpeg2 corrupt_mpeg2 +-mpeg2dec_SOURCES = mpeg2dec.c dump_state.c getopt.c gettimeofday.c ++mpeg2dec_SOURCES = mpeg2dec.c dump_state.c gettimeofday.c + mpeg2dec_LDADD = $(libvo) $(libmpeg2) $(libmpeg2convert) +-extract_mpeg2_SOURCES = extract_mpeg2.c getopt.c +-corrupt_mpeg2_SOURCES = corrupt_mpeg2.c getopt.c ++extract_mpeg2_SOURCES = extract_mpeg2.c ++corrupt_mpeg2_SOURCES = corrupt_mpeg2.c + + man_MANS = mpeg2dec.1 extract_mpeg2.1 + +-EXTRA_DIST = getopt.h gettimeofday.h $(man_MANS) ++EXTRA_DIST = gettimeofday.h $(man_MANS) diff --git a/mingw-w64-libmpeg2-git/0002-libmpeg2-fix-deprecated.patch b/mingw-w64-libmpeg2/0002-libmpeg2-fix-deprecated.patch similarity index 63% rename from mingw-w64-libmpeg2-git/0002-libmpeg2-fix-deprecated.patch rename to mingw-w64-libmpeg2/0002-libmpeg2-fix-deprecated.patch index e6fd8bcccb..158b65640b 100644 --- a/mingw-w64-libmpeg2-git/0002-libmpeg2-fix-deprecated.patch +++ b/mingw-w64-libmpeg2/0002-libmpeg2-fix-deprecated.patch @@ -1,6 +1,14 @@ ---- libmpeg2/libvo/video_out_dx.c 2014-07-11 00:22:33.440400000 +0400 -+++ libmpeg2/libvo/video_out_dx.c.new 2014-07-11 00:22:27.824400000 +0400 -@@ -92,7 +92,7 @@ +--- a/libvo/video_out_dx.c ++++ b/libvo/video_out_dx.c +@@ -34,6 +34,7 @@ + #include "mpeg2.h" + #include "video_out.h" + #include "mpeg2convert.h" ++#include "vo_internal.h" + + #include + #include +@@ -92,7 +93,7 @@ switch (message) { case WM_WINDOWPOSCHANGED: @@ -9,12 +17,12 @@ /* update the window position and size */ point_window.x = 0; -@@ -173,7 +173,7 @@ +@@ -173,7 +174,7 @@ /* store a directx_instance pointer into the window local storage * (for later use in event_handler). * We need to use SetWindowLongPtr when it is available in mingw */ - SetWindowLong (instance->window, GWL_USERDATA, (LONG) instance); -+ SetWindowLongPtr (instance->window, GWLP_USERDATA, (LONG) instance); ++ SetWindowLongPtr (instance->window, GWLP_USERDATA, (LONG_PTR) instance); ShowWindow (instance->window, SW_SHOW); diff --git a/mingw-w64-libmpeg2-git/0003-do-not-AC_C_ALWAYS_INLINE-it-redefines-inline-breaking-mingw-w64-GCC-5.1.0-C99.patch b/mingw-w64-libmpeg2/0003-do-not-AC_C_ALWAYS_INLINE-it-redefines-inline-breaking-mingw-w64-GCC-5.1.0-C99.patch similarity index 100% rename from mingw-w64-libmpeg2-git/0003-do-not-AC_C_ALWAYS_INLINE-it-redefines-inline-breaking-mingw-w64-GCC-5.1.0-C99.patch rename to mingw-w64-libmpeg2/0003-do-not-AC_C_ALWAYS_INLINE-it-redefines-inline-breaking-mingw-w64-GCC-5.1.0-C99.patch diff --git a/mingw-w64-libmpeg2/0004-stringop-overflow.patch b/mingw-w64-libmpeg2/0004-stringop-overflow.patch new file mode 100644 index 0000000000..d62e4f1ab1 --- /dev/null +++ b/mingw-w64-libmpeg2/0004-stringop-overflow.patch @@ -0,0 +1,40 @@ +--- a/src/extract_mpeg2.c ++++ b/src/extract_mpeg2.c +@@ -148,7 +148,7 @@ + return 0; \ + } \ + } else { \ +- memcpy (head_buf, header, bytes); \ ++ memcpy ((void*)head_buf, header, bytes); \ + state = DEMUX_HEADER; \ + state_bytes = bytes; \ + return 0; \ +@@ -437,7 +437,7 @@ + } + if (end != buffer + BUFFER_SIZE) + break; +- memcpy (buffer, buf, end - buf); ++ memcpy ((void*)buffer, buf, end - buf); + buf = buffer + (end - buf); + } + } +--- a/src/mpeg2dec.c ++++ b/src/mpeg2dec.c +@@ -406,7 +406,7 @@ + return 0; \ + } \ + } else { \ +- memcpy (head_buf, header, bytes); \ ++ memcpy ((void*)head_buf, header, bytes); \ + state = DEMUX_HEADER; \ + state_bytes = bytes; \ + return 0; \ +@@ -740,7 +740,7 @@ + } + if (end != buffer + buffer_size) + break; +- memcpy (buffer, buf, end - buf); ++ memcpy ((void*)buffer, buf, end - buf); + buf = buffer + (end - buf); + } while (!sigint); + free (buffer); diff --git a/mingw-w64-libmpeg2/PKGBUILD b/mingw-w64-libmpeg2/PKGBUILD new file mode 100644 index 0000000000..de5ae45a84 --- /dev/null +++ b/mingw-w64-libmpeg2/PKGBUILD @@ -0,0 +1,71 @@ +# Maintainer: Alexey Pavlov +# Contributor: Ray Donnelly + +_realname=libmpeg2 +pkgbase=mingw-w64-${_realname} +pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" +pkgver=0.5.1 +pkgrel=1 +pkgdesc="Library for decoding MPEG-1 and MPEG-2 video streams (mingw-w64)" +arch=('any') +mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64') +url="https://libmpeg2.sourceforge.io/" +license=('spdx:GPL-2.0-or-later') +provides=("${MINGW_PACKAGE_PREFIX}-${_realname}-git") +conflicts=("${MINGW_PACKAGE_PREFIX}-${_realname}-git") +replaces=("${MINGW_PACKAGE_PREFIX}-${_realname}-git") +makedepends=("${MINGW_PACKAGE_PREFIX}-cc" + "${MINGW_PACKAGE_PREFIX}-autotools") +depends=("${MINGW_PACKAGE_PREFIX}-cc-libs") +source=("https://download.videolan.org/contrib/libmpeg2/${_realname}-${pkgver}.tar.gz" + 0001-use-system-getopt.patch + 0002-libmpeg2-fix-deprecated.patch + 0003-do-not-AC_C_ALWAYS_INLINE-it-redefines-inline-breaking-mingw-w64-GCC-5.1.0-C99.patch + 0004-stringop-overflow.patch) +sha256sums=('dee22e893cb5fc2b2b6ebd60b88478ab8556cb3b93f9a0d7ce8f3b61851871d4' + '8df95ae46b9224e9888513137ee8f99423de88973c2c865e30c19f213e6660d8' + '0b9fddc5161ee11d7d0dba559ace98425c2d709b6ab99e130b6ff816444f014a' + '8beb78faac22b9a6c37b4ff23663cd83ce894443c02337e427729acd8bd6cce0' + 'b21d712c563fad8a68d7d7851858fdb041de682929b2e80993a1febdd9ea5f44') + +apply_patch_with_msg() { + for _patch in "$@" + do + msg2 "Applying ${_patch}" + patch -p1 -i "${srcdir}/${_patch}" + done +} + +prepare() { + cd ${_realname}-${pkgver} + + apply_patch_with_msg \ + 0001-use-system-getopt.patch \ + 0002-libmpeg2-fix-deprecated.patch \ + 0003-do-not-AC_C_ALWAYS_INLINE-it-redefines-inline-breaking-mingw-w64-GCC-5.1.0-C99.patch \ + 0004-stringop-overflow.patch + + # Use system getopt.h instead + rm -f src/getopt.h + + autoreconf -fi +} + +build() { + mkdir -p build-${MSYSTEM} && cd build-${MSYSTEM} + + ../${_realname}-${pkgver}/configure \ + --prefix=${MINGW_PREFIX} \ + --enable-shared \ + --enable-static \ + --disable-sdl + + make +} + +package() { + cd build-${MSYSTEM} + make DESTDIR="${pkgdir}" install + + install -Dm644 "${srcdir}"/${_realname}-${pkgver}/COPYING "${pkgdir}"${MINGW_PREFIX}/share/licenses/libmpeg2/LICENSE +}