diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index d1f261c67..adc1355fe 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -41,6 +41,19 @@ if(${USE_ROBOTO}) add_definitions(-DFRICTION_BUNDLE_ROBOTO) endif() +option(USE_SKIA_SYSTEM_LIBS "Use skia (third-party) system libraries on Linux" OFF) +if(${USE_SKIA_SYSTEM_LIBS}) + pkg_check_modules(EXPAT REQUIRED expat) + pkg_check_modules(FREETYPE REQUIRED freetype2) + pkg_check_modules(JPEG REQUIRED libjpeg) + pkg_check_modules(PNG REQUIRED libpng) + pkg_check_modules(WEBP REQUIRED libwebpmux) + pkg_check_modules(WEBPMUX REQUIRED libwebpdemux) + pkg_check_modules(ZLIB REQUIRED zlib) + pkg_check_modules(ICU REQUIRED icu-i18n) + pkg_check_modules(HARFBUZZ REQUIRED harfbuzz) +endif() + if(APPLE) set(ICON_FILE ${CMAKE_CURRENT_SOURCE_DIR}/icons/${PROJECT_NAME}.icns) set(MACOSX_BUNDLE_BUNDLE_NAME ${PROJECT_NAME}) @@ -107,6 +120,19 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../skia ) +if(${USE_SKIA_SYSTEM_LIBS}) + include_directories( + ${EXPAT_INCLUDE_DIRS} + ${FREETYPE_INCLUDE_DIRS} + ${JPEG_INCLUDE_DIRS} + ${PNG_INCLUDE_DIRS} + ${WEBP_INCLUDE_DIRS} + ${ZLIB_INCLUDE_DIRS} + ${ICU_INCLUDE_DIRS} + ${HARFBUZZ_INCLUDE_DIRS} + ) +endif() + if(UNIX) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../gperftools/include) if(APPLE) @@ -432,6 +458,21 @@ target_link_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../skia/out/build ) +if(${USE_SKIA_SYSTEM_LIBS}) + target_link_directories( + ${PROJECT_NAME} + PRIVATE + ${EXPAT_LIBRARIES_DIRS} + ${FREETYPE_LIBRARIES_DIRS} + ${JPEG_LIBRARIES_DIRS} + ${PNG_LIBRARIES_DIRS} + ${WEBP_LIBRARIES_DIRS} + ${ZLIB_LIBRARIES_DIRS} + ${ICU_LIBRARIES_DIRS} + ${HARFBUZZ_LIBRARIES_DIRS} + ) +endif() + if(UNIX) target_link_directories( ${PROJECT_NAME} @@ -451,6 +492,22 @@ target_link_libraries( ${SKIA_LIBRARIES} ) +if(${USE_SKIA_SYSTEM_LIBS}) + target_link_libraries( + ${PROJECT_NAME} + PRIVATE + ${EXPAT_LIBRARIES} + ${FREETYPE_LIBRARIES} + ${JPEG_LIBRARIES} + ${PNG_LIBRARIES} + ${WEBP_LIBRARIES} + ${WEBPMUX_LIBRARIES} + ${ZLIB_LIBRARIES} + ${ICU_LIBRARIES} + ${HARFBUZZ_LIBRARIES} + ) +endif() + if(APPLE) target_link_libraries( ${PROJECT_NAME} diff --git a/src/scripts/build_ci.sh b/src/scripts/build_ci.sh index f2ae99396..f742910bd 100755 --- a/src/scripts/build_ci.sh +++ b/src/scripts/build_ci.sh @@ -24,24 +24,8 @@ set -e -x CI=${CI:-0} APT=${APT:-0} -SKIA_SYNC=${SKIA_SYNC:-1} PC=${PC:-""} -SF_NET_SRC="https://sourceforge.net/projects/friction/files/source" -SF_NET_SNAP="https://sourceforge.net/projects/friction/files/snapshots" - -SKIA_GIT="4fcb5c225a" -GPERF_GIT="4df0b85" - -SKIA_TAR=${SKIA_TAR:-0} -GPERF_TAR=${GPERF_TAR:-0} - -FRICTION_DIST=/snapshots/distfiles - -if [ "${SKIA_TAR}" = 1 ]; then - SKIA_SYNC=0 -fi - if [ "${APT}" = 1 ]; then sudo apt update -y sudo apt install -y \ @@ -54,7 +38,6 @@ autoconf \ automake \ cmake \ python3 \ -python-is-python3 \ ninja-build \ tree \ libfontconfig1-dev \ @@ -73,11 +56,19 @@ qtbase5-dev \ qtdeclarative5-dev-tools \ qtdeclarative5-dev \ qtmultimedia5-dev \ -qttools5-dev-tools +qttools5-dev-tools \ +libexpat1-dev \ +libfreetype-dev \ +libjpeg-turbo8-dev \ +libpng-dev \ +libwebp-dev \ +zlib1g-dev \ +libicu-dev \ +libharfbuzz-dev fi if [ "${CI}" = 1 ]; then - git submodule update -i --recursive + git submodule update -i fi if [ "${PC}" != "" ]; then @@ -90,16 +81,6 @@ COMMIT=`git rev-parse --short HEAD` BRANCH=`git rev-parse --abbrev-ref HEAD` if [ ! -f "${CWD}/src/gperftools/.libs/libtcmalloc.a" ]; then - if [ "${GPERF_TAR}" = 1 ]; then - rm -rf ${CWD}/src/gperftools || true - if [ -f "${FRICTION_DIST}/gperftools.tar.xz" ]; then - tar xf ${FRICTION_DIST}/gperftools.tar.xz - else - curl -k -L "${SF_NET_SRC}/gperftools-${GPERF_GIT}.tar.xz/download" --output ${CWD}/gperftools.tar.xz - tar xf ${CWD}/gperftools.tar.xz - fi - mv gperftools-${GPERF_GIT} ${CWD}/src/gperftools - fi cd ${CWD}/src/gperftools ./autogen.sh CC=clang CXX=clang++ ./configure --disable-shared @@ -107,21 +88,8 @@ if [ ! -f "${CWD}/src/gperftools/.libs/libtcmalloc.a" ]; then fi if [ ! -f "${CWD}/src/skia/out/build/libskia.a" ]; then - if [ "${SKIA_TAR}" = 1 ]; then - rm -rf ${CWD}/src/skia || true - if [ -f "${FRICTION_DIST}/skia.tar.xz" ]; then - tar xf ${FRICTION_DIST}/skia.tar.xz - else - curl -k -L "${SF_NET_SRC}/skia-${SKIA_GIT}-minimal.tar.xz/download" --output ${CWD}/skia.tar.xz - tar xf ${CWD}/skia.tar.xz - fi - mv skia-${SKIA_GIT} ${CWD}/src/skia - fi cd ${CWD}/src/skia - if [ "${SKIA_SYNC}" = 1 ]; then - python3 tools/git-sync-deps || true - fi - bin/gn gen out/build --args='is_official_build=true is_debug=false cc="clang" cxx="clang++" extra_cflags=["-Wno-error"] target_os="linux" target_cpu="x64" skia_use_system_expat=false skia_use_system_freetype2=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false skia_use_system_icu=false skia_use_system_harfbuzz=false skia_use_dng_sdk=false' + bin/gn gen out/build --args='is_official_build=true is_debug=false cc="clang" cxx="clang++" extra_cflags=["-Wno-error"] target_os="linux" target_cpu="x64" skia_use_system_expat=true skia_use_system_freetype2=true skia_use_system_libjpeg_turbo=true skia_use_system_libpng=true skia_use_system_libwebp=true skia_use_system_zlib=false skia_use_system_icu=true skia_use_system_harfbuzz=true skia_use_dng_sdk=false' ninja -C out/build -j${MKJOBS} skia fi @@ -131,6 +99,7 @@ mkdir build cd build cmake -G Ninja \ +-DUSE_SKIA_SYSTEM_LIBS=ON \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_CXX_COMPILER=clang++ \