OSDN Git Service

merge mkspecs into single qplatformdefs header
authorIvailo Monev <xakepa10@laimg.moc>
Tue, 16 Jul 2019 20:02:32 +0000 (20:02 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Tue, 16 Jul 2019 20:02:32 +0000 (20:02 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
mkspecs/freebsd/freebsd.cmake [deleted file]
mkspecs/freebsd/qplatformdefs.h [deleted file]
mkspecs/linux/qplatformdefs.h [deleted file]
mkspecs/mkspecs.cmake
mkspecs/openbsd/qplatformdefs.h [deleted file]
src/core/global/global.cmake
src/core/global/qplatformdefs.h [moved from mkspecs/common/mkspecs_posix.h with 75% similarity]

diff --git a/mkspecs/freebsd/freebsd.cmake b/mkspecs/freebsd/freebsd.cmake
deleted file mode 100644 (file)
index c629c4f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-add_definitions(-D_THREAD_SAFE)
diff --git a/mkspecs/freebsd/qplatformdefs.h b/mkspecs/freebsd/qplatformdefs.h
deleted file mode 100644 (file)
index da3c277..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2016-2019 Ivailo Monev
-**
-** This file is part of the qmake spec of the Katie Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPLATFORMDEFS_H
-#define QPLATFORMDEFS_H
-
-// Get Qt defines/settings
-#include "qconfig.h"
-
-// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs
-#include <unistd.h>
-
-// We are hot - unistd.h should have turned on the specific APIs we requested
-#include "common/mkspecs_posix.h"
-
-#undef QT_OPEN_LARGEFILE
-
-#define QT_OPEN_LARGEFILE       0
-
-#define QT_SNPRINTF             ::snprintf
-#define QT_VSNPRINTF            ::vsnprintf
-
-#endif // QPLATFORMDEFS_H
diff --git a/mkspecs/linux/qplatformdefs.h b/mkspecs/linux/qplatformdefs.h
deleted file mode 100644 (file)
index b484d9a..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2016-2019 Ivailo Monev
-**
-** This file is part of the qmake spec of the Katie Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPLATFORMDEFS_H
-#define QPLATFORMDEFS_H
-
-// Get Qt defines/settings
-#include "qconfig.h"
-
-// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs
-
-// 1) need to reset default environment if _BSD_SOURCE is defined
-// 2) need to specify POSIX thread interfaces explicitly in glibc 2.0
-// 3) it seems older glibc need this to include the X/Open stuff
-#ifndef _GNU_SOURCE
-#  define _GNU_SOURCE
-#endif
-
-#include <unistd.h>
-
-// We are hot - unistd.h should have turned on the specific APIs we requested
-#define QT_USE_XOPEN_LFS_EXTENSIONS
-#include "common/mkspecs_posix.h"
-
-#if defined(__GLIBC__) && (__GLIBC__ < 2)
-#undef QT_SOCKLEN_T
-#define QT_SOCKLEN_T            int
-#endif
-
-#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
-#define QT_SNPRINTF             ::snprintf
-#define QT_VSNPRINTF            ::vsnprintf
-#endif
-
-#endif // QPLATFORMDEFS_H
index 997c6cc..5c4e9a9 100644 (file)
@@ -8,16 +8,13 @@ if(NOT KATIE_TYPE)
     katie_definition(-DQT_SHARED)
 endif()
 
-include_directories(${KATIE_MKSPECS_DIR})
 if(NOT KATIE_PLATFORM)
     if(CMAKE_SYSTEM_NAME MATCHES "Linux")
-        include_directories(${KATIE_MKSPECS_DIR}/linux)
         set(KATIE_PLATFORM "linux")
     elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
-        include_directories(${KATIE_MKSPECS_DIR}/freebsd)
         set(KATIE_PLATFORM "freebsd")
+        katie_definition(-D_THREAD_SAFE)
     elseif(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
-        include_directories(${KATIE_MKSPECS_DIR}/openbsd)
         set(KATIE_PLATFORM "openbsd")
     else()
         message(FATAL_ERROR "Unknown platform '${CMAKE_SYSTEM_NAME}'")
diff --git a/mkspecs/openbsd/qplatformdefs.h b/mkspecs/openbsd/qplatformdefs.h
deleted file mode 100644 (file)
index a54f5c9..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2016-2019 Ivailo Monev
-**
-** This file is part of the qmake spec of the Katie Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPLATFORMDEFS_H
-#define QPLATFORMDEFS_H
-
-// Get Qt defines/settings
-
-#include "qconfig.h"
-
-// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs
-#include <unistd.h>
-
-// We are hot - unistd.h should have turned on the specific APIs we requested
-#include "common/mkspecs_posix.h"
-
-#undef QT_OPEN_LARGEFILE
-#define QT_OPEN_LARGEFILE       0
-
-// QT_SOCKLEN_T
-// OpenBSD 2.2 - 2.4            int
-// OpenBSD 2.5 - 2.8            socklen_t
-
-#define QT_SNPRINTF             ::snprintf
-#define QT_VSNPRINTF            ::vsnprintf
-
-// 1003.1c-1995 says on page 38 (2.9.3, paragraph 3) that if _POSIX_THREADS
-// is defined, then _POSIX_THREAD_SAFE_FUNCTIONS must also be defined.
-// However this looks like a well-known typo (reversed dependency).
-//
-// On the other hand _POSIX_THREAD_SAFE_FUNCTIONS should be defined only
-// if the Thread-Safe Functions option is implemented. OpenBSD does not
-// support all of the required _r() interfaces, especially getpwuid_r(),
-// which means it should not define _POSIX_THREAD_SAFE_FUNCTIONS.
-//
-// Since OpenBSD does define _POSIX_THREAD_SAFE_FUNCTIONS, we have to
-// undefine it behind its back.
-#ifdef _POSIX_THREAD_SAFE_FUNCTIONS
-#undef _POSIX_THREAD_SAFE_FUNCTIONS
-#endif
-
-// Older OpenBSD versions may still use the a.out format instead of ELF.
-#ifndef __ELF__
-#define QT_AOUT_UNDERSCORE
-#endif
-
-#endif // QPLATFORMDEFS_H
index f1f3eea..0e07fe8 100644 (file)
@@ -4,6 +4,7 @@ set(CORE_HEADERS
     ${CMAKE_CURRENT_SOURCE_DIR}/global/qendian.h
     ${CMAKE_CURRENT_SOURCE_DIR}/global/qnumeric.h
     ${CMAKE_CURRENT_SOURCE_DIR}/global/qlibraryinfo.h
+    ${CMAKE_CURRENT_SOURCE_DIR}/global/qplatformdefs.h
 )
 
 set(CORE_SOURCES
similarity index 75%
rename from mkspecs/common/mkspecs_posix.h
rename to src/core/global/qplatformdefs.h
index 1322fe1..61838c0 100644 (file)
 **
 ****************************************************************************/
 
-#ifndef Q_POSIX_QPLATFORMDEFS_H
-#define Q_POSIX_QPLATFORMDEFS_H
+#ifndef QPLATFORMDEFS_H
+#define QPLATFORMDEFS_H
+
+// Get Qt defines/settings
+#include "qconfig.h"
+
+#if defined(__linux__)
+#  define QT_USE_XOPEN_LFS_EXTENSIONS
+// 1) need to reset default environment if _BSD_SOURCE is defined
+// 2) need to specify POSIX thread interfaces explicitly in glibc 2.0
+// 3) it seems older glibc need this to include the X/Open stuff
+#  ifndef _GNU_SOURCE
+#    define _GNU_SOURCE
+#  endif
+
+#elif defined(__OpenBSD__)
+// 1003.1c-1995 says on page 38 (2.9.3, paragraph 3) that if _POSIX_THREADS
+// is defined, then _POSIX_THREAD_SAFE_FUNCTIONS must also be defined.
+// However this looks like a well-known typo (reversed dependency).
+//
+// On the other hand _POSIX_THREAD_SAFE_FUNCTIONS should be defined only
+// if the Thread-Safe Functions option is implemented. OpenBSD does not
+// support all of the required _r() interfaces, especially getpwuid_r(),
+// which means it should not define _POSIX_THREAD_SAFE_FUNCTIONS.
+//
+// Since OpenBSD does define _POSIX_THREAD_SAFE_FUNCTIONS, we have to
+// undefine it behind its back.
+#  ifdef _POSIX_THREAD_SAFE_FUNCTIONS
+#  undef _POSIX_THREAD_SAFE_FUNCTIONS
+#  endif
+
+// Older OpenBSD versions may still use the a.out format instead of ELF.
+#  ifndef __ELF__
+#  define QT_AOUT_UNDERSCORE
+#  endif
 
+#endif
+
+#include <unistd.h>
 #include <stdio.h>
 #include <dirent.h>
 #include <signal.h>
 #define QT_READ                 ::read
 #define QT_WRITE                ::write
 
-#define QT_OPEN_LARGEFILE       O_LARGEFILE
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
+#  define QT_OPEN_LARGEFILE     0
+#else
+#  define QT_OPEN_LARGEFILE     O_LARGEFILE
+#endif
 #define QT_OPEN_RDONLY          O_RDONLY
 #define QT_OPEN_WRONLY          O_WRONLY
 #define QT_OPEN_RDWR            O_RDWR
 #define QT_READDIR_R            ::readdir_r
 #endif
 
+#if defined(__GLIBC__) && (__GLIBC__ < 2)
+#define QT_SOCKLEN_T            int
+#else
 #define QT_SOCKLEN_T            socklen_t
+#endif
 
 #define QT_SOCKET_CONNECT       ::connect
 #define QT_SOCKET_BIND          ::bind
 #define QT_SIGNAL_ARGS          int
 #define QT_SIGNAL_IGNORE        SIG_IGN
 
+#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)
+#define QT_SNPRINTF             ::snprintf
+#define QT_VSNPRINTF            ::vsnprintf
+#endif
+
 #endif // include guard