diff options
| -rw-r--r-- | CHANGELOG.md | 3 | ||||
| -rw-r--r-- | PKGBUILD | 6 | ||||
| -rw-r--r-- | meson.build | 25 | ||||
| -rw-r--r-- | meson_options.txt | 3 | ||||
| -rw-r--r-- | nanosvg.c | 2 | ||||
| -rw-r--r-- | nanosvg/nanosvg.h | 1 | ||||
| -rw-r--r-- | nanosvg/nanosvgrast.h | 1 | ||||
| -rw-r--r-- | nanosvgrast.c | 4 | ||||
| -rw-r--r-- | svg.c | 2 | 
9 files changed, 33 insertions, 14 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index f2290cc..07e8558 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@  * JPEG XL support ([#14][14])  * Log output now respects the [`NO_COLOR`](http://no-color.org/)    environment variable. +* Support for linking against a system provided nanosvg library. See +  the new `-Dsystem-nanosvg` meson option. Defaults to `disabled` +  (i.e. use the bundled version).  [14]: https://codeberg.org/dnkl/wbg/pulls/14 @@ -1,12 +1,12 @@  pkgname=wbg -pkgver=1.2.0 +pkgver=1.2.0.r13.gd687493  pkgrel=1  pkgdesc="Super simple wallpaper application"  arch=('x86_64' 'aarch64')  url=https://codeberg.org/dnkl/wbg  license=(mit)  makedepends=('meson' 'ninja' 'wayland-protocols' 'tllist>=1.0.1') -depends=('wayland' 'pixman' 'libjpeg-turbo' 'libpng' 'libwebp' 'libjxl') +depends=('wayland' 'pixman' 'nanosvg' 'libjpeg-turbo' 'libpng' 'libwebp' 'libjxl')  source=()  changelog=CHANGELOG.md @@ -16,7 +16,7 @@ pkgver() {  }  build() { -  meson --prefix=/usr --buildtype=release --wrap-mode=nofallback .. +  meson --prefix=/usr --buildtype=release --wrap-mode=nofallback -Dsystem-nanosvg=enabled ..    ninja  } diff --git a/meson.build b/meson.build index ea310ca..69ff14e 100644 --- a/meson.build +++ b/meson.build @@ -48,17 +48,28 @@ endif  math = cc.find_library('m')  pixman = dependency('pixman-1') +system_nanosvg = cc.find_library('nanosvg', required: get_option('system-nanosvg')) +system_nanosvgrast = cc.find_library('nanosvgrast', required: get_option('system-nanosvg'))  png = dependency('libpng', required: get_option('png'))  jpg = dependency('libjpeg', required: get_option('jpeg'))  webp = dependency('libwebp', required: get_option('webp'))  jxl = dependency('libjxl', required: get_option('jxl'))  jxl_threads = dependency('libjxl_threads', required: false) -svg = declare_dependency( -  sources: ['nanosvg.c', '3rd-party/nanosvg/src/nanosvg.h', -            'nanosvgrast.c', '3rd-party/nanosvg/src/nanosvgrast.h'], -  include_directories: '3rd-party/nanosvg/src', -  dependencies: math, -) + +if system_nanosvg.found() and system_nanosvgrast.found() +  svg = declare_dependency( +    dependencies: [system_nanosvg, system_nanosvgrast, math] +  ) +  svg_lib = 'nanosvg (system)' +else +  svg = declare_dependency( +    sources: ['nanosvg.c', '3rd-party/nanosvg/src/nanosvg.h', +              'nanosvgrast.c', '3rd-party/nanosvg/src/nanosvgrast.h'], +    include_directories: '.', +    dependencies: math, +  ) +  svg_lib = 'nanosvg (bundled)' +endif  have_svg = get_option('svg')  if not png.found() and not jpg.found() and not jxl.found() and not webp.found() and not have_svg @@ -158,7 +169,7 @@ summary(      'JPEG support': jpg.found(),      'JPEG XL support': jxl.found(),      'WebP support': webp.found(), -    'SVG support': have_svg +    'SVG support': svg_lib,    },    bool_yn: true  ) diff --git a/meson_options.txt b/meson_options.txt index b9aae7f..43299b0 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -3,3 +3,6 @@ option('jpeg', type: 'feature')  option('jxl', type: 'feature')  option('webp', type: 'feature')  option('svg', type: 'boolean') + +option('system-nanosvg', type: 'feature', value: 'disabled', +       description: 'use system\'s nanosvg instead of the bundled version') @@ -3,4 +3,4 @@  #include <math.h>  #define NANOSVG_ALL_COLOR_KEYWORDS  #define NANOSVG_IMPLEMENTATION -#include <nanosvg.h> +#include <3rd-party/nanosvg/src/nanosvg.h> diff --git a/nanosvg/nanosvg.h b/nanosvg/nanosvg.h new file mode 100644 index 0000000..5c08f32 --- /dev/null +++ b/nanosvg/nanosvg.h @@ -0,0 +1 @@ +#include <3rd-party/nanosvg/src/nanosvg.h> diff --git a/nanosvg/nanosvgrast.h b/nanosvg/nanosvgrast.h new file mode 100644 index 0000000..c6b63dd --- /dev/null +++ b/nanosvg/nanosvgrast.h @@ -0,0 +1 @@ +#include <3rd-party/nanosvg/src/nanosvgrast.h> diff --git a/nanosvgrast.c b/nanosvgrast.c index 1aa46c4..07d85b6 100644 --- a/nanosvgrast.c +++ b/nanosvgrast.c @@ -1,6 +1,6 @@  #include <stdlib.h>  #include <string.h> -#include <nanosvg.h> +#include <3rd-party/nanosvg/src/nanosvg.h>  #define NANOSVGRAST_IMPLEMENTATION -#include <nanosvgrast.h> +#include <3rd-party/nanosvg/src/nanosvgrast.h> @@ -2,7 +2,7 @@  #include <stdlib.h>  #include <stdio.h> -#include <nanosvgrast.h> +#include <nanosvg/nanosvgrast.h>  #define LOG_MODULE "svg"  #define LOG_ENABLE_DBG 0  | 
