Skip to content

Commit

Permalink
[Qt6] Add Qt6WebSockets (#8164)
Browse files Browse the repository at this point in the history
  • Loading branch information
barche authored Feb 25, 2024
1 parent 642fb81 commit e1d2b98
Showing 1 changed file with 126 additions and 0 deletions.
126 changes: 126 additions & 0 deletions Q/Qt6WebSockets/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder, Pkg

name = "Qt6WebSockets"
version = v"6.5.2"

# Collection of sources required to build qt6
sources = [
ArchiveSource("https://download.qt.io/official_releases/qt/$(version.major).$(version.minor)/$version/submodules/qtwebsockets-everywhere-src-$version.tar.xz",
"204bd7b0dffb54c934abc6cf0eb5e3016f11b3c9721a67b4875a6b21bb8b5c76"),
ArchiveSource("https://github.com/phracker/MacOSX-SDKs/releases/download/11.0-11.1/MacOSX11.1.sdk.tar.xz",
"9b86eab03176c56bb526de30daa50fa819937c54b280364784ce431885341bf6"),
ArchiveSource("https://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/mingw-w64-v10.0.0.tar.bz2",
"ba6b430aed72c63a3768531f6a3ffc2b0fde2c57a3b251450dcf489a894f0894")
]

script = raw"""
cd $WORKSPACE/srcdir
mkdir build
cd build/
qtsrcdir=`ls -d ../qtwebsockets-*`
case "$bb_full_target" in
x86_64-linux-musl-libgfortran5-cxx11)
cmake -DCMAKE_INSTALL_PREFIX=${prefix} -DCMAKE_FIND_ROOT_PATH=$prefix -DCMAKE_BUILD_TYPE=Release $qtsrcdir
;;
*mingw*)
cd $WORKSPACE/srcdir/mingw*/mingw-w64-headers
./configure --prefix=/opt/$target/$target/sys-root --enable-sdk=all --host=$target
make install
cd ../mingw-w64-crt/
if [ ${target} == "i686-w64-mingw32" ]; then
_crt_configure_args="--disable-lib64 --enable-lib32"
elif [ ${target} == "x86_64-w64-mingw32" ]; then
_crt_configure_args="--disable-lib32 --enable-lib64"
fi
./configure --prefix=/opt/$target/$target/sys-root --enable-sdk=all --host=$target --enable-wildcard ${_crt_configure_args}
make -j${nproc}
make install
cd ../mingw-w64-libraries/winpthreads
./configure --prefix=/opt/$target/$target/sys-root --host=$target --enable-static --enable-shared
make -j${nproc}
make install
cd $WORKSPACE/srcdir/build
cmake -DQT_HOST_PATH=$host_prefix \
-DPython_ROOT_DIR=/usr \
-DCMAKE_INSTALL_PREFIX=${prefix} \
-DCMAKE_PREFIX_PATH=$host_prefix \
-DCMAKE_FIND_ROOT_PATH=$prefix \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
-DCMAKE_BUILD_TYPE=Release \
$qtsrcdir
;;
*apple-darwin*)
apple_sdk_root=$WORKSPACE/srcdir/MacOSX11.1.sdk
sed -i "s!/opt/x86_64-apple-darwin14/x86_64-apple-darwin14/sys-root!$apple_sdk_root!" $CMAKE_TARGET_TOOLCHAIN
deployarg="-DCMAKE_OSX_DEPLOYMENT_TARGET=10.14"
cmake -DQT_HOST_PATH=$host_prefix \
-DPython_ROOT_DIR=/usr \
-DCMAKE_INSTALL_PREFIX=${prefix} \
-DCMAKE_PREFIX_PATH=$host_prefix \
-DCMAKE_FIND_ROOT_PATH=$prefix \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
-DCMAKE_SYSROOT=$apple_sdk_root -DCMAKE_FRAMEWORK_PATH=$apple_sdk_root/System/Library/Frameworks -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \
-DCMAKE_BUILD_TYPE=Release \
$qtsrcdir
;;
*)
cmake -DQT_HOST_PATH=$host_prefix \
-DPython_ROOT_DIR=/usr \
-DCMAKE_INSTALL_PREFIX=${prefix} \
-DCMAKE_PREFIX_PATH=$host_prefix \
-DCMAKE_FIND_ROOT_PATH=$prefix \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
-DCMAKE_BUILD_TYPE=Release \
$qtsrcdir
;;
esac
cmake --build . --parallel ${nproc}
cmake --install .
install_license $WORKSPACE/srcdir/qt*-src-*/LICENSES/LGPL-3.0-only.txt
"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = expand_cxxstring_abis(filter(!Sys.isapple, supported_platforms()))
filter!(p -> arch(p) != "armv6l", platforms) # No OpenGL on armv6
platforms_macos = [ Platform("x86_64", "macos"), Platform("aarch64", "macos") ]

# The products that we will ensure are always built
products = [
LibraryProduct(["Qt6WebSockets", "libQt6WebSockets", "QtWebSockets"], :libqt6websockets),
]

products_macos = [
FrameworkProduct("QtWebSockets", :libqt6websockets),
]

# Dependencies that must be installed before this package can be built
dependencies = [
HostBuildDependency("Qt6Base_jll"),
HostBuildDependency("Qt6Declarative_jll"),
Dependency("Qt6Base_jll"; compat="="*string(version)),
Dependency("Qt6Declarative_jll"; compat="="*string(version)),
]

include("../../fancy_toys.jl")

if any(should_build_platform.(triplet.(platforms_macos)))
build_tarballs(ARGS, name, version, sources, script, platforms_macos, products_macos, dependencies; preferred_gcc_version = v"10", julia_compat="1.6")
end

if any(should_build_platform.(triplet.(platforms)))
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; preferred_gcc_version = v"10", julia_compat="1.6")
end

0 comments on commit e1d2b98

Please sign in to comment.