Merge branch 'master' of github.com:novacoin-project/novacoin
authoruser <balthazar@yandex.ru>
Sat, 1 Jan 2022 19:34:51 +0000 (22:34 +0300)
committeruser <balthazar@yandex.ru>
Sat, 1 Jan 2022 19:34:51 +0000 (22:34 +0300)
mingw64_deps/boost/build.sh
mingw64_deps/db/build.sh
mingw64_deps/openssl/build.sh
mingw64_deps/qt/build.sh
mingw64_deps/zlib/build.sh

index 754b053..10e1e4c 100755 (executable)
@@ -1,36 +1,50 @@
 #!/bin/bash
 
-CROSS=$1
+TARGET_CPU=$1
+TARGET_OS=$2
 ROOT=$(pwd)
 
-if [[ ! "${CROSS}" =~ ^(aarch64|x86_64) ]]; then
-echo "Platform ${CROSS} is not supported"
+if [[ ! "${TARGET_CPU}" =~ ^(aarch64|x86_64) ]]; then
+echo "Platform ${TARGET_CPU} is not supported"
 echo "Expected either aarch64 or x86_64."
 exit 1
 fi
 
-if [[ ! $(which ${CROSS}-w64-mingw32-clang) ]]; then
-echo "llvm-mingw is not installed, please download it from https://github.com/mstorsjo/llvm-mingw/releases"
+if [[ ! "${TARGET_OS}" =~ ^(w64\-mingw32|linux\-gnu) ]]; then
+echo "Operation sysrem ${TARGET_OS} is not supported"
+echo "Expected either w64-mingw32 or linux-gnu."
 exit 1
 fi
 
-if [[ ! $(which make) ]]; then
-echo "make is not installed, please install buld-essential package"
+# Cross-building prefix
+CROSS=${TARGET_CPU}-${TARGET_OS}
+
+if [[ ! $(which ${CROSS}-gcc) ]]; then
+echo "Target C compiler ${CROSS}-gcc is not found"
+exit 1
+fi
+
+if [[ ! $(which ${CROSS}-g++) ]]; then
+echo "Target C++ compiler ${CROSS}-g++ is not found"
 exit 1
 fi
 
+if [ "${TARGET_OS}" == "w64-mingw32" ]; then
+MINGW32_PARAMS="target-os=windows"
+fi
+
 # Create stage directory
-mkdir ${ROOT}/${CROSS}-w64-mingw32
+mkdir ${ROOT}/${CROSS}
 
 cd ${ROOT}/boost
 
 # Create compiler settings
-echo "using gcc : : ${CROSS}-w64-mingw32-g++ ;" > user-config-${CROSS}.jam
+echo "using gcc : : ${CROSS}-g++ ;" > user-config-${CROSS}.jam
 
 # Build boost
-./b2 --user-config=user-config-${CROSS}.jam cxxflags="-fstack-protector-strong -D_FORTIFY_SOURCE=2" linkflags=-fstack-protector-strong --build-type=minimal --layout=system --with-chrono --with-filesystem --with-program_options --with-system --with-thread target-os=windows address-model=64 variant=release link=static threading=multi runtime-link=static stage --prefix=${ROOT}/${CROSS}-w64-mingw32 install
+./b2 --user-config=user-config-${CROSS}.jam cxxflags="-fstack-protector-strong -D_FORTIFY_SOURCE=2" linkflags=-fstack-protector-strong --build-type=minimal --layout=system --with-chrono --with-filesystem --with-program_options --with-system --with-thread ${MINGW32_PARAMS} address-model=64 variant=release link=static threading=multi runtime-link=static stage --prefix=${ROOT}/${CROSS} install
 
 cd ${ROOT}
 
 # Remove build directories
-rm -rf ${ROOT}/boost/stage ${ROOT}/boost/bin.v2
+rm -rf ${ROOT}/boost/stage ${ROOT}/boost/bin.v2 ${ROOT}/boost/user-config-${CROSS}.jam
index 5f012b7..ed83ace 100755 (executable)
@@ -1,17 +1,32 @@
 #!/bin/bash
 
