From 192c57796600d5cceb24e21d2be5094a4694e7de Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Sat, 15 Jan 2022 00:53:46 +0100 Subject: [PATCH] Add fallbacks to all common dependencies --- .gitignore | 3 +-- meson.build | 26 ++++++++++++++++++++------ scripts/install-dependencies.sh | 4 ++-- src/api/system.c | 1 + subprojects/freetype2.wrap | 9 +++++++++ subprojects/lua.wrap | 6 +++--- subprojects/pcre2.wrap | 15 +++++++++++++++ subprojects/sdl2.wrap | 12 ++++++++++++ 8 files changed, 63 insertions(+), 13 deletions(-) create mode 100644 subprojects/freetype2.wrap create mode 100644 subprojects/pcre2.wrap create mode 100644 subprojects/sdl2.wrap diff --git a/.gitignore b/.gitignore index d1bba414..75dec714 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,7 @@ build*/ .build*/ lhelper/ submodules/ -subprojects/lua*/ -subprojects/reproc/ +subprojects/*/ /appimage* .ccls-cache .lite-debug.log diff --git a/meson.build b/meson.build index 867b72b9..ccc84cb3 100644 --- a/meson.build +++ b/meson.build @@ -3,7 +3,10 @@ project('lite-xl', version : '2.0.3', license : 'MIT', meson_version : '>= 0.42', - default_options : ['c_std=gnu11'] + default_options : [ + 'c_std=gnu11', + 'wrap_mode=nofallback' + ] ) #=============================================================================== @@ -24,7 +27,7 @@ endif cc = meson.get_compiler('c') lite_includes = [] -lite_cargs = [] +lite_cargs = ['-DSDL_MAIN_HANDLED', '-DPCRE2_STATIC'] # On macos we need to use the SDL renderer to support retina displays if get_option('renderer') or host_machine.system() == 'darwin' lite_cargs += '-DLITE_USE_SDL_RENDERER' @@ -47,15 +50,26 @@ if not get_option('source-only') libm = cc.find_library('m', required : false) libdl = cc.find_library('dl', required : false) threads_dep = dependency('threads') + lua_dep = dependency('lua5.4', required : false) if not lua_dep.found() lua_dep = dependency('lua', fallback: ['lua', 'lua_dep'], - default_options: ['line_editing=false', 'default_library=static'] + default_options: ['default_library=static', 'line_editing=false', 'interpreter=false'] ) endif - pcre2_dep = dependency('libpcre2-8') - freetype_dep = dependency('freetype2') - sdl_dep = dependency('sdl2') + + pcre2_dep = dependency('libpcre2-8', fallback: ['pcre2', 'libpcre2_8'], + default_options: ['default_library=static', 'grep=false', 'test=false'] + ) + + freetype_dep = dependency('freetype2', fallback: ['freetype2', 'freetype_dep'], + default_options: ['default_library=static', 'zlib=disabled', 'bzip2=disabled', 'png=disabled', 'harfbuzz=disabled', 'brotli=disabled'] + ) + + sdl_dep = dependency('sdl2', fallback: ['sdl2', 'sdl2_dep'], + default_options: ['default_library=static'] + ) + lite_deps = [lua_dep, sdl_dep, freetype_dep, pcre2_dep, libm, libdl, threads_dep] endif #=============================================================================== diff --git a/scripts/install-dependencies.sh b/scripts/install-dependencies.sh index 2f9519b1..b75e6dca 100644 --- a/scripts/install-dependencies.sh +++ b/scripts/install-dependencies.sh @@ -63,10 +63,10 @@ main() { elif [[ "$OSTYPE" == "msys" ]]; then if [[ $lhelper == true ]]; then pacman --noconfirm -S \ - ${MINGW_PACKAGE_PREFIX}-{gcc,meson,ninja,ntldd,pkg-config} unzip + ${MINGW_PACKAGE_PREFIX}-{gcc,meson,ninja,ntldd,pkg-config,mesa} unzip else pacman --noconfirm -S \ - ${MINGW_PACKAGE_PREFIX}-{gcc,meson,ninja,ntldd,pkg-config,freetype,pcre2,SDL2} unzip + ${MINGW_PACKAGE_PREFIX}-{gcc,meson,ninja,ntldd,pkg-config,mesa,freetype,pcre2,SDL2} unzip fi fi } diff --git a/src/api/system.c b/src/api/system.c index 8abc5595..cf7232e6 100644 --- a/src/api/system.c +++ b/src/api/system.c @@ -1,4 +1,5 @@ #include +#include #include #include #include diff --git a/subprojects/freetype2.wrap b/subprojects/freetype2.wrap new file mode 100644 index 00000000..6d7f449a --- /dev/null +++ b/subprojects/freetype2.wrap @@ -0,0 +1,9 @@ +[wrap-file] +directory = freetype-2.11.1 +source_url = https://download.savannah.gnu.org/releases/freetype/freetype-2.11.1.tar.gz +source_filename = freetype-2.11.1.tar.gz +source_hash = f8db94d307e9c54961b39a1cc799a67d46681480696ed72ecf78d4473770f09b + +[provide] +freetype2 = freetype_dep + diff --git a/subprojects/lua.wrap b/subprojects/lua.wrap index 71a37d39..bd6ee5eb 100644 --- a/subprojects/lua.wrap +++ b/subprojects/lua.wrap @@ -3,9 +3,9 @@ directory = lua-5.4.3 source_url = https://www.lua.org/ftp/lua-5.4.3.tar.gz source_filename = lua-5.4.3.tar.gz source_hash = f8612276169e3bfcbcfb8f226195bfc6e466fe13042f1076cbde92b7ec96bbfb -patch_filename = lua_5.4.3-1_patch.zip -patch_url = https://wrapdb.mesonbuild.com/v2/lua_5.4.3-1/get_patch -patch_hash = 66794455e18d373041c8ffa9c23d1629b813c7a716f8905425d347937f5c8dc8 +patch_filename = lua_5.4.3-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/lua_5.4.3-2/get_patch +patch_hash = 3c23ec14a3f000d80fe2e2fdddba63a56e13c758d74195daa4ff0da7bfdb02da [provide] lua-5.4 = lua_dep diff --git a/subprojects/pcre2.wrap b/subprojects/pcre2.wrap new file mode 100644 index 00000000..99e82cf4 --- /dev/null +++ b/subprojects/pcre2.wrap @@ -0,0 +1,15 @@ +[wrap-file] +directory = pcre2-10.39 +source_url = https://github.com/PhilipHazel/pcre2/releases/download/pcre2-10.39/pcre2-10.39.tar.bz2 +source_filename = pcre2-10.39.tar.bz2 +source_hash = 0f03caf57f81d9ff362ac28cd389c055ec2bf0678d277349a1a4bee00ad6d440 +patch_filename = pcre2_10.39-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/pcre2_10.39-2/get_patch +patch_hash = c4cfffff83e7bb239c8c330339b08f4367b019f79bf810f10c415e35fb09cf14 + +[provide] +libpcre2-8 = -libpcre2_8 +libpcre2-16 = -libpcre2_16 +libpcre2-32 = -libpcre2_32 +libpcre2-posix = -libpcre2_posix + diff --git a/subprojects/sdl2.wrap b/subprojects/sdl2.wrap new file mode 100644 index 00000000..9ef9e1d3 --- /dev/null +++ b/subprojects/sdl2.wrap @@ -0,0 +1,12 @@ +[wrap-file] +directory = SDL2-2.0.18 +source_url = https://www.libsdl.org/release/SDL2-2.0.18.tar.gz +source_filename = SDL2-2.0.18.tar.gz +source_hash = 94d40cd73dbfa10bb6eadfbc28f355992bb2d6ef6761ad9d4074eff95ee5711c +patch_filename = sdl2_2.0.18-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/sdl2_2.0.18-2/get_patch +patch_hash = cd77f33395d3d019bb89217b9da41fc640ed8c78cbbbebc5c662155a25e2820e + +[provide] +sdl2 = sdl2_dep +