Fix macOS build issue with recent commit
Add objc_args in meson when compiling to pass C defines also to bundle_open.m. Default "bundle" option to false to have by default a unix-like build and install. In the run-local script always expect that "bundle" option is to false to have a unix-like install. In the build-package script pass the -Dbundle=true option when building on macos. When setting the resouce path revert to original method using [[NSBundle mainBundle] resourcePath] to have the real resource path when the bundle option will be activated. With the recent commit the function set_macos_bundle_resources will be called only if the "bundle" option is activate and is not used in unix-like mode.
This commit is contained in:
parent
717f4eb782
commit
c9669410ad
|
@ -32,7 +32,11 @@ lite_build () {
|
||||||
local build="$1"
|
local build="$1"
|
||||||
build_dir_is_usable "$build" || exit 1
|
build_dir_is_usable "$build" || exit 1
|
||||||
rm -fr "$build"
|
rm -fr "$build"
|
||||||
meson setup --buildtype=release "$build" || exit 1
|
setup_options=()
|
||||||
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
setup_options+=(-Dbundle=true)
|
||||||
|
fi
|
||||||
|
meson setup "${setup_options[@]}" "$build" || exit 1
|
||||||
ninja -C "$build" || exit 1
|
ninja -C "$build" || exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
option('bundle', type : 'boolean', value : true, description: 'Build a macOS bundle')
|
option('bundle', type : 'boolean', value : false, description: 'Build a macOS bundle')
|
||||||
option('portable', type : 'boolean', value : false, description: 'Portable install')
|
option('portable', type : 'boolean', value : false, description: 'Portable install')
|
||||||
option('renderer', type : 'boolean', value : false, description: 'Use SDL renderer')
|
option('renderer', type : 'boolean', value : false, description: 'Use SDL renderer')
|
||||||
|
|
|
@ -47,10 +47,7 @@ if [[ "$OSTYPE" == "msys"* || "$OSTYPE" == "mingw"* ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rundir=".run"
|
rundir=".run"
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
if [ "$option_portable" == on ]; then
|
||||||
bindir="$rundir"
|
|
||||||
datadir="$rundir"
|
|
||||||
elif [ "$option_portable" == on ]; then
|
|
||||||
bindir="$rundir"
|
bindir="$rundir"
|
||||||
datadir="$rundir/data"
|
datadir="$rundir/data"
|
||||||
else
|
else
|
||||||
|
|
|
@ -5,25 +5,8 @@
|
||||||
void set_macos_bundle_resources(lua_State *L)
|
void set_macos_bundle_resources(lua_State *L)
|
||||||
{ @autoreleasepool
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
/* Use resolved executablePath instead of resourcePath to allow lanching
|
NSString* resource_path = [[NSBundle mainBundle] resourcePath];
|
||||||
the lite-xl binary via a symlink, like typically done by Homebrew:
|
lua_pushstring(L, [resource_path UTF8String]);
|
||||||
|
|
||||||
/usr/local/bin/lite-xl -> /Applications/lite-xl.app/Contents/MacOS/lite-xl
|
|
||||||
|
|
||||||
The resourcePath returns /usr/local in this case instead of
|
|
||||||
/Applications/lite-xl.app/Contents/Resources, which makes later
|
|
||||||
access to the resource files fail. Resolving the symlink to the
|
|
||||||
executable and then the relative path to the expected directory
|
|
||||||
Resources is a workaround for starting the application from both
|
|
||||||
the launcher directly and the command line via the symlink.
|
|
||||||
*/
|
|
||||||
NSString* executable_path = [[NSBundle mainBundle] executablePath];
|
|
||||||
char resolved_path[PATH_MAX + 16 + 1];
|
|
||||||
realpath([executable_path UTF8String], resolved_path);
|
|
||||||
strcat(resolved_path, "/../../Resources");
|
|
||||||
char resource_path[PATH_MAX + 1];
|
|
||||||
realpath(resolved_path, resource_path);
|
|
||||||
lua_pushstring(L, resource_path);
|
|
||||||
lua_setglobal(L, "MACOS_RESOURCES");
|
lua_setglobal(L, "MACOS_RESOURCES");
|
||||||
}}
|
}}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -28,6 +28,7 @@ executable('lite-xl',
|
||||||
include_directories: [lite_include, font_renderer_include],
|
include_directories: [lite_include, font_renderer_include],
|
||||||
dependencies: lite_deps,
|
dependencies: lite_deps,
|
||||||
c_args: lite_cargs,
|
c_args: lite_cargs,
|
||||||
|
objc_args: lite_cargs,
|
||||||
link_with: libfontrenderer,
|
link_with: libfontrenderer,
|
||||||
link_args: lite_link_args,
|
link_args: lite_link_args,
|
||||||
install_dir: lite_bindir,
|
install_dir: lite_bindir,
|
||||||
|
|
Loading…
Reference in New Issue