FLTK logo

[master] 6686d2b - Wayland platform: add support of FreeBSD version 13.1

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] 6686d2b - Wayland platform: add support of FreeBSD version 13.1 "ManoloFLTK" May 19, 2022  
 
commit 6686d2bfa9e6189476cfdc14d77e759d80377c06
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Thu May 19 17:18:53 2022 +0200
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Thu May 19 17:18:53 2022 +0200

    Wayland platform: add support of FreeBSD version 13.1

 README.Wayland.txt      | 22 +++++++++++++++++++---
 configure.ac            | 21 +++++++++++++++------
 libdecor/build/Makefile | 40 +++++++++++++++++++++++++++++++++-------
 makeinclude.in          |  1 +
 4 files changed, 68 insertions(+), 16 deletions(-)

diff --git README.Wayland.txt README.Wayland.txt
index 668fc13..f307cd1 100644
--- README.Wayland.txt
+++ README.Wayland.txt
@@ -20,7 +20,7 @@ CONTENTS
 ==============
 
 Version 1.4 of the FLTK library introduces support of the public FLTK API on
-the Wayland platform. It requires a Wayland-equipped OS which means Linux.
+the Wayland platform. It requires a Wayland-equipped OS, namely Linux or FreeBSD.
 Pre-existing platform-independent source code for FLTK 1.3.x should build and
 run unchanged with FLTK 1.4 and the Wayland platform.
 The code has been tested on Debian, Ubuntu and Fedora with 3 distinct Wayland
@@ -32,8 +32,8 @@ CJK text-input methods, as well as dead and compose keys are supported.
 ==========================
 
 It is possible to have your FLTK application do all its windowing and drawing
-through the Wayland protocol on Linux systems. All graphics is done via Cairo or EGL.
-All text-drawing is done via Pango.
+through the Wayland protocol on Linux or FreeBSD systems.
+All graphics is done via Cairo or EGL. All text-drawing is done via Pango.
 
  2.1 Configuration
 ---------------
@@ -167,3 +167,19 @@ in a Fedora 35 Workstation distribution :
 - cmake-gui    <== if you plan to use the GUI of CMake
 
 Package installation command: sudo yum install <package-name ...>
