Skaffold headless backend

This commit is contained in:
Frederik Carlier 2023-09-28 11:31:31 +00:00
parent 1ec7eb6ecb
commit f56d4cfce2
8 changed files with 231 additions and 13 deletions

View file

@ -0,0 +1,30 @@
/* HeadlessContext.c - Headless Context
*
* Copyright (c) 2023 Keysight Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef HeadlessContext_h_INCLUDE
#define HeadlessContext_h_INCLUDE
#include "gsc/GSContext.h"
@interface HeadlessContext : GSContext
{
}
@end
#endif

View file

@ -0,0 +1,32 @@
/* HeadlessServer.c - Headless Server
*
* Copyright (c) 2023 Keysight Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef HeadlessServer_h_INCLUDE
#define HeadlessServer_h_INCLUDE
#include "config.h"
#include <GNUstepGUI/GSDisplayServer.h>
@interface HeadlessServer : GSDisplayServer
{
}
@end
#endif /* HeadlessServer_h_INCLUDE */

View file

@ -50,6 +50,11 @@
@interface WaylandServer (Initialize)
+ (void) initializeBackend;
@end
#elif BUILD_SERVER == SERVER_headless
#include <headless/HeadlessServer.h>
@interface HeadlessServer (Initialize)
+ (void) initializeBackend;
@end
#endif
/* Call the correct initalization routines for the choosen
@ -70,6 +75,8 @@
[WIN32Server initializeBackend];
#elif BUILD_SERVER == SERVER_wayland
[WaylandServer initializeBackend];
#elif BUILD_SERVER == SERVER_xheadless
[HeadlessServer initializeBackend];
#else
[NSException raise: NSInternalInconsistencyException
format: @"No Window Server configured in backend"];
@ -96,6 +103,8 @@
context = @"CairoContext";
#elif (BUILD_GRAPHICS==GRAPHICS_opal)
context = @"OpalContext";
#elif (BUILD_GRAPHICS==GRAPHICS_headless)
context = @"HeadlessContext";
#else
#error INVALID build graphics type
#endif

View file

@ -0,0 +1,42 @@
#
# Main makefile for GNUstep Headless Backend
#
# Copyright (C) 2002 Free Software Foundation, Inc.
#
# Author: Adam Fedor <fedor@gnu.org>
#
# This file is part of the GNUstep Backend.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; see the file COPYING.LIB.
# If not, see <http://www.gnu.org/licenses/> or write to the
# Free Software Foundation, 51 Franklin Street, Fifth Floor,
PACKAGE_NAME = gnustep-back
GNUSTEP_LOCAL_ADDITIONAL_MAKEFILES=../../back.make
include $(GNUSTEP_MAKEFILES)/common.make
include ../../config.make
# The library to be compiled, as a library or as a bundle
SUBPROJECT_NAME=xheadless
# The Objective-C source files to be compiled
xheadless_OBJC_FILES =
-include GNUmakefile.preamble
include $(GNUSTEP_MAKEFILES)/subproject.make
-include GNUmakefile.postamble

View file

@ -0,0 +1,51 @@
#
# GNUmakefile.preamble
#
# Copyright (C) 2002 Free Software Foundation, Inc.
#
# Author: Adam Fedor <fedor@gnu.org>
#
# This file is part of the GNUstep Backend.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; see the file COPYING.LIB.
# If not, see <http://www.gnu.org/licenses/> or write to the
# Free Software Foundation, 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# Flags dealing with compiling and linking
#
# Additional flags to pass to the preprocessor
ADDITIONAL_CPPFLAGS += -Wall $(CONFIG_SYSTEM_DEFS)
# Additional flags to pass to the Objective-C compiler
ADDITIONAL_OBJCFLAGS =
# Additional flags to pass to the C compiler
ADDITIONAL_CFLAGS =
# Additional include directories the compiler should search
ADDITIONAL_INCLUDE_DIRS += -I../../Headers \
-I../$(GNUSTEP_TARGET_DIR) $(GRAPHIC_CFLAGS)
# Additional LDFLAGS to pass to the linker
ADDITIONAL_LDFLAGS =
# Additional library directories the linker should search
ADDITIONAL_LIB_DIRS =
#
# Flags dealing with installing and uninstalling
#

View file

@ -0,0 +1,26 @@
/* HeadlessContext.m - Headless Context
*
* Copyright (c) 2023 Keysight Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
#include "Headless/HeadlessContext.h"
@implementation HeadlessContext
@end

View file

@ -0,0 +1,26 @@
/* HeadlessServer.m - Headless Server
*
* Copyright (c) 2023 Keysight Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "config.h"
#include "Headless/HeadlessServer.h"
@implementation HeadlessServer
@end

View file

@ -565,10 +565,10 @@ case $target_os in
esac
AC_ARG_ENABLE(server,
[ --enable-server=SRV Build server type: x11, win32, wayland],,
[ --enable-server=SRV Build server type: x11, win32, wayland, headless],,
enable_server=$BUILD_SERVER)
AC_ARG_ENABLE(graphics,
[ --enable-graphics=GPH Build graphics: xlib, xdps, winlib, art, cairo, opal],,
[ --enable-graphics=GPH Build graphics: xlib, xdps, winlib, art, cairo, opal, headless],,
enable_graphics="$BUILD_GRAPHICS")
BUILD_SERVER=$enable_server
@ -658,8 +658,6 @@ if test x"$BUILD_GRAPHICS" = "xcairo"; then
CAIRO_LIBS="$CAIRO_LIBS $XFT_LIBS"
CAIRO_CFLAGS="$CAIRO_CFLAGS"
LIBS="-lwayland-client -lwayland-cursor -lxkbcommon $LIBS"
else
AC_MSG_ERROR([Invalid Cairo installation])
fi
LIBS="$CAIRO_LIBS $LIBS"
CPPFLAGS="$CAIRO_CFLAGS $CPPFLAGS"
@ -717,6 +715,8 @@ elif test x"$BUILD_GRAPHICS" = "xopal"; then
fi
AC_MSG_NOTICE([Switching to $BUILD_GRAPHICS])
fi
elif test x"$BUILD_GRAPHICS" = "xheadless"; then
: # Nothing to do
else
AC_MSG_ERROR([Invalid graphics backend $BUILD_GRAPHICS])
fi
@ -757,15 +757,17 @@ if test $BUILD_SERVER = win32; then
fi
AH_TOP([
#define SERVER_x11 1
#define SERVER_win32 2
#define SERVER_wayland 3
#define GRAPHICS_xdps 0
#define GRAPHICS_art 1
#define GRAPHICS_xlib 2
#define GRAPHICS_winlib 3
#define GRAPHICS_cairo 4
#define GRAPHICS_opal 5
#define SERVER_x11 1
#define SERVER_win32 2
#define SERVER_wayland 3
#define SERVER_headless 4
#define GRAPHICS_xdps 0
#define GRAPHICS_art 1
#define GRAPHICS_xlib 2
#define GRAPHICS_winlib 3
#define GRAPHICS_cairo 4
#define GRAPHICS_opal 5
#define GRAPHICS_headless 6
])
AC_DEFINE_UNQUOTED(BUILD_SERVER,SERVER_$BUILD_SERVER,
[Define to type of window server to build])