-CROSS=$1
+TARGET_CPU=$1
+TARGET_OS=$2
 ROOT=$(pwd)
 MUTEX="x86_64/gcc-assembly"
 
-if [[ ! "${CROSS}" =~ ^(aarch64|x86_64) ]]; then
-echo "Platform ${CROSS} is not supported"
+if [[ ! "${TARGET_CPU}" =~ ^(aarch64|x86_64) ]]; then
+echo "Platform ${TARGET_CPU} is not supported"
 echo "Expected either aarch64 or x86_64."
 exit 1
 fi
 
-if [[ ! $(which ${CROSS}-w64-mingw32-clang) ]]; then
-echo "llvm-mingw is not installed, please download it from https://github.com/mstorsjo/llvm-mingw/releases"
+if [[ ! "${TARGET_OS}" =~ ^(w64\-mingw32|linux\-gnu) ]]; then
+echo "Operation sysrem ${TARGET_OS} is not supported"
+echo "Expected either w64-mingw32 or linux-gnu."
+exit 1
+fi
+
+# Cross-building prefix
+CROSS=${TARGET_CPU}-${TARGET_OS}
+
+if [[ ! $(which ${CROSS}-gcc) ]]; then
+echo "Target C compiler ${CROSS}-gcc is not found"
+exit 1
+fi
+
+if [[ ! $(which ${CROSS}-g++) ]]; then
+echo "Target C++ compiler ${CROSS}-g++ is not found"
 exit 1
 fi
 
@@ -20,26 +35,30 @@ echo "make is not installed, please install buld-essential package"
 exit 1
 fi
 
-if [ "${CROSS}" == "aarch64" ]; then
+if [ "${TARGET_CPU}" == "aarch64" ]; then
 MUTEX="ARM64/gcc-assembly"
 fi
 
+if [ "${TARGET_OS}" == "w64-mingw32" ]; then
+MINGW32_PARAMS="--enable-mingw"
+fi
+
 # Make build directories
-mkdir ${ROOT}/${CROSS}-w64-mingw32-build
+mkdir ${ROOT}/${CROSS}-build
 
 # Stage directory
-mkdir ${ROOT}/${CROSS}-w64-mingw32
+mkdir ${ROOT}/${CROSS}
 
 # Compile BerkeleyDB
 
-cd ${ROOT}/${CROSS}-w64-mingw32-build
+cd ${ROOT}/${CROSS}-build
 export CFLAGS="-fstack-protector-all -D_FORTIFY_SOURCE=2"
 export CXXFLAGS=${CFLAGS}
 export LDFLAGS="-fstack-protector-all"
-${ROOT}/libdb/dist/configure --prefix=${ROOT}/${CROSS}-w64-mingw32 --enable-smallbuild --enable-cxx --disable-shared --disable-replication --with-mutex=${MUTEX} --enable-mingw --host=${CROSS}-w64-mingw32
+${ROOT}/libdb/dist/configure --prefix=${ROOT}/${CROSS} --enable-smallbuild --enable-cxx --disable-shared --disable-replication --with-mutex=${MUTEX} ${MINGW32_PARAMS} --host=${CROSS}
 make -j 4 library_build
 make library_install
 
 # Remove build directore
 cd ${ROOT}
-rm -rf ${ROOT}/${CROSS}-w64-mingw32-build
+rm -rf ${ROOT}/${CROSS}-build
index f53a927..26fb4a8 100755 (executable)
@@ -1,16 +1,31 @@
 #!/bin/bash
 
-CROSS=$1
+TARGET_CPU=$1
+TARGET_OS=$2
 ROOT=$(pwd)
 
-if [[ ! "${CROSS}" =~ ^(aarch64|x86_64) ]]; then
-echo "Platform ${CROSS} is not supported"
+if [[ ! "${TARGET_CPU}" =~ ^(aarch64|x86_64) ]]; then
+echo "Platform ${TARGET_CPU} is not supported"
 echo "Expected either aarch64 or x86_64."
 exit 1
 fi
 
