net-misc/meganz-sdk: update live

Signed-off-by: Alfred Wingate <parona@protonmail.com>
This commit is contained in:
Alfred Wingate 2024-09-14 12:04:49 +03:00
parent ed071fbab7
commit ffc51253ba
No known key found for this signature in database
GPG Key ID: A12750536B5E7010

View File

@ -1,107 +1,120 @@
# Copyright 1999-2021 Gentoo Authors # Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI=7 EAPI=8
inherit cmake flag-o-matic
inherit flag-o-matic qmake-utils autotools db-use
if [[ -z ${PV%%*9999} ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/${PN%-*}/${PN#*-}.git"
else
SRC_URI="https://github.com/meganz/sdk/archive/v${PV}d.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/sdk-${PV}d"
RESTRICT="primaryuri"
KEYWORDS="~amd64 ~x86"
fi
DESCRIPTION="MEGA C++ SDK" DESCRIPTION="MEGA C++ SDK"
HOMEPAGE="https://github.com/meganz/sdk" HOMEPAGE="https://github.com/meganz/sdk"
LICENSE="BSD-2" if [[ "${PV}" == "9999" ]]; then
SLOT="0/30701" inherit git-r3
IUSE="examples ffmpeg freeimage fuse hardened inotify libuv mediainfo qt raw +sqlite test" EGIT_REPO_URI="https://github.com/meganz/sdk.git"
REQUIRED_USE=" else
examples? ( sqlite ) SRC_URI="https://github.com/meganz/sdk/archive/v${PV}.tar.gz -> ${P}.tar.gz"
fuse? ( examples ) S="${WORKDIR}/sdk-${PV}"
" KEYWORDS="~amd64"
# tests require a working mega.nz account and login details provided via $MEGA_EMAIL and $MEGA_PWD fi
RESTRICT+=" test"
LICENSE="BSD-2"
SLOT="0/${PV}"
IUSE="examples ffmpeg freeimage fuse libuv mediainfo qt test"
RESTRICT="!test? ( test )"
# <ffmpeg-6: https://github.com/meganz/sdk/issues/2635
RDEPEND=" RDEPEND="
dev-libs/crypto++ dev-db/sqlite:3
sys-libs/zlib dev-libs/crypto++:=
dev-libs/libpcre:3[cxx] dev-libs/icu:=
dev-libs/openssl:0 dev-libs/libsodium:=
net-dns/c-ares dev-libs/openssl:=
net-dns/c-ares:=
net-misc/curl net-misc/curl
sqlite? ( dev-db/sqlite:3 ) ffmpeg? ( <media-video/ffmpeg-6 )
!sqlite? ( sys-libs/db:*[cxx] )
examples? (
sys-libs/readline:0
fuse? ( sys-fs/fuse:0 )
)
freeimage? ( media-libs/freeimage ) freeimage? ( media-libs/freeimage )
libuv? ( dev-libs/libuv ) fuse? ( sys-fs/fuse )
dev-libs/libsodium libuv? ( dev-libs/libuv:= )
mediainfo? ( media-libs/libmediainfo ) mediainfo? (
ffmpeg? ( media-video/ffmpeg ) media-libs/libmediainfo
raw? ( media-libs/libraw ) media-libs/libzen
)
qt? ( dev-qt/qtcore:5 )
" "
DEPEND=" DEPEND="
${RDEPEND} ${RDEPEND}
test? ( dev-cpp/gtest ) sys-libs/readline
" "
pkg_setup() {
use sqlite || append-cppflags "-I$(db_includedir)"
}
src_prepare() { src_prepare() {
default # 1. Mismatched pkgconfig file names
use qt && sed \ # 2. Symbols still needed publically when linking library
-e '/SOURCES += src\// s:+:-:' \ sed -i \
-e '/!exists.*config.h/ s:!::' \ -e '/pkg_check_modules/ s/libcrypto++/libcryptopp/' \
-e 's:CONFIG(USE_MEGAAPI) {:&\nLIBS += -lmega:' \ -e '/target_link_libraries(SDKlib/ { /\(curl\|sodium\)/ s/PRIVATE/PUBLIC/ }' \
-e '/^unix:!macx {/,/^}/d' \ contrib/cmake/modules/sdklib_libraries.cmake || die
-i bindings/qt/sdk.pri
use test && sed \ sed -i \
-e 's:\$(GTEST_DIR)/lib/lib\([^ ]\+\)\.la:-l\1:g' \ -e 's|DESTINATION cmake|DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake|' \
-e 's: tests/tool_purge_account::' \ -e 's|DESTINATION pkgconfig|DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig|' \
-i tests/include.am contrib/cmake/modules/sdklib_target.cmake || die
eautoreconf
# examples use readline symbols
sed -i \
-e 's/target_link_libraries(megacli PRIVATE MEGA::SDKlib)/target_link_libraries(megacli PRIVATE MEGA::SDKlib PkgConfig::readline)/' \
examples/CMakeLists.txt || die
cmake_src_prepare
} }
src_configure() { src_configure() {
local myeconfargs=( # building with DEBUG disabled isn't tested apparently
--enable-chat # https://github.com/meganz/sdk/issues/2658
$(use_enable inotify) append-cppflags -DDEBUG=1
$(use_enable hardened gcc-hardening)
$(use_with libuv) local mycmakeargs=(
$(use_with !sqlite db) # CMakeLists.txt
$(use_with sqlite) # contrib/cmake/modules/sdklib_options.cmake
$(use_enable examples)
$(use_enable test tests) -DENABLE_ISOLATED_GFX=OFF # required freeimage + doesn't properly link libz
$(use_with freeimage) -DENABLE_QT_BINDINGS=$(usex qt) # doesn't get installed
$(use_with fuse) -DENABLE_SDKLIB_EXAMPLES=$(usex examples)
$(use_with mediainfo libmediainfo) -DENABLE_SDKLIB_TESTS=$(usex test)
$(use_with ffmpeg) -DENABLE_SDKLIB_WERROR=OFF
$(use_with raw libraw) -DUSE_FFMPEG=$(usex ffmpeg)
-DUSE_C_ARES=ON
-DUSE_FREEIMAGE=$(usex freeimage)
-DUSE_LIBUV=$(usex libuv)
-DUSE_MEDIAINFO=$(usex mediainfo)
-DUSE_OPENSSL=ON
-DUSE_PDFIUM=OFF # unpackaged
-DUSE_READLINE=ON
-DWITH_FUSE=$(usex fuse)
) )
use test && myeconfargs+=( cmake_src_configure
--with-gtest="${EPREFIX}/usr"
)
econf "${myeconfargs[@]}"
} }
src_test() { src_test() {
export MEGA_EMAIL MEGA_PWD MEGA_EMAIL_AUX="${MEGA_EMAIL}" MEGA_PWD_AUX="${MEGA_PWD}" set -- "${BUILD_DIR}"/tests/unit/test_unit
default einfo ${@}
${@} || die
# integration test require a mega account and will be destructive, which is why they aren't run.
# IMPORTANT: the main account must be empty (Cloud & Rubbish) before starting the test and it will be purged at exit.
# Both main and auxiliar accounts shouldn't be contacts yet and shouldn't have any pending contact requests.
# Set your login credentials as environment variables:
# * $MEGA_EMAIL and $MEGA_PWD (and $MEGA_EMAIL_AUX / $MEGA_PWD_AUX for shares * contacts)
} }
src_install() { src_install() {
default cmake_src_install
doheader -r include/mega doheader -r include/mega
use qt || return if use qt; then
insinto /usr/share/${PN}/bindings/qt dolib.so "${BUILD_DIR}"/bindings/qt/libSDKQtBindings.so
doins bindings/qt/*.{h,cpp,pri} insinto /usr/share/${PN}/bindings/qt
doins bindings/qt/*.{h,cpp}
fi
} }