merge mkspecs into single qplatformdefs header

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2019-07-16 20:02:32 +00:00
parent 849ba7a632
commit a0841ca7b0
7 changed files with 54 additions and 204 deletions

View file

@ -1 +0,0 @@
add_definitions(-D_THREAD_SAFE)

View file

@ -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

View file

@ -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

View 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}'")

View file

@ -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

View 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

View file

@ -31,9 +31,45 @@
**
****************************************************************************/
#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>
@ -122,7 +158,11 @@
#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
@ -151,7 +191,11 @@
#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
@ -160,4 +204,9 @@
#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