From 45dc1d8ca982793b4ebbde12723558f12c9791c9 Mon Sep 17 00:00:00 2001
From: Thomas Guillem <thomas@gllm.fr>
Date: Thu, 6 Jul 2023 17:17:51 +0200
Subject: [PATCH 01/12] buildsystem/get_vlc.sh: make it work from any paths

(cherry picked from commit 859811fc5c54414837b12503de872ead88ca69f0)
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
---
 buildsystem/get-vlc.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/buildsystem/get-vlc.sh b/buildsystem/get-vlc.sh
index 38edd8d..ca61dec 100755
--- a/buildsystem/get-vlc.sh
+++ b/buildsystem/get-vlc.sh
@@ -1,6 +1,8 @@
 #! /bin/sh
 set -e
 
+LIBVLCJNI_SRC_DIR="$(cd "$(dirname "$0")"; pwd -P)/.."
+PATCHES_DIR=$LIBVLCJNI_SRC_DIR/libvlc/patches/vlc3
 #############
 # FUNCTIONS #
 #############
@@ -78,7 +80,7 @@ if [ ! -d "vlc" ]; then
     git reset --hard ${VLC_TESTED_HASH} || fail "VLC sources: VLC_TESTED_HASH ${VLC_TESTED_HASH} not found"
     diagnostic "VLC sources: applying custom patches"
     # Keep Message-Id inside commits description to track them afterwards
