[vlc-commits] [Git][videolan/vlc][master] 8 commits: configure: check typeof on C++ compilers
Hugo Beauzée-Luyssen (@chouquette)
gitlab at videolan.org
Sat May 21 16:08:35 UTC 2022
Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC
Commits:
784c3245 by Alexandre Janniaux at 2022-05-21T15:17:00+00:00
configure: check typeof on C++ compilers
C compilers can have GNU extensions to support typeof in C code, but
some C++ compilers like clang are removing the builtin since decltype
can be used in C++ without the constraints from typeof. Decltype is not
100% equivalent for this reason: references will be kept in the returned
type.
The check in m4/typeof.m4 comes from graydon/monotone and dovecot/core
and was slightly modified to namespace the define for C++ code.
- - - - -
bd8f233b by Alexandre Janniaux at 2022-05-21T15:17:00+00:00
vlc_fixup: fix usage of typeof from C++
Replace typeof by a decltype()-based equivalent on compilers not
supporting typeof.
Decltype is not equivalent to typeof, but we are mostly concerned about
removing references from the type, since it has no use in C code like
VLC list.
Note that this fixup is there to fix the usage of headers using typeof
in C++ code, not to provide "typeof" directly C++ to replace decltype.
- - - - -
63ec4f10 by Alexandre Janniaux at 2022-05-21T15:17:00+00:00
qt: add cocoa platform plugin
- - - - -
5401eadd by Alexandre Janniaux at 2022-05-21T15:17:00+00:00
contrib: qt: fix sed usage on macosx
sed -i doesn't work correctly with non-GNU sed.
- - - - -
3f4721da by Alexandre Janniaux at 2022-05-21T15:17:00+00:00
contrib: qt: backport patch for macosx
A header previously transitively included has gone missing in the
latest 5 releases and was only fixed from 6.x.
- - - - -
24f8f0dd by Alexandre Janniaux at 2022-05-21T15:17:00+00:00
contrib: qt: ship cocoa plugin
- - - - -
10abb2ff by Alexandre Janniaux at 2022-05-21T15:17:00+00:00
contrib: qt: namespace ENV_VARS variable
- - - - -
fb6704f3 by Alexandre Janniaux at 2022-05-21T15:17:00+00:00
macosx: disable --with-x on default configuration
When building Qt, we only add and link the X11 library and flags when
QT5_HAS_X11 is defined (in automake), which happens when we build
Qt5X11Extras.
Without this check, if autotools find the X11 library, then it might
fail to find the headers (because X_CFLAGS won't be used) or will at
least fail to link correct (because -lX11 will be missing from the
link command).
Since we don't use X11 on MacOSX, disable it by default in the configure
script like Qt, so that enabling Qt module locally works correctly.
- - - - -
7 changed files:
- configure.ac
- + contrib/src/qt/qt-add-missing-header-darwin.patch
- contrib/src/qt/rules.mak
- extras/package/macosx/configure.sh
- include/vlc_fixups.h
- + m4/typeof.m4
- modules/gui/qt/qt.cpp
Changes:
=====================================
configure.ac
=====================================
@@ -68,7 +68,10 @@ dnl Check for compiler properties
AC_C_CONST
AC_C_INLINE
AC_C_RESTRICT
+AC_LANG_PUSH([C++])
AX_CXX_COMPILE_STDCXX_14([noext], [mandatory])
+AX_CXX_TYPEOF
+AC_LANG_POP([C++])
dnl Extend the --help string at the current spot.
AC_DEFUN([EXTEND_HELP_STRING], [m4_divert_once([HELP_ENABLE], [$1])])
=====================================
contrib/src/qt/qt-add-missing-header-darwin.patch
=====================================
@@ -0,0 +1,28 @@
+From 2fe5acf1d581236641037df268e1d968f6b54121 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=3D=3FUTF-8=3Fq=3F=3DC3=3D98ystein=3D20Heskestad=3F=3D?=
+ <oystein.heskestad at qt.io>
+Date: Mon, 16 May 2022 10:57:39 +0200
+Subject: [PATCH] Add missing macOS header file that was indirectly included
+
+Change-Id: I4d4c7d4f957fc36dea5e06eb6d661aeecf6385f1
+Reviewed-by: Timur Pocheptsov <timur.pocheptsov at qt.io>
+---
+ src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h
+index e070ba977d..0896917334 100644
+--- a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h
++++ b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h
+@@ -43,6 +43,8 @@
+ #include <qpa/qplatformgraphicsbuffer.h>
+ #include <private/qcore_mac_p.h>
+
++#include <CoreGraphics/CGColorSpace.h>
++
+ QT_BEGIN_NAMESPACE
+
+ class QIOSurfaceGraphicsBuffer : public QPlatformGraphicsBuffer
+--
+2.35.1
+
=====================================
contrib/src/qt/rules.mak
=====================================
@@ -51,11 +51,12 @@ else
$(APPLY) $(SRC)/qt/qt-fix-msys-long-pathes.patch
$(APPLY) $(SRC)/qt/0003-fix-angle-compilation.patch
cd $(UNPACK_DIR); for i in QtFontDatabaseSupport QtWindowsUIAutomationSupport QtEventDispatcherSupport QtCore; do \
- sed -i -e 's,"../../../../../src,"../src,g' include/$$i/$(QT_VERSION)/$$i/private/*.h; done
+ sed -i.orig -e 's,"../../../../../src,"../src,g' include/$$i/$(QT_VERSION)/$$i/private/*.h; done
endif
$(APPLY) $(SRC)/qt/qt-fix-gcc11-build.patch
endif
+ $(APPLY) $(SRC)/qt/qt-add-missing-header-darwin.patch
$(MOVE)
@@ -106,14 +107,14 @@ ifdef HAVE_MINGW_W64
QT_CONFIG += -no-direct2d
endif
-ENV_VARS := $(HOSTVARS) DXSDK_DIR=$(PREFIX)/bin
+QT_ENV_VARS := $(HOSTVARS) DXSDK_DIR=$(PREFIX)/bin
.qt: qt
# Prevent all Qt contribs from generating and installing libtool .la files
- cd $< && sed -i "/CONFIG/ s/ create_libtool/ -create_libtool/g" mkspecs/features/qt_module.prf
- +cd $< && $(ENV_VARS) ./configure $(QT_PLATFORM) $(QT_CONFIG) -prefix $(PREFIX) -hostprefix $(PREFIX)/lib/qt5
+ cd $< && sed -i.orig "/CONFIG/ s/ create_libtool/ -create_libtool/g" mkspecs/features/qt_module.prf
+ +cd $< && $(QT_ENV_VARS) ./configure $(QT_PLATFORM) $(QT_CONFIG) -prefix $(PREFIX) -hostprefix $(PREFIX)/lib/qt5
# Make && Install libraries
- cd $< && $(ENV_VARS) $(MAKE)
+ cd $< && $(QT_ENV_VARS) $(MAKE)
cd $< && $(MAKE) -C src sub-corelib-install_subtargets sub-gui-install_subtargets sub-widgets-install_subtargets sub-platformsupport-install_subtargets sub-zlib-install_subtargets sub-bootstrap-install_subtargets sub-network-install_subtargets
# Install tools
cd $< && $(MAKE) -C src sub-moc-install_subtargets sub-rcc-install_subtargets sub-uic-install_subtargets sub-qlalr-install_subtargets
@@ -127,10 +128,17 @@ ifdef HAVE_WIN32
# Vista styling
$(SRC)/qt/AddStaticLink.sh "$(PREFIX)" Qt5Widgets plugins/styles qwindowsvistastyle
endif
+
+ifdef HAVE_MACOSX
+ $(SRC)/qt/AddStaticLink.sh "$(PREFIX)" Qt5Gui plugins/platforms qcocoa
+ # Qt Cocoa plugins depend on printer support...
+ cd $< && cp ./lib/libQt5PrintSupport.a "$(PREFIX)/lib/"
+endif
+
#fix host tools headers to avoid collusion with target headers
mkdir -p $(PREFIX)/lib/qt5/include
cp -R $(PREFIX)/include/QtCore $(PREFIX)/lib/qt5/include
- sed -i -e "s#\$\$QT_MODULE_INCLUDE_BASE#$(PREFIX)/lib/qt5/include#g" $(PREFIX)/lib/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri
+ sed -i.orig -e "s#\$\$QT_MODULE_INCLUDE_BASE#$(PREFIX)/lib/qt5/include#g" $(PREFIX)/lib/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri
# Install a qmake with correct paths set
cd $< && $(MAKE) sub-qmake-qmake-aux-pro-install_subtargets install_mkspecs
ifdef HAVE_WIN32
=====================================
extras/package/macosx/configure.sh
=====================================
@@ -25,6 +25,7 @@ OPTIONS="
--disable-pulse
--disable-vnc
--with-macosx-version-min=10.11
+ --without-x
"
export CFLAGS
=====================================
include/vlc_fixups.h
=====================================
@@ -684,4 +684,11 @@ int clock_nanosleep(clockid_t clock_id, int flags,
} /* extern "C" */
#endif
+#if defined(__cplusplus)
+#ifndef HAVE_CXX_TYPEOF
+# include <type_traits>
+# define typeof(t) std::remove_reference<decltype(t)>::type
+#endif
+#endif
+
#endif /* !LIBVLC_FIXUPS_H */
=====================================
m4/typeof.m4
=====================================
@@ -0,0 +1,20 @@
+dnl @synopsis AX_CXX_TYPEOF
+dnl
+dnl tests for the presence of the gcc hashmap stl extension
+dnl
+dnl @author Patrick Mauritz <oxygene at studentenbude.ath.cx>
+dnl @version 2005-08-15
+dnl @license AllPermissive
+
+AC_DEFUN([AX_CXX_TYPEOF],[
+AC_LANG_ASSERT([C++])
+AC_CACHE_CHECK(whether the C++ compiler supports typeof,
+ac_cv_cxx_typeof,
+[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ int x; typeof (x) y[6]; ]])],
+ [ac_cv_cxx_typeof=yes],
+ [ac_cv_cxx_typeof=no])
+])
+if test "$ac_cv_cxx_typeof" = yes; then
+ AC_DEFINE(HAVE_CXX_TYPEOF, 1, [Define if the compiler supports typeof.])
+fi
+])
=====================================
modules/gui/qt/qt.cpp
=====================================
@@ -93,6 +93,8 @@ extern "C" char **environ;
#ifdef _WIN32
Q_IMPORT_PLUGIN(QWindowsVistaStylePlugin)
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
+ #elif defined(Q_OS_MACOS)
+ Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)
#endif
#endif
#endif
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0caa9ea0e6abd897a059a60ba43f66d2bd1deba1...fb6704f3d60725babb22cdb0caf8530cd36044b2
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0caa9ea0e6abd897a059a60ba43f66d2bd1deba1...fb6704f3d60725babb22cdb0caf8530cd36044b2
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list