From 89b2ed17d86e1fbe7e322641839627f3cbc26824 Mon Sep 17 00:00:00 2001 From: Matt Weir Date: Tue, 9 Apr 2019 18:15:12 +1200 Subject: [PATCH 1/2] Updates for compiling 1.1.0 for QNAP --- build/QNAP_NAS/build-CT-i686 | 146 ------------------ build/QNAP_NAS/build-CT-x86-64 | 13 +- build/QNAP_NAS/build-arm64 | 16 +- build/QNAP_NAS/build-linaro | 14 +- build/QNAP_NAS/build-marvell | 134 ---------------- .../source/megacmdpkg/SynoBuildConf/build | 2 +- src/megacmdexecuter.cpp | 2 +- 7 files changed, 28 insertions(+), 299 deletions(-) delete mode 100755 build/QNAP_NAS/build-CT-i686 delete mode 100755 build/QNAP_NAS/build-marvell diff --git a/build/QNAP_NAS/build-CT-i686 b/build/QNAP_NAS/build-CT-i686 deleted file mode 100755 index 19d423a2..00000000 --- a/build/QNAP_NAS/build-CT-i686 +++ /dev/null @@ -1,146 +0,0 @@ -#!/bin/bash -# run this from the MEGAcmd folder -# but first set up the environment per the PDF and tar files at https://sourceforge.net/projects/qosgpl/files/QNAP%20NAS%20Tool%20Chains/ -# and put the MEGAcmd tree at /opt/cross-project/qnap/ - -#prerequisites: -# - qnap installed cross compiler from http://download.qnap.com/dev/Toolchain/QNAP_cross_toolchains_64.20160606.tar -# (unzipped to /opt/cross-compile) -# - (maybe)32 bit libz, eg this works for ubuntu 16.04: sudo apt-get install zlib1g:i386 - -export PROJECT=i686-QNAP-linux-gnu -export PRJROOT=/opt/cross-project/CT -export ARCH=x86 -export TARGET=$PROJECT -export CROSS_COMPILE=${TARGET}- -export TARGET_PREFIX=${PRJROOT}/${PROJECT}/cross-tools -export SYS_TARGET_PREFIX=${PRJROOT}/${PROJECT}/cross-tools -export PATH=${SYS_TARGET_PREFIX}/bin/:${PATH}:/usr/sbin:/sbin - -export MEGA_CMD_DIR=/opt/cross-project/qnap/MEGAcmd - -#export MACHINE= -export CUSTOM_CONFIG_ARGS="--host=${TARGET} --disable-dependency-tracking" - -export CC=${CROSS_COMPILE}gcc -export CXX=${CROSS_COMPILE}g++ -export LD=${CROSS_COMPILE}ld -export CFLAGS="$CFLAGS -fPIC -fexceptions -fvisibility=hidden -fsigned-char" -export CPPFLAGS="-DNDEBUG" -export CXXFLAGS="$CXXFLAGS $CFLAGS -DNDEBUG -DENABLE_BACKUPS -DMEGACMD_USERAGENT_SUFFIX=QNAP -DHAVE_LIBUV" -export AR=${CROSS_COMPILE}ar -export NM=${CROSS_COMPILE}nm -export STRIP=${CROSS_COMPILE}strip -export RANLIB=${CROSS_COMPILE}ranlib -export OBJDUMP=${CROSS_COMPILE}objdump -export LDFLAGS= -export ConfigOpt= -#export ARCH=$ARCH -export ToolChainSysRoot=$SYS_TARGET_PREFIX -export SysRootPrefix=$SYS_TARGET_PREFIX -export SysRootInclude=$SYS_TARGET_PREFIX/include -export SysRootLib=$SYS_TARGET_PREFIX/lib - -export CROSS_COMPILE= - -export AUTOMAKE_OPTIONS="no-dependencies" - - -echo ---------- env set up -------------------- -env | sort -echo ---------- env set up -------------------- - -#fix any utf-8 w/ BOM files that the compiler can't handle -cd $MEGA_CMD_DIR -find src -name "*.h" | xargs dos2unix -find src -name "*.c" | xargs dos2unix -find src -name "*.cpp" | xargs dos2unix -find sdk/include -name "*.h" | xargs dos2unix -find sdk/src -name "*.c" | xargs dos2unix -find sdk/src -name "*.cpp" | xargs dos2unix - - -cd $MEGA_CMD_DIR/sdk -pwd - -mkdir -p norecurse -mv norecurse/* . - -./contrib/build_sdk.sh -a -e -g -I -n -q -R -v -X -C"$CUSTOM_CONFIG_ARGS" -O linux-32 2>&1 | tee $MEGA_CMD_DIR/mybuildlogs-sdkbuild.out - -if [ -e ./src/libmega.a ] ; then - size=$(wc -c < ./src/libmega.a ) - if [ $size -le 5000 ] ; then - echo "erasing bad build products" - rm -f ./src/libmega.a - rm -f ./src/libmega.la - fi -fi - -if ! [ -e src/libmega.a ] ; then - echo "libtool could not link it so we do it ourselves. Including Zen and MediaInfo somehow reference a nonexistent path /home/slava in the Synology libtool libraries. If we left those out it would make the lib ok." - echo "we make the lib using $AR directly, with and output the same name src/libmega.la that satisfies the configure script for MEGAcmd." - rm -f src/libmega.la - $AR -rcs ./src/libmega.a `find src -name "*.o"` `find sdk_build -name "*.a"` - cp ./src/libmega.a ./src/libmega.la -fi - -if ! [ -e ./sdk_build/install/lib/libmega.a ] ; then - cp ./src/libmega* ./sdk_build/install/lib/ -fi - -if ! [ -e ./sdk_build/install/lib/libmega.a ] ; then - echo "SDK build failed" - exit 1 -fi - -mv ./Makefile* norecurse/ -mv ./config* norecurse/ -cd .. - -echo -------------------------------------------------------- sdk end -------------------------------------- - - -echo about to build megacmd --------------------------- - -sh autogen.sh 2>&1 | tee $MEGA_CMD_DIR/mybuildlogs-autogen2.out -./configure --without-libraw SUBDIRS="" --enable-static --with-cryptopp --with-readline=$MEGA_CMD_DIR/sdk/sdk_build/install/include/ \ - $CUSTOM_CONFIG_ARGS 2>&1 | tee $MEGA_CMD_DIR/mybuildlogs-configure2.out - - -export INCLUDES="-I$MEGA_CMD_DIR/sdk/sdk_build/install/include -I$MEGA_CMD_DIR/sdk/include/ -I$MEGA_CMD_DIR/include/mega/posix" -#somehow autotools is determined to have WIN32 defined -#make SUBDIRS='' 2>&1 | tee $MEGA_CMD_DIR/mybuildlogs-make2.out - -rm -f mega-cmd-server -rm -f mega-cmd -rm -f mega-cmd-exec - -$CXX $CXXFLAGS src/megacmd.cpp src/comunicationsmanager.cpp src/megacmdutils.cpp src/megacmdcommonutils.cpp src/configurationmanager.cpp src/megacmdlogger.cpp src/megacmdsandbox.cpp src/listeners.cpp src/megacmdexecuter.cpp src/comunicationsmanagerportsockets.cpp src/comunicationsmanagerfilesockets.cpp -Isdk/include -Isdk/include/mega/posix -Isdk/sdk_build/install/include `find sdk/src -name "*.o"` sdk/sdk_build/install/lib/libcryptopp.a sdk/sdk_build/install/lib/libcurl.a sdk/sdk_build/install/lib/libcares.a sdk/sdk_build/install/lib/libssl.a sdk/sdk_build/install/lib/libcrypto.a sdk/sdk_build/install/lib/libsqlite3.a sdk/sdk_build/install/lib/libfreeimage.a sdk/sdk_build/install/lib/libmediainfo.a sdk/sdk_build/install/lib/libzen.a sdk/sdk_build/build/libuv-v1.8.0/.libs/libuv.a -lpthread -ldl -lrt sdk/sdk_build/install/lib/libz.a -o mega-cmd-server - -$CXX $CXXFLAGS src/megacmdcommonutils.cpp src/megacmdshell/*.cpp -Isdk/include -Isdk/include/mega/posix -Isdk/sdk_build/install/include `find sdk/src -name "*.o"` sdk/sdk_build/install/lib/libcryptopp.a sdk/sdk_build/install/lib/libcurl.a sdk/sdk_build/install/lib/libcares.a sdk/sdk_build/install/lib/libssl.a sdk/sdk_build/install/lib/libcrypto.a sdk/sdk_build/install/lib/libsqlite3.a sdk/sdk_build/install/lib/libfreeimage.a sdk/sdk_build/install/lib/libmediainfo.a sdk/sdk_build/install/lib/libzen.a -lpthread -ldl -lrt sdk/sdk_build/install/lib/libz.a ./sdk/sdk_build/install/lib/libreadline.a ./sdk/sdk_build/install/lib/libtermcap.a -o mega-cmd - -$CXX $CXXFLAGS src/megacmdcommonutils.cpp src/client/*.cpp src/megacmdshell/megacmdshellcommunications.cpp -Isdk/include -Isdk/include/mega/posix -Isdk/sdk_build/install/include `find sdk/src -name "*.o"` sdk/sdk_build/install/lib/libcryptopp.a sdk/sdk_build/install/lib/libcurl.a sdk/sdk_build/install/lib/libcares.a sdk/sdk_build/install/lib/libssl.a sdk/sdk_build/install/lib/libcrypto.a sdk/sdk_build/install/lib/libsqlite3.a sdk/sdk_build/install/lib/libfreeimage.a sdk/sdk_build/install/lib/libmediainfo.a sdk/sdk_build/install/lib/libzen.a -lpthread -ldl -lrt sdk/sdk_build/install/lib/libz.a -o mega-exec - -echo "outputs should be 3 files: mega-cmd mega-cmd-server mega-exec. ls output: " -ls mega-cmd mega-cmd-server mega-exec - -if [ -e mega-cmd ] && [ -e mega-cmd-server ] && [ -e mega-exec ] ; then - - mkdir -p install - cp src/client/mega-* install/ - cp mega-cmd mega-exec mega-cmd-server install/ - - mkdir -p build/QNAP_NAS/megacmdpkg/x86 - cp install/* build/QNAP_NAS/megacmdpkg/x86 - - MAJOR=`sed -n -e 's/.*MAJOR_VERSION \([0-9]*\).*/\1/p' < src/megacmdversion.h` - MINOR=`sed -n -e 's/.*MINOR_VERSION \([0-9]*\).*/\1/p' < src/megacmdversion.h` - MICRO=`sed -n -e 's/.*MICRO_VERSION \([0-9]*\).*/\1/p' < src/megacmdversion.h` - MEGACMD_VERSION="\"$MAJOR.$MINOR.$MICRO\"" - sed -i build/QNAP_NAS/megacmdpkg/qpkg.cfg -e "s/^QPKG_VER=.*/QPKG_VER=$MEGACMD_VERSION/" -else - echo "Build failed" - exit 1 -fi - diff --git a/build/QNAP_NAS/build-CT-x86-64 b/build/QNAP_NAS/build-CT-x86-64 index d0e6d269..abd9d7ec 100755 --- a/build/QNAP_NAS/build-CT-x86-64 +++ b/build/QNAP_NAS/build-CT-x86-64 @@ -8,8 +8,10 @@ # (unzipped to /opt/cross-compile) # - (maybe)32 bit libz, eg this works for ubuntu 16.04: sudo apt-get install zlib1g:i386 +export BUILDROOT=$(pwd)/../../../.. + export PROJECT=x86_64-QNAP-linux-gnu -export PRJROOT=/opt/cross-project/CT +export PRJROOT=${BUILDROOT}/opt/cross-project/CT export ARCH=x86_64 export TARGET=x86_64-QNAP-linux-gnu export CROSS_COMPILE=${TARGET}- @@ -17,7 +19,7 @@ export TARGET_PREFIX=${PRJROOT}/${PROJECT}/cross-tools export SYS_TARGET_PREFIX=${PRJROOT}/${PROJECT}/cross-tools export PATH=${SYS_TARGET_PREFIX}/bin/:${PATH}:/usr/sbin:/sbin -export MEGA_CMD_DIR=/opt/cross-project/qnap/MEGAcmd +export MEGA_CMD_DIR=${BUILDROOT}/opt/cross-project/qnap/MEGAcmd #export MACHINE= export CUSTOM_CONFIG_ARGS="--host=${TARGET} --disable-dependency-tracking" @@ -27,7 +29,7 @@ export CXX=${CROSS_COMPILE}g++ export LD=${CROSS_COMPILE}ld export CFLAGS="$CFLAGS -fPIC -fexceptions -fvisibility=hidden -fsigned-char" export CPPFLAGS="-DNDEBUG" -export CXXFLAGS="$CXXFLAGS $CFLAGS -DNDEBUG -DENABLE_BACKUPS -DMEGACMD_USERAGENT_SUFFIX=QNAP -DHAVE_LIBUV" +export CXXFLAGS="$CXXFLAGS $CFLAGS -DNDEBUG -DENABLE_BACKUPS -DMEGACMD_USERAGENT_SUFFIX=QNAP -DHAVE_LIBUV -std=c++11" export AR=${CROSS_COMPILE}ar export NM=${CROSS_COMPILE}nm export STRIP=${CROSS_COMPILE}strip @@ -45,6 +47,7 @@ export CROSS_COMPILE= export AUTOMAKE_OPTIONS="no-dependencies" +${CXX} --version echo ---------- env set up -------------------- env | sort @@ -118,9 +121,9 @@ rm -f mega-cmd-exec $CXX $CXXFLAGS src/megacmd.cpp src/comunicationsmanager.cpp src/megacmdutils.cpp src/megacmdcommonutils.cpp src/configurationmanager.cpp src/megacmdlogger.cpp src/megacmdsandbox.cpp src/listeners.cpp src/megacmdexecuter.cpp src/comunicationsmanagerportsockets.cpp src/comunicationsmanagerfilesockets.cpp -Isdk/include -Isdk/include/mega/posix -Isdk/sdk_build/install/include `find sdk/src -name "*.o"` sdk/sdk_build/install/lib/libcryptopp.a sdk/sdk_build/install/lib/libcurl.a sdk/sdk_build/install/lib/libcares.a sdk/sdk_build/install/lib/libssl.a sdk/sdk_build/install/lib/libcrypto.a sdk/sdk_build/install/lib/libsqlite3.a sdk/sdk_build/install/lib/libfreeimage.a sdk/sdk_build/install/lib/libmediainfo.a sdk/sdk_build/install/lib/libzen.a sdk/sdk_build/build/libuv-v1.8.0/.libs/libuv.a -lpthread -ldl -lrt sdk/sdk_build/install/lib/libz.a -o mega-cmd-server -$CXX $CXXFLAGS src/megacmdcommonutils.cpp src/megacmdshell/*.cpp -Isdk/include -Isdk/include/mega/posix -Isdk/sdk_build/install/include `find sdk/src -name "*.o"` sdk/sdk_build/install/lib/libcryptopp.a sdk/sdk_build/install/lib/libcurl.a sdk/sdk_build/install/lib/libcares.a sdk/sdk_build/install/lib/libssl.a sdk/sdk_build/install/lib/libcrypto.a sdk/sdk_build/install/lib/libsqlite3.a sdk/sdk_build/install/lib/libfreeimage.a sdk/sdk_build/install/lib/libmediainfo.a sdk/sdk_build/install/lib/libzen.a -lpthread -ldl -lrt sdk/sdk_build/install/lib/libz.a ./sdk/sdk_build/install/lib/libreadline.a ./sdk/sdk_build/install/lib/libtermcap.a -o mega-cmd +$CXX $CXXFLAGS src/megacmdcommonutils.cpp src/megacmdshell/*.cpp -Isdk/include -Isdk/include/mega/posix -Isdk/sdk_build/install/include `find sdk/src -name "*.o"` sdk/sdk_build/install/lib/libcryptopp.a sdk/sdk_build/install/lib/libcurl.a sdk/sdk_build/install/lib/libcares.a sdk/sdk_build/install/lib/libssl.a sdk/sdk_build/install/lib/libcrypto.a sdk/sdk_build/install/lib/libsqlite3.a sdk/sdk_build/install/lib/libfreeimage.a sdk/sdk_build/install/lib/libmediainfo.a sdk/sdk_build/install/lib/libzen.a sdk/sdk_build/build/libuv-v1.8.0/.libs/libuv.a -lpthread -ldl -lrt sdk/sdk_build/install/lib/libz.a ./sdk/sdk_build/install/lib/libreadline.a ./sdk/sdk_build/install/lib/libtermcap.a -o mega-cmd -$CXX $CXXFLAGS src/megacmdcommonutils.cpp src/client/*.cpp src/megacmdshell/megacmdshellcommunications.cpp -Isdk/include -Isdk/include/mega/posix -Isdk/sdk_build/install/include `find sdk/src -name "*.o"` sdk/sdk_build/install/lib/libcryptopp.a sdk/sdk_build/install/lib/libcurl.a sdk/sdk_build/install/lib/libcares.a sdk/sdk_build/install/lib/libssl.a sdk/sdk_build/install/lib/libcrypto.a sdk/sdk_build/install/lib/libsqlite3.a sdk/sdk_build/install/lib/libfreeimage.a sdk/sdk_build/install/lib/libmediainfo.a sdk/sdk_build/install/lib/libzen.a -lpthread -ldl -lrt sdk/sdk_build/install/lib/libz.a -o mega-exec +$CXX $CXXFLAGS src/megacmdcommonutils.cpp src/client/*.cpp src/megacmdshell/megacmdshellcommunications.cpp -Isdk/include -Isdk/include/mega/posix -Isdk/sdk_build/install/include `find sdk/src -name "*.o"` sdk/sdk_build/install/lib/libcryptopp.a sdk/sdk_build/install/lib/libcurl.a sdk/sdk_build/install/lib/libcares.a sdk/sdk_build/install/lib/libssl.a sdk/sdk_build/install/lib/libcrypto.a sdk/sdk_build/install/lib/libsqlite3.a sdk/sdk_build/install/lib/libfreeimage.a sdk/sdk_build/install/lib/libmediainfo.a sdk/sdk_build/install/lib/libzen.a sdk/sdk_build/build/libuv-v1.8.0/.libs/libuv.a -lpthread -ldl -lrt sdk/sdk_build/install/lib/libz.a -o mega-exec echo "outputs should be 3 files: mega-cmd mega-cmd-server mega-exec. ls output: " ls mega-cmd mega-cmd-server mega-exec diff --git a/build/QNAP_NAS/build-arm64 b/build/QNAP_NAS/build-arm64 index 16b9a39f..f15603aa 100755 --- a/build/QNAP_NAS/build-arm64 +++ b/build/QNAP_NAS/build-arm64 @@ -8,8 +8,10 @@ # (unzipped to /opt/cross-compile) # - (maybe)32 bit libz, eg this works for ubuntu 16.04: sudo apt-get install zlib1g:i386 +export BUILDROOT=$(pwd)/../../../.. + export PROJECT=aarch64-QNAP-linux-gnu -export PRJROOT=/opt/cross-project/arm_64 +export PRJROOT=${BUILDROOT}/opt/cross-project/arm_64 export ARCH=aarch64 export TARGET=$PROJECT export CROSS_COMPILE=${TARGET}- @@ -17,7 +19,7 @@ export TARGET_PREFIX=${PRJROOT}/${PROJECT}/bin export SYS_TARGET_PREFIX=${PRJROOT}/${PROJECT}/bin export PATH=${SYS_TARGET_PREFIX}:${PATH}:/usr/sbin:/sbin -export MEGA_CMD_DIR=/opt/cross-project/qnap/MEGAcmd +export MEGA_CMD_DIR=${BUILDROOT}/opt/cross-project/qnap/MEGAcmd export MACHINE=aarch64 export CUSTOM_CONFIG_ARGS="--host=${TARGET} --disable-dependency-tracking" @@ -27,7 +29,7 @@ export CXX=${CROSS_COMPILE}g++ export LD=${CROSS_COMPILE}ld export CFLAGS="$CFLAGS -fPIC -fexceptions -fvisibility=hidden -fsigned-char " export CPPFLAGS="-DNDEBUG " -export CXXFLAGS="$CXXFLAGS $CFLAGS $CPPFLAGS -DENABLE_BACKUPS -DMEGACMD_USERAGENT_SUFFIX=QNAP -DHAVE_LIBUV" +export CXXFLAGS="$CXXFLAGS $CFLAGS $CPPFLAGS -DENABLE_BACKUPS -DMEGACMD_USERAGENT_SUFFIX=QNAP -DHAVE_LIBUV -std=c++11" export AR=${CROSS_COMPILE}ar export NM=${CROSS_COMPILE}nm export STRIP=${CROSS_COMPILE}strip @@ -45,6 +47,8 @@ export CROSS_COMPILE= export AUTOMAKE_OPTIONS="no-dependencies" +${CXX} --version + echo ---------- env set up -------------------- env | sort echo ---------- env set up -------------------- @@ -115,11 +119,11 @@ rm -f mega-cmd-server rm -f mega-cmd rm -f mega-cmd-exec -$CXX $CXXFLAGS src/megacmd.cpp src/comunicationsmanager.cpp src/megacmdutils.cpp src/megacmdcommonutils.cpp src/configurationmanager.cpp src/megacmdlogger.cpp src/megacmdsandbox.cpp src/listeners.cpp src/megacmdexecuter.cpp src/comunicationsmanagerportsockets.cpp src/comunicationsmanagerfilesockets.cpp -Isdk/include -Isdk/include/mega/posix -Isdk/sdk_build/install/include `find sdk/src -name "*.o"` sdk/sdk_build/install/lib/libcryptopp.a sdk/sdk_build/install/lib/libcurl.a sdk/sdk_build/install/lib/libcares.a sdk/sdk_build/install/lib/libssl.a sdk/sdk_build/install/lib/libcrypto.a sdk/sdk_build/install/lib/libsqlite3.a sdk/sdk_build/install/lib/libfreeimage.a sdk/sdk_build/install/lib/libmediainfo.a sdk/sdk_build/install/lib/libzen.a sdk/sdk_build/build/libuv-v1.8.0/.libs/libuv.a -lpthread -ldl -lrt sdk/sdk_build/install/lib/libz.a -o mega-cmd-server +$CXX $CXXFLAGS src/megacmd.cpp src/comunicationsmanager.cpp src/megacmdutils.cpp src/megacmdcommonutils.cpp src/configurationmanager.cpp src/megacmdlogger.cpp src/megacmdsandbox.cpp src/listeners.cpp src/megacmdexecuter.cpp src/comunicationsmanagerportsockets.cpp src/comunicationsmanagerfilesockets.cpp -Isdk/include -Isdk/include/mega/posix -Isdk/sdk_build/install/include `find sdk/src -name "*.o"` sdk/sdk_build/install/lib/libcryptopp.a sdk/sdk_build/install/lib/libcurl.a sdk/sdk_build/install/lib/libcares.a sdk/sdk_build/install/lib/libssl.a sdk/sdk_build/install/lib/libcrypto.a sdk/sdk_build/install/lib/libsqlite3.a sdk/sdk_build/install/lib/libfreeimage.a sdk/sdk_build/install/lib/libmediainfo.a sdk/sdk_build/install/lib/libzen.a sdk/sdk_build/build/libuv-v1.8.0/.libs/libuv.a -lpthread -ldl -lrt sdk/sdk_build/install/lib/libz.a -lstdc++fs -o mega-cmd-server -$CXX $CXXFLAGS src/megacmdcommonutils.cpp src/megacmdshell/*.cpp -Isdk/include -Isdk/include/mega/posix -Isdk/sdk_build/install/include `find sdk/src -name "*.o"` sdk/sdk_build/install/lib/libcryptopp.a sdk/sdk_build/install/lib/libcurl.a sdk/sdk_build/install/lib/libcares.a sdk/sdk_build/install/lib/libssl.a sdk/sdk_build/install/lib/libcrypto.a sdk/sdk_build/install/lib/libsqlite3.a sdk/sdk_build/install/lib/libfreeimage.a sdk/sdk_build/install/lib/libmediainfo.a sdk/sdk_build/install/lib/libzen.a -lpthread -ldl -lrt sdk/sdk_build/install/lib/libz.a ./sdk/sdk_build/install/lib/libreadline.a ./sdk/sdk_build/install/lib/libtermcap.a -o mega-cmd +$CXX $CXXFLAGS src/megacmdcommonutils.cpp src/megacmdshell/*.cpp -Isdk/include -Isdk/include/mega/posix -Isdk/sdk_build/install/include `find sdk/src -name "*.o"` sdk/sdk_build/install/lib/libcryptopp.a sdk/sdk_build/install/lib/libcurl.a sdk/sdk_build/install/lib/libcares.a sdk/sdk_build/install/lib/libssl.a sdk/sdk_build/install/lib/libcrypto.a sdk/sdk_build/install/lib/libsqlite3.a sdk/sdk_build/install/lib/libfreeimage.a sdk/sdk_build/install/lib/libmediainfo.a sdk/sdk_build/install/lib/libzen.a sdk/sdk_build/build/libuv-v1.8.0/.libs/libuv.a -lpthread -ldl -lrt sdk/sdk_build/install/lib/libz.a ./sdk/sdk_build/install/lib/libreadline.a ./sdk/sdk_build/install/lib/libtermcap.a -lstdc++fs -o mega-cmd -$CXX $CXXFLAGS src/megacmdcommonutils.cpp src/client/*.cpp src/megacmdshell/megacmdshellcommunications.cpp -Isdk/include -Isdk/include/mega/posix -Isdk/sdk_build/install/include `find sdk/src -name "*.o"` sdk/sdk_build/install/lib/libcryptopp.a sdk/sdk_build/install/lib/libcurl.a sdk/sdk_build/install/lib/libcares.a sdk/sdk_build/install/lib/libssl.a sdk/sdk_build/install/lib/libcrypto.a sdk/sdk_build/install/lib/libsqlite3.a sdk/sdk_build/install/lib/libfreeimage.a sdk/sdk_build/install/lib/libmediainfo.a sdk/sdk_build/install/lib/libzen.a -lpthread -ldl -lrt sdk/sdk_build/install/lib/libz.a -o mega-exec +$CXX $CXXFLAGS src/megacmdcommonutils.cpp src/client/*.cpp src/megacmdshell/megacmdshellcommunications.cpp -Isdk/include -Isdk/include/mega/posix -Isdk/sdk_build/install/include `find sdk/src -name "*.o"` sdk/sdk_build/install/lib/libcryptopp.a sdk/sdk_build/install/lib/libcurl.a sdk/sdk_build/install/lib/libcares.a sdk/sdk_build/install/lib/libssl.a sdk/sdk_build/install/lib/libcrypto.a sdk/sdk_build/install/lib/libsqlite3.a sdk/sdk_build/install/lib/libfreeimage.a sdk/sdk_build/install/lib/libmediainfo.a sdk/sdk_build/install/lib/libzen.a sdk/sdk_build/build/libuv-v1.8.0/.libs/libuv.a -lpthread -ldl -lrt sdk/sdk_build/install/lib/libz.a -lstdc++fs -o mega-exec echo "outputs should be 3 files: mega-cmd mega-cmd-server mega-exec. ls output: " ls mega-cmd mega-cmd-server mega-exec diff --git a/build/QNAP_NAS/build-linaro b/build/QNAP_NAS/build-linaro index 852c25a4..7095d376 100755 --- a/build/QNAP_NAS/build-linaro +++ b/build/QNAP_NAS/build-linaro @@ -9,9 +9,10 @@ # (unzipped to /opt/) # - 32 bit libz, eg this works for ubuntu 16.04: sudo apt-get install zlib1g:i386 +export BUILDROOT=$(pwd)/../../../.. export PROJECT=arm-linux-gnueabihf -export PRJROOT=/opt/cross-project/arm/linaro +export PRJROOT=${BUILDROOT}/opt/cross-project/arm/linaro export ARCH=arm export TARGET=arm-linux-gnueabihf export CROSS_COMPILE=${TARGET}- @@ -21,10 +22,10 @@ export SYS_TARGET_PREFIX=${PRJROOT}/${PROJECT}/libc export PATH=${PRJROOT}/bin:${PATH}:/usr/sbin:/sbin -export MEGA_CMD_DIR=/opt/cross-project/qnap/MEGAcmd +export MEGA_CMD_DIR=${BUILDROOT}/opt/cross-project/qnap/MEGAcmd -#export PATH=/opt/cross-project/arm/linaro/arm-linux-gnueabihf/libc/usr/lib/:/opt/cross-project/arm/linaro/bin:$PATH -#export LD_LIBRARY_PATH=/opt/cross-project/arm/linaro/arm-linux-gnueabihf/libc/usr/lib:$LD_LIBRARY_PATH +#export PATH=${BUILDROOT}/opt/cross-project/arm/linaro/arm-linux-gnueabihf/libc/usr/lib/:/opt/cross-project/arm/linaro/bin:$PATH +#export LD_LIBRARY_PATH=${BUILDROOT}/opt/cross-project/arm/linaro/arm-linux-gnueabihf/libc/usr/lib:$LD_LIBRARY_PATH export MACHINE=armada38x export CUSTOM_CONFIG_ARGS="--host=${TARGET} --disable-dependency-tracking" @@ -34,7 +35,7 @@ export CXX=${CROSS_COMPILE}g++ export LD=${CROSS_COMPILE}ld export CFLAGS="$CFLAGS -fPIC -fexceptions -fvisibility=hidden -fsigned-char" export CPPFLAGS="-DNDEBUG" -export CXXFLAGS="$CXXFLAGS $CFLAGS -DNDEBUG -DENABLE_BACKUPS -DMEGACMD_USERAGENT_SUFFIX=QNAP -DHAVE_LIBUV" +export CXXFLAGS="$CXXFLAGS $CFLAGS -DNDEBUG -DENABLE_BACKUPS -DMEGACMD_USERAGENT_SUFFIX=QNAP -DHAVE_LIBUV -std=c++11" export AR=${CROSS_COMPILE}ar export NM=${CROSS_COMPILE}nm export STRIP=${CROSS_COMPILE}strip @@ -52,6 +53,7 @@ export CROSS_COMPILE= export AUTOMAKE_OPTIONS="no-dependencies" +${CXX} --version echo ---------- env set up -------------------- env | sort @@ -102,7 +104,7 @@ echo -------------------------------------------------------- sdk end ---------- echo about to build megacmd --------------------------- sh autogen.sh 2>&1 | tee $MEGA_CMD_DIR/mybuildlogs-autogen2.out -./configure --without-libraw SUBDIRS="" --enable-static --with-cryptopp --with-readline=/opt/cross-project/arm/marvell/arm-none-linux-gnueabi/libc/marvell-f/src/MEGAcmd/sdk/sdk_build/install/include/ \ +./configure --without-libraw SUBDIRS="" --enable-static --with-cryptopp --with-readline=${BUILDROOT}/opt/cross-project/arm/marvell/arm-none-linux-gnueabi/libc/marvell-f/src/MEGAcmd/sdk/sdk_build/install/include/ \ $CUSTOM_CONFIG_ARGS 2>&1 | tee $MEGA_CMD_DIR/mybuildlogs-configure2.out diff --git a/build/QNAP_NAS/build-marvell b/build/QNAP_NAS/build-marvell deleted file mode 100755 index 2ebfdc3a..00000000 --- a/build/QNAP_NAS/build-marvell +++ /dev/null @@ -1,134 +0,0 @@ -#!/bin/bash -# run this from the MEGAcmd folder -# but first set up the environment per the PDF and tar files at https://sourceforge.net/projects/qosgpl/files/QNAP%20NAS%20Tool%20Chains/ -# and put the MEGAcmd tree at /opt/cross-project/qnap/ -# this first sample build uses the arm cross compile toolchain, testing on the TS-228 - -#dependencies -# - qnap cross compiler from unzipping cross-project-arm-20110901.tar.gz per the PDF instructions. This corresponds to the qnap arm-x19 platform -# - dox2unix - -. /opt/cross-project/arm/marvell/arm-glibc-2.5.env - -export MEGA_CMD_DIR=/opt/cross-project/qnap/MEGAcmd - -export PATH=/opt/cross-project/arm/marvell/arm-none-linux-gnueabi/libc/marvell-f/usr/share:/opt/cross-project/arm/marvell/bin:$PATH - -export MACHINE=armada38x -export CUSTOM_CONFIG_ARGS="--host=arm-none-linux-gnueabi --disable-dependency-tracking" - -export CC=${CROSS_COMPILE}gcc -export CXX=${CROSS_COMPILE}g++ -export LD=${CROSS_COMPILE}ld -export CFLAGS="$CFLAGS -fPIC -fexceptions -fvisibility=hidden -fsigned-char" -export CPPFLAGS="-DNDEBUG" -export CXXFLAGS="$CXXFLAGS $CFLAGS -DNDEBUG -DENABLE_BACKUPS -DMEGACMD_USERAGENT_SUFFIX=QNAP -DHAVE_LIBUV" -export AR=${CROSS_COMPILE}ar -export NM=${CROSS_COMPILE}nm -export STRIP=${CROSS_COMPILE}strip -export RANLIB=${CROSS_COMPILE}ranlib -export OBJDUMP=${CROSS_COMPILE}objdump -export LDFLAGS= -export ConfigOpt= -export ToolChainSysRoot=$SYS_TARGET_PREFIX -export SysRootPrefix=$SYS_TARGET_PREFIX -export SysRootInclude=$SYS_TARGET_PREFIX/include -export SysRootLib=$SYS_TARGET_PREFIX/lib - -export CROSS_COMPILE= - -export AUTOMAKE_OPTIONS="no-dependencies" - - -echo ---------- env set up -------------------- -env | sort -echo ---------- env set up -------------------- - -#fix any utf-8 w/ BOM files that the compiler can't handle -cd $MEGA_CMD_DIR -find src -name "*.h" | xargs dos2unix -find src -name "*.c" | xargs dos2unix -find src -name "*.cpp" | xargs dos2unix -find sdk/include -name "*.h" | xargs dos2unix -find sdk/src -name "*.c" | xargs dos2unix -find sdk/src -name "*.cpp" | xargs dos2unix - - -cd $MEGA_CMD_DIR/sdk -pwd - -mkdir -p norecurse -mv norecurse/* . - -echo executing ./contrib/build_sdk.sh -a -e -f -g -I -q -v -X -C "$CUSTOM_CONFIG_ARGS" -O linux-generic32 - -#ultimately after overcoming many build challenges, we still can't build freeimage, as it turns out it uses __sync builtins, but they fail to link. Hence the -f -./contrib/build_sdk.sh -a -e -g -f -I -n -q -R -X -C"$CUSTOM_CONFIG_ARGS" -O linux-generic32 -0 2>&1 | tee $MEGA_CMD_DIR/mybuildlogs-sdkbuild.out - -if ! [ -e src/libmega.a ] ; then - echo "libtool could not link it so we do it ourselves. Including Zen and MediaInfo somehow reference a nonexistent path /home/slava in the Synology libtool libraries. If we left those out it would make the lib ok." - echo "we make the lib using $AR directly, with and output the same name src/libmega.la that satisfies the configure script for MEGAcmd." - rm -f src/libmega.la - $AR -rcs ./src/libmega.a `find src -name "*.o"` `find sdk_build -name "*.a"` - cp ./src/libmega.a ./src/libmega.la -fi - -if ! [ -e ./sdk_build/install/lib/libmega.a ] ; then - cp ./src/libmega* ./sdk_build/install/lib/ -fi - -if ! [ -e ./sdk_build/install/lib/libmega.a ] ; then - echo "SDK build failed" - exit 1 -fi - -mv ./Makefile* norecurse/ -mv ./config* norecurse/ -cd .. - -echo -------------------------------------------------------- sdk end -------------------------------------- - - -echo about to build megacmd --------------------------- - -sh autogen.sh 2>&1 | tee $MEGA_CMD_DIR/mybuildlogs-autogen2.out -./configure --without-libraw SUBDIRS="" --enable-static --with-cryptopp --with-readline=/opt/cross-project/arm/marvell/arm-none-linux-gnueabi/libc/marvell-f/src/MEGAcmd/sdk/sdk_build/install/include/ \ - $CUSTOM_CONFIG_ARGS 2>&1 | tee $MEGA_CMD_DIR/mybuildlogs-configure2.out - - -export INCLUDES="-I$MEGA_CMD_DIR/sdk/sdk_build/install/include -I$MEGA_CMD_DIR/sdk/include/ -I$MEGA_CMD_DIR/include/mega/posix" -#somehow autotools is determined to have WIN32 defined -#make SUBDIRS='' 2>&1 | tee $MEGA_CMD_DIR/mybuildlogs-make2.out - -rm -f mega-cmd-server -rm -f mega-cmd -rm -f mega-cmd-exec - -$CXX $CXXFLAGS src/megacmd.cpp src/comunicationsmanager.cpp src/megacmdutils.cpp src/megacmdcommonutils.cpp src/configurationmanager.cpp src/megacmdlogger.cpp src/megacmdsandbox.cpp src/listeners.cpp src/megacmdexecuter.cpp src/comunicationsmanagerportsockets.cpp src/comunicationsmanagerfilesockets.cpp -Isdk/include -Isdk/include/mega/posix -Isdk/sdk_build/install/include sdk/sdk_build/install/lib/libmega.a sdk/sdk_build/install/lib/libcryptopp.a sdk/sdk_build/install/lib/libcurl.a sdk/sdk_build/install/lib/libcares.a sdk/sdk_build/install/lib/libssl.a sdk/sdk_build/install/lib/libcrypto.a sdk/sdk_build/install/lib/libsqlite3.a sdk/sdk_build/install/lib/libmediainfo.a sdk/sdk_build/install/lib/libzen.a sdk/sdk_build/build/libuv-v1.8.0/.libs/libuv.a -lpthread -ldl -lrt sdk/sdk_build/install/lib/libz.a -o mega-cmd-server - -$CXX $CXXFLAGS src/megacmdcommonutils.cpp src/megacmdshell/*.cpp -Isdk/include -Isdk/include/mega/posix -Isdk/sdk_build/install/include sdk/sdk_build/install/lib/libmega.a sdk/sdk_build/install/lib/libcryptopp.a sdk/sdk_build/install/lib/libcurl.a sdk/sdk_build/install/lib/libcares.a sdk/sdk_build/install/lib/libssl.a sdk/sdk_build/install/lib/libcrypto.a sdk/sdk_build/install/lib/libsqlite3.a -lpthread -ldl -lrt sdk/sdk_build/install/lib/libz.a ./sdk/sdk_build/install/lib/libreadline.a ./sdk/sdk_build/install/lib/libtermcap.a -o mega-cmd - -$CXX $CXXFLAGS src/megacmdcommonutils.cpp src/client/*.cpp src/megacmdshell/megacmdshellcommunications.cpp -Isdk/include -Isdk/include/mega/posix -Isdk/sdk_build/install/include sdk/sdk_build/install/lib/libmega.a sdk/sdk_build/install/lib/libcryptopp.a sdk/sdk_build/install/lib/libcurl.a sdk/sdk_build/install/lib/libcares.a sdk/sdk_build/install/lib/libssl.a sdk/sdk_build/install/lib/libcrypto.a sdk/sdk_build/install/lib/libsqlite3.a -lpthread -ldl -lrt sdk/sdk_build/install/lib/libz.a -o mega-exec - -echo "outputs should be 3 files: mega-cmd mega-cmd-server mega-exec. ls output: " -ls mega-cmd mega-cmd-server mega-exec - -if [ -e mega-cmd ] && [ -e mega-cmd-server ] && [ -e mega-exec ] ; then - - mkdir -p install - cp src/client/mega-* install/ - cp mega-cmd mega-exec mega-cmd-server install/ - - mkdir -p build/QNAP_NAS/megacmdpkg/arm-x19 - cp install/* build/QNAP_NAS/megacmdpkg/arm-x19 - - MAJOR=`sed -n -e 's/.*MAJOR_VERSION \([0-9]*\).*/\1/p' < src/megacmdversion.h` - MINOR=`sed -n -e 's/.*MINOR_VERSION \([0-9]*\).*/\1/p' < src/megacmdversion.h` - MICRO=`sed -n -e 's/.*MICRO_VERSION \([0-9]*\).*/\1/p' < src/megacmdversion.h` - MEGACMD_VERSION="\"$MAJOR.$MINOR.$MICRO\"" - sed -i build/QNAP_NAS/megacmdpkg/qpkg.cfg -e "s/^QPKG_VER=.*/QPKG_VER=$MEGACMD_VERSION/" -else - echo "Build failed" - exit 1 -fi - diff --git a/build/SynologyNAS/toolkit/source/megacmdpkg/SynoBuildConf/build b/build/SynologyNAS/toolkit/source/megacmdpkg/SynoBuildConf/build index 10881c63..44156d81 100644 --- a/build/SynologyNAS/toolkit/source/megacmdpkg/SynoBuildConf/build +++ b/build/SynologyNAS/toolkit/source/megacmdpkg/SynoBuildConf/build @@ -17,7 +17,7 @@ export CXX=$CXX export LD=$LD export CFLAGS="$CFLAGS -O2 -fexceptions -fvisibility=hidden -static" export CPPFLAGS="$CPPFLAGS -DNDEBUG" -export CXXFLAGS="-std=c++11 $CFLAGS -DNDEBUG -DENABLE_BACKUPS -DMEGACMD_USERAGENT_SUFFIX=QNAP -DHAVE_LIBUV" +export CXXFLAGS="-std=c++11 $CFLAGS -DNDEBUG -DENABLE_BACKUPS -DMEGACMD_USERAGENT_SUFFIX=Synology -DHAVE_LIBUV -std=c++11" export AR=$AR export NM=$NM export STRIP=$STRIP diff --git a/src/megacmdexecuter.cpp b/src/megacmdexecuter.cpp index aea2f81a..0192c06b 100644 --- a/src/megacmdexecuter.cpp +++ b/src/megacmdexecuter.cpp @@ -39,7 +39,7 @@ #include namespace fs = std::filesystem; #define MEGACMDEXECUTER_FILESYSTEM -#elif !defined(__MINGW32__) && !defined(__ANDROID__) && ( (__cplusplus >= 201100L) || (defined(_MSC_VER) && _MSC_VER >= 1600) ) +#elif !defined(__MINGW32__) && !defined(__ANDROID__) && ( (__cplusplus >= 201100L) || (defined(_MSC_VER) && _MSC_VER >= 1600) ) && (!defined(__GNUC__) || (__GNUC__*100+__GNUC_MINOR__) >= 503) #define MEGACMDEXECUTER_FILESYSTEM #ifdef WIN32 #include From 1ee1cc4ecd54ebec8ea1ac5da176afa33029c9b7 Mon Sep 17 00:00:00 2001 From: Christian Blume Date: Tue, 16 Apr 2019 17:52:41 +1200 Subject: [PATCH 2/2] Adjust Synology build scripts --- .../toolkit/build_all_synology_packages | 11 ++++------- .../source/megacmdpkg/SynoBuildConf/build | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/build/SynologyNAS/toolkit/build_all_synology_packages b/build/SynologyNAS/toolkit/build_all_synology_packages index 1f74dddb..fe11f861 100755 --- a/build/SynologyNAS/toolkit/build_all_synology_packages +++ b/build/SynologyNAS/toolkit/build_all_synology_packages @@ -18,7 +18,7 @@ build_package() { if [ -e /toolkit/build_env/ds.$platform-6.1/ ] ; then echo "cleaning old build of $platform" - rm -rf /toolkit/build_env/ds.$platform-6.1/ + rm -rf /toolkit/build_env/ds.$platform-6.1/ fi ./pkgscripts-ng/EnvDeploy -v 6.1 -p $platform -t /toolkit/toolkit_tarballs/ @@ -45,7 +45,7 @@ build_package() { MEGACMD_VERSION="\"$MAJOR.$MINOR.$MICRO\"" sed -i source/megacmdpkg/INFO.sh -e "s/^version=.*/version=$MEGACMD_VERSION/" - ./pkgscripts-ng/PkgCreate.py -i -p $platform megacmdpkg + ./pkgscripts-ng/PkgCreate.py -i -p $platform megacmdpkg echo "Signing!" tar -xf syn-sign-key -C /toolkit/build_env/ds.$platform-6.1/root/ @@ -59,13 +59,12 @@ build_package() { mkdir -p synology_build_results/image-$platform cp -r /toolkit/build_env/ds.$platform-6.1/image synology_build_results/image-$platform - - rm -rf /toolkit/build_env/ds.$platform-6.1/ else echo "------- $platform build failed -----" echo "whimper" > synology_build_results/$platform.failed fi - + cp /toolkit/build_env/ds.$platform-6.1/logs.build /toolkit/synology_build_results/$platform.logs.build + rm -rf /toolkit/build_env/ds.$platform-6.1/ fi } @@ -75,5 +74,3 @@ mkdir -p synology_build_results for p in `./pkgscripts-ng/EnvDeploy -v 6.1 --list | grep -o "[^:]*$" ` ; do build_package $p done - - diff --git a/build/SynologyNAS/toolkit/source/megacmdpkg/SynoBuildConf/build b/build/SynologyNAS/toolkit/source/megacmdpkg/SynoBuildConf/build index 44156d81..c93f8dd9 100644 --- a/build/SynologyNAS/toolkit/source/megacmdpkg/SynoBuildConf/build +++ b/build/SynologyNAS/toolkit/source/megacmdpkg/SynoBuildConf/build @@ -1,8 +1,13 @@ +#!/bin/bash # SynoBuildConf/build +set -x +env mkdir ./MEGAcmd/sdk/sdk_build -mkdir ./MEGAcmd/sdk/sdk_build/install -mkdir ./MEGAcmd/sdk/sdk_build/install/lib + +local_install_dir=$PWD/MEGAcmd/sdk/sdk_build/install +mkdir $local_install_dir +mkdir $local_install_dir/lib AUTOMAKE_OPTIONS="no-dependencies" @@ -14,10 +19,11 @@ export SPECIAL_OPENSSL_CONFIG_PARAMS="" export CC=$CC export CXX=$CXX +$CXX --version export LD=$LD export CFLAGS="$CFLAGS -O2 -fexceptions -fvisibility=hidden -static" export CPPFLAGS="$CPPFLAGS -DNDEBUG" -export CXXFLAGS="-std=c++11 $CFLAGS -DNDEBUG -DENABLE_BACKUPS -DMEGACMD_USERAGENT_SUFFIX=Synology -DHAVE_LIBUV -std=c++11" +export CXXFLAGS="-std=c++0x $CFLAGS -DNDEBUG -DENABLE_BACKUPS -DMEGACMD_USERAGENT_SUFFIX=Synology -DHAVE_LIBUV" export AR=$AR export NM=$NM export STRIP=$STRIP @@ -149,7 +155,7 @@ pwd mkdir -p norecurse mv norecurse/* . -./contrib/build_sdk.sh -a -e $suppress_freeimage_flag -g -I -n -q -R -v -X -0 -C "$CUSTOM_CONFIG_ARGS" -O $OS_COMPILER_FOR_OPENSSL -S "$SPECIAL_OPENSSL_CONFIG_PARAMS" 2>&1 | tee /mybuildlogs-sdkbuild.out +./contrib/build_sdk.sh -a -e $suppress_freeimage_flag -g -I -q -R -v -X -0 -C "$CUSTOM_CONFIG_ARGS" -O $OS_COMPILER_FOR_OPENSSL -S "$SPECIAL_OPENSSL_CONFIG_PARAMS" 2>&1 | tee /mybuildlogs-sdkbuild.out if ! [ -e src/libmega.la ] ; then echo "libtool could not link it so we do it ourselves. Including Zen and MediaInfo somehow reference a nonexistent path /home/chingfen in the Synology libtool libraries. If we left those out it would make the lib ok." @@ -176,7 +182,7 @@ echo -------------------------------------------------------- sdk end ---------- echo about to build megacmd --------------------------- sh autogen.sh 2>&1 | tee /mybuildlogs-autogen2.out -./configure --without-libraw --enable-static --with-cryptopp $CUSTOM_CONFIG_ARGS 2>&1 | tee /mybuildlogs-configure2.out +./configure --without-libraw --enable-static --with-cryptopp=$local_install_dir --with-readline=$local_install_dir --with-termcap=$local_install_dir $CUSTOM_CONFIG_ARGS 2>&1 | tee /mybuildlogs-configure2.out export INCLUDES="-I/source/megacmdpkg/MEGAcmd/sdk/sdk_build/install/include -I/source/megacmdpkg/MEGAcmd/sdk/include/ -I/source/megacmdpkg/MEGAcmd/sdk/include/mega/posix" make SUBDIRS='' DEFS='' 2>&1 | tee /mybuildlogs-make2.out @@ -217,7 +223,7 @@ if [ "$built_arch" == "$BUILD_ARCH-bit" ] ; then echo "Correct buildarch: $BUILD_ARCH" else echo "wrong buildarch: $BUILD_ARCH" - file mega-exec + file mega-exec rm mega-exec fi