add build zlib, libpng and harfbuzz

This commit is contained in:
Syping 2020-04-30 18:21:35 +02:00
parent 5c8640d683
commit 18f1dae33c
3 changed files with 448 additions and 85 deletions

View file

@ -13,11 +13,13 @@ ENV QT_SYSCONF_DIR /etc/xdg
ENV CUSTOM_VERSION YES
ENV QT_SERIES 5.12
ENV QT_BUILD 8
ENV ZLIB_VERSION 1.2.11
ENV LIBPNG_VERSION 1.6.37
ENV LIBJPEGTURBO_VERSION 2.0.4
ENV LIBRESSL_VERSION 3.0.2
ENV OPENSSL_VERSION 1.1.1f
ENV ICU_VERSION 66.1
ENV UPX_VERSION 3.96
ENV HB_VERSION 2.6.5
# SSL Choice
ENV CUSTOM_SSL YES
@ -55,8 +57,12 @@ RUN qtchooser -install -f qt5-x86_64-w64-mingw32 ${PREFIX_DIR}/lib/x86_64-w64-mi
qtchooser -install -f 5 ${PREFIX_DIR}/lib/x86_64-w64-mingw32/qt_${QT_SERIES}.${QT_BUILD}_d/bin/qmake && \
qtchooser -install -f qt5 ${PREFIX_DIR}/lib/x86_64-w64-mingw32/qt_${QT_SERIES}.${QT_BUILD}_d/bin/qmake && \
qtchooser -install -f default ${PREFIX_DIR}/lib/x86_64-w64-mingw32/qt_${QT_SERIES}.${QT_BUILD}_d/bin/qmake && \
ln -s ${PREFIX_DIR}/lib/i686-w64-mingw32/libjpeg-turbo-${LIBJPEGTURBO_VERSION}_d ${PREFIX_DIR}/lib/i686-w64-mingw32/libjpeg-turbo && \
ln -s ${PREFIX_DIR}/lib/x86_64-w64-mingw32/libjpeg-turbo-${LIBJPEGTURBO_VERSION}_d ${PREFIX_DIR}/lib/x86_64-w64-mingw32/libjpeg-turbo && \
ln -s ${PREFIX_DIR}/lib/i686-w64-mingw32/zlib-${ZLIB_VERSION} ${PREFIX_DIR}/lib/i686-w64-mingw32/zlib && \
ln -s ${PREFIX_DIR}/lib/x86_64-w64-mingw32/zlib-${ZLIB_VERSION} ${PREFIX_DIR}/lib/x86_64-w64-mingw32/zlib && \
ln -s ${PREFIX_DIR}/lib/i686-w64-mingw32/libpng-${LIBPNG_VERSION} ${PREFIX_DIR}/lib/i686-w64-mingw32/libpng && \
ln -s ${PREFIX_DIR}/lib/x86_64-w64-mingw32/libpng-${LIBPNG_VERSION} ${PREFIX_DIR}/lib/x86_64-w64-mingw32/libpng && \
ln -s ${PREFIX_DIR}/lib/i686-w64-mingw32/libjpeg-turbo-${LIBJPEGTURBO_VERSION} ${PREFIX_DIR}/lib/i686-w64-mingw32/libjpeg-turbo && \
ln -s ${PREFIX_DIR}/lib/x86_64-w64-mingw32/libjpeg-turbo-${LIBJPEGTURBO_VERSION} ${PREFIX_DIR}/lib/x86_64-w64-mingw32/libjpeg-turbo && \
ln -s ${PREFIX_DIR}/lib/i686-w64-mingw32/openssl-${OPENSSL_VERSION}_d ${PREFIX_DIR}/lib/i686-w64-mingw32/openssl && \
ln -s ${PREFIX_DIR}/lib/x86_64-w64-mingw32/openssl-${OPENSSL_VERSION}_d ${PREFIX_DIR}/lib/x86_64-w64-mingw32/openssl && \
ln -s ${PREFIX_DIR}/lib/i686-w64-mingw32/qt_${QT_SERIES}.${QT_BUILD}_d ${PREFIX_DIR}/lib/i686-w64-mingw32/qt5 && \

View file