-if [[ ! $(which ${CROSS}-w64-mingw32-clang) ]]; then
-echo "llvm-mingw is not installed, please download it from https://github.com/mstorsjo/llvm-mingw/releases"
+if [[ ! "${TARGET_OS}" =~ ^(w64\-mingw32|linux\-gnu) ]]; then
+echo "Operation sysrem ${TARGET_OS} is not supported"
+echo "Expected either w64-mingw32 or linux-gnu."
+exit 1
+fi
+
+# Cross-building prefix
+CROSS=${TARGET_CPU}-${TARGET_OS}
+
+if [[ ! $(which ${CROSS}-gcc) ]]; then
+echo "Target C compiler ${CROSS}-gcc is not found"
+exit 1
+fi
+
+if [[ ! $(which ${CROSS}-g++) ]]; then
+echo "Target C++ compiler ${CROSS}-g++ is not found"
 exit 1
 fi
 
@@ -19,25 +34,37 @@ echo "make is not installed, please install buld-essential package"
 exit 1
 fi
 
+if [ "${TARGET_CPU}" == "aarch64" ]; then
+MUTEX="ARM64/gcc-assembly"
+fi
+
+if [ "${TARGET_OS}" == "w64-mingw32" ]; then
+TARGET_PARAMS="mingw64"
+else
+TARGET_PARAMS="linux-generic64"
+fi
+
 # Make build directories
-mkdir ${ROOT}/${CROSS}-w64-mingw32-build
+mkdir ${ROOT}/${CROSS}-build
 
 # Stage directory
-mkdir ${ROOT}/${CROSS}-w64-mingw32
+mkdir ${ROOT}/${CROSS}
 
 # Compile BerkeleyDB
 
-cd ${ROOT}/${CROSS}-w64-mingw32-build
+cd ${ROOT}/${CROSS}-build
 export CFLAGS="-fstack-protector-all -D_FORTIFY_SOURCE=2"
 export LDFLAGS="-fstack-protector-all"
-${ROOT}/openssl/Configure --cross-compile-prefix=${CROSS}-w64-mingw32- --prefix=${ROOT}/${CROSS}-w64-mingw32 no-shared no-asm mingw64 --api=1.1.1
+${ROOT}/openssl/Configure --cross-compile-prefix=${CROSS}- --prefix=${ROOT}/${CROSS} no-shared no-asm ${TARGET_PARAMS} --api=1.1.1
 make -j 4 build_libs
 make install_dev
 
 # Create symlink for compatibility
-cd ${ROOT}/${CROSS}-w64-mingw32
-ln -s lib64 lib
+cd ${ROOT}/${CROSS}
+if [[ -d lib64 ]]; then
+    ln -s lib64 lib
+fi
 
 # Remove build directore
 cd ${ROOT}
-rm -rf ${ROOT}/${CROSS}-w64-mingw32-build
+rm -rf ${ROOT}/${CROSS}-build
index 9e9bcf4..7ab0019 100755 (executable)
@@ -1,22 +1,31 @@
 #!/bin/bash
 
-CROSS=$1
+TARGET_CPU=$1
+TARGET_OS=$2
 ROOT=$(pwd)
 
-if [[ ! "${CROSS}" =~ ^(aarch64|x86_64) ]]; then
-echo "Platform ${CROSS} is not supported"
+if [[ ! "${TARGET_CPU}" =~ ^(aarch64|x86_64) ]]; then
+echo "Platform ${TARGET_CPU} is not supported"
 echo "Expected either aarch64 or x86_64."
 exit 1
 fi
 
-if [[ ! $(which ${CROSS}-w64-mingw32-clang) ]]; then
-echo "llvm-mingw is not installed, please download it from https://github.com/mstorsjo/llvm-mingw/releases"
-echo "Untar downloaded archive and add its /bin directory to your PATH"
+if [[ ! "${TARGET_OS}" =~ ^(w64\-mingw32|linux\-gnu) ]]; then
+echo "Operation sysrem ${TARGET_OS} is not supported"
+echo "Expected either w64-mingw32 or linux-gnu."
 exit 1
 fi
 