-    git am --message-id ../libvlcjni/libvlc/patches/vlc3/*.patch || fail "VLC sources: cannot apply custom patches"
+    git am --message-id $PATCHES_DIR/*.patch || fail "VLC sources: cannot apply custom patches"
     cd ..
 else
     diagnostic "VLC source: found sources, leaving untouched"
@@ -88,7 +90,7 @@ if [ "$BYPASS_VLC_SRC_CHECKS" = 1 ]; then
 elif [ $RESET -eq 1 ]; then
     cd vlc
     git reset --hard ${VLC_TESTED_HASH} || fail "VLC sources: VLC_TESTED_HASH ${VLC_TESTED_HASH} not found"
-    for patch_file in ../libvlcjni/libvlc/patches/vlc3/*.patch; do
+    for patch_file in $PATCHES_DIR/*.patch; do
         git am --message-id $patch_file
         check_patch_is_applied "$patch_file"
     done
@@ -99,7 +101,7 @@ else
     cd vlc
     git cat-file -e ${VLC_TESTED_HASH} 2> /dev/null || \
         fail "Error: Your vlc checkout does not contain the latest tested commit: ${VLC_TESTED_HASH}"
-    for patch_file in ../libvlcjni/libvlc/patches/vlc3/*.patch; do
+    for patch_file in $PATCHES_DIR/*.patch; do
         check_patch_is_applied "$patch_file"
     done
     cd ..
-- 
GitLab


From 981f3a5a86bfa047388f60ff678c3861ce418aec Mon Sep 17 00:00:00 2001
From: Thomas Guillem <thomas@gllm.fr>
Date: Fri, 7 Jul 2023 13:54:06 +0200
Subject: [PATCH 02/12] buildsystem: move vlc3 patches and remove vlc4 ones

---
 buildsystem/get-vlc.sh                        |  2 +-
 ...at-Workaround-sendmsg-bug-on-android.patch |  0
 ...bvlc-events-Add-callbacks-for-record.patch |  0
 ...tls-Handle-errors-from-older-kernels.patch |  0
 ...file-Add-error-dialog-for-write-open.patch |  0
 ...ibvlc-media_player-Add-record-method.patch |  0
 ...006-input-es_out-set-video-exclusive.patch |  0
 ..._ReadLine-increase-line-length-limit.patch |  0
 ...ract-attachment-also-when-preparsing.patch |  0
 ...t-display-discoverer-preparsers-logs.patch |  0
 ...4.0-patches-to-allow-preparsing-of-n.patch |  0
 ...a_player-backport-fast-seek-argument.patch |  0
 ...track-rework-DynamicsProcessing-stop.patch |  0
 ...android-process-formatted-text-nodes.patch |  0
 ...aglib-Fix-extraction-of-AAC-metadata.patch |  0
 ...e-system-keystore-from-the-first-try.patch |  0
 ...ystore-return-false-when-interrupted.patch |  0
 ...andle-vlc_credential_get-interruptio.patch |  0
 .../0018-access-add-a-cache-helper.patch      |  0
 .../0019-dsm-use-the-cache-helper.patch       |  0
 .../0020-smb2-use-the-cache-helper.patch      |  0
 ...-android-implement-net-intf-priority.patch |  0
 ...at-Workaround-sendmsg-bug-on-android.patch | 82 -------------------
 ...android-process-formatted-text-nodes.patch | 54 ------------
 ...tls-Handle-errors-from-older-kernels.patch | 42 ----------
 ...file-Add-error-dialog-for-write-open.patch | 43 ----------
 26 files changed, 1 insertion(+), 222 deletions(-)
 rename libvlc/patches/{vlc3 => }/0001-compat-Workaround-sendmsg-bug-on-android.patch (100%)
 rename libvlc/patches/{vlc3 => }/0002-libvlc-events-Add-callbacks-for-record.patch (100%)
 rename libvlc/patches/{vlc3 => }/0003-network-tls-Handle-errors-from-older-kernels.patch (100%)
 rename libvlc/patches/{vlc3 => }/0004-access_output-file-Add-error-dialog-for-write-open.patch (100%)
 rename libvlc/patches/{vlc3 => }/0005-libvlc-media_player-Add-record-method.patch (100%)
 rename libvlc/patches/{vlc3 => }/0006-input-es_out-set-video-exclusive.patch (100%)
 rename libvlc/patches/{vlc3 => }/0007-stream_ReadLine-increase-line-length-limit.patch (100%)
 rename libvlc/patches/{vlc3 => }/0008-input-Extract-attachment-also-when-preparsing.patch (100%)
 rename libvlc/patches/{vlc3 => }/0009-input-display-discoverer-preparsers-logs.patch (100%)
 rename libvlc/patches/{vlc3 => }/0010-taglib-Backport-4.0-patches-to-allow-preparsing-of-n.patch (100%)
 rename libvlc/patches/{vlc3 => }/0011-media_player-backport-fast-seek-argument.patch (100%)
 rename libvlc/patches/{vlc3 => }/0012-audiotrack-rework-DynamicsProcessing-stop.patch (100%)
 rename libvlc/patches/{vlc3 => }/0013-freetype-android-process-formatted-text-nodes.patch (100%)
 rename libvlc/patches/{vlc3 => }/0014-taglib-Fix-extraction-of-AAC-metadata.patch (100%)
 rename libvlc/patches/{vlc3 => }/0015-keystore-use-the-system-keystore-from-the-first-try.patch (100%)
 rename libvlc/patches/{vlc3 => }/0016-keystore-return-false-when-interrupted.patch (100%)
 rename libvlc/patches/{vlc3 => }/0017-modules-access-handle-vlc_credential_get-interruptio.patch (100%)
 rename libvlc/patches/{vlc3 => }/0018-access-add-a-cache-helper.patch (100%)
 rename libvlc/patches/{vlc3 => }/0019-dsm-use-the-cache-helper.patch (100%)
 rename libvlc/patches/{vlc3 => }/0020-smb2-use-the-cache-helper.patch (100%)
 rename libvlc/patches/{vlc3 => }/0021-upnp-android-implement-net-intf-priority.patch (100%)
 delete mode 100644 libvlc/patches/vlc4/0001-compat-Workaround-sendmsg-bug-on-android.patch
 delete mode 100644 libvlc/patches/vlc4/0001-freetype-android-process-formatted-text-nodes.patch
 delete mode 100644 libvlc/patches/vlc4/0002-network-tls-Handle-errors-from-older-kernels.patch
 delete mode 100644 libvlc/patches/vlc4/0003-access_output-file-Add-error-dialog-for-write-open.patch

diff --git a/buildsystem/get-vlc.sh b/buildsystem/get-vlc.sh
index ca61dec..e95dd26 100755
--- a/buildsystem/get-vlc.sh
+++ b/buildsystem/get-vlc.sh
@@ -2,7 +2,7 @@
 set -e
 
 LIBVLCJNI_SRC_DIR="$(cd "$(dirname "$0")"; pwd -P)/.."
-PATCHES_DIR=$LIBVLCJNI_SRC_DIR/libvlc/patches/vlc3
+PATCHES_DIR=$LIBVLCJNI_SRC_DIR/libvlc/patches
 #############
 # FUNCTIONS #
 #############
diff --git a/libvlc/patches/vlc3/0001-compat-Workaround-sendmsg-bug-on-android.patch b/libvlc/patches/0001-compat-Workaround-sendmsg-bug-on-android.patch
similarity index 100%
rename from libvlc/patches/vlc3/0001-compat-Workaround-sendmsg-bug-on-android.patch
rename to libvlc/patches/0001-compat-Workaround-sendmsg-bug-on-android.patch
diff --git a/libvlc/patches/vlc3/0002-libvlc-events-Add-callbacks-for-record.patch b/libvlc/patches/0002-libvlc-events-Add-callbacks-for-record.patch
similarity index 100%
rename from libvlc/patches/vlc3/0002-libvlc-events-Add-callbacks-for-record.patch
rename to libvlc/patches/0002-libvlc-events-Add-callbacks-for-record.patch
diff --git a/libvlc/patches/vlc3/0003-network-tls-Handle-errors-from-older-kernels.patch b/libvlc/patches/0003-network-tls-Handle-errors-from-older-kernels.patch
similarity index 100%
rename from libvlc/patches/vlc3/0003-network-tls-Handle-errors-from-older-kernels.patch
rename to libvlc/patches/0003-network-tls-Handle-errors-from-older-kernels.patch
diff --git a/libvlc/patches/vlc3/0004-access_output-file-Add-error-dialog-for-write-open.patch b/libvlc/patches/0004-access_output-file-Add-error-dialog-for-write-open.patch
similarity index 100%
rename from libvlc/patches/vlc3/0004-access_output-file-Add-error-dialog-for-write-open.patch
rename to libvlc/patches/0004-access_output-file-Add-error-dialog-for-write-open.patch
diff --git a/libvlc/patches/vlc3/0005-libvlc-media_player-Add-record-method.patch b/libvlc/patches/0005-libvlc-media_player-Add-record-method.patch
similarity index 100%
rename from libvlc/patches/vlc3/0005-libvlc-media_player-Add-record-method.patch
rename to libvlc/patches/0005-libvlc-media_player-Add-record-method.patch
diff --git a/libvlc/patches/vlc3/0006-input-es_out-set-video-exclusive.patch b/libvlc/patches/0006-input-es_out-set-video-exclusive.patch
similarity index 100%
rename from libvlc/patches/vlc3/0006-input-es_out-set-video-exclusive.patch
rename to libvlc/patches/0006-input-es_out-set-video-exclusive.patch
diff --git a/libvlc/patches/vlc3/0007-stream_ReadLine-increase-line-length-limit.patch b/libvlc/patches/0007-stream_ReadLine-increase-line-length-limit.patch
similarity index 100%
rename from libvlc/patches/vlc3/0007-stream_ReadLine-increase-line-length-limit.patch
rename to libvlc/patches/0007-stream_ReadLine-increase-line-length-limit.patch
diff --git a/libvlc/patches/vlc3/0008-input-Extract-attachment-also-when-preparsing.patch b/libvlc/patches/0008-input-Extract-attachment-also-when-preparsing.patch
similarity index 100%
rename from libvlc/patches/vlc3/0008-input-Extract-attachment-also-when-preparsing.patch
rename to libvlc/patches/0008-input-Extract-attachment-also-when-preparsing.patch
diff --git a/libvlc/patches/vlc3/0009-input-display-discoverer-preparsers-logs.patch b/libvlc/patches/0009-input-display-discoverer-preparsers-logs.patch
similarity index 100%
rename from libvlc/patches/vlc3/0009-input-display-discoverer-preparsers-logs.patch
rename to libvlc/patches/0009-input-display-discoverer-preparsers-logs.patch
diff --git a/libvlc/patches/vlc3/0010-taglib-Backport-4.0-patches-to-allow-preparsing-of-n.patch b/libvlc/patches/0010-taglib-Backport-4.0-patches-to-allow-preparsing-of-n.patch
similarity index 100%
rename from libvlc/patches/vlc3/0010-taglib-Backport-4.0-patches-to-allow-preparsing-of-n.patch
rename to libvlc/patches/0010-taglib-Backport-4.0-patches-to-allow-preparsing-of-n.patch
diff --git a/libvlc/patches/vlc3/0011-media_player-backport-fast-seek-argument.patch b/libvlc/patches/0011-media_player-backport-fast-seek-argument.patch
similarity index 100%
rename from libvlc/patches/vlc3/0011-media_player-backport-fast-seek-argument.patch
rename to libvlc/patches/0011-media_player-backport-fast-seek-argument.patch
diff --git a/libvlc/patches/vlc3/0012-audiotrack-rework-DynamicsProcessing-stop.patch b/libvlc/patches/0012-audiotrack-rework-DynamicsProcessing-stop.patch
similarity index 100%
rename from libvlc/patches/vlc3/0012-audiotrack-rework-DynamicsProcessing-stop.patch
rename to libvlc/patches/0012-audiotrack-rework-DynamicsProcessing-stop.patch
diff --git a/libvlc/patches/vlc3/0013-freetype-android-process-formatted-text-nodes.patch b/libvlc/patches/0013-freetype-android-process-formatted-text-nodes.patch
similarity index 100%
rename from libvlc/patches/vlc3/0013-freetype-android-process-formatted-text-nodes.patch
rename to libvlc/patches/0013-freetype-android-process-formatted-text-nodes.patch
diff --git a/libvlc/patches/vlc3/0014-taglib-Fix-extraction-of-AAC-metadata.patch b/libvlc/patches/0014-taglib-Fix-extraction-of-AAC-metadata.patch
similarity index 100%
rename from libvlc/patches/vlc3/0014-taglib-Fix-extraction-of-AAC-metadata.patch
rename to libvlc/patches/0014-taglib-Fix-extraction-of-AAC-metadata.patch
diff --git a/libvlc/patches/vlc3/0015-keystore-use-the-system-keystore-from-the-first-try.patch b/libvlc/patches/0015-keystore-use-the-system-keystore-from-the-first-try.patch
similarity index 100%
rename from libvlc/patches/vlc3/0015-keystore-use-the-system-keystore-from-the-first-try.patch
rename to libvlc/patches/0015-keystore-use-the-system-keystore-from-the-first-try.patch
diff --git a/libvlc/patches/vlc3/0016-keystore-return-false-when-interrupted.patch b/libvlc/patches/0016-keystore-return-false-when-interrupted.patch
similarity index 100%
rename from libvlc/patches/vlc3/0016-keystore-return-false-when-interrupted.patch
rename to libvlc/patches/0016-keystore-return-false-when-interrupted.patch
diff --git a/libvlc/patches/vlc3/0017-modules-access-handle-vlc_credential_get-interruptio.patch b/libvlc/patches/0017-modules-access-handle-vlc_credential_get-interruptio.patch
similarity index 100%
rename from libvlc/patches/vlc3/0017-modules-access-handle-vlc_credential_get-interruptio.patch
rename to libvlc/patches/0017-modules-access-handle-vlc_credential_get-interruptio.patch
diff --git a/libvlc/patches/vlc3/0018-access-add-a-cache-helper.patch b/libvlc/patches/0018-access-add-a-cache-helper.patch
similarity index 100%
rename from libvlc/patches/vlc3/0018-access-add-a-cache-helper.patch
rename to libvlc/patches/0018-access-add-a-cache-helper.patch
diff --git a/libvlc/patches/vlc3/0019-dsm-use-the-cache-helper.patch b/libvlc/patches/0019-dsm-use-the-cache-helper.patch
similarity index 100%
rename from libvlc/patches/vlc3/0019-dsm-use-the-cache-helper.patch
rename to libvlc/patches/0019-dsm-use-the-cache-helper.patch
diff --git a/libvlc/patches/vlc3/0020-smb2-use-the-cache-helper.patch b/libvlc/patches/0020-smb2-use-the-cache-helper.patch
similarity index 100%
rename from libvlc/patches/vlc3/0020-smb2-use-the-cache-helper.patch
rename to libvlc/patches/0020-smb2-use-the-cache-helper.patch
diff --git a/libvlc/patches/vlc3/0021-upnp-android-implement-net-intf-priority.patch b/libvlc/patches/0021-upnp-android-implement-net-intf-priority.patch
similarity index 100%
rename from libvlc/patches/vlc3/0021-upnp-android-implement-net-intf-priority.patch
rename to libvlc/patches/0021-upnp-android-implement-net-intf-priority.patch
diff --git a/libvlc/patches/vlc4/0001-compat-Workaround-sendmsg-bug-on-android.patch b/libvlc/patches/vlc4/0001-compat-Workaround-sendmsg-bug-on-android.patch
deleted file mode 100644
index ca86c5f..0000000
--- a/libvlc/patches/vlc4/0001-compat-Workaround-sendmsg-bug-on-android.patch
+++ /dev/null
@@ -1,82 +0,0 @@
-From dfab4e10f396671cfa1c48a9ab0b9f4443946321 Mon Sep 17 00:00:00 2001
-Message-Id: <dfab4e10f396671cfa1c48a9ab0b9f4443946321.1571236616.git.rom@rom1v.com>
-From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
-Date: Thu, 28 Mar 2019 15:23:48 +0100
-Subject: [PATCH 1/3] compat: Workaround sendmsg bug on android
-
-This only happens on 64bits builds, see compat/sendmsg.c comments
----
- compat/sendmsg.c      | 24 ++++++++++++++++++++++++
- configure.ac          |  3 +++
- include/vlc_network.h |  6 ++++++
- 3 files changed, 33 insertions(+)
-
-diff --git a/compat/sendmsg.c b/compat/sendmsg.c
-index 0b08ce0942..2ef542eb7b 100644
---- a/compat/sendmsg.c
-+++ b/compat/sendmsg.c
-@@ -133,6 +133,30 @@ ssize_t sendmsg(int fd, const struct msghdr *msg, int flags)
-     free(data);
-     return res;
- }
-+#elif defined(__ANDROID__) && defined(__aarch64__)
-+
-+#undef sendmsg
-+
-+#include <sys/types.h>
-+#include <sys/socket.h>
-+
-+/**
-+ * Since we bumped the NDK version from 14 to 18, some devices (at least up to
-+ * Android 6) are returning errors on 4 bytes, even though ssize_t is actually
-+ * 8 bytes. This causes `value < 0` checks to yield false, and consider the value
-+ * as a non error.
-+ * As the patch lies in either the NDK or the Android kernel, or the device libc
-+ * we can only work around it. If errno is not 0 & we receive -1, on 32bits or
-+ * 64bits, we assume an error was returned.
-+ */
-+ssize_t vlc_sendmsg(int fd, const struct msghdr *msg, int flags)
-+{
-+    errno = 0;
-+    ssize_t ret = sendmsg(fd, msg, flags);
-+    if ((ret < 0 || ret == 0xFFFFFFFF) && errno != 0)
-+        return -1;
-+    return ret;
-+}
- 
- #else
- #error sendmsg not implemented on your platform!
-diff --git a/configure.ac b/configure.ac
-index 210b4ca537..3d72781883 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -415,6 +415,9 @@ AS_IF([test "$SYS" = linux],[
-     ],[
-       HAVE_ANDROID="1"
-       AC_MSG_RESULT([yes])
-+      AS_IF([test "${host_cpu}" = "aarch64"], [
-+          AC_LIBOBJ([sendmsg])
-+      ])
-     ],[
-       AC_MSG_RESULT([no])
-     ])
-diff --git a/include/vlc_network.h b/include/vlc_network.h
-index 88dcfefbca..17cdca6198 100644
---- a/include/vlc_network.h
-+++ b/include/vlc_network.h
-@@ -296,6 +296,12 @@ static inline int net_GetPeerAddress( int fd, char *address, int *port )
- 
- VLC_API char *vlc_getProxyUrl(const char *);
- 
-+#if defined(__ANDROID__) && defined(__aarch64__)
-+struct msghdr;
-+ssize_t vlc_sendmsg(int fd, const struct msghdr *msg, int flags);
-+#define sendmsg(a, b, c) vlc_sendmsg(a,b,c)
-+#endif
-+
- # ifdef __cplusplus
- }
- # endif
--- 
-2.23.0
-
diff --git a/libvlc/patches/vlc4/0001-freetype-android-process-formatted-text-nodes.patch b/libvlc/patches/vlc4/0001-freetype-android-process-formatted-text-nodes.patch
deleted file mode 100644
index 9aa821a..0000000
--- a/libvlc/patches/vlc4/0001-freetype-android-process-formatted-text-nodes.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From 4218d5fca526010c8cfd412c55f53cc367e76bd5 Mon Sep 17 00:00:00 2001
-Message-Id: <4218d5fca526010c8cfd412c55f53cc367e76bd5.1638525655.git.hugo@beauzee.fr>
-From: Francois Cartegnie <fcvlcdev@free.fr>
-Date: Thu, 2 Dec 2021 10:06:28 +0100
-Subject: [PATCH] freetype: android: process formatted text nodes
-
-Trims filenames as they are not stored as attributes.
-
-Also removes incorrect asprintf 0 return value handling
----
- .../text_renderer/freetype/fonts/android.c    | 26 +++++++++++++++++--
- 1 file changed, 24 insertions(+), 2 deletions(-)
-
-diff --git a/modules/text_renderer/freetype/fonts/android.c b/modules/text_renderer/freetype/fonts/android.c
-index 6712640d48..c395bb2626 100644
---- a/modules/text_renderer/freetype/fonts/android.c
-+++ b/modules/text_renderer/freetype/fonts/android.c
-@@ -84,9 +84,31 @@ static int Android_ParseFont( vlc_font_select_t *fs, xml_reader_t *p_xml,
-      * We don't need all font weights. Only 400 (regular) and 700 (bold)
-      */
-     if( i_weight == 400 || i_weight == 700 )
--        if( asprintf( &psz_fontfile, "%s/%s", SYSTEM_FONT_PATH, psz_val ) < 0
--         || !NewFont( psz_fontfile, 0, i_flags, p_family ) )
-+    {
-+        /* left trim */
-+        psz_val += strspn( psz_val, " \t\r\n" );
-+        /* right trim */
-+        size_t len = strlen( psz_val );
-+        const char *psz_end = psz_val + len;
-+        while( psz_end > psz_val &&
-+               ( psz_end[-1] == ' ' ||
-+                 psz_end[-1] == '\t' ||
-+                 psz_end[-1] == '\r' ||
-+                 psz_end[-1] == '\n' ) )
-+            psz_end--;
-+        len = psz_end - psz_val;
-+
-+        psz_fontfile = malloc( sizeof(SYSTEM_FONT_PATH) + 1 + len );
-+        if( !psz_fontfile )
-+            return VLC_ENOMEM;
-+        memcpy( psz_fontfile, SYSTEM_FONT_PATH, sizeof(SYSTEM_FONT_PATH) - 1 );
-+        psz_fontfile[sizeof(SYSTEM_FONT_PATH) - 1] = '/';
-+        memcpy( &psz_fontfile[sizeof(SYSTEM_FONT_PATH)], psz_val, len );
-+        psz_fontfile[sizeof(SYSTEM_FONT_PATH) + len] = '\0';
-+
-+        if( !NewFont( psz_fontfile, 0, i_flags, p_family ) )
-             return VLC_ENOMEM;
-+    }
- 
-     return VLC_SUCCESS;
- }
--- 
-2.33.0
-
diff --git a/libvlc/patches/vlc4/0002-network-tls-Handle-errors-from-older-kernels.patch b/libvlc/patches/vlc4/0002-network-tls-Handle-errors-from-older-kernels.patch
deleted file mode 100644
index 112cc7e..0000000
--- a/libvlc/patches/vlc4/0002-network-tls-Handle-errors-from-older-kernels.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 1ac1a72efed635e5d6c59db61e056cef08756ed1 Mon Sep 17 00:00:00 2001
-Message-Id: <1ac1a72efed635e5d6c59db61e056cef08756ed1.1571236616.git.rom@rom1v.com>
-In-Reply-To: <dfab4e10f396671cfa1c48a9ab0b9f4443946321.1571236616.git.rom@rom1v.com>
-References: <dfab4e10f396671cfa1c48a9ab0b9f4443946321.1571236616.git.rom@rom1v.com>
-From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
-Date: Fri, 29 Mar 2019 10:56:26 +0100
-Subject: [PATCH 2/3] network: tls: Handle errors from older kernels
-
-If MSG_FASTOPEN is defined, but turns out to be unimplemented by the
-underlying kernel (as is the case on android where the NDK claims to
-support fast open but some older kernels don't) EPIPE is returned
-instead of EOPNOTSUPP.
-See net/ipv4/tcp.c:936 & net/core/stream.c:55
-sk_stream_wait_connect will return EPIPE if no SYN was sent/received,
-and sendmsg will propagate that error.
-Treating EPIPE as a synonym for EOPNOTSUPP here allows for the
-connection to proceed, and the first call to sendmsg to complete as
-expected.
----
- src/network/stream.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/src/network/stream.c b/src/network/stream.c
-index 5a24bd7134..0b9b1573d7 100644
---- a/src/network/stream.c
-+++ b/src/network/stream.c
-@@ -383,8 +383,11 @@ static ssize_t vlc_tls_ConnectWrite(vlc_tls_t *tls,
-             return -1;
-     }
-     else
--    if (errno != EOPNOTSUPP)
-+    if (errno != EOPNOTSUPP && errno != EPIPE)
-+    { /* If MSG_FASTOPEN was defined but the kernel doesn't support fast open at
-+        all, EPIPE will be returned instead of EOPNOTSUPP */
-         return -1;
-+    }
-     /* Fast open not supported or disabled... fallback to normal mode */
- #endif
- 
--- 
-2.23.0
-
diff --git a/libvlc/patches/vlc4/0003-access_output-file-Add-error-dialog-for-write-open.patch b/libvlc/patches/vlc4/0003-access_output-file-Add-error-dialog-for-write-open.patch
deleted file mode 100644
index f1f2c3e..0000000
--- a/libvlc/patches/vlc4/0003-access_output-file-Add-error-dialog-for-write-open.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From cba62e75c2be117abfdeea091f030ff7e252bfec Mon Sep 17 00:00:00 2001
-Message-Id: <cba62e75c2be117abfdeea091f030ff7e252bfec.1571236616.git.rom@rom1v.com>
-In-Reply-To: <dfab4e10f396671cfa1c48a9ab0b9f4443946321.1571236616.git.rom@rom1v.com>
-References: <dfab4e10f396671cfa1c48a9ab0b9f4443946321.1571236616.git.rom@rom1v.com>
-From: Soomin Lee <bubu@mikan.io>
-Date: Mon, 1 Oct 2018 15:37:57 +0200
-Subject: [PATCH 3/3] access_output: file: Add error dialog for write/open
-
----
- modules/access_output/file.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-diff --git a/modules/access_output/file.c b/modules/access_output/file.c
-index c983e3a8f0..8a690fc41f 100644
---- a/modules/access_output/file.c
-+++ b/modules/access_output/file.c
-@@ -87,6 +87,9 @@ static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
-         {
-             if (errno == EINTR)
-                 continue;
-+            if (errno == ENOSPC)
-+                vlc_dialog_display_error(p_access, "record",
-+                                         "An error occurred during recording. Error: %s", vlc_strerror_c(errno));
-             block_ChainRelease (p_buffer);
-             msg_Err( p_access, "cannot write: %s", vlc_strerror_c(errno) );
-             return -1;
-@@ -304,8 +307,13 @@ static int Open( vlc_object_t *p_this )
-             if (fd != -1)
-                 break;
-             if (fd == -1)
-+            {
-                 msg_Err (p_access, "cannot create %s: %s", path,
-                          vlc_strerror_c(errno));
-+
-+                vlc_dialog_display_error(p_access, "record",
-+                                         "An error occurred during recording. Error: %s", vlc_strerror_c(errno));
-+            }
-             if (overwrite || errno != EEXIST)
-                 break;
-             flags &= ~O_EXCL;
--- 
-2.23.0
-
-- 
GitLab


From 3e96c6475cf37dd46797ce733d8676b69e0b7fa1 Mon Sep 17 00:00:00 2001
From: Francois Cartegnie <fcvlcdev@free.fr>
Date: Wed, 30 Nov 2022 14:01:36 +0100
Subject: [PATCH 03/12] compile_libvlc.sh: add directory argument when
 generating pc

(cherry picked from commit 4a134adbcaeeae4c7887c9038d2d23a9ccf8719e)
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
---
 buildsystem/compile-libvlc.sh | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/buildsystem/compile-libvlc.sh b/buildsystem/compile-libvlc.sh
index 47c3d29..d70e21d 100755
--- a/buildsystem/compile-libvlc.sh
+++ b/buildsystem/compile-libvlc.sh
@@ -219,12 +219,13 @@ avlc_get_symbol()
 
 avlc_gen_pc_file()
 {
-echo "Generating $1 pkg-config file"
-echo "Name: $1
-Description: $1
-Version: $2
-Libs: -l$1
-Cflags:" > contrib/${TARGET_TUPLE}/lib/pkgconfig/$(echo $1|tr 'A-Z' 'a-z').pc
+echo -n "Generating $2 pkg-config file"
+echo $1/$(echo $2|tr 'A-Z' 'a-z').pc
+echo "Name: $2
+Description: $2
+Version: $3
+Libs: -l$2
+Cflags:" > $1/$(echo $2|tr 'A-Z' 'a-z').pc
 }
 
 avlc_pkgconfig()
@@ -448,9 +449,8 @@ fi
 echo "Building the contribs"
 mkdir -p contrib/contrib-android-${TARGET_TUPLE}
 
-mkdir -p contrib/${TARGET_TUPLE}/lib/pkgconfig
-avlc_gen_pc_file EGL 1.1
-avlc_gen_pc_file GLESv2 2
+avlc_gen_pc_file contrib/${TARGET_TUPLE}/lib/pkgconfig EGL 1.1
+avlc_gen_pc_file contrib/${TARGET_TUPLE}/lib/pkgconfig GLESv2 2
 
 cd contrib/contrib-android-${TARGET_TUPLE}
 
-- 
GitLab


From f66b49d9640c59ffa527f59a701d7b1c2452a414 Mon Sep 17 00:00:00 2001
From: Francois Cartegnie <fcvlcdev@free.fr>
Date: Wed, 30 Nov 2022 14:03:56 +0100
Subject: [PATCH 04/12] compile-libvlc.sh: pass VLC_TARBALLS parameter

(cherry picked from commit 7badf59466c0fd9ed2166e4b76b3c391bdb7f3ab)
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
---
 buildsystem/compile-libvlc.sh | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/buildsystem/compile-libvlc.sh b/buildsystem/compile-libvlc.sh
index d70e21d..fb718a2 100755
--- a/buildsystem/compile-libvlc.sh
+++ b/buildsystem/compile-libvlc.sh
@@ -123,6 +123,14 @@ else
 fi
 
 VLC_BUILD_DIR="$(cd $VLC_SRC_DIR/; pwd)/build-android-${TARGET_TUPLE}"
+
+if [ -z $VLC_TARBALLS ]; then
+    VLC_TARBALLS="$(cd $VLC_SRC_DIR/;pwd)/contrib/tarballs"
+fi
+if [ ! -d $VLC_TARBALLS ]; then
+    mkdir -p $VLC_TARBALLS
+fi
+
 VLC_OUT_PATH="$VLC_BUILD_DIR/ndk"
 mkdir -p $VLC_OUT_PATH
 
@@ -472,7 +480,7 @@ if [ "$AVLC_USE_PREBUILT_CONTRIBS" -gt "0" ]; then
         make prebuilt PREBUILT_URL="$VLC_PREBUILT_CONTRIBS_URL"
         avlc_checkfail "Fetching prebuilt contribs from ${VLC_PREBUILT_CONTRIBS_URL} failed"
     fi
-    make .luac
+    make TARBALLS="$VLC_TARBALLS" .luac
 else
     # Some libraries have arm assembly which won't build in thumb mode
     # We append -marm to the CFLAGS of these libs to disable thumb mode
@@ -490,14 +498,14 @@ else
     # fix modplug endianess check (narrowing error)
     export ac_cv_c_bigendian=no
 
-    make $MAKEFLAGS fetch
+    make TARBALLS="$VLC_TARBALLS" $MAKEFLAGS fetch
     avlc_checkfail "contribs: make fetch failed"
 
     # gettext
-    which autopoint >/dev/null || make $MAKEFLAGS .gettext
+    which autopoint >/dev/null || make TARBALLS="$VLC_TARBALLS" $MAKEFLAGS .gettext
     #export the PATH
     # Make
-    make $MAKEFLAGS
+    make TARBALLS="$VLC_TARBALLS" $MAKEFLAGS
     avlc_checkfail "contribs: make failed"
 
     # Make prebuilt contribs package
-- 
GitLab


From b89ea6e0f9802525da5126ac70cf97afff470b73 Mon Sep 17 00:00:00 2001
From: Thomas Guillem <thomas@gllm.fr>
Date: Fri, 7 Jul 2023 11:38:11 +0200
Subject: [PATCH 05/12] buildsystem/compile-libvlc.sh: allow build from
 anywhere

And don't change the directory since this script can be sourced.

It is now possible to use this script for

- Build an existing VLC:
vlc $ ../libvlcjni/buildsystem/compile-libvlc.sh -a arm

- Build VLC from libvlcjni
libvlcjni $ ./buildsystem/compile-libvlc.sh -a arm

- Build VLC from vlc-android

(cherry picked from commit b6b33ffb7ee5306e6b99afde2be6fbd6cccdaa43)
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
---
 buildsystem/compile-libvlc.sh | 97 ++++++++++++++++++-----------------
 1 file changed, 51 insertions(+), 46 deletions(-)

diff --git a/buildsystem/compile-libvlc.sh b/buildsystem/compile-libvlc.sh
index fb718a2..a0893cb 100755
--- a/buildsystem/compile-libvlc.sh
+++ b/buildsystem/compile-libvlc.sh
@@ -112,11 +112,18 @@ fi
 ############
 # VLC PATH #
 ############
-SRC_DIR=$PWD
-if [ -f $SRC_DIR/src/libvlc.h ];then
-    VLC_SRC_DIR="$SRC_DIR"
-elif [ -d $SRC_DIR/vlc ];then
-    VLC_SRC_DIR=$SRC_DIR/vlc
+LIBVLCJNI_SRC_DIR="$(cd "$(dirname "$0")"; pwd -P)/.."
+# Fix path if the script is sourced from vlc-android
+if [ -d $LIBVLCJNI_SRC_DIR/libvlcjni ];then
+    LIBVLCJNI_SRC_DIR=$LIBVLCJNI_SRC_DIR/libvlcjni
+fi
+
+if [ -f $LIBVLCJNI_SRC_DIR/src/libvlc.h ];then
+    VLC_SRC_DIR="$LIBVLCJNI_SRC_DIR"
+elif [ -f $PWD/src/libvlc.h ];then
+    VLC_SRC_DIR="$PWD"
+elif [ -d $LIBVLCJNI_SRC_DIR/vlc ];then
+    VLC_SRC_DIR=$LIBVLCJNI_SRC_DIR/vlc
 else
     echo "Could not find vlc sources"
     exit 1
@@ -427,26 +434,23 @@ VLC_MODULE_BLACKLIST="
 
 export PATH="$VLC_SRC_DIR/extras/tools/build/bin:$PATH"
 echo "Building tools"
-cd $VLC_SRC_DIR/extras/tools
-./bootstrap
+(cd $VLC_SRC_DIR/extras/tools && ./bootstrap)
 avlc_checkfail "buildsystem tools: bootstrap failed"
-make $MAKEFLAGS
+make -C $VLC_SRC_DIR/extras/tools $MAKEFLAGS
 avlc_checkfail "buildsystem tools: make failed"
-make $MAKEFLAGS .gas || make $MAKEFLAGS .buildgas
+make -C $VLC_SRC_DIR/extras/tools $MAKEFLAGS .gas || make -C $VLC_SRC_DIR/extras/tools $MAKEFLAGS .buildgas
 avlc_checkfail "buildsystem tools: make failed"
-cd ../../..
 
 VLC_CONTRIB="$VLC_SRC_DIR/contrib/$TARGET_TUPLE"
 
-cd $VLC_SRC_DIR
 
 #############
 # BOOTSTRAP #
 #############
 
-if [ ! -f configure ]; then
+if [ ! -f $VLC_SRC_DIR/configure ]; then
     echo "Bootstraping"
-    ./bootstrap
+    (cd $VLC_SRC_DIR && ./bootstrap)
     avlc_checkfail "vlc: bootstrap failed"
 fi
 
@@ -455,69 +459,70 @@ fi
 ############
 
 echo "Building the contribs"
-mkdir -p contrib/contrib-android-${TARGET_TUPLE}
 
-avlc_gen_pc_file contrib/${TARGET_TUPLE}/lib/pkgconfig EGL 1.1
-avlc_gen_pc_file contrib/${TARGET_TUPLE}/lib/pkgconfig GLESv2 2
+VLC_CONTRIB_DIR=$VLC_SRC_DIR/contrib/contrib-android-${TARGET_TUPLE}
+VLC_CONTRIB_OUT_DIR=$VLC_SRC_DIR/contrib/${TARGET_TUPLE}
+
+mkdir -p $VLC_CONTRIB_OUT_DIR/lib/pkgconfig
+avlc_gen_pc_file $VLC_CONTRIB_OUT_DIR/lib/pkgconfig EGL 1.1
+avlc_gen_pc_file $VLC_CONTRIB_OUT_DIR/lib/pkgconfig GLESv2 2
 
-cd contrib/contrib-android-${TARGET_TUPLE}
+mkdir -p $VLC_CONTRIB_DIR/lib/pkgconfig
 
 # TODO: VLC 4.0 won't rm config.mak after each call to bootstrap. Move it just
 # before ">> config.make" when switching to VLC 4.0
-rm -f config.mak
+rm -f $VLC_CONTRIB_DIR/config.mak
 
 export USE_FFMPEG=1
-ANDROID_ABI=${ANDROID_ABI} ANDROID_API=${ANDROID_API} \
-    ../bootstrap --host=${TARGET_TUPLE} ${VLC_BOOTSTRAP_ARGS}
+(cd $VLC_CONTRIB_DIR && ANDROID_ABI=${ANDROID_ABI} ANDROID_API=${ANDROID_API} \
+    ../bootstrap --host=${TARGET_TUPLE} ${VLC_BOOTSTRAP_ARGS})
 avlc_checkfail "contribs: bootstrap failed"
 
 if [ "$AVLC_USE_PREBUILT_CONTRIBS" -gt "0" ]; then
     # Fetch prebuilt contribs
     if [ -z "$VLC_PREBUILT_CONTRIBS_URL" ]; then
-        make prebuilt
+        make -C $VLC_CONTRIB_DIR prebuilt
         avlc_checkfail "Fetching prebuilt contribs failed"
     else
-        make prebuilt PREBUILT_URL="$VLC_PREBUILT_CONTRIBS_URL"
+        make -C $VLC_CONTRIB_DIR prebuilt PREBUILT_URL="$VLC_PREBUILT_CONTRIBS_URL"
         avlc_checkfail "Fetching prebuilt contribs from ${VLC_PREBUILT_CONTRIBS_URL} failed"
     fi
-    make TARBALLS="$VLC_TARBALLS" .luac
+    make -C $VLC_CONTRIB_DIR TARBALLS="$VLC_TARBALLS" .luac
 else
     # Some libraries have arm assembly which won't build in thumb mode
     # We append -marm to the CFLAGS of these libs to disable thumb mode
-    [ ${ANDROID_ABI} = "armeabi-v7a" ] && echo "NOTHUMB := -marm" >> config.mak
+    [ ${ANDROID_ABI} = "armeabi-v7a" ] && echo "NOTHUMB := -marm" >> $VLC_CONTRIB_DIR/config.mak
 
-    echo "EXTRA_CFLAGS=${VLC_CFLAGS}" >> config.mak
-    echo "EXTRA_CXXFLAGS=${VLC_CXXFLAGS}" >> config.mak
-    echo "CC=${CROSS_CLANG}" >> config.mak
-    echo "CXX=${CROSS_CLANG}++" >> config.mak
-    echo "AR=${CROSS_TOOLS}ar" >> config.mak
-    echo "AS=${CROSS_TOOLS}as" >> config.mak
-    echo "RANLIB=${CROSS_TOOLS}ranlib" >> config.mak
-    echo "LD=${CROSS_TOOLS}ld" >> config.mak
+    echo "EXTRA_CFLAGS=${VLC_CFLAGS}" >> $VLC_CONTRIB_DIR/config.mak
+    echo "EXTRA_CXXFLAGS=${VLC_CXXFLAGS}" >> $VLC_CONTRIB_DIR/config.mak
+    echo "CC=${CROSS_CLANG}" >> $VLC_CONTRIB_DIR/config.mak
+    echo "CXX=${CROSS_CLANG}++" >> $VLC_CONTRIB_DIR/config.mak
+    echo "AR=${CROSS_TOOLS}ar" >> $VLC_CONTRIB_DIR/config.mak
+    echo "AS=${CROSS_TOOLS}as" >> $VLC_CONTRIB_DIR/config.mak
+    echo "RANLIB=${CROSS_TOOLS}ranlib" >> $VLC_CONTRIB_DIR/config.mak
+    echo "LD=${CROSS_TOOLS}ld" >> $VLC_CONTRIB_DIR/config.mak
 
     # fix modplug endianess check (narrowing error)
     export ac_cv_c_bigendian=no
 
-    make TARBALLS="$VLC_TARBALLS" $MAKEFLAGS fetch
+    make -C $VLC_CONTRIB_DIR TARBALLS="$VLC_TARBALLS" $MAKEFLAGS fetch
     avlc_checkfail "contribs: make fetch failed"
 
     # gettext
-    which autopoint >/dev/null || make TARBALLS="$VLC_TARBALLS" $MAKEFLAGS .gettext
+    which autopoint >/dev/null || make -C $VLC_CONTRIB_DIR TARBALLS="$VLC_TARBALLS" $MAKEFLAGS .gettext
     #export the PATH
     # Make
-    make TARBALLS="$VLC_TARBALLS" $MAKEFLAGS
+    make -C $VLC_CONTRIB_DIR TARBALLS="$VLC_TARBALLS" $MAKEFLAGS
     avlc_checkfail "contribs: make failed"
 
     # Make prebuilt contribs package
     if [ "$AVLC_MAKE_PREBUILT_CONTRIBS" -gt "0" ]; then
-        make package
+        make -C $VLC_CONTRIB_DIR package
         avlc_checkfail "Creating prebuilt contribs package failed"
     fi
 fi
 
-cd ../../
-
-mkdir -p $VLC_BUILD_DIR && cd $VLC_BUILD_DIR
+mkdir -p $VLC_BUILD_DIR
 
 #############
 # CONFIGURE #
@@ -541,12 +546,13 @@ export ac_cv_header_search_h=no
 export ac_cv_func_tdestroy=no
 export ac_cv_func_tfind=no
 
-if [ ! -e ./config.h -o "$AVLC_RELEASE" = 1 ]; then
+if [ ! -e $VLC_BUILD_DIR/config.h -o "$AVLC_RELEASE" = 1 ]; then
     VLC_CONFIGURE_DEBUG=""
     if [ ! "$AVLC_RELEASE" = 1 ]; then
         VLC_CONFIGURE_DEBUG="--enable-debug --disable-branch-protection"
     fi
 
+    (cd $VLC_BUILD_DIR && \
     CFLAGS="${VLC_CFLAGS}" \
     CXXFLAGS="${VLC_CFLAGS} ${VLC_CXXFLAGS}" \
     CC="${CROSS_CLANG}" \
@@ -562,7 +568,8 @@ if [ ! -e ./config.h -o "$AVLC_RELEASE" = 1 ]; then
     sh ../configure --host=$TARGET_TUPLE --build=x86_64-unknown-linux \
         --with-contrib=${VLC_SRC_DIR}/contrib/${TARGET_TUPLE} \
         --prefix=${VLC_BUILD_DIR}/install/ \
-        ${EXTRA_PARAMS} ${VLC_CONFIGURE_ARGS} ${VLC_CONFIGURE_DEBUG}
+        ${EXTRA_PARAMS} ${VLC_CONFIGURE_ARGS} ${VLC_CONFIGURE_DEBUG} \
+    )
     avlc_checkfail "vlc: configure failed"
 fi
 
@@ -571,13 +578,11 @@ fi
 ############
 
 echo "Building"
-make $MAKEFLAGS
+make -C $VLC_BUILD_DIR $MAKEFLAGS
 avlc_checkfail "vlc: make failed"
-make install
+make -C $VLC_BUILD_DIR install
 avlc_checkfail "vlc: make install failed"
 
-cd $SRC_DIR
-
 ##################
 # libVLC modules #
 ##################
@@ -666,7 +671,7 @@ echo -e "ndk-build vlc"
 
 touch $VLC_OUT_PATH/dummy.cpp
 
-$NDK_BUILD -C libvlcjni/libvlc \
+$NDK_BUILD -C $LIBVLCJNI_SRC_DIR/libvlc \
     APP_STL="c++_shared" \
     APP_CPPFLAGS="-frtti -fexceptions" \
     VLC_SRC_DIR="$VLC_SRC_DIR" \
-- 
GitLab


From 97d71098566afb6ce6c47c1a16b956999fcf580b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
Date: Wed, 3 Aug 2022 13:35:40 +0200
Subject: [PATCH 06/12] CI: merge build-all-base and build-libvlc-base

The format is only used by the latter which is the base for all other
configurations

(cherry picked from commit 593278ea3d82e2ee75658518e9a6b493c25ea052)
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
---
 buildsystem/gitlab/.gitlab-ci.yml | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/buildsystem/gitlab/.gitlab-ci.yml b/buildsystem/gitlab/.gitlab-ci.yml
index 3a0d53c..4cc6d8b 100644
--- a/buildsystem/gitlab/.gitlab-ci.yml
+++ b/buildsystem/gitlab/.gitlab-ci.yml
@@ -16,19 +16,14 @@ stages:
   - build
   - package
 
-.build-all-base:
+# Rebuilds libvlc JNI
+.build-libvlc-base:
     stage: build
     script: |
         cd .. 
         [ ! -d "vlc-android" ] && git clone https://code.videolan.org/videolan/vlc-android
         cd vlc-android
         ./buildsystem/compile.sh ${EXTRA_BUILD_PARAM} -a ${ARCH}
-    variables:
-        MAKEFLAGS: -j8
-
-# Rebuilds libvlc JNI
-.build-libvlc-base:
-    extends: .build-all-base
     rules:
         # Explicitely refuse to build anything that would also trigger
         # a medialib build
@@ -42,6 +37,7 @@ stages:
       - if: '$CI_PIPELINE_SOURCE == "push"'
     variables:
         EXTRA_BUILD_PARAM: -l
+        MAKEFLAGS: -j8
 
 #################################
 # Template config instantiation #
-- 
GitLab


From fb1469e5683a2563e4f29ae3e6b3ab0ae5792d2d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
Date: Wed, 3 Aug 2022 13:46:28 +0200
Subject: [PATCH 07/12] CI: Remove unused job

It references some script that don't exist in this repo and most likely
is a leftover from the vlc-android CI

(cherry picked from commit fb74b870ce05e627d78fa2e5070f445ab909861d)
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
---
 buildsystem/gitlab/.gitlab-ci.yml | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/buildsystem/gitlab/.gitlab-ci.yml b/buildsystem/gitlab/.gitlab-ci.yml
index 4cc6d8b..46bc431 100644
--- a/buildsystem/gitlab/.gitlab-ci.yml
+++ b/buildsystem/gitlab/.gitlab-ci.yml
@@ -122,17 +122,3 @@ publish_libs:
             - $M2_REPO
         expire_in: 2 weeks
 
-release:
-    stage: build
-    rules:
-        - if: '$CI_COMMIT_TAG =~ /^(\d+\.)?(\d+\.)?(\*|\d+)/'
-    script:
-        - ./buildsystem/compile.sh --init
-        - ./gradlew assembleRelease
-    artifacts:
-        name: "${CI_COMMIT_TAG}"
-        paths:
-            - application/app/build/outputs/apk/release/VLC-Android-*.apk
-#            - application/app/build/outputs/mapping/release/mapping.txt
-        expire_in: 2 weeks
-
-- 
GitLab


From 0205fc60567aaba58e072f68de7dc8f7017032f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
Date: Wed, 3 Aug 2022 13:51:17 +0200
Subject: [PATCH 08/12] CI: Remove package jobs

They are referencing some scripts from the vlc-android repo and are not
expected to be executed in this CI

(cherry picked from commit a541a38d40a7d1948f2251a977e2f07018e86042)
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
---
 buildsystem/gitlab/.gitlab-ci.yml | 53 -------------------------------
 1 file changed, 53 deletions(-)

diff --git a/buildsystem/gitlab/.gitlab-ci.yml b/buildsystem/gitlab/.gitlab-ci.yml
index 46bc431..251c02d 100644
--- a/buildsystem/gitlab/.gitlab-ci.yml
+++ b/buildsystem/gitlab/.gitlab-ci.yml
@@ -14,7 +14,6 @@ default:
 
 stages:
   - build
-  - package
 
 # Rebuilds libvlc JNI
 .build-libvlc-base:
@@ -70,55 +69,3 @@ build-libvlc-x86_64:
     variables:
       M2_REPO: "$CI_PROJECT_DIR/aars/repository"
 
-.build-libs-base:
-    extends: .build-release-libs-base
-    stage: build
-    script:
-      - mkdir -p $M2_REPO
-      - ./buildsystem/compile.sh -l -a ${ARCH} -m2 $M2_REPO release
-    artifacts:
-      expire_in: 1h
-      when: on_success
-      paths:
-        - $CI_PROJECT_DIR/libvlc/jni/libs/*
-        - $CI_PROJECT_DIR/.dbg/*
-
-build-libs-arm64:
-    extends: .build-libs-base
-    variables:
-        ARCH: arm64
-
-build-libs-armv7:
-    extends: .build-libs-base
-    variables:
-        ARCH: arm
-
-build-libs-x86:
-    extends: .build-libs-base
-    variables:
-        ARCH: x86
-
-build-libs-x86_64:
-    extends: .build-libs-base
-    variables:
-        ARCH: x86_64
-
-publish_libs:
-    extends: .build-release-libs-base
-    stage: package
-    needs: 
-      - job: "build-libs-arm64"
-      - job: "build-libs-armv7"
-      - job: "build-libs-x86"
-      - job: "build-libs-x86_64"
-    script:
-        - mkdir -p $M2_REPO
-        - ./buildsystem/compile.sh --init -b
-        - GRADLE_ABI=ALL RELEASE_SIGNING_ENABLED=false ./gradlew -Dmaven.repo.local=$M2_REPO -p libvlc publishToMavenLocal
-    artifacts:
-        name: "${CI_COMMIT_TAG}.dbg"
-        paths:
-            - .dbg/
-            - $M2_REPO
-        expire_in: 2 weeks
-
-- 
GitLab


From 75dbb199d01ce3480d84d29ae426430130e75ee2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
Date: Wed, 3 Aug 2022 13:52:23 +0200
Subject: [PATCH 09/12] CI: Remove the vlc-android folder after running

Otherwise we don't build anything and will not actually test much

(cherry picked from commit ad4da9a0bb35097eaabe886eb96d794625c4a567)
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
---
 buildsystem/gitlab/.gitlab-ci.yml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/buildsystem/gitlab/.gitlab-ci.yml b/buildsystem/gitlab/.gitlab-ci.yml
index 251c02d..6ded44e 100644
--- a/buildsystem/gitlab/.gitlab-ci.yml
+++ b/buildsystem/gitlab/.gitlab-ci.yml
@@ -20,9 +20,12 @@ stages:
     stage: build
     script: |
         cd .. 
-        [ ! -d "vlc-android" ] && git clone https://code.videolan.org/videolan/vlc-android
+        rm -rf vlc-android
+        git clone https://code.videolan.org/videolan/vlc-android
         cd vlc-android
         ./buildsystem/compile.sh ${EXTRA_BUILD_PARAM} -a ${ARCH}
+    after_script:
+      - rm -rf ../vlc-android
     rules:
         # Explicitely refuse to build anything that would also trigger
         # a medialib build
-- 
GitLab


From 9b817c69478893c8a7552d3680b5b4e6d973b31d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
Date: Wed, 3 Aug 2022 13:52:48 +0200
Subject: [PATCH 10/12] CI: Don't fetch the entire history

The latest revision is enough for our purposes

(cherry picked from commit 518800f9ce18a80d9a29068ca3396fd3ecd4107d)
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
---
 buildsystem/gitlab/.gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/buildsystem/gitlab/.gitlab-ci.yml b/buildsystem/gitlab/.gitlab-ci.yml
index 6ded44e..a7e6ab0 100644
--- a/buildsystem/gitlab/.gitlab-ci.yml
+++ b/buildsystem/gitlab/.gitlab-ci.yml
@@ -21,7 +21,7 @@ stages:
     script: |
         cd .. 
         rm -rf vlc-android
-        git clone https://code.videolan.org/videolan/vlc-android
+        git clone --depth=1 https://code.videolan.org/videolan/vlc-android
         cd vlc-android
         ./buildsystem/compile.sh ${EXTRA_BUILD_PARAM} -a ${ARCH}
     after_script:
-- 
GitLab


From d063ac5f37ea8d0a30cd60f8dc85f88f1d03c334 Mon Sep 17 00:00:00 2001
From: Thomas Guillem <thomas@gllm.fr>
Date: Fri, 7 Jul 2023 11:40:45 +0200
Subject: [PATCH 11/12] ci: use compile-libvlc.sh directly

And not vlc-android build script that will use libvlcjni on a fixed
HASH...

(cherry picked from commit a20e384e312eee75789eb060bb58b3d00dbf0632)
Signed-off-by: Thomas Guillem <thomas@gllm.fr>
---
 buildsystem/gitlab/.gitlab-ci.yml | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/buildsystem/gitlab/.gitlab-ci.yml b/buildsystem/gitlab/.gitlab-ci.yml
index a7e6ab0..2a0115d 100644
--- a/buildsystem/gitlab/.gitlab-ci.yml
+++ b/buildsystem/gitlab/.gitlab-ci.yml
@@ -19,13 +19,9 @@ stages:
 .build-libvlc-base:
     stage: build
     script: |
-        cd .. 
-        rm -rf vlc-android
-        git clone --depth=1 https://code.videolan.org/videolan/vlc-android
-        cd vlc-android
-        ./buildsystem/compile.sh ${EXTRA_BUILD_PARAM} -a ${ARCH}
-    after_script:
-      - rm -rf ../vlc-android
+        rm -rf vlc
+        ./buildsystem/get-vlc.sh
+        ./buildsystem/compile-libvlc.sh -a ${ARCH}
     rules:
         # Explicitely refuse to build anything that would also trigger
         # a medialib build
@@ -38,7 +34,6 @@ stages:
           - libvlc/**/*
       - if: '$CI_PIPELINE_SOURCE == "push"'
     variables:
-        EXTRA_BUILD_PARAM: -l
         MAKEFLAGS: -j8
 
 #################################
-- 
GitLab


From dedfca708363667434b519af663c26c60b00b1bc Mon Sep 17 00:00:00 2001
From: Thomas Guillem <thomas@gllm.fr>
Date: Fri, 7 Jul 2023 13:58:50 +0200
Subject: [PATCH 12/12] add .gitignore

---
 .gitignore | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 .gitignore

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1236875
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,13 @@
+# Local configuration
+local.properties
+env.sh
+
+#Android Studio
+.idea
+*.iml
+
+#gradle
+gradlew.bat
+gradlew
+gradle*/
+.gradle/
-- 
GitLab