@ -13,11 +13,13 @@ ENV QT_SYSCONF_DIR /etc/xdg
ENV CUSTOM_VERSION YES
ENV QT_SERIES 5.12
ENV QT_BUILD 8
ENV ZLIB_VERSION 1.2.11
ENV LIBPNG_VERSION 1.6.37
ENV LIBJPEGTURBO_VERSION 2.0.4
ENV LIBRESSL_VERSION 3.0.2
ENV OPENSSL_VERSION 1.1.1f
ENV ICU_VERSION 66.1
ENV UPX_VERSION 3.96
ENV HB_VERSION 2.6.5
# SSL Choice
ENV CUSTOM_SSL YES
@ -56,8 +58,12 @@ RUN qtchooser -install -f qt5-x86_64-w64-mingw32 ${PREFIX_DIR}/lib/x86_64-w64-mi
qtchooser -install -f 5 ${PREFIX_DIR}/lib/x86_64-w64-mingw32/qt_${QT_SERIES}.${QT_BUILD}_s/bin/qmake && \
qtchooser -install -f qt5 ${PREFIX_DIR}/lib/x86_64-w64-mingw32/qt_${QT_SERIES}.${QT_BUILD}_s/bin/qmake && \
qtchooser -install -f default ${PREFIX_DIR}/lib/x86_64-w64-mingw32/qt_${QT_SERIES}.${QT_BUILD}_s/bin/qmake && \
ln -s ${PREFIX_DIR}/lib/i686-w64-mingw32/libjpeg-turbo-${LIBJPEGTURBO_VERSION}_s ${PREFIX_DIR}/lib/i686-w64-mingw32/libjpeg-turbo && \
ln -s ${PREFIX_DIR}/lib/x86_64-w64-mingw32/libjpeg-turbo-${LIBJPEGTURBO_VERSION}_s ${PREFIX_DIR}/lib/x86_64-w64-mingw32/libjpeg-turbo && \
ln -s ${PREFIX_DIR}/lib/i686-w64-mingw32/zlib-${ZLIB_VERSION} ${PREFIX_DIR}/lib/i686-w64-mingw32/zlib && \
ln -s ${PREFIX_DIR}/lib/x86_64-w64-mingw32/zlib-${ZLIB_VERSION} ${PREFIX_DIR}/lib/x86_64-w64-mingw32/zlib && \
ln -s ${PREFIX_DIR}/lib/i686-w64-mingw32/libpng-${LIBPNG_VERSION} ${PREFIX_DIR}/lib/i686-w64-mingw32/libpng && \
ln -s ${PREFIX_DIR}/lib/x86_64-w64-mingw32/libpng-${LIBPNG_VERSION} ${PREFIX_DIR}/lib/x86_64-w64-mingw32/libpng && \
ln -s ${PREFIX_DIR}/lib/i686-w64-mingw32/libjpeg-turbo-${LIBJPEGTURBO_VERSION} ${PREFIX_DIR}/lib/i686-w64-mingw32/libjpeg-turbo && \
ln -s ${PREFIX_DIR}/lib/x86_64-w64-mingw32/libjpeg-turbo-${LIBJPEGTURBO_VERSION} ${PREFIX_DIR}/lib/x86_64-w64-mingw32/libjpeg-turbo && \
ln -s ${PREFIX_DIR}/lib/i686-w64-mingw32/openssl-${OPENSSL_VERSION}_s ${PREFIX_DIR}/lib/i686-w64-mingw32/openssl && \
ln -s ${PREFIX_DIR}/lib/x86_64-w64-mingw32/openssl-${OPENSSL_VERSION}_s ${PREFIX_DIR}/lib/x86_64-w64-mingw32/openssl && \
ln -s ${PREFIX_DIR}/lib/i686-w64-mingw32/qt_${QT_SERIES}.${QT_BUILD}_s ${PREFIX_DIR}/lib/i686-w64-mingw32/qt5 && \

509
qt_build
View file