-if [[ ! $(which cmake) ]]; then
-echo "cmake is not installed, please install CMake >= 3.20 (e.g. pip3 install cmake)"
+# Cross-building prefix
+CROSS=${TARGET_CPU}-${TARGET_OS}
+
+if [[ ! $(which ${CROSS}-gcc) ]]; then
+echo "Target C compiler ${CROSS}-gcc is not found"
+exit 1
+fi
+
+if [[ ! $(which ${CROSS}-g++) ]]; then
+echo "Target C++ compiler ${CROSS}-g++ is not found"
 exit 1
 fi
 
@@ -25,50 +34,60 @@ echo "make is not installed, please install buld-essential package"
 exit 1
 fi
 
+if [ "${TARGET_OS}" == "w64-mingw32" ]; then
+    TARGET_PARAMS="win32-clang-g++ -no-freetype"
+else
+    if [ "${TARGET_CPU}" == "aarch64" ]; then
+        TARGET_PARAMS="linux-aarch64-gnu-g++"
+    else
+        TARGET_PARAMS="linux-g++-64"
+    fi
+fi
+
 # Make build directories
-mkdir ${ROOT}/${CROSS}-w64-mingw32-build
-mkdir ${ROOT}/${CROSS}-w64-mingw32-build-qttools
-mkdir ${ROOT}/${CROSS}-w64-mingw32-build-qttranslations
-mkdir ${ROOT}/${CROSS}-w64-mingw32-build-qtdeclarative
+mkdir ${ROOT}/${CROSS}-build
+mkdir ${ROOT}/${CROSS}-build-qttools
+mkdir ${ROOT}/${CROSS}-build-qttranslations
+mkdir ${ROOT}/${CROSS}-build-qtdeclarative
 
 # Stage directory
-mkdir ${ROOT}/${CROSS}-w64-mingw32
+mkdir ${ROOT}/${CROSS}
 
 # Compile Qt
 
-cd ${ROOT}/${CROSS}-w64-mingw32-build
+cd ${ROOT}/${CROSS}-build
 export CFLAGS="-fstack-protector-all -D_FORTIFY_SOURCE=2"
 export CXXFLAGS=${CFLAGS}
 export LDFLAGS="-fstack-protector-all"
