Article 6P11Q MEGAsync-5.3.0.0_Linux for slackware64-current

MEGAsync-5.3.0.0_Linux for slackware64-current

by
J_W
from LinuxQuestions.org on (#6P11Q)
Hello,

I will report that I successfully compiled andcreatedthe latest MEGAsync release 5.3.0.0_linux on slackware64-current environment.

The slackbuild and patches werebased on Arch linux's information. Thanks to Arch!

Note)
The latest version of MEGAsyncsource use Microsoft vcpkg for handling third-party requirements.
*** From README.linux.md ***
VCPKG

Along with Qt, MEGA Desktop app and the MEGA SDK require another dozen or more third party libraries
to cover all the functionality exposed to our users. We are using Microsoft's VCPKG C++ Library Manager
for managing our dependencies.
You need to clone the VCPKG git repo (you can of course choose the local directory,
****************************
README.linux.md
sources: https://github.com/meganz/MEGAsync/r...v5.3.0.0_Linux
https://github.com/meganz/sdk/releases/tag/v7.1.2
Arch linux info : https://aur.archlinux.org/packages/megasync

I included "git clone' command in my slackbuildand vcpkg will fetch missing requirements during compilation.
Please note that this kind of build style doesn't conform to SBo's regulation of slackbuild.

Anyway,I confirmed that created package works fine on my 64-current environment.

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

PRGNAM=MEGAsync
VERSION=${VERSION:-5.3.0.0}
SDK=${SDK:-7.1.2}
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
# Apply patches from ArchLinux. Thabks to Arch.
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
# Now, the third-party requirements are handled through VCPKG.
# URL{ https://github.com/microsoft/vcpk
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}"
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}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 format020-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
)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
fiMEGAsync.info
Code:PRGNAM="MEGAsync"
VERSION="5.3.0.0"
HOMEPAGE="https://github.com/meganz/MEGAsync/"
DOWNLOAD="https://github.com/meganz/MEGAsync/archive/v5.3.0.0_Linux/MEGAsync-5.3.0.0_Linux.tar.gz \
https://github.com/meganz/sdk/archive/v7.1.2/sdk-7.1.2.tar.gz"
MD5SUM="79701a3004f9e106402129a3d28637db \
435873a0cf2fc53cb853e4f4376ae0d6"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="FreeImage libmediainfo"
MAINTAINER=""
EMAIL=""Thanks
J_W
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments