[Update: Oct. 28. 2024]
Version bump to "5.6.0.0"


MEGAsync.SlackBuild
[code]
#!/bin/sh

# Slackware build script for MEGASync input plugin

# Copyright 2017,2018 Felipe Bugno <capent@yahoo.com>
#
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# 2023-04-14 : 4.9.1.0 (2jw) -- version bump to 4.9.1.0_linux
# 2023-09-16 : 4.9.1.0 (3jw) -- Recompiled against libsodium-1.0.19 (libsodium.so.26.1.0)
# 2024-01-30 : 4.9.1.0 (4jw) -- Recompiled against ffmpeg-6.1.1
# 2024-07-06 : 5.3.0.0 (1jw) -- version bump to 5.3.0.0 with sdk-7.1.2
# 2024-07-07 : 5.3.0.0 (2jw) -- Fix overwriting default FFmpeg6's soft-links in /usr/lib64/
# 2024-07-27 : 5.4.0.0 (1jw) -- version bump to 5.4.0.0 with sdk-7.3.0
# 2024-07-27 : 5.4.0.0 (2jw) -- Fix overwriting default FFmpeg6's libswresample.so.4
# 2024-08-14 : 5.4.0.0 (3jw) -- Recompiled against FFmpeg-7.0.2
# 2024-08-15 : 5.4.1.0 (1jw) -- version bump to 5.4.1.0 with sdk-7.6.0.eafa851
# 2024-10-28 : 5.6.0.0 (1jw) -- version bump to 5.6.0.0 with sdk-7.12.0

PRGNAM=MEGAsync
VERSION=${VERSION:-
5.6.0.0}
SDK=${SDK:-
7.12.0}
BUILD=${BUILD:-1}
TAG=${TAG:-jw}

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i586 ;;
    arm*) ARCH=arm ;;
       *) ARCH=$( uname -m ) ;;
  esac
fi

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

if [ "$ARCH" = "i586" ]; then
  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
else
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
fi

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION\_Linux
tar xvf $CWD/$PRGNAM-$VERSION\_Linux.tar.gz
cd $PRGNAM-$VERSION\_Linux/src/MEGASync/mega
tar --strip-components=1 -xvf $CWD/sdk-$SDK.tar.gz
cd ../../../
chown -R root:root .
find -L . \
 \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  -o -perm 511 \) -exec chmod 755 {} \; -o \
 \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;

cd src/MEGASync/mega
patch -p1 < $CWD/010-megasync-freeimage-remove-obsolete-ffmpeg-macros.patch
patch -p1 < $CWD/020-megasync-sdk-fix-cmake-dependencies-detection.patch
cd ../../../
patch -p1 < $CWD/030-megasync-app-fix-cmake-dependencies-detection.patch

cd $TMP
rm -rf vcpkg
# Now.. we will use microsoft VCPKG build system for MEGAsync desktop apps
git clone https://github.com/microsoft/vcpkg


CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS"
export CXXFLAGS+=' -DNDEBUG'

cmake -DVCPKG_ROOT=$TMP/vcpkg  -B build -S $PRGNAM-$VERSION\_Linux -DCMAKE_BUILD_TYPE=Release \
-G 'Unix Makefiles' \
-DCMAKE_MODULE_PATH:PATH="$TMP/$PRGNAM-$VERSION\_Linux/src/MEGASync/mega/contrib/cmake/modules/packages" \
-DCMAKE_SKIP_INSTALL_RPATH:BOOL='YES' \
-Wno-dev

cmake --build build --target MEGAsync