-${ROOT}/qtbase/configure -xplatform win32-clang-g++ --hostprefix=${ROOT}/${CROSS}-w64-mingw32 --prefix=${ROOT}/${CROSS}-w64-mingw32 -device-option CROSS_COMPILE=${CROSS}-w64-mingw32- -release -confirm-license -no-compile-examples -no-cups -no-egl -no-eglfs -no-evdev -no-icu -no-iconv -no-libproxy -no-openssl -no-reduce-relocations -no-schannel -no-sctp -no-sql-db2 -no-sql-ibase -no-sql-oci -no-sql-tds -no-sql-mysql -no-sql-odbc -no-sql-psql -no-sql-sqlite  -no-sql-sqlite2 -no-system-proxies -no-use-gold-linker -no-zstd -nomake examples -nomake tests -nomake tools -opensource -qt-libpng -qt-pcre -qt-zlib -static -no-feature-bearermanagement -no-feature-colordialog -no-feature-concurrent -no-feature-dial -no-feature-ftp -no-feature-http -no-feature-image_heuristic_mask -no-feature-keysequenceedit -no-feature-lcdnumber -no-feature-networkdiskcache -no-feature-networkproxy -no-feature-pdf -no-feature-printdialog -no-feature-printer -no-feature-printpreviewdialog -no-feature-printpreviewwidget -no-feature-sessionmanager -no-feature-socks5 -no-feature-sql -no-feature-sqlmodel -no-feature-statemachine -no-feature-syntaxhighlighter -no-feature-textbrowser -no-feature-textmarkdownwriter -no-feature-textodfwriter -no-feature-topleveldomain -no-feature-udpsocket -no-feature-undocommand -no-feature-undogroup -no-feature-undostack -no-feature-undoview -no-feature-vnc -no-feature-xml -no-dbus -no-opengl -no-freetype
+${ROOT}/qtbase/configure -xplatform ${TARGET_PARAMS} --hostprefix=${ROOT}/${CROSS} --prefix=${ROOT}/${CROSS} -device-option CROSS_COMPILE=${CROSS}- -release -confirm-license -no-compile-examples -no-cups -no-egl -no-eglfs -no-evdev -no-icu -no-iconv -no-libproxy -no-openssl -no-reduce-relocations -no-schannel -no-sctp -no-sql-db2 -no-sql-ibase -no-sql-oci -no-sql-tds -no-sql-mysql -no-sql-odbc -no-sql-psql -no-sql-sqlite  -no-sql-sqlite2 -no-system-proxies -no-use-gold-linker -no-zstd -nomake examples -nomake tests -nomake tools -opensource -qt-libpng -qt-pcre -qt-zlib -static -no-feature-bearermanagement -no-feature-colordialog -no-feature-concurrent -no-feature-dial -no-feature-ftp -no-feature-http -no-feature-image_heuristic_mask -no-feature-keysequenceedit -no-feature-lcdnumber -no-feature-networkdiskcache -no-feature-networkproxy -no-feature-pdf -no-feature-printdialog -no-feature-printer -no-feature-printpreviewdialog -no-feature-printpreviewwidget -no-feature-sessionmanager -no-feature-socks5 -no-feature-sql -no-feature-sqlmodel -no-feature-statemachine -no-feature-syntaxhighlighter -no-feature-textbrowser -no-feature-textmarkdownwriter -no-feature-textodfwriter -no-feature-topleveldomain -no-feature-udpsocket -no-feature-undocommand -no-feature-undogroup -no-feature-undostack -no-feature-undoview -no-feature-vnc -no-feature-xml -no-dbus -no-opengl
 make -j 4
 make install
 cd ${ROOT}
-rm -rf ${ROOT}/${CROSS}-w64-mingw32-build
+rm -rf ${ROOT}/${CROSS}-build
 
 # Compile Qt tools
 
-cd ${ROOT}/${CROSS}-w64-mingw32-build-qttools
-${ROOT}/${CROSS}-w64-mingw32/bin/qmake ${ROOT}/qttools
+cd ${ROOT}/${CROSS}-build-qttools
+${ROOT}/${CROSS}/bin/qmake ${ROOT}/qttools
 make -j 4
-make DESTDIR=${ROOT}/${CROSS}-w64-mingw32 install
+make DESTDIR=${ROOT}/${CROSS} install
 cd ${ROOT}
-rm -rf ${ROOT}/${CROSS}-w64-mingw32-build-qttools
+rm -rf ${ROOT}/${CROSS}-build-qttools
 
 # Compile translations
 
-cd ${ROOT}/${CROSS}-w64-mingw32-build-qttranslations
-${ROOT}/${CROSS}-w64-mingw32/bin/qmake ${ROOT}/qttranslations
+cd ${ROOT}/${CROSS}-build-qttranslations
+${ROOT}/${CROSS}/bin/qmake ${ROOT}/qttranslations
 make -j 4
-make DESTDIR=${ROOT}/${CROSS}-w64-mingw32 install
+make DESTDIR=${ROOT}/${CROSS} install
 cd ${ROOT}
-rm -rf ${ROOT}/${CROSS}-w64-mingw32-build-qttranslations
+rm -rf ${ROOT}/${CROSS}-build-qttranslations
 
 # Compile qtdeclarative
 
-cd ${ROOT}/${CROSS}-w64-mingw32-build-qtdeclarative
-${ROOT}/${CROSS}-w64-mingw32/bin/qmake ${ROOT}/qtdeclarative
+cd ${ROOT}/${CROSS}-build-qtdeclarative
+${ROOT}/${CROSS}/bin/qmake ${ROOT}/qtdeclarative
 make -j 4
-make DESTDIR=${ROOT}/${CROSS}-w64-mingw32 install
+make DESTDIR=${ROOT}/${CROSS} install
 cd ${ROOT}
