Skip to content

Commit

Permalink
feat: Support linux target in the qtox build scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Jan 6, 2025
1 parent 888132c commit 936d171
Show file tree
Hide file tree
Showing 32 changed files with 249 additions and 182 deletions.
2 changes: 1 addition & 1 deletion qtox/build_extra_cmake_modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "extra-cmake-modules" --supported "linux win32 win64 macos-x86_64 macos-arm64" "$@"
parse_arch --dep "extra-cmake-modules" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64" "$@"

"$SCRIPT_DIR/download/download_extra_cmake_modules.sh"

Expand Down
2 changes: 1 addition & 1 deletion qtox/build_ffmpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "ffmpeg" --supported "win32 win64 macos-x86_64 macos-arm64" "$@"
parse_arch --dep "ffmpeg" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64" "$@"

if [ "$SCRIPT_ARCH" == "win64" ]; then
FFMPEG_ARCH="x86_64"
Expand Down
2 changes: 1 addition & 1 deletion qtox/build_hunspell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "hunspell" --supported "win32 win64 macos-x86_64 macos-arm64" "$@"
parse_arch --dep "hunspell" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64" "$@"

if [ "$LIB_TYPE" = "shared" ]; then
ENABLE_STATIC=--disable-static
Expand Down
2 changes: 1 addition & 1 deletion qtox/build_kimageformats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "kimageformats" --supported "linux macos-x86_64 macos-arm64" "$@"
parse_arch --dep "kimageformats" --supported "linux-x86_64 macos-x86_64 macos-arm64" "$@"

"$SCRIPT_DIR/download/download_kimageformats.sh"

Expand Down
2 changes: 1 addition & 1 deletion qtox/build_libexif.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "libexif" --supported "win32 win64 macos-x86_64 macos-arm64" "$@"
parse_arch --dep "libexif" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64" "$@"

if [ "$LIB_TYPE" = "shared" ]; then
ENABLE_STATIC=--disable-static
Expand Down
2 changes: 1 addition & 1 deletion qtox/build_openal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "openal" --supported "win32 win64 macos-x86_64 macos-arm64" "$@"
parse_arch --dep "openal" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64" "$@"

if [ "$SCRIPT_ARCH" = "win32" ] || [ "$SCRIPT_ARCH" = "win64" ]; then
"$SCRIPT_DIR/download/download_openal.sh" patched
Expand Down
8 changes: 7 additions & 1 deletion qtox/build_openssl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "openssl" --supported "win32 win64 macos-x86_64 macos-arm64" "$@"
parse_arch --dep "openssl" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64" "$@"

if [ "$SCRIPT_ARCH" == "win64" ]; then
OPENSSL_ARCH="mingw64"
Expand All @@ -25,6 +25,12 @@ elif [ "$SCRIPT_ARCH" == "macos-x86_64" ]; then
elif [ "$SCRIPT_ARCH" == "macos-arm64" ]; then
OPENSSL_ARCH="darwin64-arm64-cc"
CROSS_COMPILE_ARCH=""
elif [ "$SCRIPT_ARCH" == "linux-x86_64" ]; then
OPENSSL_ARCH="linux-x86_64"
CROSS_COMPILE_ARCH=""
else
echo "Unsupported arch: $SCRIPT_ARCH"
exit 1
fi

if [ "$LIB_TYPE" = "static" ]; then
Expand Down
2 changes: 1 addition & 1 deletion qtox/build_opus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "opus" --supported "win32 win64 macos-x86_64 macos-arm64" "$@"
parse_arch --dep "opus" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64" "$@"

if [ "$LIB_TYPE" = "shared" ]; then
ENABLE_STATIC=--disable-static
Expand Down
2 changes: 1 addition & 1 deletion qtox/build_qrencode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "qrencode" --supported "win32 win64 macos-x86_64 macos-arm64" "$@"
parse_arch --dep "qrencode" --supported "linux-x86_64 win32 win64 macos-x86_64 macos-arm64" "$@"

if [ "$LIB_TYPE" = "shared" ]; then
BUILD_SHARED_LIBS=ON
Expand Down
111 changes: 0 additions & 111 deletions qtox/build_qt_macos.sh

This file was deleted.

5 changes: 3 additions & 2 deletions qtox/build_qtbase_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "qtbase" --supported "linux" "$@"
parse_arch --dep "qtbase" --supported "linux-x86_64" "$@"

"$SCRIPT_DIR/download/download_qtbase.sh"

export CXXFLAGS="-DQT_MESSAGELOGCONTEXT"
export OBJCXXFLAGS="$CXXFLAGS"

mkdir qtbase/_build && pushd qtbase/_build
mkdir -p qtbase/_build
pushd qtbase/_build
../configure -prefix "$DEP_PREFIX/qt" \
-appstore-compliant \
-release \
Expand Down
65 changes: 65 additions & 0 deletions qtox/build_qtbase_macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env bash

# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright © 2024 The TokTok team

set -euxo pipefail

readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"
source "$SCRIPT_DIR/download/version_qt.sh"