#Install
DESTDIR=$PKG cmake --install build
install -d "$PKG/usr/lib${LIBDIRSUFFIX}"
# Do Not overwrite *.so of default ffmpeg-7.x's libraries.
rm $PKG/opt/megasync/lib/*.so
# Now move ffmpeg related libs to STD lib64 dir
mv $PKG/opt/megasync/lib/* $PKG/usr/lib${LIBDIRSUFFIX}/

install -D -m644 $PRGNAM-$VERSION\_Linux/LICENCE.md -t "$PKG/usr/share/licenses/megasync"
install -D -m644 $PRGNAM-$VERSION\_Linux/installer/terms.txt -t "$PKG/usr/share/licenses/megasync"
install -D -m644 $PRGNAM-$VERSION\_Linux/src/MEGASync/mega/LICENSE "$PKG/usr/share/licenses/megasync/LICENCE-SDK"
rm -d "$PKG/opt"{/megasync{/lib,},}

find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cd $TMP/$PRGNAM-$VERSION\_Linux
cp -a  README.md LICENCE.md CREDITS.md $PKG/usr/doc/$PRGNAM-$VERSION
cp $CWD/010-megasync-freeimage-remove-obsolete-ffmpeg-macros.patch $CWD/020-megasync-sdk-fix-cmake-dependencies-detection.patch \
 $CWD/030-megasync-app-fix-cmake-dependencies-detection.patch \
 $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz}

MEGAsync.info
[code]
PRGNAM="MEGAsync"
VERSION="5.6.0.0"
HOMEPAGE="https://github.com/meganz/MEGAsync/"
DOWNLOAD="https://github.com/meganz/MEGAsync/archive/v5.6.0.0_Linux/MEGAsync-5.6.0.0_Linux.tar.gz \
 https://github.com/meganz/sdk/archive/v7.12.0/sdk-7.12.0.tar.gz"
MD5SUM="cf496f6af7179598ad1eb4ddfe457b0e \
 0c8a7c9990391f2b28625e0d466b3785"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="FreeImage libmediainfo"
MAINTAINER=""
EMAIL=""

010-megasync-freeimage-remove-obsolete-ffmpeg-macros.patch
[code]
--- a/src/gfx/freeimage.cpp
+++ b/src/gfx/freeimage.cpp
@@ -200,12 +200,6 @@ bool GfxProviderFreeImage::readbitmapFreeimage(const LocalPath& imagePath, int s
 
 #ifdef HAVE_FFMPEG
 
-#ifdef AV_CODEC_CAP_TRUNCATED
-#define CAP_TRUNCATED AV_CODEC_CAP_TRUNCATED
-#else
-#define CAP_TRUNCATED CODEC_CAP_TRUNCATED
-#endif
-
 const char *GfxProviderFreeImage::supportedformatsFfmpeg()
 {
     return  ".264.265.3g2.3gp.3gpa.3gpp.3gpp2.mp3"
@@ -321,10 +315,6 @@ bool GfxProviderFreeImage::readbitmapFfmpeg(const LocalPath& imagePath, int size
 
     // Force seeking to key frames
     formatContext->seek2any = false;
-    if (decoder->capabilities & CAP_TRUNCATED)
-    {
-        codecContext->flags |= CAP_TRUNCATED;
-    }
 
     AVPixelFormat sourcePixelFormat = static_cast<AVPixelFormat>(codecParm->format);
     AVPixelFormat targetPixelFormat = AV_PIX_FMT_BGR24; //raw data expected by freeimage is in this format


020-megasync-sdk-fix-cmake-dependencies-detection.patch
[code]
--- a/contrib/cmake/modules/sdklib_libraries.cmake
+++ b/contrib/cmake/modules/sdklib_libraries.cmake
@@ -95,7 +95,7 @@ macro(load_sdklib_libraries)
 
         find_package(PkgConfig REQUIRED) # For libraries loaded using pkg-config
 
-        pkg_check_modules(cryptopp REQUIRED IMPORTED_TARGET libcrypto++)
+        pkg_check_modules(cryptopp REQUIRED IMPORTED_TARGET libcryptopp)
         target_link_libraries(SDKlib PUBLIC PkgConfig::cryptopp) # TODO: Private for SDK core
 
         pkg_check_modules(sodium REQUIRED IMPORTED_TARGET libsodium)
@@ -139,7 +139,7 @@ macro(load_sdklib_libraries)
         endif()
 
         if(USE_PDFIUM)
-            pkg_check_modules(pdfium REQUIRED IMPORTED_TARGET pdfium)
+            pkg_check_modules(pdfium REQUIRED IMPORTED_TARGET libpdfium)
             target_link_libraries(SDKlib PRIVATE PkgConfig::pdfium)
             set(HAVE_PDFIUM 1)
         endif()


030-megasync-app-fix-cmake-dependencies-detection.patch
[code]
--- a/src/MEGAUpdateGenerator/CMakeLists.txt
+++ b/src/MEGAUpdateGenerator/CMakeLists.txt
@@ -15,10 +15,11 @@ target_sources(MEGAUpdateGenerator
 )
 
 # Load and link needed libraries for the CHATlib target
-find_package(cryptopp CONFIG REQUIRED)
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(cryptopp REQUIRED IMPORTED_TARGET libcryptopp)
 target_link_libraries(MEGAUpdateGenerator
     PRIVATE
-    cryptopp::cryptopp
+    PkgConfig::cryptopp
     MEGA::SDKlib
 )


slack-desc
[code]
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':' except on otherwise blank lines.

        |-----handy-ruler------------------------------------------------------|
MEGAsync: MEGAsync (mega cloud storage service)
MEGAsync:
MEGAsync: MEGAsync open source release for MEGA cloud storage services
MEGAsync:
MEGAsync:
MEGAsync: Compiled using default Slackware Qt4.
MEGAsync:
MEGAsync: Homepage: https://github.com/meganz/MEGAsync
MEGAsync: Service: https://mega.nz/
MEGAsync:
MEGAsync:

doinst.sh
[code]
if [ -x /usr/bin/update-desktop-database ]; then
  /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
fi

if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
  if [ -x /usr/bin/gtk-update-icon-cache ]; then
    /usr/bin/gtk-update-icon-cache -f usr/share/icons/hicolor >/dev/null 2>&1
  fi
fi

---
[Update]