new package: megacmd
This commit is contained in:
parent
f608e19ffc
commit
cf44500331
32
packages/megacmd/build.sh
Normal file
32
packages/megacmd/build.sh
Normal file
@ -0,0 +1,32 @@
|
||||
TERMUX_PKG_HOMEPAGE=https://mega.nz/
|
||||
TERMUX_PKG_DESCRIPTION="Provides non UI access to MEGA services"
|
||||
TERMUX_PKG_LICENSE="BSD 2-Clause"
|
||||
TERMUX_PKG_MAINTAINER="@termux"
|
||||
TERMUX_PKG_VERSION=1.4.1
|
||||
_COMMIT=fd50adec27d1c2fdea8f7264cb30b8d8117d0699
|
||||
TERMUX_PKG_SRCURL=https://github.com/meganz/MEGAcmd.git
|
||||
TERMUX_PKG_GIT_BRANCH=master
|
||||
_SDK_COMMIT=0e79b2739f695d08efed5a61bbf44362e127c30b
|
||||
TERMUX_PKG_DEPENDS="c-ares, cryptopp, ffmpeg, freeimage, libc++, libcurl, libsodium, libsqlite, libuv, libzen, mediainfo, openssl, pcre, readline, zlib"
|
||||
TERMUX_PKG_BUILD_IN_SRC=true
|
||||
TERMUX_PKG_RM_AFTER_INSTALL="lib/libpthread.a"
|
||||
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
|
||||
--disable-static
|
||||
--with-pcre=$TERMUX_PREFIX
|
||||
ac_cv_lib_pthread_pthread_create=yes
|
||||
"
|
||||
|
||||
termux_step_post_get_source() {
|
||||
git fetch --unshallow
|
||||
git checkout $_COMMIT
|
||||
( cd sdk && git checkout $_SDK_COMMIT )
|
||||
}
|
||||
|
||||
termux_step_pre_configure() {
|
||||
autoreconf -fi
|
||||
|
||||
export OBJCXX="$CXX"
|
||||
CPPFLAGS+=" -DENABLE_SYNC"
|
||||
|
||||
echo '!<arch>' > $TERMUX_PREFIX/lib/libpthread.a
|
||||
}
|
19
packages/megacmd/configure.ac.patch
Normal file
19
packages/megacmd/configure.ac.patch
Normal file
@ -0,0 +1,19 @@
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
AC_INIT([MEGAcmd], m4_esyscmd([ grep define < src/megacmdversion.h | awk '{print $3}' | awk 'BEGIN { RS = "" ; FS = "\n" } {printf $1"."$2"."$3}']), [https://github.com/meganz/megacmd])
|
||||
|
||||
-AM_INIT_AUTOMAKE
|
||||
+AM_INIT_AUTOMAKE([1.11 foreign silent-rules])
|
||||
|
||||
AC_PROG_CC
|
||||
AC_CONFIG_FILES(Makefile)
|
||||
@@ -50,7 +50,6 @@
|
||||
# AC_GNU_SOURCE
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
|
||||
-AM_INIT_AUTOMAKE([1.11 foreign silent-rules])
|
||||
AC_CONFIG_HEADERS([src/megacmdconfig.h]) #this avoids inline definitions of stuff already defined in sdk's config.h (e.g: -DPACKAGE_NAME)
|
||||
|
||||
LT_INIT([shared disable-static win32-dll])
|
@ -0,0 +1,56 @@
|
||||
--- a/src/comunicationsmanagerfilesockets.cpp
|
||||
+++ b/src/comunicationsmanagerfilesockets.cpp
|
||||
@@ -76,10 +76,10 @@ int ComunicationsManagerFileSockets::cre
|
||||
return -1;
|
||||
}
|
||||
|
||||
- char socket_path[60];
|
||||
+ char socket_path[] = "@TERMUX_PREFIX@/tmp/megaCMD_XXXXXXXXXXXXXXXXXXXX/srv_XXXXXXXXXXX";
|
||||
*sockId = get_next_comm_id();
|
||||
bzero(socket_path, sizeof( socket_path ) * sizeof( *socket_path ));
|
||||
- sprintf(socket_path, "/tmp/megaCMD_%d/srv_%d", getuid(), *sockId);
|
||||
+ sprintf(socket_path, "@TERMUX_PREFIX@/tmp/megaCMD_%d/srv_%d", getuid(), *sockId);
|
||||
|
||||
struct sockaddr_un addr;
|
||||
socklen_t saddrlen = sizeof( addr );
|
||||
@@ -140,8 +140,8 @@ ComunicationsManagerFileSockets::Comunic
|
||||
int ComunicationsManagerFileSockets::initialize()
|
||||
{
|
||||
MegaFileSystemAccess *fsAccess = new MegaFileSystemAccess();
|
||||
- char csocketsFolder[34]; // enough to hold all numbers up to 64-bits
|
||||
- sprintf(csocketsFolder, "/tmp/megaCMD_%d", getuid());
|
||||
+ char csocketsFolder[] = "@TERMUX_PREFIX@/tmp/megaCMD_XXXXXXXXXXXXXXXXXXXX"; // enough to hold all numbers up to 64-bits
|
||||
+ sprintf(csocketsFolder, "@TERMUX_PREFIX@/tmp/megaCMD_%d", getuid());
|
||||
LocalPath socketsFolder = LocalPath::fromLocalname(csocketsFolder);
|
||||
|
||||
fsAccess->setdefaultfolderpermissions(0700);
|
||||
@@ -169,9 +169,9 @@ int ComunicationsManagerFileSockets::ini
|
||||
memset(&addr, 0, sizeof( addr ));
|
||||
addr.sun_family = AF_UNIX;
|
||||
|
||||
- char socketPath[60];
|
||||
+ char socketPath[] = "@TERMUX_PREFIX@/tmp/megaCMD_XXXXXXXXXXXXXXXXXXXX/srv";
|
||||
bzero(socketPath, sizeof( socketPath ) * sizeof( *socketPath ));
|
||||
- sprintf(socketPath, "/tmp/megaCMD_%d/srv", getuid());
|
||||
+ sprintf(socketPath, "@TERMUX_PREFIX@/tmp/megaCMD_%d/srv", getuid());
|
||||
|
||||
strncpy(addr.sun_path, socketPath, sizeof( addr.sun_path ) - 1);
|
||||
|
||||
@@ -236,7 +236,7 @@ void ComunicationsManagerFileSockets::st
|
||||
{ //shutdown failed. we need to send something to the blocked thread so as to wake up from select
|
||||
|
||||
int clientsocket = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
- char socket_path[60];
|
||||
+ char socket_path[] = "@TERMUX_PREFIX@/tmp/megaCMD_XXXXXXXXXXXXXXXXXXXX/srv";
|
||||
if (clientsocket < 0 )
|
||||
{
|
||||
LOG_err << "ERROR opening client socket to exit select: " << errno;
|
||||
@@ -250,7 +250,7 @@ void ComunicationsManagerFileSockets::st
|
||||
}
|
||||
bzero(socket_path, sizeof( socket_path ) * sizeof( *socket_path ));
|
||||
{
|
||||
- sprintf(socket_path, "/tmp/megaCMD_%d/srv", getuid() );
|
||||
+ sprintf(socket_path, "@TERMUX_PREFIX@/tmp/megaCMD_%d/srv", getuid() );
|
||||
}
|
||||
|
||||
struct sockaddr_un addr;
|
@ -0,0 +1,34 @@
|
||||
--- a/src/megacmdshell/megacmdshellcommunications.cpp
|
||||
+++ b/src/megacmdshell/megacmdshellcommunications.cpp
|
||||
@@ -137,7 +137,7 @@ string createAndRetrieveConfigFolder()
|
||||
if (( getpwuid_r(22, pwdptr, pwdbuffer, pwdlinelen, &tempPwdPtr)) != 0)
|
||||
{
|
||||
cerr << "Couldnt get HOME folder" << endl;
|
||||
- return "/tmp";
|
||||
+ return "@TERMUX_PREFIX@/tmp";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -293,7 +293,7 @@ SOCKET MegaCmdShellCommunications::creat
|
||||
else
|
||||
{
|
||||
SOCKET thesock = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
- char socket_path[60];
|
||||
+ char socket_path[] = "@TERMUX_PREFIX@/tmp/megaCMD_XXXXXXXXXXXXXXXXXXXX/srv_XXXXXXXXXXX";
|
||||
if (!socketValid(thesock))
|
||||
{
|
||||
cerr << "ERROR opening socket: " << ERRNO << endl;
|
||||
@@ -307,11 +307,11 @@ SOCKET MegaCmdShellCommunications::creat
|
||||
bzero(socket_path, sizeof( socket_path ) * sizeof( *socket_path ));
|
||||
if (number)
|
||||
{
|
||||
- sprintf(socket_path, "/tmp/megaCMD_%d/srv_%d", getuid(), number);
|
||||
+ sprintf(socket_path, "@TERMUX_PREFIX@/tmp/megaCMD_%d/srv_%d", getuid(), number);
|
||||
}
|
||||
else
|
||||
{
|
||||
- sprintf(socket_path, "/tmp/megaCMD_%d/srv", getuid() );
|
||||
+ sprintf(socket_path, "@TERMUX_PREFIX@/tmp/megaCMD_%d/srv", getuid() );
|
||||
}
|
||||
|
||||
struct sockaddr_un addr;
|
Loading…
Reference in New Issue
Block a user