+
+
+3.3 FreeBSD
+
+The Wayland platform is know to work with FreeBSD version 13.1 and the sway compositor.
+
+These packages are necessary to build the FLTK library and the sway compositor:
+pkg install git autoconf pkgconf xorg urwfonts gnome seatd sway dmenu-wayland dmenu
+
+The FLTK library should be built, for now, as follows :
+
+git clone https://github.com/fltk/fltk fltk
+cd fltk
+autoconf -f
+./configure --enable-localzlib --enable-wayland
+make
diff --git configure.ac configure.ac
index 0d35374..8b2b95e 100644
--- configure.ac
+++ configure.ac
@@ -996,17 +996,26 @@ AS_CASE([$host_os_gui], [cygwin* | mingw*], [
       DSOFLAGS="$LIBS $DSOFLAGS"
       enable_pango=yes
       LIBDECORDIR="libdecor/build"
-      LDFLAGS="$LDFLAGS -rdynamic -no-pie"
+      LDFLAGS="$LDFLAGS -rdynamic"
+      AC_SUBST([UNAME])
+      UNAME="$(uname -s)"
+      AS_CASE([$UNAME], 
+         [Linux], [LDFLAGS="$LDFLAGS -no-pie"],
+         [*], [CXXFLAGS="$CXXFLAGS -I../libdecor/build"]
+      )
 
       AC_SEARCH_LIBS([dlopen], [dl])
 
       AS_IF([test x$enable_gl != xno], [
-          AC_CHECK_HEADER([GL/gl.h], [AC_DEFINE([HAVE_GL])])
-          AC_CHECK_HEADER([GL/glu.h], [
-              AC_DEFINE([HAVE_GL_GLU_H])
-              GLLIBS="$($PKGCONFIG --libs wayland-egl) $($PKGCONFIG --libs egl) $($PKGCONFIG --libs glu) $($PKGCONFIG --libs gl) $GLLIBS"
+          AS_IF([$PKGCONFIG --exists gl], [ 
+             AC_DEFINE([HAVE_GL]) 
+             GLLIBS="$($PKGCONFIG --libs wayland-egl) $($PKGCONFIG --libs egl) $($PKGCONFIG --libs gl) $GLLIBS"
           ])
-          GLWLDEMO="egl"
+          AS_IF([$PKGCONFIG --exists glu], [ 
+             AC_DEFINE([HAVE_GL_GLU_H]) 
+             GLLIBS="$($PKGCONFIG --libs glu) $GLLIBS"
+          ])
+           GLWLDEMO="egl"
       ], [
           LINKFLTKGL=""
           GLLIBNAME=""
diff --git libdecor/build/Makefile libdecor/build/Makefile
index 99f825d..498f01f 100644
--- libdecor/build/Makefile
+++ libdecor/build/Makefile
@@ -16,22 +16,47 @@
 
 include ../../makeinclude
 
-CFLAGS_DECOR =  -I. -I../.. -I../../src -I../src -fPIC -D_GNU_SOURCE \
-  -DUSE_SYSTEM_LIBDECOR=0 -DHAVE_MEMFD_CREATE -DHAVE_MKOSTEMP -DHAVE_POSIX_FALLOCATE
 OBJECTS =  fl_libdecor.o libdecor-cairo-blur.o fl_libdecor-plugins.o \
   ../../src/xdg-decoration-protocol.o ../../src/xdg-shell-protocol.o \
   ../../src/text-input-protocol.o cursor-settings.o os-compatibility.o
-PROTOCOLS = /usr/share/wayland-protocols
+
+
+#$(UNAME) is set to the product of `uname -s` in makeinclude
+
+Linux_PROTO  = /usr/share/wayland-protocols
+FreeBSD_PROTO =  /usr/local/share/wayland-protocols
+PROTOCOLS = ${${UNAME}_PROTO}
+
+Linux_INPUT =
+FreeBSD_INPUT = linux/input.h
+EXTRA_INPUT= ${${UNAME}_INPUT}
+
+Linux_CFLAGS =
+FreeBSD_CFLAGS = -I/usr/local/include
+EXTRA_DECOR =  ${${UNAME}_CFLAGS}
+
+CFLAGS_DECOR =  -I. -I../.. -I../../src -I../src $(EXTRA_DECOR) -fPIC -D_GNU_SOURCE \
+  -DUSE_SYSTEM_LIBDECOR=0 -DHAVE_MEMFD_CREATE -DHAVE_MKOSTEMP -DHAVE_POSIX_FALLOCATE
+
+Linux_NOPIE = -no-pie
+FreeBSD_NOPIE =
+NOPIE = ${${UNAME}_NOPIE}
 
 all : demo $(GLWLDEMO)
 
 depend:
 	: echo "libdecor/build: make depend..."
+	
+linux/input.h :
+	mkdir -p linux
+	echo "#define BTN_LEFT 0x110" > linux/input.h
+	echo "#define BTN_RIGHT 0x111" >> linux/input.h
+	echo "#define BTN_MIDDLE 0x112" >> linux/input.h
 
 fl_libdecor.o : fl_libdecor.c ../src/libdecor.c ../../src/xdg-shell-protocol.c ../../src/xdg-decoration-protocol.c ../../src/text-input-protocol.c
 	$(CC) $(CFLAGS) $(CFLAGS_DECOR) -c  fl_libdecor.c -DLIBDECOR_PLUGIN_API_VERSION=1 -DLIBDECOR_PLUGIN_DIR=\"/usr/local/lib\"
 
-fl_libdecor-plugins.o : fl_libdecor-plugins.c ../src/plugins/cairo/libdecor-cairo.c
+fl_libdecor-plugins.o : $(EXTRA_INPUT) fl_libdecor-plugins.c ../src/plugins/cairo/libdecor-cairo.c
 	$(CC) $(CFLAGS) $(CFLAGS_DECOR) -c  fl_libdecor-plugins.c  -DLIBDECOR_PLUGIN_API_VERSION=1 -DLIBDECOR_PLUGIN_DIR=\"/usr/local/lib\"
 
 libdecor-cairo-blur.o : ../src/plugins/cairo/libdecor-cairo-blur.c
@@ -65,11 +90,11 @@ cursor-settings.o : ../src/cursor-settings.c
 	    $(PROTOCOLS)/unstable/text-input/text-input-unstable-v3.xml \
 	    ../../src/text-input-client-protocol.h
 	
-demo : ../demo/demo.c $(OBJECTS)
-	$(CC)  -o demo ../demo/demo.c -D_GNU_SOURCE -I../.. -I../src -I. -I../../src $(OBJECTS) $(LDLIBS) -lm -rdynamic -no-pie -Wl,--defsym=fl_libdecor_using_weston=0
+demo : ../demo/demo.c $(OBJECTS) $(EXTRA_INPUT)
+	$(CC)  -o demo ../demo/demo.c -D_GNU_SOURCE -I../.. -I../src -I. -I../../src $(EXTRA_DECOR) $(OBJECTS) $(LDLIBS) -lm -rdynamic $(NOPIE) -Wl,--defsym=fl_libdecor_using_weston=0
 
 egl : ../demo/egl.c $(OBJECTS)
-	$(CC)  -o egl ../demo/egl.c -D_GNU_SOURCE -I../.. -I../src -I. -I../../src $(OBJECTS) $(GLDLIBS) -lm -rdynamic -no-pie -Wl,--defsym=fl_libdecor_using_weston=0
+	$(CC)  -o egl ../demo/egl.c -D_GNU_SOURCE -I../.. -I../src -I. -I../../src $(EXTRA_DECOR) $(OBJECTS) $(GLDLIBS) -lm -rdynamic $(NOPIE) -Wl,--defsym=fl_libdecor_using_weston=0 
 
 
 install:
@@ -79,3 +104,4 @@ uninstall:
 
 clean:
 	$(RM) *.o ../../src/xdg-*.c ../../src/xdg-*.h ../../src/xdg-*.o ../../src/text-input-* demo egl
+	rm -r -f linux
diff --git makeinclude.in makeinclude.in
index 49db6e7..8df8eb2 100644
--- makeinclude.in
+++ makeinclude.in
@@ -27,6 +27,7 @@ FLTK_VERSION		= @FLTK_VERSION@
 # FLTK configuration options: BUILD = { WIN | OSX | X11 | XFT | WAYLAND }
 
 BUILD		= @BUILD@
+UNAME            = @UNAME@
 
 # Standard configure variables
 
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.