-rm -rf ${ROOT}/${CROSS}-w64-mingw32-build-qtdeclarative
+rm -rf ${ROOT}/${CROSS}-build-qtdeclarative
index 70b5bab..7ea071e 100755 (executable)
@@ -1,16 +1,31 @@
 #!/bin/bash
 
-CROSS=$1
+TARGET_CPU=$1
+TARGET_OS=$2
 ROOT=$(pwd)
 
-if [[ ! "${CROSS}" =~ ^(aarch64|x86_64) ]]; then
-echo "Platform ${CROSS} is not supported"
+if [[ ! "${TARGET_CPU}" =~ ^(aarch64|x86_64) ]]; then
+echo "Platform ${TARGET_CPU} is not supported"
 echo "Expected either aarch64 or x86_64."
 exit 1
 fi
 
-if [[ ! $(which ${CROSS}-w64-mingw32-clang) ]]; then
-echo "llvm-mingw is not installed, please download it from https://github.com/mstorsjo/llvm-mingw/releases"
+if [[ ! "${TARGET_OS}" =~ ^(w64\-mingw32|linux\-gnu) ]]; then
+echo "Operation sysrem ${TARGET_OS} is not supported"
+echo "Expected either w64-mingw32 or linux-gnu."
+exit 1
+fi
+
+# Cross-building prefix
+CROSS=${TARGET_CPU}-${TARGET_OS}
+
+if [[ ! $(which ${CROSS}-gcc) ]]; then
+echo "Target C compiler ${CROSS}-gcc is not found"
+exit 1
+fi
+
+if [[ ! $(which ${CROSS}-g++) ]]; then
+echo "Target C++ compiler ${CROSS}-g++ is not found"
 exit 1
 fi
 
@@ -19,22 +34,31 @@ echo "make is not installed, please install buld-essential package"
 exit 1
 fi
 
+if [ "${TARGET_CPU}" == "aarch64" ]; then
+MUTEX="ARM64/gcc-assembly"
+fi
+
 # Make build directoriy
-cp -r ${ROOT}/zlib ${ROOT}/${CROSS}-w64-mingw32-build-zlib
+cp -r ${ROOT}/zlib ${ROOT}/${CROSS}-build-zlib
 
 # Stage directory
-mkdir ${ROOT}/${CROSS}-w64-mingw32
+mkdir ${ROOT}/${CROSS}
 
 # Compile zlib
-cd ${ROOT}/${CROSS}-w64-mingw32-build-zlib
-perl -i -pe "s,(PREFIX =)\$,\$1 ${CROSS}-w64-mingw32-," win32/Makefile.gcc
-perl -i -pe "s,(CFLAGS =.*)\$,\$1 -fstack-protector-all -D_FORTIFY_SOURCE," win32/Makefile.gcc
-perl -i -pe "s,(LDFLAGS =.*)\$,\$1 -fstack-protector-all," win32/Makefile.gcc
-make -j 4 -f win32/Makefile.gcc
+cd ${ROOT}/${CROSS}-build-zlib
+export CC=${CROSS}-gcc
+export CXX=${CROSS}-g++
+export LD=${CROSS}-ld
+export RANLIB=${CROSS}-ranlib
+export CFLAGS="-fstack-protector-all -D_FORTIFY_SOURCE=2"
+export CXXFLAGS=${CFLAGS}
+export LDFLAGS="-fstack-protector-all"
+${ROOT}/zlib/configure --prefix=${ROOT}/${CROSS} --static
+make -j 4
 
 # Install zlib to our cross-tools directory
-make install DESTDIR=${ROOT}/${CROSS}-w64-mingw32 INCLUDE_PATH=/include LIBRARY_PATH=/lib BINARY_PATH=/bin -f win32/Makefile.gcc
+make install
 
 # Remove build directory
 cd ${ROOT}
-rm -rf ${ROOT}/${CROSS}-w64-mingw32-build-zlib
+rm -rf ${ROOT}/${CROSS}-build-zlib