VirtualGL-3.0.1 for slackware64-15.0

VirtualGL.SlackBuild
[code]
#!/bin/sh

# Slackware build script for VirtualGL

# Copyright 2022 JW(Shinichi Abe) <shin1.abe@nifty.com>
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

PRGNAM=VirtualGL
VERSION=${VERSION:-3.0.1}
BUILD=${BUILD:-1}
TAG=${TAG:-jw}

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i586 ;;
    arm*) ARCH=arm ;;
       *) ARCH=$( uname -m ) ;;
  esac
fi

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

if [ "$ARCH" = "i586" ]; then
  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
else
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
fi

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
# Apply upstream patch -- Thanks to Arch
patch -Np1 -i $CWD/46d09529563127fef0d42a4fb2681ae8d65a856b.patch


chown -R root:root .
find -L . \
 \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  -o -perm 511 \) -exec chmod 755 {} \; -o \
 \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;

mkdir -p build
cd build
  cmake \
    -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
    -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DLIB_SUFFIX=${LIBDIRSUFFIX} \
    -DTJPEG_LIBRARY=/usr/lib${LIBDIRSUFFIX}/libturbojpeg.so \
    -DVGL_FAKEXCB=1 \
    -DCMAKE_BUILD_TYPE=Release ..
  make
  make install DESTDIR=$PKG
  mv $PKG/usr/bin/glxinfo $PKG/usr/bin/vglxinfo
  mv $PKG/usr/bin/eglinfo $PKG/usr/bin/veglinfo
cd ..

find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

find $PKG -name perllocal.pod -o -name ".packlist" -o -name "*.bs" | xargs rm -f || true

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a \
  *.txt doc $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz}

46d09529563127fef0d42a4fb2681ae8d65a856b.patch
[code]
From 46d09529563127fef0d42a4fb2681ae8d65a856b Mon Sep 17 00:00:00 2001
From: DRC <information@virtualgl.org>
Date: Thu, 7 Jul 2022 17:22:57 -0500
Subject: [PATCH] Build: Fix compilation errors with libX11 1.8.x

Fixes #205
---
 ChangeLog.md           |  2 ++
 server/CMakeLists.txt  | 10 ++++++++++
 server/FakePbuffer.cpp |  2 +-
 server/faker-sym.h     |  6 ++++++
 server/faker-x11.cpp   |  7 ++++++-
 server/faker.cpp       |  4 ++--
 6 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/ChangeLog.md b/ChangeLog.md
index 292a5a94..4b9cc36f 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -8,6 +8,8 @@ module when using recent versions of nVidia's proprietary drivers.  In some
 cases, this led to incorrect device permissions for **/dev/nvidia*** after the
 display manager was restarted.
 
+2. Fixed compilation errors when building with libX11 1.8.x.
+
 
 3.0.1
 =====
diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt
index 574521a0..2ce92856 100644
--- a/server/CMakeLists.txt
+++ b/server/CMakeLists.txt
@@ -91,6 +91,16 @@ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/faker-mapfile
         > ${CMAKE_CURRENT_BINARY_DIR}/faker-mapfile
     DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/faker-mapfile.c)
 
