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")
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")
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}
# 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
# 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
+++ /dev/null
-#!/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
+++ /dev/null
-#!/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
# 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
#!/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}
# 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
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")
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")