parse_arch --dep "qtbase" --supported "macos-arm64 macos-x86_64" "$@"

export CXXFLAGS="-DQT_MESSAGELOGCONTEXT"
export OBJCXXFLAGS="$CXXFLAGS"

if [ -n "$SANITIZE" ]; then
QT_SANITIZE=(-sanitize "$CLANG_SANITIZER")
BUILD_TYPE=debug
else
QT_SANITIZE=()
fi

if [ "$BUILD_TYPE" = "debug" ]; then
QT_FORCE_DEBUG_INFO="-force-debug-info"
else
QT_FORCE_DEBUG_INFO="-no-force-debug-info"
fi

tar Jxf <(curl -L "https://download.qt.io/archive/qt/$(echo "$QT_VERSION" | grep -o '...')/$QT_VERSION/submodules/qtbase-everywhere-src-$QT_VERSION.tar.xz")
rm -rf qtbase && mv "qtbase-everywhere-src-$QT_VERSION" qtbase && cd qtbase
rm -rf _build && mkdir _build && cd _build
../configure \
--prefix="$QT_PREFIX" \
-appstore-compliant \
-static \
-release \
-force-asserts \
"$QT_FORCE_DEBUG_INFO" \
"${QT_SANITIZE[@]}" \
-qt-doubleconversion \
-qt-freetype \
-qt-harfbuzz \
-qt-libjpeg \
-qt-libpng \
-qt-pcre \
-qt-zlib \
-no-feature-androiddeployqt \
-no-feature-brotli \
-no-feature-macdeployqt \
-no-feature-printsupport \
-no-feature-qmake \
-no-feature-sql \
-no-feature-dbus \
-no-opengl \
-no-openssl \
-- \
-DCMAKE_FIND_ROOT_PATH="$DEP_PREFIX" \
-Wno-dev
cat config.summary
cmake --build .
cmake --install .
cd ../..
rm -rf qtbase
2 changes: 1 addition & 1 deletion qtox/build_qtimageformats_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "qtimageformats" --supported "linux" "$@"
parse_arch --dep "qtimageformats" --supported "linux-x86_64" "$@"

"$SCRIPT_DIR/download/download_qtimageformats.sh"

Expand Down
28 changes: 28 additions & 0 deletions qtox/build_qtimageformats_macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright © 2024 The TokTok team

set -euxo pipefail

readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"
source "$SCRIPT_DIR/download/version_qt.sh"

parse_arch --dep "qt" --supported "macos-arm64 macos-x86_64" "$@"

export CXXFLAGS="-DQT_MESSAGELOGCONTEXT"
export OBJCXXFLAGS="$CXXFLAGS"

tar Jxf <(curl -L "https://download.qt.io/archive/qt/$(echo "$QT_VERSION" | grep -o '...')/$QT_VERSION/submodules/qtimageformats-everywhere-src-$QT_VERSION.tar.xz")
rm -rf qtimageformats && mv "qtimageformats-everywhere-src-$QT_VERSION" qtimageformats && cd qtimageformats
rm -rf _build && mkdir _build && cd _build
"$QT_PREFIX/bin/qt-configure-module" .. \
-- \
-DCMAKE_FIND_ROOT_PATH="$DEP_PREFIX" \
-Wno-dev
cmake --build .
cmake --install .
cd ../..
rm -rf qtimageformats
2 changes: 1 addition & 1 deletion qtox/build_qtsvg_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "qtsvg" --supported "linux" "$@"
parse_arch --dep "qtsvg" --supported "linux-x86_64" "$@"

"$SCRIPT_DIR/download/download_qtsvg.sh"

Expand Down
28 changes: 28 additions & 0 deletions qtox/build_qtsvg_macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright © 2024 The TokTok team

set -euxo pipefail

readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"
source "$SCRIPT_DIR/download/version_qt.sh"

parse_arch --dep "qt" --supported "macos-arm64 macos-x86_64" "$@"

export CXXFLAGS="-DQT_MESSAGELOGCONTEXT"
export OBJCXXFLAGS="$CXXFLAGS"

tar Jxf <(curl -L "https://download.qt.io/archive/qt/$(echo "$QT_VERSION" | grep -o '...')/$QT_VERSION/submodules/qtsvg-everywhere-src-$QT_VERSION.tar.xz")
rm -rf qtsvg && mv "qtsvg-everywhere-src-$QT_VERSION" qtsvg && cd qtsvg
rm -rf _build && mkdir _build && cd _build
"$QT_PREFIX/bin/qt-configure-module" .. \
-- \
-DCMAKE_FIND_ROOT_PATH="$DEP_PREFIX" \
-Wno-dev
cmake --build .
cmake --install .
cd ../..
rm -rf qtsvg
2 changes: 1 addition & 1 deletion qtox/build_qttools_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"

source "$SCRIPT_DIR/build_utils.sh"

parse_arch --dep "qttools" --supported "linux" "$@"
parse_arch --dep "qttools" --supported "linux-x86_64" "$@"

"$SCRIPT_DIR/download/download_qttools.sh"

Expand Down
Loading

0 comments on commit 936d171

Please sign in to comment.