+include(CheckPrototypeDefinition)
+set(CMAKE_REQUIRED_INCLUDES ${X11_X11_INCLUDE_PATH})
+check_prototype_definition(XkbOpenDisplay
+    "Display *XkbOpenDisplay(_Xconst char *, int *, int *, int *, int *, int *)"
+    NULL X11/XKBlib.h LIBX11_18)
+unset(CMAKE_REQUIRED_INCLUDES)
+if(LIBX11_18)
+    add_definitions(-DLIBX11_18)
+endif()
+
 set(FAKER_SOURCES
     backend.cpp
     ContextHash.cpp
diff --git a/server/FakePbuffer.cpp b/server/FakePbuffer.cpp
index bfa55279..64aab775 100644
--- a/server/FakePbuffer.cpp
+++ b/server/FakePbuffer.cpp
@@ -10,11 +10,11 @@
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 // wxWindows Library License for more details.
 
+#include <X11/Xlibint.h>
 #include "FakePbuffer.h"
 #include "TempContextEGL.h"
 #include "BufferState.h"
 #include "ContextHashEGL.h"
-#include <X11/Xlibint.h>
 
 using namespace util;
 using namespace backend;
diff --git a/server/faker-sym.h b/server/faker-sym.h
index 0fa1e5cd..3c6f94e8 100644
--- a/server/faker-sym.h
+++ b/server/faker-sym.h
@@ -704,9 +704,15 @@ FUNCDEF2(int, XNextEvent, Display *, dpy, XEvent *, xe, XNextEvent)
 
 FUNCDEF1(Display *, XOpenDisplay, _Xconst char *, name, XOpenDisplay)
 
+#ifdef LIBX11_18
+FUNCDEF6(Display *, XkbOpenDisplay, _Xconst char *, display_name,
+    int *, event_rtrn, int *, error_rtrn, int *, major_in_out,
+    int *, minor_in_out, int *, reason_rtrn, XkbOpenDisplay)
+#else
 FUNCDEF6(Display *, XkbOpenDisplay, char *, display_name, int *, event_rtrn,
     int *, error_rtrn, int *, major_in_out, int *, minor_in_out,
     int *, reason_rtrn, XkbOpenDisplay)
+#endif
 
 FUNCDEF5(Bool, XQueryExtension, Display *, dpy, _Xconst char *, name,
     int *, major_opcode, int *, first_event, int *, first_error,
diff --git a/server/faker-x11.cpp b/server/faker-x11.cpp
index 99e8bf17..a233f3b1 100644
--- a/server/faker-x11.cpp
+++ b/server/faker-x11.cpp
@@ -1,6 +1,6 @@
 // Copyright (C)2004 Landmark Graphics Corporation
 // Copyright (C)2005, 2006 Sun Microsystems, Inc.
-// Copyright (C)2009, 2011-2016, 2018-2021 D. R. Commander
+// Copyright (C)2009, 2011-2016, 2018-2022 D. R. Commander
 //
 // This library is free software and may be redistributed and/or modified under
 // the terms of the wxWindows Library License, Version 3.1 or (at your option)
@@ -586,8 +586,13 @@ Display *XOpenDisplay(_Xconst char *name)
 // within libX11, VirtualGL cannot intercept it on some platforms.  Thus we
 // need to interpose XkbOpenDisplay().
 
+#ifdef LIBX11_18
+Display *XkbOpenDisplay(_Xconst char *display_name, int *event_rtrn,
+    int *error_rtrn, int *major_in_out, int *minor_in_out, int *reason_rtrn)
+#else
 Display *XkbOpenDisplay(char *display_name, int *event_rtrn, int *error_rtrn,
     int *major_in_out, int *minor_in_out, int *reason_rtrn)
+#endif
 {
     Display *dpy = NULL;
 
diff --git a/server/faker.cpp b/server/faker.cpp
index ec537a62..601cfa3e 100644
--- a/server/faker.cpp
+++ b/server/faker.cpp
@@ -1,6 +1,6 @@
 // Copyright (C)2004 Landmark Graphics Corporation
 // Copyright (C)2005, 2006 Sun Microsystems, Inc.
-// Copyright (C)2009, 2011, 2013-2016, 2019-2021 D. R. Commander
+// Copyright (C)2009, 2011, 2013-2016, 2019-2022 D. R. Commander
 //
 // This library is free software and may be redistributed and/or modified under
 // the terms of the wxWindows Library License, Version 3.1 or (at your option)
@@ -14,6 +14,7 @@
 
 #include <unistd.h>
 #include "Mutex.h"
+#include <X11/Xlibint.h>
 #include "ContextHash.h"
 #ifdef EGLBACKEND
 #include "ContextHashEGL.h"
@@ -27,7 +28,6 @@
 #include "fakerconfig.h"
 #include "threadlocal.h"
 #include <dlfcn.h>
-#include <X11/Xlibint.h>
 #include "faker.h"
 


slack-desc
[code]
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':' except on otherwise blank lines.

         |-----handy-ruler------------------------------------------------------|
VirtualGL: VirtualGL (remote OpenGL rendering)
VirtualGL:
VirtualGL: VirtualGL is an open source package which gives any Unix or Linux
VirtualGL: remote display software the ability to run OpenGL applications with
VirtualGL: full 3D hardware acceleration.
VirtualGL:
VirtualGL: Homepage: https://virtualgl.org/Main/HomePage
VirtualGL:
VirtualGL:
VirtualGL:
VirtualGL:

VirtualGL.info
[code]
PRGNAM="VirtualGL"
VERSION="3.0.1"
HOMEPAGE="https://github.com/VirtualGL/virtualgl"
DOWNLOAD="https://jaist.dl.sourceforge.net/project/virtualgl/3.0.1/VirtualGL-3.0.1.tar.gz"
MD5SUM="e7ec38c7e69a2d8db10941057b753aa6"
DOWNLOAD_x86_64="direct download link(s) of application source tarball(s), x86_64 only"
MD5SUM_x86_64=""
REQUIRES="%README%"
MAINTAINER="JW(Shinichi Abe)"
EMAIL="shin1.abe@nifty.com"


< sample Log >
[code]
$ glxspheres64
Polygons in scene: 62464 (61 spheres * 1024 polys/spheres)
GLX FB config ID of window: 0xad (8/8/8/0)
Visual ID of window: 0x27
Context is Direct
OpenGL Renderer: NVIDIA GeForce GTX 1060 6GB/PCIe/SSE2
59.975655 frames/sec - 66.932831 Mpixels/sec
59.957130 frames/sec - 66.912157 Mpixels/sec
59.950381 frames/sec - 66.904625 Mpixels/sec
59.954037 frames/sec - 66.908705 Mpixels/sec
...

$ vglrun /usr/bin/glxspheres64
Polygons in scene: 62464 (61 spheres * 1024 polys/spheres)
GLX FB config ID of window: 0xad (8/8/8/0)
Visual ID of window: 0x21
Context is Direct
OpenGL Renderer: NVIDIA GeForce GTX 1060 6GB/PCIe/SSE2
534.958612 frames/sec - 597.013811 Mpixels/sec
540.546484 frames/sec - 603.249876 Mpixels/sec
527.378161 frames/sec - 588.554028 Mpixels/sec
545.998366 frames/sec - 609.334177 Mpixels/sec
547.866048 frames/sec - 611.418509 Mpixels/sec
...

screenshot of glxsphere64
glxspheres64_2022-08-25_16-06-23


---
[2022-08-25] 新規
[ ]