Remove libpng scripts;
authoruser <balthazar@yandex.ru>
Wed, 29 Dec 2021 10:39:04 +0000 (13:39 +0300)
committeruser <balthazar@yandex.ru>
Wed, 29 Dec 2021 10:39:04 +0000 (13:39 +0300)
Compile all win32 dependencies with -fstack-protector-all;
Add missing flags to cmake configs.

CMakeLists.txt
mingw64_deps/boost/build.sh
mingw64_deps/db/build.sh
mingw64_deps/openssl/build.sh
mingw64_deps/png/build.sh [deleted file]
mingw64_deps/png/setup.sh [deleted file]
mingw64_deps/qt/build.sh
mingw64_deps/qt/setup.sh
mingw64_deps/zlib/build.sh
src/CMakeLists.txt

index 7d0e790..bc498f6 100644 (file)
@@ -43,7 +43,7 @@ if (NOT MSVC)
 if (NOT WIN32)
 set(FPIC "-fPIC")
 endif()
-set (CMAKE_C_FLAGS "-flto -O3 ${FPIC} -Wno-deprecated -fstack-protector-strong")
+set (CMAKE_C_FLAGS "-flto -O3 ${FPIC} -Wno-deprecated -fstack-protector-all")
 set (CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter -fexceptions -frtti")
 else()
 set(CMAKE_C_FLAGS "/O2")
@@ -266,7 +266,7 @@ add_executable(novacoin-qt WIN32 ${ALL_SOURCES})
 
 if (NOT MSVC)
 list(APPEND ALL_DEFINITIONS _FORTIFY_SOURCE=2)
-set(ALL_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fstack-protector-strong")
+set(ALL_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fstack-protector-all")
 if (WIN32)
 list(APPEND ALL_LIBRARIES mingw32 ssp)
 set(ALL_LINKER_FLAGS "${ALL_LINKER_FLAGS} -static-libgcc -static")
index 4b25654..754b053 100755 (executable)
@@ -28,7 +28,7 @@ cd ${ROOT}/boost
 echo "using gcc : : ${CROSS}-w64-mingw32-g++ ;" > user-config-${CROSS}.jam
 
 # Build boost
-./b2 --user-config=user-config-${CROSS}.jam --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 target-os=windows address-model=64 variant=release link=static threading=multi runtime-link=static stage --prefix=${ROOT}/${CROSS}-w64-mingw32 install
 
 cd ${ROOT}
 
index 203be24..5f012b7 100755 (executable)
@@ -33,7 +33,10 @@ mkdir ${ROOT}/${CROSS}-w64-mingw32
 # Compile BerkeleyDB
 
 cd ${ROOT}/${CROSS}-w64-mingw32-build
-CC=${CROSS}-w64-mingw32-gcc CXX=${CROSS}-w64-mingw32-g++ ${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
+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
 make -j 4 library_build
 make library_install
 
index 146f449..f53a927 100755 (executable)
@@ -28,7 +28,8 @@ mkdir ${ROOT}/${CROSS}-w64-mingw32
 # Compile BerkeleyDB
 
 cd ${ROOT}/${CROSS}-w64-mingw32-build
-#CC=${CROSS}-w64-mingw32-gcc CXX=${CROSS}-w64-mingw32-g++ 
+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
 make -j 4 build_libs
 make install_dev
diff --git a/mingw64_deps/png/build.sh b/mingw64_deps/png/build.sh
deleted file mode 100755 (executable)
index 437d93b..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/bash
-
-CROSS=$1
-ROOT=$(pwd)
-
-if [[ ! "${CROSS}" =~ ^(aarch64|x86_64) ]]; then
-echo "Platform ${CROSS} 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"
-exit 1
-fi
-
-if [[ ! $(which make) ]]; then
-echo "make is not installed, please install buld-essential package"
-exit 1
-fi
-
-# Make build directories
-cp -r ${ROOT}/zlib ${ROOT}/${CROSS}-w64-mingw32-build-zlib
-mkdir ${ROOT}/${CROSS}-w64-mingw32-build-libpng
-
-# Stage directory
-mkdir ${ROOT}/${CROSS}-w64-mingw32
-
-# Compile zlib
-cd ${ROOT}/${CROSS}-w64-mingw32-build-zlib
-perl -i -pe "s,(PREFIX =)\$,\$1 ${CROSS}-w64-mingw32-," win32/Makefile.gcc
-make -j 4 -f win32/Makefile.gcc
-
-# 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
-
-# Remove build directory
-cd ${ROOT}
-rm -rf ${ROOT}/${CROSS}-w64-mingw32-build-zlib
-
-# Compile libpng
-cd ${ROOT}/${CROSS}-w64-mingw32-build-libpng
-export CFLAGS="-I${ROOT}/${CROSS}-w64-mingw32/include"
-export LDFLAGS="-I${ROOT}/${CROSS}-w64-mingw32/lib"
-${ROOT}/libpng/configure --prefix=${ROOT}/${CROSS}-w64-mingw32 --target=${CROSS}-w64-mingw32
-make -j 4
-make install
-
-# Remove build directory
-cd ${ROOT}
-rm -rf ${ROOT}/${CROSS}-w64-mingw32-build-libpng
diff --git a/mingw64_deps/png/setup.sh b/mingw64_deps/png/setup.sh
deleted file mode 100755 (executable)
index e66a494..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-if [[ ! $(which git) ]]; then
-    echo "git is not installed"
-    exit -1
-fi
-
-git clone  https://github.com/madler/zlib
-git clone https://github.com/glennrp/libpng
index 7befd18..9e9bcf4 100755 (executable)
@@ -37,6 +37,9 @@ mkdir ${ROOT}/${CROSS}-w64-mingw32
 # Compile Qt
 
 cd ${ROOT}/${CROSS}-w64-mingw32-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
 make -j 4
 make install
index e92045c..0e3b6a9 100755 (executable)
@@ -1,11 +1,17 @@
 #!/bin/bash
 
+ROOT=$(pwd)
+
 if [[ ! $(which git) ]]; then
     echo "git is not installed"
     exit -1
 fi
 
-git clone -b 5.15.2 https://github.com/qt/qtbase.git
-git clone -b 5.15.2 https://github.com/qt/qttools.git
-git clone -b 5.15.2 https://github.com/qt/qttranslations.git
+git clone -b 5.15.2 https://github.com/qt/qtbase.git ${ROOT}/qtbase
+git clone -b 5.15.2 https://github.com/qt/qttools.git ${ROOT}/qttools
+git clone -b 5.15.2 https://github.com/qt/qttranslations.git ${ROOT}/qttranslations
+git clone -b 5.15.2 https://github.com/qt/qtdeclarative.git ${ROOT}/qtdeclarative
 
+cd ${ROOT}/qtbase
+patch -s -p1 < ${ROOT}/stack_protector.patch
+cd ${ROOT}
index 79cfcd5..70b5bab 100755 (executable)
@@ -28,6 +28,8 @@ mkdir ${ROOT}/${CROSS}-w64-mingw32
 # 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
 
 # Install zlib to our cross-tools directory
index 639b0fe..1db96fa 100644 (file)
@@ -29,7 +29,7 @@ if (NOT MSVC)
 if (NOT WIN32)
 set(FPIC "-fPIC")
 endif()
-set (CMAKE_C_FLAGS "-flto -O3 ${FPIC} -Wno-deprecated -fstack-protector-strong")
+set (CMAKE_C_FLAGS "-flto -O3 ${FPIC} -Wno-deprecated -fstack-protector-all")
 set (CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter -fexceptions -frtti")
 else()
 set(CMAKE_C_FLAGS "/O2")
@@ -171,7 +171,7 @@ add_executable(novacoind ${ALL_SOURCES})
 
 if (NOT MSVC)
 list(APPEND ALL_DEFINITIONS _FORTIFY_SOURCE=2)
-set(ALL_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fstack-protector-strong")
+set(ALL_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fstack-protector-all")
 if (WIN32)
 list(APPEND ALL_LIBRARIES mingw32 ssp)
 set(ALL_LINKER_FLAGS "${ALL_LINKER_FLAGS} -static-libgcc -static")