Build with system-provided megasdk (we package it separately, because it's a separate project). This patch is based on https://github.com/void-linux/void-packages/blob/40760239c3d5adaef2c093a9ffa4059038fc1309/srcpkgs/MEGAcmd/patches/autotools.patch --- a/src/include.am +++ b/src/include.am @@ -7,9 +7,9 @@ MEGACMD = mega-cmd mega-exec mega-cmd-server bin_PROGRAMS += $(MEGACMD) -$(MEGACMD): $(top_builddir)/sdk/src/libmega.la +$(MEGACMD): noinst_HEADERS += src/comunicationsmanager.h src/configurationmanager.h src/megacmd.h src/megacmdlogger.h src/megacmdsandbox.h src/megacmdutils.h src/megacmdcommonutils.h src/listeners.h src/megacmdexecuter.h src/megacmdtransfermanager.h src/megacmdversion.h src/megacmdplatform.h src/comunicationsmanagerportsockets.h -megacmdcompletiondir = $(sysconfdir)/bash_completion.d/ +megacmdcompletiondir = $(datarootdir)/bash-completion/completions megacmdcompletion_DATA = src/client/megacmd_completion.sh megacmdscripts_bindir = $(bindir) @@ -20,20 +20,21 @@ mega_cmddir=examples #CMDCLIENT -noinst_HEADERS += src/megacmdcommonutils.h src/megacmdshell/megacmdshellcommunications.h src/megacmdshell/megacmdshell.h sdk/include/mega/thread.h +noinst_HEADERS += src/megacmdcommonutils.h src/megacmdshell/megacmdshellcommunications.h src/megacmdshell/megacmdshell.h mega_exec_SOURCES = src/megacmdcommonutils.cpp src/client/megacmdclient.cpp src/megacmdshell/megacmdshellcommunications.cpp mega_execdir=examples #mega_exec_CXXFLAGS = -std=c++11 -DUSE_CPPTHREAD=1 -Iinclude/ #mega_exec_CXXFLAGS = -Iinclude/ -mega_exec_CXXFLAGS = -Isdk/include/ $(LMEGAINC) +mega_exec_CXXFLAGS = $(LMEGAINC) +mega_exec_LDADD = $(RL_LDFLAGS) $(RL_LIBS) $(TERMCAP_LDFLAGS) $(TERMCAP_LIBS) $(MEGA_LIBS) #CMDSHELL -noinst_HEADERS += src/megacmdcommonutils.h src/megacmdshell/megacmdshellcommunications.h src/megacmdshell/megacmdshell.h sdk/include/mega/thread.h +noinst_HEADERS += src/megacmdcommonutils.h src/megacmdshell/megacmdshellcommunications.h src/megacmdshell/megacmdshell.h mega_cmd_SOURCES = src/megacmdcommonutils.cpp src/megacmdshell/megacmdshellcommunications.cpp src/megacmdshell/megacmdshell.cpp -mega_cmd_CXXFLAGS = $(RL_CXXFLAGS) -Isdk/include/ $(LMEGAINC) -mega_cmd_LDADD = $(RL_LDFLAGS) $(RL_LIBS) $(TERMCAP_LDFLAGS) $(TERMCAP_LIBS) +mega_cmd_CXXFLAGS = $(RL_CXXFLAGS) $(LMEGAINC) +mega_cmd_LDADD = $(RL_LDFLAGS) $(RL_LIBS) $(TERMCAP_LDFLAGS) $(TERMCAP_LIBS) $(MEGA_LIBS) mega_cmd_server_CXXFLAGS = $(LMEGAINC) $(DB_CXXFLAGS) if USE_PCRE @@ -41,9 +42,7 @@ endif if WIN32 -noinst_HEADERS += src/megacmdshell/megacmdshellcommunicationsnamedpipes.h sdk/include/mega/thread.h sdk/include/mega/thread/win32thread.h sdk/include/mega/logging.h -mega_cmd_SOURCES += src/megacmdshell/megacmdshellcommunicationsnamedpipes.cpp sdk/src/thread/win32thread.cpp sdk/src/logging.cpp -mega_exec_SOURCES += src/megacmdshell/megacmdshellcommunicationsnamedpipes.cpp sdk/src/thread/win32thread.cpp sdk/src/logging.cpp +noinst_HEADERS += src/megacmdshell/megacmdshellcommunicationsnamedpipes.h mega_cmd_server_SOURCES += src/comunicationsmanagernamedpipes.cpp mega_cmd_server_CXXFLAGS += -D_WIN32=1 -Isdk/include/ -Isdk/include/mega/win32 @@ -56,12 +55,10 @@ else -mega_cmd_server_LDADD=$(DB_LDFLAGS) $(DB_LIBS) $(PCRE_LIBS) $(top_builddir)/sdk/src/libmega.la +mega_cmd_server_LDADD=$(DB_LDFLAGS) $(DB_LIBS) $(PCRE_LIBS) $(MEGA_LIBS) mega_cmd_server_SOURCES += src/comunicationsmanagerfilesockets.cpp -noinst_HEADERS += src/comunicationsmanagerfilesockets.h sdk/include/mega/thread/posixthread.h sdk/include/mega/logging.h -mega_cmd_SOURCES += sdk/src/thread/posixthread.cpp sdk/src/logging.cpp -mega_exec_SOURCES += sdk/src/thread/posixthread.cpp sdk/src/logging.cpp +noinst_HEADERS += src/comunicationsmanagerfilesockets.h #mega_cmd_CXXFLAGS += -DUSE_PTHREAD=1 #mega_exec_CXXFLAGS += -DUSE_PTHREAD=1 --- a/Makefile.am +++ b/Makefile.am @@ -46,7 +46,6 @@ DISTCLEANFILES= BUILT_SOURCES= noinst_PROGRAMS= -SUBDIRS = sdk include src/include.am #EXTRA_DIST += autogen.sh --- a/configure.ac +++ b/configure.ac @@ -18,11 +18,6 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -m4_include([sdk/m4/ax_check_compile_flag.m4]) -m4_include([sdk/m4/ax_check_link_flag.m4]) -m4_include([sdk/m4/ax_cxx_compile_stdcxx.m4]) -m4_include([sdk/m4/ax_atomic.m4]) - m4_define([megacmd_major_version], [$(cat src/megacmdversion.h | grep "define MEGACMD_MAJOR" | cut -d" " -f 3)]) m4_define([megacmd_minor_version], [$(cat src/megacmdversion.h | grep "define MEGACMD_MINOR" | cut -d" " -f 3)]) m4_define([megacmd_micro_version], [$(cat src/megacmdversion.h | grep "define MEGACMD_MICRO" | cut -d" " -f 3)]) @@ -42,9 +37,7 @@ AC_CONFIG_FILES(Makefile) AC_OUTPUT -AC_CONFIG_SUBDIRS(sdk) - # Define _GNU_SOURCE # AC_GNU_SOURCE AC_USE_SYSTEM_EXTENSIONS @@ -541,7 +534,8 @@ #This will simulate compilation of sdk and extract the includes defined for it. Thus we can # take care of the configuration done for the subproject withtout having to recheck here AC_OUTPUT -LMEGAINC=$(cd sdk; for i in $(make -n 2>/dev/null | grep "\-I" | grep megaapi ); do echo $i; done | grep "\-I" | sort | uniq | awk '{printf $0" "}') +PKG_CHECK_MODULES([MEGA],[libmega]) +LMEGAINC=${MEGA_CFLAGS} AC_SUBST(LMEGAINC) # Output