mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
Get it building on macOS
This commit is contained in:
14
.travis.yml
14
.travis.yml
@@ -75,8 +75,8 @@ matrix:
|
|||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- PYTHON=python3
|
- PYTHON=python3
|
||||||
- PKG_CONFIG_PATH=$HOME/glfw/lib/pkgconfig:$HOME/harfbuzz/lib/pkgconfig:$PKG_CONFIG_PATH
|
- PKG_CONFIG_PATH=$HOME/harfbuzz/lib/pkgconfig:$PKG_CONFIG_PATH
|
||||||
- LD_LIBRARY_PATH=$HOME/glfw/lib:$HOME/harfbuzz/lib:$LD_LIBRARY_PATH
|
- LD_LIBRARY_PATH=$HOME/harfbuzz/lib:$LD_LIBRARY_PATH
|
||||||
- ASAN_OPTIONS=leak_check_at_exit=0
|
- ASAN_OPTIONS=leak_check_at_exit=0
|
||||||
|
|
||||||
install: |
|
install: |
|
||||||
@@ -86,7 +86,7 @@ install: |
|
|||||||
if [[ "$USE_BREW" == "1" ]]; then
|
if [[ "$USE_BREW" == "1" ]]; then
|
||||||
brew update;
|
brew update;
|
||||||
brew install python3;
|
brew install python3;
|
||||||
brew install glfw;
|
brew install libunistring;
|
||||||
brew install freetype;
|
brew install freetype;
|
||||||
brew install harfbuzz --without-glib --without-gobject-introspection --without-graphite2 --without-icu4c;
|
brew install harfbuzz --without-glib --without-gobject-introspection --without-graphite2 --without-icu4c;
|
||||||
else
|
else
|
||||||
@@ -95,13 +95,6 @@ install: |
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
pushd /tmp
|
pushd /tmp
|
||||||
wget -O glfw-3.2.1.zip https://github.com/glfw/glfw/archive/3.2.1.zip
|
|
||||||
unzip -q glfw-3.2.1.zip
|
|
||||||
cd glfw-3.2.1
|
|
||||||
cmake -DBUILD_SHARED_LIBS=ON -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_DOCS=OFF -DCMAKE_INSTALL_PREFIX=$HOME/glfw
|
|
||||||
make
|
|
||||||
make install
|
|
||||||
|
|
||||||
wget https://github.com/behdad/harfbuzz/releases/download/1.6.3/harfbuzz-1.6.3.tar.bz2
|
wget https://github.com/behdad/harfbuzz/releases/download/1.6.3/harfbuzz-1.6.3.tar.bz2
|
||||||
tar xf harfbuzz-1.6.3.tar.bz2
|
tar xf harfbuzz-1.6.3.tar.bz2
|
||||||
cd harfbuzz-1.6.3
|
cd harfbuzz-1.6.3
|
||||||
@@ -111,7 +104,6 @@ install: |
|
|||||||
cd ..
|
cd ..
|
||||||
popd
|
popd
|
||||||
fi
|
fi
|
||||||
pkg-config --cflags glfw3
|
|
||||||
pkg-config --cflags harfbuzz
|
pkg-config --cflags harfbuzz
|
||||||
if [[ "$TRAVIS_OS_NAME" != 'osx' ]]; then
|
if [[ "$TRAVIS_OS_NAME" != 'osx' ]]; then
|
||||||
PLIB=$(ldd `which python` | grep libpython | cut -d ' ' -f 3)
|
PLIB=$(ldd `which python` | grep libpython | cut -d ' ' -f 3)
|
||||||
|
|||||||
@@ -89,14 +89,12 @@ the following dependencies are installed first.
|
|||||||
=== Dependencies
|
=== Dependencies
|
||||||
|
|
||||||
* python >= 3.5
|
* python >= 3.5
|
||||||
* glfw >= 3.2
|
* harfbuzz >= 1.5.0
|
||||||
* libunistring
|
* libunistring
|
||||||
* zlib
|
* zlib
|
||||||
* libpng
|
* libpng
|
||||||
* freetype
|
* freetype
|
||||||
* fontconfig (not needed on macOS)
|
* fontconfig (not needed on macOS)
|
||||||
* harfbuzz >= 1.5.0
|
|
||||||
* xsel (only on X11 systems with glfw < 3.3)
|
|
||||||
* ImageMagick (optional, needed to use the `kitty icat` tool to display images in the terminal)
|
* ImageMagick (optional, needed to use the `kitty icat` tool to display images in the terminal)
|
||||||
* gcc or clang (required only for building)
|
* gcc or clang (required only for building)
|
||||||
* pkg-config (required only for building)
|
* pkg-config (required only for building)
|
||||||
@@ -131,8 +129,7 @@ python3 /path/to/kitty/folder
|
|||||||
kitty is available as a macOS `dmg` file for easy installation from the
|
kitty is available as a macOS `dmg` file for easy installation from the
|
||||||
link:../../releases[releases page]. You can also run kitty directly from
|
link:../../releases[releases page]. You can also run kitty directly from
|
||||||
source using the above install from source instructions, after installing its
|
source using the above install from source instructions, after installing its
|
||||||
two dependencies (`python >= 3.5` and `glfw >= 3.2` using http://brew.sh/[brew]
|
dependencies using http://brew.sh/[brew] or a similar package manager.
|
||||||
or a similar package manager)
|
|
||||||
|
|
||||||
|
|
||||||
== Design philosophy
|
== Design philosophy
|
||||||
|
|||||||
@@ -859,15 +859,9 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)loadMainMenu
|
- (void)loadMainMenu
|
||||||
{
|
{ // removed by Kovid as it generated compiler warnings
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 100800
|
|
||||||
[[NSBundle mainBundle] loadNibNamed:@"MainMenu"
|
|
||||||
owner:NSApp
|
|
||||||
topLevelObjects:&nibObjects];
|
|
||||||
#else
|
|
||||||
[[NSBundle mainBundle] loadNibNamed:@"MainMenu" owner:NSApp];
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
// Set up the menu bar (manually)
|
// Set up the menu bar (manually)
|
||||||
|
|||||||
12
glfw/glfw.py
12
glfw/glfw.py
@@ -19,13 +19,19 @@ def init_env(env, pkg_config, at_least_version, module='x11'):
|
|||||||
x for x in ans.cflags
|
x for x in ans.cflags
|
||||||
if x not in '-Wpedantic -Wextra -pedantic-errors'.split()
|
if x not in '-Wpedantic -Wextra -pedantic-errors'.split()
|
||||||
]
|
]
|
||||||
|
if not isosx:
|
||||||
ans.cflags.append('-pthread')
|
ans.cflags.append('-pthread')
|
||||||
ans.cflags.append('-fpic')
|
|
||||||
ans.ldpaths.append('-pthread')
|
ans.ldpaths.append('-pthread')
|
||||||
|
ans.cflags.append('-fpic')
|
||||||
ans.cflags.append('-D_GLFW_' + module.upper())
|
ans.cflags.append('-D_GLFW_' + module.upper())
|
||||||
ans.cflags.append('-D_GLFW_BUILD_DLL')
|
ans.cflags.append('-D_GLFW_BUILD_DLL')
|
||||||
|
|
||||||
if not isosx:
|
if isosx:
|
||||||
|
ans.ldpaths.extend(
|
||||||
|
"-framework Cocoa -framework IOKit -framework CoreFoundation -framework CoreVideo".
|
||||||
|
split()
|
||||||
|
)
|
||||||
|
else:
|
||||||
ans.ldpaths.extend('-lrt -lm -ldl'.split())
|
ans.ldpaths.extend('-lrt -lm -ldl'.split())
|
||||||
|
|
||||||
if module == 'x11':
|
if module == 'x11':
|
||||||
@@ -216,6 +222,8 @@ def main():
|
|||||||
shutil.copy2(src, '.')
|
shutil.copy2(src, '.')
|
||||||
shutil.copy2(glfw_header, '.')
|
shutil.copy2(glfw_header, '.')
|
||||||
patch_in_file('internal.h', lambda x: x.replace('../include/GLFW/', ''))
|
patch_in_file('internal.h', lambda x: x.replace('../include/GLFW/', ''))
|
||||||
|
patch_in_file('cocoa_window.m', lambda x: re.sub(
|
||||||
|
r'[(]void[)]loadMainMenu.+?}', '(void)loadMainMenu\n{ // removed by Kovid as it generated compiler warnings \n}\n', x, flags=re.DOTALL))
|
||||||
json.dump(
|
json.dump(
|
||||||
sinfo,
|
sinfo,
|
||||||
open('source-info.json', 'w'),
|
open('source-info.json', 'w'),
|
||||||
|
|||||||
@@ -7,9 +7,7 @@
|
|||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include <structmember.h>
|
#include <structmember.h>
|
||||||
#include "glfw-wrapper.h"
|
#include "glfw-wrapper.h"
|
||||||
#if defined(__APPLE__)
|
|
||||||
extern bool cocoa_make_window_resizable(void *w);
|
extern bool cocoa_make_window_resizable(void *w);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if GLFW_KEY_LAST >= MAX_KEY_COUNT
|
#if GLFW_KEY_LAST >= MAX_KEY_COUNT
|
||||||
#error "glfw has too many keys, you should increase MAX_KEY_COUNT"
|
#error "glfw has too many keys, you should increase MAX_KEY_COUNT"
|
||||||
@@ -262,7 +260,8 @@ create_os_window(PyObject UNUSED *self, PyObject *args) {
|
|||||||
glfwSetWindowFocusCallback(glfw_window, window_focus_callback);
|
glfwSetWindowFocusCallback(glfw_window, window_focus_callback);
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
if (OPT(macos_hide_titlebar)) {
|
if (OPT(macos_hide_titlebar)) {
|
||||||
if (!cocoa_make_window_resizable(glfwGetCocoaWindow(glfw_window))) { PyErr_Print(); }
|
if (glfwGetCocoaWindow) { if (!cocoa_make_window_resizable(glfwGetCocoaWindow(glfw_window))) { PyErr_Print(); } }
|
||||||
|
else fprintf(stderr, "Failed to load glfwGetCocoaWindow\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
double now = monotonic();
|
double now = monotonic();
|
||||||
|
|||||||
4
setup.py
4
setup.py
@@ -208,7 +208,9 @@ def kitty_env():
|
|||||||
ans.ldpaths += pylib + font_libs + gl_libs + libpng + [
|
ans.ldpaths += pylib + font_libs + gl_libs + libpng + [
|
||||||
'-lunistring'
|
'-lunistring'
|
||||||
]
|
]
|
||||||
if not isosx:
|
if isosx:
|
||||||
|
ans.ldpaths.extend('-framework Cocoa'.split())
|
||||||
|
else:
|
||||||
ans.ldpaths += ['-lrt']
|
ans.ldpaths += ['-lrt']
|
||||||
if '-ldl' not in ans.ldpaths:
|
if '-ldl' not in ans.ldpaths:
|
||||||
ans.ldpaths.append('-ldl')
|
ans.ldpaths.append('-ldl')
|
||||||
|
|||||||
Reference in New Issue
Block a user