Skip to content

Commit

Permalink
[GLFW] Update to 3.4 (#8990)
Browse files Browse the repository at this point in the history
`Wayland_jll` and `xkbcommon_jll` are required for Wayland.
  • Loading branch information
JamesWrigley committed Jul 1, 2024
1 parent eacec49 commit 943248f
Showing 1 changed file with 35 additions and 5 deletions.
40 changes: 35 additions & 5 deletions G/GLFW/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -1,24 +1,51 @@
using BinaryBuilder

name = "GLFW"
version = v"3.3.9"
version = "3.4"

# Collection of sources required to build glfw
sources = [
ArchiveSource("https://github.com/glfw/glfw/releases/download/$(version)/glfw-$(version).zip",
"55261410f8c3a9cc47ce8303468a90f40a653cd8f25fb968b12440624fb26d08")
"b5ec004b2712fd08e8861dc271428f048775200a2df719ccf575143ba749a3e9")
]

# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir/glfw-*/
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$prefix -DCMAKE_TOOLCHAIN_FILE="${CMAKE_TARGET_TOOLCHAIN}" \
# Building with Wayland fails on FreeBSD because it's missing some headers (e.g. linux/input.h)
if [[ ${target} == *linux* ]]; then
export WAYLAND_ENABLED=ON
else
export WAYLAND_ENABLED=OFF
fi
# On FreeBSD we need to set __BSD_VISIBLE to enable ppoll() in the system headers
if [[ ${target} == *freebsd* ]]; then
export BSD_VISIBLE=1
else
export BSD_VISIBLE=0
fi
# We need _POSIX_C_SOURCE >= 199309L for `CLOCK_MONOTONIC`, and >= 200809L for `O_CLOEXEC`.
# See:
# - https://github.com/glfw/glfw/issues/1988
# - https://github.com/glfw/glfw/issues/2495
CFLAGS="-D_POSIX_C_SOURCE='200809L' -D__BSD_VISIBLE=${BSD_VISIBLE}" cmake .. \
-DCMAKE_INSTALL_PREFIX=$prefix \
-DCMAKE_TOOLCHAIN_FILE="${CMAKE_TARGET_TOOLCHAIN}" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DGLFW_BUILD_EXAMPLES=false \
-DGLFW_BUILD_TESTS=false \
-DGLFW_BUILD_DOCS=OFF
-DGLFW_BUILD_DOCS=OFF \
-DGLFW_BUILD_WAYLAND=${WAYLAND_ENABLED}
# Cmake insists on finding the `wayland-scanner` binary built for the target
# platform, so we have to explicitly override it to use the binary for the host.
cmake -DWAYLAND_SCANNER_EXECUTABLE="$host_bindir/wayland-scanner" ..
make -j${nproc}
make install
"""
Expand All @@ -33,10 +60,13 @@ products = [
]

x11_platforms = filter(p->Sys.islinux(p) || Sys.isfreebsd(p), platforms)
wayland_platforms = filter(Sys.islinux, platforms)

# Dependencies that must be installed before this package can be built
dependencies = [
HostBuildDependency("Wayland_jll"; platforms=wayland_platforms),
BuildDependency("Xorg_xorgproto_jll"; platforms=x11_platforms),
Dependency("xkbcommon_jll"; platforms=wayland_platforms),
Dependency("Libglvnd_jll"; platforms=x11_platforms),
Dependency("Xorg_libXcursor_jll"; platforms=x11_platforms),
Dependency("Xorg_libXi_jll"; platforms=x11_platforms),
Expand All @@ -45,4 +75,4 @@ dependencies = [
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6")
build_tarballs(ARGS, name, VersionNumber(version), sources, script, platforms, products, dependencies; julia_compat="1.6")

0 comments on commit 943248f

Please sign in to comment.