mirror of
https://github.com/hexchat/hexchat.git
synced 2024-11-05 02:32:31 +01:00
Various fixes for mingw
This commit is contained in:
parent
9b8a7eaa01
commit
e9b9ff9f38
@ -7,9 +7,6 @@ ar = '/usr/bin/x86_64-w64-mingw32-gcc-ar'
|
||||
strip = '/usr/bin/x86_64-w64-mingw32-strip'
|
||||
pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config'
|
||||
|
||||
[properties]
|
||||
c_args = ['-DNTDDI_VERSION=NTDDI_WIN7', '-D_WIN32_WINNT=_WIN32_WINNT_WIN7']
|
||||
|
||||
[host_machine]
|
||||
system = 'windows'
|
||||
cpu_family = 'x86_64'
|
||||
|
16
meson.build
16
meson.build
@ -15,6 +15,7 @@ cc = meson.get_compiler('c')
|
||||
|
||||
libgio_dep = dependency('gio-2.0', version: '>= 2.34.0')
|
||||
libgmodule_dep = dependency('gmodule-2.0')
|
||||
global_deps = []
|
||||
if cc.get_id() == 'msvc'
|
||||
libssl_dep = cc.find_library('libeay32')
|
||||
else
|
||||
@ -76,13 +77,18 @@ configure_file(output: 'config.h', configuration: config_h)
|
||||
config_h_include = include_directories('.')
|
||||
|
||||
if host_machine.system() == 'windows'
|
||||
add_project_arguments('-DWIN32', language: 'c')
|
||||
add_project_arguments(
|
||||
'-DWIN32',
|
||||
'-DNTDDI_VERSION=NTDDI_WIN7',
|
||||
'-D_WIN32_WINNT=_WIN32_WINNT_WIN7',
|
||||
language: 'c')
|
||||
endif
|
||||
|
||||
|
||||
global_cflags = []
|
||||
test_cflags = [
|
||||
'-pipe',
|
||||
'-fPIE',
|
||||
'-funsigned-char',
|
||||
'-Wno-conversion',
|
||||
'-Wno-pointer-sign',
|
||||
@ -112,6 +118,10 @@ if get_option('buildtype') != 'plain'
|
||||
}
|
||||
''', args: '-fstack-protector-all')
|
||||
global_cflags += '-fstack-protector-strong'
|
||||
|
||||
if host_machine.system() == 'windows'
|
||||
global_deps += cc.find_library('ssp')
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
add_project_arguments(global_cflags, language: 'c')
|
||||
@ -121,6 +131,10 @@ global_ldflags = []
|
||||
test_ldflags = [
|
||||
'-Wl,-z,relro',
|
||||
'-Wl,-z,now',
|
||||
'-Wl,-pie',
|
||||
# mingw
|
||||
'-Wl,--dynamicbase',
|
||||
'-Wl,--nxcompat',
|
||||
]
|
||||
foreach ldflag : test_ldflags
|
||||
if cc.has_argument(ldflag) and cc.links('int main (void) { return 0; }', args: ldflag)
|
||||
|
@ -5,7 +5,8 @@ sysinfo_sources = [
|
||||
|
||||
sysinfo_deps = [
|
||||
libgio_dep,
|
||||
hexchat_plugin_dep
|
||||
hexchat_plugin_dep,
|
||||
common_sysinfo_deps,
|
||||
]
|
||||
|
||||
sysinfo_includes = []
|
||||
@ -41,7 +42,10 @@ if system == 'linux' or system == 'darwin'
|
||||
endif
|
||||
|
||||
elif system == 'windows'
|
||||
sysinfo_sources += 'win32/backend.c'
|
||||
sysinfo_sources += [
|
||||
'win32/backend.c',
|
||||
'../../src/common/sysinfo/win32/backend.c'
|
||||
]
|
||||
else
|
||||
error('sysinfo: Unknown system?')
|
||||
endif
|
||||
|
@ -30,14 +30,7 @@
|
||||
|
||||
#include "../format.h"
|
||||
|
||||
static int command_callback (char *word[], char *word_eol[], void *user_data);
|
||||
|
||||
void print_info (void);
|
||||
|
||||
guint64 hdd_capacity;
|
||||
guint64 hdd_free_space;
|
||||
char *read_hdd_info (IWbemClassObject *object);
|
||||
char *get_memory_info (void);
|
||||
static char *get_memory_info (void);
|
||||
|
||||
char *
|
||||
sysinfo_backend_get_sound (void)
|
||||
@ -98,11 +91,6 @@ sysinfo_backend_get_os (void)
|
||||
return sysinfo_get_os ();
|
||||
}
|
||||
|
||||
static int get_cpu_arch (void)
|
||||
{
|
||||
return sysinfo_get_cpu_arch ();
|
||||
}
|
||||
|
||||
static char *get_memory_info (void)
|
||||
{
|
||||
MEMORYSTATUSEX meminfo = { 0 };
|
||||
|
@ -59,8 +59,8 @@
|
||||
#include "hexchatc.h"
|
||||
|
||||
/* Setting _FILE_OFFSET_BITS to 64 doesn't change lseek to use off64_t on Windows, so override lseek to the version that does */
|
||||
#ifdef WIN32
|
||||
#define lseek _lseeki64
|
||||
#if defined(WIN32) && (!defined(__MINGW32__) && !defined(__MINGW64__))
|
||||
#define lseek _lseeki64
|
||||
#endif
|
||||
|
||||
/* interval timer to detect timeouts */
|
||||
|
@ -24,9 +24,11 @@ common_sources = [
|
||||
'util.c'
|
||||
]
|
||||
|
||||
common_sysinfo_deps = []
|
||||
|
||||
common_deps = [
|
||||
libgio_dep,
|
||||
]
|
||||
] + global_deps
|
||||
|
||||
common_includes = [
|
||||
config_h_include,
|
||||
@ -41,7 +43,10 @@ if host_machine.system() == 'windows'
|
||||
common_deps += [
|
||||
cc.find_library('ws2_32'), # winsock
|
||||
cc.find_library('winmm'), # playsound
|
||||
]
|
||||
common_sysinfo_deps += [
|
||||
cc.find_library('wbemuuid'), # sysinfo
|
||||
cc.find_library('wbemcore'),
|
||||
]
|
||||
|
||||
common_sources += 'sysinfo/win32/backend.c'
|
||||
@ -98,7 +103,7 @@ endif
|
||||
hexchat_common = static_library('hexchatcommon',
|
||||
sources: [textevents] + marshal + common_sources,
|
||||
include_directories: config_h_include,
|
||||
dependencies: common_deps,
|
||||
dependencies: common_deps + common_sysinfo_deps,
|
||||
c_args: common_cflags,
|
||||
pic: true
|
||||
)
|
||||
@ -113,4 +118,5 @@ hexchat_common_dep = declare_dependency(
|
||||
hexchat_plugin_dep = declare_dependency(
|
||||
include_directories: common_includes,
|
||||
compile_args: common_cflags,
|
||||
dependencies: global_deps,
|
||||
)
|
||||
|
@ -200,13 +200,15 @@ plugin_list_add (hexchat_context *ctx, char *filename, const char *name,
|
||||
return pl;
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
static void *
|
||||
hexchat_dummy (hexchat_plugin *ph)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
#else
|
||||
|
||||
static int
|
||||
hexchat_read_fd (hexchat_plugin *ph, GIOChannel *source, char *buf, int *len)
|
||||
{
|
||||
|
@ -1471,7 +1471,13 @@ handle_message_tag_time (const char *time, message_tags_data *tags_data)
|
||||
long long int t;
|
||||
|
||||
/* we ignore the milisecond part */
|
||||
if (sscanf (time, "%lld", &t) != 1)
|
||||
if (
|
||||
#if defined(__MINGW64__) || defined(__MINGW32__)
|
||||
__mingw_sscanf
|
||||
#else
|
||||
sscanf
|
||||
#endif
|
||||
(time, "%lld", &t) != 1)
|
||||
return;
|
||||
|
||||
tags_data->timestamp = (time_t) t;
|
||||
|
@ -174,7 +174,7 @@ static char *query_wmi (QueryWmiType type)
|
||||
goto release_locator;
|
||||
}
|
||||
|
||||
hr = namespace->lpVtbl->QueryInterface (namespace, &IID_IUnknown, &namespaceUnknown);
|
||||
hr = namespace->lpVtbl->QueryInterface (namespace, &IID_IUnknown, (void**)&namespaceUnknown);
|
||||
if (FAILED (hr))
|
||||
{
|
||||
goto release_namespace;
|
||||
|
@ -142,7 +142,7 @@ fe_args (int argc, char *argv[])
|
||||
{
|
||||
if (strstr (error->message, "--help-all") != NULL)
|
||||
{
|
||||
buffer = g_strdup_printf (g_option_context_get_help (context, FALSE, NULL));
|
||||
buffer = g_option_context_get_help (context, FALSE, NULL);
|
||||
gtk_init (&argc, &argv);
|
||||
create_msg_dialog ("Long Help", buffer);
|
||||
g_free (buffer);
|
||||
@ -150,7 +150,7 @@ fe_args (int argc, char *argv[])
|
||||
}
|
||||
else if (strstr (error->message, "--help") != NULL || strstr (error->message, "-?") != NULL)
|
||||
{
|
||||
buffer = g_strdup_printf (g_option_context_get_help (context, TRUE, NULL));
|
||||
buffer = g_option_context_get_help (context, TRUE, NULL);
|
||||
gtk_init (&argc, &argv);
|
||||
create_msg_dialog ("Help", buffer);
|
||||
g_free (buffer);
|
||||
|
@ -51,6 +51,15 @@ if get_option('with-libnotify')
|
||||
hexchat_gtk_sources += 'notifications/notification-libnotify.c'
|
||||
hexchat_gtk_deps += dependency('libnotify')
|
||||
elif false # TODO HAVE_GTK_MAC
|
||||
elif host_machine.system() == 'windows'
|
||||
hexchat_gtk_sources += 'notifications/notification-windows.c'
|
||||
|
||||
# TODO: mingw doesn't have these headers or libs
|
||||
# add_languages('cpp')
|
||||
# shared_module('hcnotifications-winrt',
|
||||
# sources: 'notifications/notification-winrt.cpp'
|
||||
#)
|
||||
|
||||
else
|
||||
hexchat_gtk_sources += 'notifications/notification-dummy.c'
|
||||
endif
|
||||
@ -80,5 +89,6 @@ executable('hexchat',
|
||||
dependencies: hexchat_gtk_deps,
|
||||
c_args: hexchat_gtk_cflags,
|
||||
link_args: hexchat_gtk_ldflags,
|
||||
install: true
|
||||
install: true,
|
||||
gui_app: true,
|
||||
)
|
||||
|
@ -16,12 +16,11 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <gmodule.h>
|
||||
|
||||
#include "hexchat.h"
|
||||
#include "plugin.h"
|
||||
|
||||
#include <Windows.h>
|
||||
#include <gmodule.h>
|
||||
#include <windows.h>
|
||||
|
||||
void (*winrt_notification_backend_show) (const char *title, const char *text) = NULL;
|
||||
int (*winrt_notification_backend_init) (const char **error) = NULL;
|
||||
|
@ -465,6 +465,7 @@ tray_make_item (GtkWidget *menu, char *label, void *callback, void *userdata)
|
||||
return item;
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
static void
|
||||
tray_toggle_cb (GtkCheckMenuItem *item, unsigned int *setting)
|
||||
{
|
||||
@ -476,6 +477,7 @@ blink_item (unsigned int *setting, GtkWidget *menu, char *label)
|
||||
{
|
||||
menu_toggle_item (label, menu, tray_toggle_cb, setting, *setting);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
tray_menu_destroy (GtkWidget *menu, gpointer userdata)
|
||||
@ -586,7 +588,7 @@ tray_menu_cb (GtkWidget *widget, guint button, guint time, gpointer userdata)
|
||||
g_signal_connect (G_OBJECT (menu), "enter-notify-event",
|
||||
G_CALLBACK (tray_menu_enter_cb), NULL);
|
||||
|
||||
tray_menu_timer = g_timeout_add (500, tray_check_hide, menu);
|
||||
tray_menu_timer = g_timeout_add (500, (GSourceFunc)tray_check_hide, menu);
|
||||
#endif
|
||||
|
||||
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL,
|
||||
|
Loading…
Reference in New Issue
Block a user