@ -20,14 +20,17 @@ fi
if [ ! "${CUSTOM_VERSION}" == "YES" ]; then
# Third Party
ZLIB_VERSION=1.2.11
LIBPNG_VERSION=1.6.37
LIBJPEGTURBO_VERSION=2.0.4
LIBRESSL_VERSION=3.0.2
OPENSSL_VERSION=1.1.1f
ICU_VERSION=66.1
HB_VERSION=2.6.5 # HarfBuzz
# Qt Framework
QT_SERIES=5.12
QT_BUILD=8
QT_SERIES=5.12 # (x.x).y
QT_BUILD=8 # x.x.(y)
fi
# --------------------------------------
@ -45,7 +48,7 @@ fi
# ----------- QT BUILD FLAGS -----------
if [ ! "${CUSTOM_QT_FLAGS}" == "YES" ]; then
QT_FLAGS="-qt-libpng -qt-zlib -qt-freetype -opengl desktop -skip qtactiveqt -skip qtconnectivity -skip qtlocation -skip qtmultimedia -skip qtwebengine -skip qtwebglplugin"
QT_FLAGS="-qt-freetype -opengl desktop -skip qtactiveqt -skip qtconnectivity -skip qtlocation -skip qtmultimedia -skip qtwebengine -skip qtwebglplugin"
fi
if [ ! "${CUSTOM_QT_NOMAKE_FLAGS}" == "YES" ]; then
QT_NOMAKE_FLAGS="-nomake tests -nomake examples"
@ -58,7 +61,7 @@ fi
# --------- CPU VARIABLES HERE ---------
if [ "${CPU_THREADS}" == "" ]; then
local NPROC_PATH=$(command -v nproc)
NPROC_PATH=$(command -v nproc)
if [ ! "${NPROC_PATH}" == "" ]; then
CPU_THREADS=$(nproc --all)
else
@ -71,10 +74,13 @@ fi
if [ ! "${CUSTOM_BUILD}" == "YES" ]; then
# Projects being build
BUILD_QT=YES
BUILD_ZLIB=YES
BUILD_PNG=YES
BUILD_JPG=YES
BUILD_SSL=YES
BUILD_ICU=NO
BUILD_HB=NO
BUILD_QT=YES
fi
# --------------------------------------
@ -82,45 +88,195 @@ fi
if [ ! "${CUSTOM_LINK}" == "YES" ]; then
# Projects being linked
LINK_ZLIB=YES
LINK_PNG=YES
LINK_JPG=YES
LINK_SSL=YES
LINK_ICU=NO
LINK_HB=NO
fi
# --------------------------------------
# ----- DON'T EDIT BELOW THIS LINE -----
# --------------------------------------
# libjpeg-turbo Script
# shared make script
function libjpegturbo_init {
mkdir -p "${BUILD_DIR}/libjpeg-turbo-${LIBJPEGTURBO_VERSION}_${TARGET_PLATFORM}"
cd "${BUILD_DIR}/libjpeg-turbo-${LIBJPEGTURBO_VERSION}_${TARGET_PLATFORM}"
function shared_init {
local SM_PROJECT_NAME=$1
local SM_PROJECT_VERSION=$2
local SM_TARGET_TYPE=$3
if [ "${BUILD_MODE}" == "TL" ]; then
local SM_BUILD_DIR="${BUILD_DIR}/${SM_PROJECT_NAME}-${SM_PROJECT_VERSION}_${TARGET_PLATFORM}"
else
local SM_BUILD_DIR="${BUILD_DIR}/${SM_PROJECT_NAME}-${SM_PROJECT_VERSION}_${TARGET_PLATFORM}_${SM_TARGET_TYPE}"
fi
mkdir -p "${SM_BUILD_DIR}"
cd "${SM_BUILD_DIR}"
}
function libjpegturbo_build {
cd "${BUILD_DIR}/libjpeg-turbo-${LIBJPEGTURBO_VERSION}_${TARGET_PLATFORM}"
cmake ${CMAKE_GENERATOR_FLAGS} -DCMAKE_BUILD_TYPE=Release -DENABLE_SHARED=OFF -DCMAKE_INSTALL_PREFIX="${PREFIX_DIR}/libjpeg-turbo-${LIBJPEGTURBO_VERSION}_${TARGET_PLATFORM}" -DCMAKE_INSTALL_LIBDIR="${PREFIX_DIR}/lib/${COMPILER}/libjpeg-turbo-${LIBJPEGTURBO_VERSION}" -DCMAKE_INSTALL_INCLUDEDIR="${PREFIX_DIR}/include/libjpeg-turbo-${LIBJPEGTURBO_VERSION}" "${CMAKE_TOOLCHAIN_FLAGS}" "${SOURCE_DIR_LIBJPEGTURBO}"
function shared_clean {
local SM_PROJECT_NAME=$1
local SM_PROJECT_VERSION=$2
local SM_TARGET_TYPE=$3
if [ "${BUILD_MODE}" == "TL" ]; then
local SM_BUILD_DIR="${BUILD_DIR}/${SM_PROJECT_NAME}-${SM_PROJECT_VERSION}_${TARGET_PLATFORM}"
else
local SM_BUILD_DIR="${BUILD_DIR}/${SM_PROJECT_NAME}-${SM_PROJECT_VERSION}_${TARGET_PLATFORM}_${SM_TARGET_TYPE}"
fi
cd "${SM_BUILD_DIR}"
rm -rf "${SM_BUILD_DIR}"
}
# automake script
function automake_init {
shared_init $1 $2 $3
}
function automake_build {
local AM_PROJECT_DIR=$1
local AM_PROJECT_NAME=$2
local AM_PROJECT_VERSION=$3
local AM_TARGET_TYPE=$4
local AM_TARGET_SUFFIX=$5
if [ "${BUILD_MODE}" == "TL" ]; then
local AM_BUILD_DIR="${BUILD_DIR}/${AM_PROJECT_NAME}-${AM_PROJECT_VERSION}_${TARGET_PLATFORM}"
local AM_TARGET_TYPE=static
else
local AM_BUILD_DIR="${BUILD_DIR}/${AM_PROJECT_NAME}-${AM_PROJECT_VERSION}_${TARGET_PLATFORM}_${AM_TARGET_TYPE}"
fi
cd "${AM_BUILD_DIR}"
if [ "${AM_TARGET_TYPE}" == "static" ]; then
local AM_EXTRA_FLAGS=--disable-shared
else
local AM_EXTRA_FLAGS=
fi
if [ "${USE_CLANG}" == "YES" ]; then
local CC=${COMPILER}-clang
local CXX=${COMPILER}-clang++
elif [ "${USE_GCC}" == "YES" ]; then
local CC=${COMPILER}-gcc
local CXX=${COMPILER}-g++
else
local CC=${COMPILER}-cc
local CXX=${COMPILER}-c++
fi
if [ "${AM_PROJECT_NAME}" == "libpng" ] && [ ! "${ZLIB_LDFLAGS}" == "" ] && [ ! "${ZLIB_CPPFLAGS}" == "" ]; then
local LDFLAGS=${ZLIB_LDFLAGS}
local CPPFLAGS=${ZLIB_CPPFLAGS}
else
local LDFLAGS=
local CPPFLAGS=
fi
if [ "${AM_PROJECT_NAME}" == "zlib" ]; then
if [ "${AM_TARGET_TYPE}" == "static" ]; then
local AM_EXTRA_FLAGS=--static
fi
CC=${CC} CXX=${CXX} CHOST=${COMPILER} "${AM_PROJECT_DIR}/configure" ${AM_EXTRA_FLAGS} --prefix "${PREFIX_DIR}/lib/${COMPILER}/${AM_PROJECT_NAME}-${AM_PROJECT_VERSION}${AM_TARGET_SUFFIX}" --libdir="${PREFIX_DIR}/lib/${COMPILER}/${AM_PROJECT_NAME}-${AM_PROJECT_VERSION}${AM_TARGET_SUFFIX}/lib" --includedir="${PREFIX_DIR}/include/${AM_PROJECT_NAME}-${AM_PROJECT_VERSION}"
else
CC=${CC} CXX=${CXX} CPPFLAGS=${CPPFLAGS} LDFLAGS=${LDFLAGS} "${AM_PROJECT_DIR}/configure" --host=${COMPILER} ${AM_EXTRA_FLAGS} --prefix "${PREFIX_DIR}/lib/${COMPILER}/${AM_PROJECT_NAME}-${AM_PROJECT_VERSION}${AM_TARGET_SUFFIX}" --bindir="${PREFIX_DIR}/lib/${COMPILER}/${AM_PROJECT_NAME}-${AM_PROJECT_VERSION}${AM_TARGET_SUFFIX}/bin" --libdir="${PREFIX_DIR}/lib/${COMPILER}/${AM_PROJECT_NAME}-${AM_PROJECT_VERSION}${AM_TARGET_SUFFIX}/lib" --includedir="${PREFIX_DIR}/include/${AM_PROJECT_NAME}-${AM_PROJECT_VERSION}"
fi
${MAKE_GENERATOR}
}
function automake_install {
local AM_PROJECT_NAME=$1
local AM_PROJECT_VERSION=$2
local AM_TARGET_TYPE=$3
local AM_TARGET_SUFFIX=$4
if [ "${BUILD_MODE}" == "TL" ]; then
local AM_BUILD_DIR="${BUILD_DIR}/${AM_PROJECT_NAME}-${AM_PROJECT_VERSION}_${TARGET_PLATFORM}"
else
local AM_BUILD_DIR="${BUILD_DIR}/${AM_PROJECT_NAME}-${AM_PROJECT_VERSION}_${TARGET_PLATFORM}_${AM_TARGET_TYPE}"
fi
cd "${AM_BUILD_DIR}"
${MAKE_GENERATOR_INSTALL}
if [ ! -L "${PREFIX_DIR}/lib/${COMPILER}/${AM_PROJECT_NAME}-${AM_PROJECT_VERSION}${AM_TARGET_SUFFIX}/include" ]; then
ln -sf "${PREFIX_DIR}/include/${AM_PROJECT_NAME}-${AM_PROJECT_VERSION}" "${PREFIX_DIR}/lib/${COMPILER}/${AM_PROJECT_NAME}-${AM_PROJECT_VERSION}${AM_TARGET_SUFFIX}/include"
fi
}
function automake_clean {
shared_clean $1 $2 $3
}
# cmake script
function cmake_init {
shared_init $1 $2 $3
}
function cmake_build {
local CM_PROJECT_DIR=$1
local CM_PROJECT_NAME=$2
local CM_PROJECT_VERSION=$3
local CM_TARGET_TYPE=$4
local CM_TARGET_SUFFIX=$5
if [ "${BUILD_MODE}" == "TL" ]; then
local CM_BUILD_DIR="${BUILD_DIR}/${CM_PROJECT_NAME}-${CM_PROJECT_VERSION}_${TARGET_PLATFORM}"
local CM_TARGET_TYPE=static
else
local CM_BUILD_DIR="${BUILD_DIR}/${CM_PROJECT_NAME}-${CM_PROJECT_VERSION}_${TARGET_PLATFORM}_${CM_TARGET_TYPE}"
fi
if [ "${CM_PROJECT_NAME}" == "libjpeg-turbo" ] && [ "${CM_TARGET_TYPE}" == "static" ]; then
local CM_EXTRA_FLAGS=-DENABLE_SHARED=OFF
elif [ "${CM_PROJECT_NAME}" == "harfbuzz" ]; then
local CM_EXTRA_FLAGS=-DHB_BUILD_SUBSET=OFF
else
local CM_EXTRA_FLAGS=
fi
cd "${CM_BUILD_DIR}"
cmake ${CMAKE_GENERATOR_FLAGS} -DCMAKE_BUILD_TYPE=Release ${CM_EXTRA_FLAGS} -DCMAKE_INSTALL_PREFIX="${PREFIX_DIR}/lib/${COMPILER}/${CM_PROJECT_NAME}-${CM_PROJECT_VERSION}${CM_TARGET_SUFFIX}" -DCMAKE_INSTALL_INCLUDEDIR="${PREFIX_DIR}/include/${CM_PROJECT_NAME}-${CM_PROJECT_VERSION}" "${CMAKE_TOOLCHAIN_FLAGS}" "${CM_PROJECT_DIR}"
${CMAKE_GENERATOR}
}
function libjpegturbo_install {
cd "${BUILD_DIR}/libjpeg-turbo-${LIBJPEGTURBO_VERSION}_${TARGET_PLATFORM}"
function cmake_install {
local CM_PROJECT_NAME=$1
local CM_PROJECT_VERSION=$2
local CM_TARGET_TYPE=$3
local CM_TARGET_SUFFIX=$4
if [ "${BUILD_MODE}" == "TL" ]; then
local CM_BUILD_DIR="${BUILD_DIR}/${CM_PROJECT_NAME}-${CM_PROJECT_VERSION}_${TARGET_PLATFORM}"
else
local CM_BUILD_DIR="${BUILD_DIR}/${CM_PROJECT_NAME}-${CM_PROJECT_VERSION}_${TARGET_PLATFORM}_${CM_TARGET_TYPE}"
fi
cd "${CM_BUILD_DIR}"
${CMAKE_GENERATOR_INSTALL}
if [ ! -L "${PREFIX_DIR}/lib/${COMPILER}/${CM_PROJECT_NAME}-${CM_PROJECT_VERSION}${CM_TARGET_SUFFIX}/include" ]; then
ln -sf "${PREFIX_DIR}/include/${CM_PROJECT_NAME}-${CM_PROJECT_VERSION}" "${PREFIX_DIR}/lib/${COMPILER}/${CM_PROJECT_NAME}-${CM_PROJECT_VERSION}${CM_TARGET_SUFFIX}/include"
fi
}
function cmake_clean {
shared_clean $1 $2 $3
}
# libjpeg-turbo script
function libjpegturbo_init {
cmake_init libjpeg-turbo ${LIBJPEGTURBO_VERSION}
}
function libjpegturbo_build {
cmake_build "${SOURCE_DIR_LIBJPEGTURBO}" libjpeg-turbo ${LIBJPEGTURBO_VERSION}
}
function libjpegturbo_install {
cmake_install libjpeg-turbo ${LIBJPEGTURBO_VERSION}
}
function libjpegturbo_clean {
cd "${BUILD_DIR}/libjpeg-turbo-${LIBJPEGTURBO_VERSION}_${TARGET_PLATFORM}"
rm -rf "${BUILD_DIR}/libjpeg-turbo-${LIBJPEGTURBO_VERSION}_${TARGET_PLATFORM}"
cmake_clean libjpeg-turbo ${LIBJPEGTURBO_VERSION}
}
function libjpegturbo_strip {
cd "${PREFIX_DIR}/libjpeg-turbo-${LIBJPEGTURBO_VERSION}_${TARGET_PLATFORM}"
rm -rf "${PREFIX_DIR}/libjpeg-turbo-${LIBJPEGTURBO_VERSION}_${TARGET_PLATFORM}"
cd "${PREFIX_DIR}/lib/${COMPILER}/libjpeg-turbo-${LIBJPEGTURBO_VERSION}"
rm -rf bin share
}
function libjpegturbo_register {
QT_LIBS_FLAGS="${QT_LIBS_FLAGS} -system-libjpeg -L ${PREFIX_DIR}/lib/${COMPILER}/libjpeg-turbo-${LIBJPEGTURBO_VERSION} -I ${PREFIX_DIR}/include/libjpeg-turbo-${LIBJPEGTURBO_VERSION}"
QT_LIBS_FLAGS="${QT_LIBS_FLAGS} -system-libjpeg -L ${PREFIX_DIR}/lib/${COMPILER}/libjpeg-turbo-${LIBJPEGTURBO_VERSION}/lib -I ${PREFIX_DIR}/include/libjpeg-turbo-${LIBJPEGTURBO_VERSION}"
}
function libjpegturbo_source {
@ -135,43 +291,121 @@ function libjpegturbo_source {
SOURCE_DIR_LIBJPEGTURBO="${SOURCE_DIR}/${ARCHIVE}"
}
# zlib script
function zlib_init {
if [ ! "${TARGET_OS}" == "Windows" ]; then
automake_init zlib ${ZLIB_VERSION}
fi
}
function zlib_build {
if [ "${TARGET_OS}" == "Windows" ]; then
${MAKE_GENERATOR} -fwin32/Makefile.gcc --directory="${SOURCE_DIR_ZLIB}" PREFIX=${COMPILER}- || \
rm -rf "${SOURCE_DIR_ZLIB}" || \
zlib_source ${ZLIB_VERSION} || \
${MAKE_GENERATOR} -fwin32/Makefile.gcc --directory="${SOURCE_DIR_ZLIB}" PREFIX=${COMPILER}-
else
automake_build "${SOURCE_DIR_ZLIB}" zlib ${ZLIB_VERSION}
fi
}
function zlib_install {
if [ "${TARGET_OS}" == "Windows" ]; then
${MAKE_GENERATOR_INSTALL} -fwin32/Makefile.gcc --directory="${SOURCE_DIR_ZLIB}" BINARY_PATH="${PREFIX_DIR}/lib/${COMPILER}/zlib-${ZLIB_VERSION}/bin" LIBRARY_PATH="${PREFIX_DIR}/lib/${COMPILER}/zlib-${ZLIB_VERSION}/lib" INCLUDE_PATH="${PREFIX_DIR}/include/zlib-${ZLIB_VERSION}"
if [ ! -L "${PREFIX_DIR}/lib/${COMPILER}/zlib-${ZLIB_VERSION}/include" ]; then
ln -sf "${PREFIX_DIR}/include/zlib-${ZLIB_VERSION}" "${PREFIX_DIR}/lib/${COMPILER}/zlib-${ZLIB_VERSION}/include"
fi
else
automake_install zlib ${ZLIB_VERSION}
fi
}
function zlib_clean {
if [ "${TARGET_OS}" == "Windows" ]; then
${MAKE_GENERATOR_CLEAN} -fwin32/Makefile.gcc --directory="${SOURCE_DIR_ZLIB}"
else
automake_clean zlib ${ZLIB_VERSION}
fi
}
function zlib_strip {
return 0
}
function zlib_register {
ZLIB_CPPFLAGS="-I${PREFIX_DIR}/include/zlib-${ZLIB_VERSION}"
ZLIB_LDFLAGS="-L${PREFIX_DIR}/lib/${COMPILER}/zlib-${ZLIB_VERSION}/lib"
QT_LIBS_FLAGS="${QT_LIBS_FLAGS} -system-zlib -L ${PREFIX_DIR}/lib/${COMPILER}/zlib-${ZLIB_VERSION}/lib -I ${PREFIX_DIR}/include/zlib-${ZLIB_VERSION}"
}
function zlib_source {
local VERSION=$1
local ARCHIVE=zlib-${VERSION}
mkdir -p "${SOURCE_DIR}"
cd "${SOURCE_DIR}"
if [ ! -d "${ARCHIVE}" ]; then
wget -O ${ARCHIVE}.tar.gz "https://www.zlib.net/zlib-${VERSION}.tar.gz"
tar xfz ${ARCHIVE}.tar.gz
fi
SOURCE_DIR_ZLIB="${SOURCE_DIR}/${ARCHIVE}"
}
# libpng script
function libpng_init {
automake_init libpng ${LIBPNG_VERSION}
}
function libpng_build {
automake_build "${SOURCE_DIR_LIBPNG}" libpng ${LIBPNG_VERSION}
}
function libpng_install {
automake_install libpng ${LIBPNG_VERSION}
}
function libpng_clean {
automake_clean libpng ${LIBPNG_VERSION}
}
function libpng_strip {
cd "${PREFIX_DIR}/lib/${COMPILER}/libpng-${LIBPNG_VERSION}"
rm -rf bin
}
function libpng_register {
QT_LIBS_FLAGS="${QT_LIBS_FLAGS} -system-libpng -L ${PREFIX_DIR}/lib/${COMPILER}/libpng-${LIBPNG_VERSION}/lib -I ${PREFIX_DIR}/include/libpng-${LIBPNG_VERSION}"
}
function libpng_source {
local VERSION=$1
local ARCHIVE=libpng-${VERSION}
mkdir -p "${SOURCE_DIR}"
cd "${SOURCE_DIR}"
if [ ! -d "${ARCHIVE}" ]; then
wget -O ${ARCHIVE}.tar.xz "https://download.sourceforge.net/libpng/libpng-${VERSION}.tar.xz"
tar xfJ ${ARCHIVE}.tar.xz
fi
SOURCE_DIR_LIBPNG="${SOURCE_DIR}/${ARCHIVE}"
}
# LibreSSL script
function libressl_init {
mkdir -p "${BUILD_DIR}/libressl-${LIBRESSL_VERSION}_${TARGET_PLATFORM}_${TARGET_TYPE}"
cd "${BUILD_DIR}/libressl-${LIBRESSL_VERSION}_${TARGET_PLATFORM}_${TARGET_TYPE}"
automake_init libressl ${LIBRESSL_VERSION} ${TARGET_TYPE}
}
function libressl_build {
cd "${BUILD_DIR}/libressl-${LIBRESSL_VERSION}_${TARGET_PLATFORM}_${TARGET_TYPE}"
if [ "${TARGET_TYPE}" == "static" ]; then
local EXTRA_FLAGS=--disable-shared
else
local EXTRA_FLAGS=
fi
if [ "${USE_CLANG}" == "YES" ]; then
local CC=${COMPILER}-clang
local CXX=${COMPILER}-clang++
elif [ "${USE_GCC}" == "YES" ]; then
local CC=${COMPILER}-gcc
local CXX=${COMPILER}-g++
else
local CC=${COMPILER}-cc
local CXX=${COMPILER}-c++
fi
CC=${CC} CXX=${CXX} ${SOURCE_DIR_LIBRESSL}/configure --host=${COMPILER} ${EXTRA_FLAGS} --prefix "${PREFIX_DIR}/lib/${COMPILER}/libressl-${LIBRESSL_VERSION}${TARGET_SUFFIX}" --bindir="${PREFIX_DIR}/lib/${COMPILER}/libressl-${LIBRESSL_VERSION}${TARGET_SUFFIX}/bin" --libdir="${PREFIX_DIR}/lib/${COMPILER}/libressl-${LIBRESSL_VERSION}${TARGET_SUFFIX}/lib" --includedir="${PREFIX_DIR}/include/libressl-${LIBRESSL_VERSION}"
${MAKE_GENERATOR}
automake_build "${SOURCE_DIR_LIBRESSL}" libressl ${LIBRESSL_VERSION} ${TARGET_TYPE} ${TARGET_SUFFIX}
}
function libressl_install {
cd "${BUILD_DIR}/libressl-${LIBRESSL_VERSION}_${TARGET_PLATFORM}_${TARGET_TYPE}"
${MAKE_GENERATOR_INSTALL}
ln -sf "${PREFIX_DIR}/include/libressl-${LIBRESSL_VERSION}" "${PREFIX_DIR}/lib/${COMPILER}/libressl-${LIBRESSL_VERSION}${TARGET_SUFFIX}/include"
automake_install libressl ${LIBRESSL_VERSION} ${TARGET_TYPE} ${TARGET_SUFFIX}
}
function libressl_clean {
cd "${BUILD_DIR}/libressl-${LIBRESSL_VERSION}_${TARGET_PLATFORM}_${TARGET_TYPE}"
rm -rf "${BUILD_DIR}/libressl-${LIBRESSL_VERSION}_${TARGET_PLATFORM}_${TARGET_TYPE}"
automake_clean libressl ${LIBRESSL_VERSION} ${TARGET_TYPE}
}
function libressl_strip {
@ -241,7 +475,9 @@ function openssl_install {
else
${MAKE_GENERATOR_INSTALL}
fi
ln -sf "${PREFIX_DIR}/lib/${COMPILER}/openssl-${OPENSSL_VERSION}${TARGET_SUFFIX}/include" "${PREFIX_DIR}/include/openssl-${OPENSSL_VERSION}"
if [ ! -L "${PREFIX_DIR}/include/openssl-${OPENSSL_VERSION}" ]; then
ln -sf "${PREFIX_DIR}/lib/${COMPILER}/openssl-${OPENSSL_VERSION}${TARGET_SUFFIX}/include" "${PREFIX_DIR}/include/openssl-${OPENSSL_VERSION}"
fi
}
function openssl_clean {
@ -261,15 +497,13 @@ function openssl_strip {
}
function openssl_register {
if [ "${TARGET_OS}" == "Windows" ]; then
if [ "${TARGET_TYPE}" == "static" ]; then
local EXTRA_SSLLIBS="-lws2_32 -lgdi32 -lcrypt32"
else
local EXTRA_SSLLIBS=
fi
if [ "${TARGET_OS}" == "Windows" ] && [ "${TARGET_TYPE}" == "static" ]; then
local EXTRA_SSLLIBS="-lws2_32 -lgdi32 -lcrypt32"
else
local EXTRA_SSLLIBS=
fi
export OPENSSL_LIBS="-L${PREFIX_DIR}/lib/${COMPILER}/openssl-${OPENSSL_VERSION}${TARGET_SUFFIX}/lib -lssl -lcrypto ${EXTRA_SSLLIBS}"
QT_LIBS_FLAGS="${QT_LIBS_FLAGS} -openssl-linked -L ${PREFIX_DIR}/lib/${COMPILER}/openssl-${OPENSSL_VERSION}${TARGET_SUFFIX}/lib -I ${PREFIX_DIR}/lib/${COMPILER}/openssl-${OPENSSL_VERSION}${TARGET_SUFFIX}/include"
QT_LIBS_FLAGS="${QT_LIBS_FLAGS} -openssl-linked -L ${PREFIX_DIR}/lib/${COMPILER}/openssl-${OPENSSL_VERSION}${TARGET_SUFFIX}/lib -I ${PREFIX_DIR}/include/openssl-${OPENSSL_VERSION}"
}
function openssl_source {
@ -327,13 +561,16 @@ function icu_build {
local CC=${COMPILER}-cc
local CXX=${COMPILER}-c++
fi
CC=${CC} CXX=${CXX} CXXFLAGS="-I${BUILD_DIR}/icu4c-${ICU_VERSION}_stdthreads_${TARGET_PLATFORM}/cmake_stdheaders_generator/cmake_stdheaders_generator" "${SOURCE_DIR_ICU}/configure" --host=${COMPILER} ${EXTRA_FLAGS} --disable-samples --disable-tests --prefix="${PREFIX_DIR}/icu4c-${ICU_VERSION}_${TARGET_PLATFORM}_${TARGET_TYPE}" --libdir="${PREFIX_DIR}/lib/${COMPILER}/icu4c-${ICU_VERSION}${TARGET_SUFFIX}" --includedir="${PREFIX_DIR}/include/icu4c-${ICU_VERSION}" --with-cross-build="${BUILD_DIR}/icu4c-${ICU_VERSION}_native" --with-data-packaging=${DATA_PACKAGING}
CC=${CC} CXX=${CXX} CXXFLAGS="-I${BUILD_DIR}/icu4c-${ICU_VERSION}_stdthreads_${TARGET_PLATFORM}/cmake_stdheaders_generator/cmake_stdheaders_generator" "${SOURCE_DIR_ICU}/configure" --host=${COMPILER} ${EXTRA_FLAGS} --disable-samples --disable-tests --prefix="${PREFIX_DIR}/lib/${COMPILER}/icu4c-${ICU_VERSION}${TARGET_SUFFIX}" --includedir="${PREFIX_DIR}/include/icu4c-${ICU_VERSION}" --with-cross-build="${BUILD_DIR}/icu4c-${ICU_VERSION}_native" --with-data-packaging=${DATA_PACKAGING}
${MAKE_GENERATOR}
}
function icu_install {
cd "${BUILD_DIR}/icu4c-${ICU_VERSION}_${TARGET_PLATFORM}_${TARGET_TYPE}"
${MAKE_GENERATOR_INSTALL}
if [ ! -L "${PREFIX_DIR}/lib/${COMPILER}/icu4c-${ICU_VERSION}${TARGET_SUFFIX}/include" ]; then
ln -sf "${PREFIX_DIR}/include/icu4c-${ICU_VERSION}" "${PREFIX_DIR}/lib/${COMPILER}/icu4c-${ICU_VERSION}${TARGET_SUFFIX}/include"
fi
}
function icu_clean_native {
@ -354,8 +591,8 @@ function icu_clean {
}
function icu_strip {
cd "${PREFIX_DIR}/icu4c-${ICU_VERSION}_${TARGET_PLATFORM}_${TARGET_TYPE}"
rm -rf "${PREFIX_DIR}/icu4c-${ICU_VERSION}_${TARGET_PLATFORM}_${TARGET_TYPE}"
cd "${PREFIX_DIR}/lib/${COMPILER}/icu4c-${ICU_VERSION}${TARGET_SUFFIX}"
rm -rf bin lib/icu share
}
function icu_register {
@ -387,6 +624,44 @@ function icu_source {
SOURCE_DIR_ICU_MINGW_STD_THREADS="${SOURCE_DIR}/${ARCHIVE}/mingw-std-threads"
}
# HB script
function hb_init {
cmake_init harfbuzz ${HB_VERSION} ${TARGET_TYPE}
}
function hb_build {
cmake_build "${SOURCE_DIR_HB}" harfbuzz ${HB_VERSION} ${TARGET_TYPE} ${TARGET_SUFFIX}
}
function hb_install {
cmake_install harfbuzz ${HB_VERSION} ${TARGET_TYPE} ${TARGET_SUFFIX}
}
function hb_clean {
cmake_clean harfbuzz ${HB_VERSION} ${TARGET_TYPE}
}
function hb_strip {
return 0
}
function hb_register {
QT_LIBS_FLAGS="${QT_LIBS_FLAGS} -system-harfbuzz -L ${PREFIX_DIR}/lib/${COMPILER}/harfbuzz-${HB_VERSION}/lib -I ${PREFIX_DIR}/include/harfbuzz-${HB_VERSION}"
}
function hb_source {
local VERSION=$1
local ARCHIVE=harfbuzz-${VERSION}
mkdir -p "${SOURCE_DIR}"
cd "${SOURCE_DIR}"
if [ ! -d "${ARCHIVE}" ]; then
wget -O ${ARCHIVE}.tar.xz "https://github.com/harfbuzz/harfbuzz/releases/download/${VERSION}/harfbuzz-${VERSION}.tar.xz"
tar xfJ ${ARCHIVE}.tar.xz
fi
SOURCE_DIR_HB="${SOURCE_DIR}/${ARCHIVE}"
}
# Qt script
function qt_init {
@ -406,7 +681,9 @@ function qt_build {
function qt_install {
cd "${BUILD_DIR}/qt_${QT_VERSION}_${TARGET_PLATFORM}_${TARGET_TYPE}"
${MAKE_GENERATOR_INSTALL}
ln -sf "${PREFIX_DIR}/include/qt_${QT_VERSION}" "${PREFIX_DIR}/lib/${COMPILER}/qt_${QT_VERSION}${TARGET_SUFFIX}/include"
if [ ! -L "${PREFIX_DIR}/lib/${COMPILER}/qt_${QT_VERSION}${TARGET_SUFFIX}/include" ]; then
ln -sf "${PREFIX_DIR}/include/qt_${QT_VERSION}" "${PREFIX_DIR}/lib/${COMPILER}/qt_${QT_VERSION}${TARGET_SUFFIX}/include"
fi
}
function qt_clean {
@ -512,15 +789,18 @@ function manage_dependency {
exit 1
else
CMAKE_GENERATOR="${MAKE_PATH} -j${CPU_THREADS}"
CMAKE_GENERATOR_CLEAN="${MAKE_PATH} clean"
CMAKE_GENERATOR_INSTALL="${MAKE_PATH} install"
fi
else
CMAKE_GENERATOR="${GMAKE_PATH} -j${CPU_THREADS}"
CMAKE_GENERATOR_CLEAN="${GMAKE_PATH} clean"
CMAKE_GENERATOR_INSTALL="${GMAKE_PATH} install"
fi
else
CMAKE_GENERATOR_FLAGS="-GNinja"
CMAKE_GENERATOR="${NINJA_PATH}"
CMAKE_GENERATOR_CLEAN="${NINJA_PATH} clean"
CMAKE_GENERATOR_INSTALL="${NINJA_PATH} install"
fi
local GMAKE_PATH=$(command -v gmake)
@ -531,21 +811,14 @@ function manage_dependency {
exit 1
else
MAKE_GENERATOR="${MAKE_PATH} -j${CPU_THREADS}"
MAKE_GENERATOR_CLEAN="${MAKE_PATH} clean"
MAKE_GENERATOR_INSTALL="${MAKE_PATH} install"
fi
else
MAKE_GENERATOR="${GMAKE_PATH} -j${CPU_THREADS}"
MAKE_GENERATOR_CLEAN="${GMAKE_PATH} clean"
MAKE_GENERATOR_INSTALL="${GMAKE_PATH} install"
fi
if [ "${BUILD_SSL}" == "YES" ]; then
if [ "${USE_OPENSSL}" == "YES" ]; then
local PERL_PATH=$(command -v perl)
if [ "${PERL_PATH}" == "" ]; then
echo "OpenSSL missing Perl dependency, please install it!"
exit 1
fi
fi
fi
if [ "${BUILD_JPG}" == "YES" ]; then
local CMAKE_PATH=$(command -v cmake)
if [ "${CMAKE_PATH}" == "" ]; then
@ -558,6 +831,15 @@ function manage_dependency {
exit 1
fi
fi
if [ "${BUILD_SSL}" == "YES" ]; then
if [ "${USE_OPENSSL}" == "YES" ]; then
local PERL_PATH=$(command -v perl)
if [ "${PERL_PATH}" == "" ]; then
echo "OpenSSL missing Perl dependency, please install it!"
exit 1
fi
fi
fi
if [ "${BUILD_ICU}" == "YES" ]; then
local CMAKE_PATH=$(command -v cmake)
if [ "${CMAKE_PATH}" == "" ]; then
@ -580,6 +862,13 @@ function manage_dependency {
exit 1
fi
fi
if [ "${BUILD_HB}" == "YES" ]; then
local CMAKE_PATH=$(command -v cmake)
if [ "${CMAKE_PATH}" == "" ]; then
echo "harfbuzz missing CMake dependency, please install it!"
exit 1
fi
fi
if [ "${BUILD_QT}" == "YES" ]; then
local GIT_PATH=$(command -v git)
if [ "${GIT_PATH}" == "" ]; then
@ -614,6 +903,35 @@ function manage_dependency {
function build_init {
mkdir -p "${BUILD_DIR}"
cd "${BUILD_DIR}"
if [ "${BUILD_ZLIB}" == "YES" ]; then
zlib_source ${ZLIB_VERSION}
fi
if [ "${BUILD_PNG}" == "YES" ]; then
libpng_source ${LIBPNG_VERSION}
fi
if [ "${BUILD_JPG}" == "YES" ]; then
libjpegturbo_source ${LIBJPEGTURBO_VERSION}
fi
if [ "${BUILD_SSL}" == "YES" ]; then
if [ "${USE_OPENSSL}" == "YES" ]; then
openssl_source ${OPENSSL_VERSION}
else
libressl_source ${LIBRESSL_VERSION}
fi
fi
if [ "${BUILD_ICU}" == "YES" ]; then
icu_source ${ICU_VERSION}
fi
if [ "${BUILD_HB}" == "YES" ]; then
hb_source ${HB_VERSION}
fi
if [ "${BUILD_QT}" == "YES" ]; then
qt_source ${QT_SERIES} ${QT_BUILD}
if [ ! "${USE_OPENSSL}" == "YES" ]; then
qt_patch
fi
qtstyleplugins_source
fi
}
function build_type {
@ -718,20 +1036,54 @@ function build_clean_env {
export ICU_LIBS=
export OPENSSL_LIBS=
QT_LIBS_FLAGS=
ZLIB_CPPFLAGS=
ZLIB_LDFLAGS=
USE_CLANG=
USE_GCC=
local EXTRA_COMMAND=$1
if [ "${EXTRA_COMMAND}" == "reregister" ]; then
if [ "${LINK_ZLIB}" == "YES" ]; then
zlib_register
fi
if [ "${LINK_PNG}" == "YES" ]; then
libpng_register
fi
if [ "${LINK_JPG}" == "YES" ]; then
libjpegturbo_register
fi
if [ "${LINK_HB}" == "YES" ]; then
hb_register
fi
fi
}
function build_tl_set {
BUILD_MODE=TL
build_type $1
if [ "${BUILD_ZLIB}" == "YES" ]; then
zlib_init
zlib_build
zlib_install
zlib_strip
zlib_clean
fi
if [ "${LINK_ZLIB}" == "YES" ]; then
zlib_register
fi
if [ "${BUILD_PNG}" == "YES" ]; then
libpng_init
libpng_build
libpng_install
libpng_strip
libpng_clean
fi
if [ "${LINK_PNG}" == "YES" ]; then
libpng_register
fi
if [ "${BUILD_JPG}" == "YES" ]; then
libjpegturbo_init
libjpegturbo_build
@ -742,9 +1094,21 @@ function build_tl_set {
if [ "${LINK_JPG}" == "YES" ]; then
libjpegturbo_register
fi
if [ "${BUILD_HB}" == "YES" ]; then
hb_init
hb_build
hb_install
hb_strip
hb_clean
fi
if [ "${LINK_HB}" == "YES" ]; then
hb_register
fi
}
function build_set {
BUILD_MODE=DEFAULT
build_type $1 $2 $3
if [ "${BUILD_SSL}" == "YES" ]; then
@ -799,23 +1163,10 @@ function build_set {
# Runtime execution script
set +e
set -e
manage_dependency
build_init
libjpegturbo_source ${LIBJPEGTURBO_VERSION}
if [ "${USE_OPENSSL}" == "YES" ]; then
openssl_source ${OPENSSL_VERSION}
else
libressl_source ${LIBRESSL_VERSION}
fi
icu_source ${ICU_VERSION}
qt_source ${QT_SERIES} ${QT_BUILD}
if [ ! "${USE_OPENSSL}" == "YES" ]; then
qt_patch
fi
qtstyleplugins_source
# Custom build
if [ "${CUSTOM_SET}" == "YES" ]; then