mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-08 21:25:32 +02:00
Fix build breakage caused by FreeBSD support
Also move the changes to the glfw files to glfw.py
This commit is contained in:
15
glfw/glfw.py
15
glfw/glfw.py
@@ -43,7 +43,12 @@ def init_env(env, pkg_config, at_least_version, module='x11'):
|
||||
else:
|
||||
ans.ldpaths.extend('-lrt -lm -ldl'.split())
|
||||
sinfo = json.load(open(os.path.join(base, 'source-info.json')))
|
||||
ans.sources = sinfo['common']['sources'] + sinfo[module]['sources']
|
||||
module_sources = list(sinfo[module]['sources'])
|
||||
if module in ('x11', 'wayland'):
|
||||
remove = 'linux_joystick.c' if is_bsd else 'null_joystick.c'
|
||||
module_sources.remove(remove)
|
||||
|
||||
ans.sources = sinfo['common']['sources'] + module_sources
|
||||
ans.all_headers = [x for x in os.listdir(base) if x.endswith('.h')]
|
||||
|
||||
if module in ('x11', 'wayland'):
|
||||
@@ -107,13 +112,13 @@ def collect_source_information():
|
||||
'common': dict(extract_sources('common')),
|
||||
'wayland_protocols': wayland_protocols,
|
||||
}
|
||||
joystick = 'null' if is_bsd else 'linux'
|
||||
for group in 'cocoa win32 x11 wayland osmesa'.split():
|
||||
m = re.search('_GLFW_' + group.upper(), raw)
|
||||
ans[group] = dict(extract_sources('glfw', m.start()))
|
||||
if group in ('x11', 'wayland'):
|
||||
ans[group]['headers'].append('{}_joystick.h'.format(joystick))
|
||||
ans[group]['sources'].append('{}_joystick.c'.format(joystick))
|
||||
for joystick in ('linux', 'null'):
|
||||
ans[group]['headers'].append('{}_joystick.h'.format(joystick))
|
||||
ans[group]['sources'].append('{}_joystick.c'.format(joystick))
|
||||
if group == 'wayland':
|
||||
ans[group]['protocols'] = p = []
|
||||
for m in re.finditer(r'WAYLAND_PROTOCOLS_PKGDATADIR\}/(.+?)"?$', raw, flags=re.M):
|
||||
@@ -224,9 +229,9 @@ const char* load_glfw(const char* path);
|
||||
f.write(header)
|
||||
|
||||
code = '''
|
||||
#include <dlfcn.h>
|
||||
#include "data-types.h"
|
||||
#include "glfw-wrapper.h"
|
||||
#include <dlfcn.h>
|
||||
|
||||
static void* handle = NULL;
|
||||
|
||||
|
||||
@@ -60,7 +60,8 @@
|
||||
"xkb_glfw.h",
|
||||
"egl_context.h",
|
||||
"osmesa_context.h",
|
||||
"linux_joystick.h"
|
||||
"linux_joystick.h",
|
||||
"null_joystick.h"
|
||||
],
|
||||
"protocols": [
|
||||
"stable/xdg-shell/xdg-shell.xml",
|
||||
@@ -78,7 +79,8 @@
|
||||
"xkb_glfw.c",
|
||||
"egl_context.c",
|
||||
"osmesa_context.c",
|
||||
"linux_joystick.c"
|
||||
"linux_joystick.c",
|
||||
"null_joystick.c"
|
||||
]
|
||||
},
|
||||
"wayland_protocols": [
|
||||
@@ -113,7 +115,9 @@
|
||||
"posix_thread.h",
|
||||
"glx_context.h",
|
||||
"egl_context.h",
|
||||
"osmesa_context.h"
|
||||
"osmesa_context.h",
|
||||
"linux_joystick.h",
|
||||
"null_joystick.h"
|
||||
],
|
||||
"sources": [
|
||||
"x11_init.c",
|
||||
@@ -124,7 +128,9 @@
|
||||
"posix_thread.c",
|
||||
"glx_context.c",
|
||||
"egl_context.c",
|
||||
"osmesa_context.c"
|
||||
"osmesa_context.c",
|
||||
"linux_joystick.c",
|
||||
"null_joystick.c"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@
|
||||
extern PyTypeObject Screen_Type;
|
||||
|
||||
// utils {{{
|
||||
static uint64_t pow10[] = {
|
||||
static uint64_t pow10_array[] = {
|
||||
1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000
|
||||
};
|
||||
|
||||
@@ -26,9 +26,9 @@ utoi(uint32_t *buf, unsigned int sz) {
|
||||
if (*p == '0') { p++; sz--; }
|
||||
else break;
|
||||
}
|
||||
if (sz < sizeof(pow10)/sizeof(pow10[0])) {
|
||||
if (sz < sizeof(pow10_array)/sizeof(pow10_array[0])) {
|
||||
for (int i = sz-1, j=0; i >= 0; i--, j++) {
|
||||
ans += (p[i] - '0') * pow10[j];
|
||||
ans += (p[i] - '0') * pow10_array[j];
|
||||
}
|
||||
}
|
||||
return ans;
|
||||
|
||||
Reference in New Issue
Block a user