[sysprof] tree: start on massive tree refactor



commit 1708ad1b4831358beb8f1396799dec28ce0eec32
Author: Christian Hergert <chergert redhat com>
Date:   Tue May 7 20:52:05 2019 -0700

    tree: start on massive tree refactor
    
    The big thing going on here is that we are going to split up the libraries
    a bit better, and remove GObject from the capture library. The libsysprof
    library will bring in the capture library statically, so we can export the
    symbols we want.
    
    Eventually, we will bump the version to sysprof-3, but not yet.

 daemon/meson.build                                 |  28 ---
 data/meson.build                                   |  93 +---------
 data/sysprof-capture.pc.in                         |  11 --
 data/sysprof-ui.pc.in                              |  11 --
 data/sysprof.pc.in                                 |  11 --
 lib/callgraph/meson.build                          |  33 ----
 lib/capture/meson.build                            |  27 ---
 lib/meson.build                                    | 143 ---------------
 lib/profiler/meson.build                           |  17 --
 lib/sources/meson.build                            |  25 ---
 lib/symbols/meson.build                            |  23 ---
 lib/sysprof.h                                      |  67 -------
 lib/sysprof.map                                    |   6 -
 lib/util/meson.build                               |  62 -------
 lib/visualizers/meson.build                        |  30 ---
 lib/widgets/meson.build                            |  29 ---
 meson.build                                        |  48 +++--
 src/libsysprof-capture/meson.build                 |  53 ++++++
 .../libsysprof-capture}/sp-capture-condition.c     |  61 +++++--
 .../libsysprof-capture}/sp-capture-condition.h     |  21 +--
 .../libsysprof-capture}/sp-capture-cursor.c        |  94 +++++++---
 .../libsysprof-capture}/sp-capture-cursor.h        |  19 +-
 .../libsysprof-capture}/sp-capture-reader.c        |  10 +-
 .../libsysprof-capture}/sp-capture-reader.h        |  11 +-
 .../libsysprof-capture}/sp-capture-types.h         |  13 +-
 .../libsysprof-capture}/sp-capture-util-private.h  |   9 +-
 .../libsysprof-capture}/sp-capture-util.c          |   4 +-
 .../libsysprof-capture}/sp-capture-writer.c        |  10 +-
 .../libsysprof-capture}/sp-capture-writer.h        |  11 +-
 {lib => src/libsysprof-capture}/sysprof-capture.h  |  20 +-
 .../libsysprof-capture}/sysprof-version.h.in       |  12 +-
 .../css/SpVisualizerView-Adwaita-dark.css          |   0
 .../css/SpVisualizerView-Adwaita.css               |   0
 .../libsysprof-ui}/css/SpVisualizerView-shared.css |   0
 .../libsysprof-ui/libsysprof-ui.gresource.xml      |   0
 src/libsysprof-ui/meson.build                      |  85 +++++++++
 {lib/util => src/libsysprof-ui}/pointcache.c       |   6 +-
 {lib/util => src/libsysprof-ui}/pointcache.h       |   4 +-
 {lib/util => src/libsysprof-ui}/rectangles.c       |   8 +-
 {lib/util => src/libsysprof-ui}/rectangles.h       |   2 +-
 .../libsysprof-ui}/sp-callgraph-view.c             |  10 +-
 .../libsysprof-ui}/sp-callgraph-view.h             |   6 +-
 .../libsysprof-ui}/sp-cell-renderer-percent.c      |   6 +-
 .../libsysprof-ui}/sp-cell-renderer-percent.h      |   4 +-
 {lib/util => src/libsysprof-ui}/sp-color-cycle.c   |   6 +-
 {lib/util => src/libsysprof-ui}/sp-color-cycle.h   |   4 +-
 .../libsysprof-ui}/sp-cpu-visualizer-row.c         |  12 +-
 .../libsysprof-ui}/sp-cpu-visualizer-row.h         |   6 +-
 .../libsysprof-ui}/sp-empty-state-view.c           |   6 +-
 .../libsysprof-ui}/sp-empty-state-view.h           |   4 +-
 .../libsysprof-ui}/sp-failed-state-view.c          |   6 +-
 .../libsysprof-ui}/sp-failed-state-view.h          |   6 +-
 .../libsysprof-ui}/sp-line-visualizer-row.c        |  14 +-
 .../libsysprof-ui}/sp-line-visualizer-row.h        |   6 +-
 .../libsysprof-ui}/sp-mark-visualizer-row.c        |  14 +-
 .../libsysprof-ui}/sp-mark-visualizer-row.h        |   6 +-
 {lib/util => src/libsysprof-ui}/sp-model-filter.c  |   6 +-
 {lib/util => src/libsysprof-ui}/sp-model-filter.h  |   4 +-
 .../widgets => src/libsysprof-ui}/sp-multi-paned.c |   6 +-
 .../widgets => src/libsysprof-ui}/sp-multi-paned.h |   4 +-
 .../libsysprof-ui}/sp-process-model-row.c          |   6 +-
 .../libsysprof-ui}/sp-process-model-row.h          |   6 +-
 .../libsysprof-ui}/sp-profiler-menu-button.c       |  14 +-
 .../libsysprof-ui}/sp-profiler-menu-button.h       |   6 +-
 .../libsysprof-ui}/sp-recording-state-view.c       |   6 +-
 .../libsysprof-ui}/sp-recording-state-view.h       |   6 +-
 {lib/util => src/libsysprof-ui}/sp-theme-manager.c |   6 +-
 {lib/util => src/libsysprof-ui}/sp-theme-manager.h |   4 +-
 .../libsysprof-ui}/sp-visualizer-list.c            |  21 ++-
 .../libsysprof-ui}/sp-visualizer-list.h            |   8 +-
 .../libsysprof-ui}/sp-visualizer-row-private.h     |   6 +-
 .../libsysprof-ui}/sp-visualizer-row.c             |   8 +-
 .../libsysprof-ui}/sp-visualizer-row.h             |   8 +-
 .../libsysprof-ui}/sp-visualizer-ticks.c           |   6 +-
 .../libsysprof-ui}/sp-visualizer-ticks.h           |   4 +-
 .../libsysprof-ui}/sp-visualizer-view.c            |  18 +-
 .../libsysprof-ui}/sp-visualizer-view.h            |  11 +-
 {lib/util => src/libsysprof-ui}/sp-zoom-manager.c  |   6 +-
 {lib/util => src/libsysprof-ui}/sp-zoom-manager.h  |   4 +-
 {lib => src/libsysprof-ui}/sysprof-ui.h            |  36 ++--
 .../libsysprof-ui}/ui/sp-callgraph-view.ui         |   0
 .../libsysprof-ui}/ui/sp-empty-state-view.ui       |   0
 .../libsysprof-ui}/ui/sp-failed-state-view.ui      |   0
 .../libsysprof-ui}/ui/sp-process-model-row.ui      |   0
 .../libsysprof-ui}/ui/sp-profiler-menu-button.ui   |   0
 .../libsysprof-ui}/ui/sp-recording-state-view.ui   |   0
 .../libsysprof-ui}/ui/sp-visualizer-view.ui        |   0
 {lib/util => src/libsysprof}/binfile.c             |   7 +-
 {lib/util => src/libsysprof}/binfile.h             |   0
 {lib/util => src/libsysprof}/demangle.cpp          |   0
 {lib/util => src/libsysprof}/demangle.h            |   2 +-
 {lib/util => src/libsysprof}/elfparser.c           |   4 +-
 {lib/util => src/libsysprof}/elfparser.h           |   0
 src/libsysprof/meson.build                         |  97 ++++++++++
 .../libsysprof}/sp-callgraph-profile-private.h     |   6 +-
 .../libsysprof}/sp-callgraph-profile.c             |  23 ++-
 .../libsysprof}/sp-callgraph-profile.h             |   6 +-
 src/libsysprof/sp-capture-gobject.c                |  25 +++
 src/libsysprof/sp-capture-gobject.h                |  36 ++++
 .../libsysprof}/sp-elf-symbol-resolver.c           |  10 +-
 .../libsysprof}/sp-elf-symbol-resolver.h           |   4 +-
 {lib/sources => src/libsysprof}/sp-gjs-source.c    |   6 +-
 {lib/sources => src/libsysprof}/sp-gjs-source.h    |   4 +-
 .../libsysprof}/sp-hostinfo-source.c               |   4 +-
 .../libsysprof}/sp-hostinfo-source.h               |   4 +-
 .../libsysprof}/sp-jitmap-symbol-resolver.c        |   6 +-
 .../libsysprof}/sp-jitmap-symbol-resolver.h        |   4 +-
 .../libsysprof}/sp-kernel-symbol-resolver.c        |   6 +-
 .../libsysprof}/sp-kernel-symbol-resolver.h        |   4 +-
 {lib/symbols => src/libsysprof}/sp-kernel-symbol.c |   9 +-
 {lib/symbols => src/libsysprof}/sp-kernel-symbol.h |   4 +-
 .../libsysprof}/sp-local-profiler.c                |   6 +-
 .../libsysprof}/sp-local-profiler.h                |   4 +-
 {lib/util => src/libsysprof}/sp-map-lookaside.c    |   4 +-
 {lib/util => src/libsysprof}/sp-map-lookaside.h    |   4 +-
 {lib/sources => src/libsysprof}/sp-memory-source.c |   5 +-
 {lib/sources => src/libsysprof}/sp-memory-source.h |   2 +-
 {lib/sources => src/libsysprof}/sp-perf-counter.c  |  15 +-
 {lib/sources => src/libsysprof}/sp-perf-counter.h  |   2 +-
 {lib/sources => src/libsysprof}/sp-perf-source.c   |  12 +-
 {lib/sources => src/libsysprof}/sp-perf-source.h   |   4 +-
 {lib/sources => src/libsysprof}/sp-proc-source.c   |   4 +-
 {lib/sources => src/libsysprof}/sp-proc-source.h   |   4 +-
 .../libsysprof}/sp-process-model-item.c            |   6 +-
 .../libsysprof}/sp-process-model-item.h            |   2 +-
 {lib/util => src/libsysprof}/sp-process-model.c    |   6 +-
 {lib/util => src/libsysprof}/sp-process-model.h    |   2 +-
 {lib/profiler => src/libsysprof}/sp-profile.c      |   4 +-
 {lib/profiler => src/libsysprof}/sp-profile.h      |   4 +-
 {lib/profiler => src/libsysprof}/sp-profiler.c     |   4 +-
 {lib/profiler => src/libsysprof}/sp-profiler.h     |   6 +-
 {lib/util => src/libsysprof}/sp-selection.c        |   4 +-
 {lib/util => src/libsysprof}/sp-selection.h        |   8 +-
 src/libsysprof/sp-source-util-private.h            |  34 ++++
 src/libsysprof/sp-source-util.c                    | 203 +++++++++++++++++++++
 {lib/sources => src/libsysprof}/sp-source.c        |   4 +-
 {lib/sources => src/libsysprof}/sp-source.h        |   4 +-
 {lib/symbols => src/libsysprof}/sp-symbol-dirs.c   |   4 +-
 {lib/symbols => src/libsysprof}/sp-symbol-dirs.h   |   2 +-
 .../libsysprof}/sp-symbol-resolver.c               |   4 +-
 .../libsysprof}/sp-symbol-resolver.h               |   4 +-
 {lib/util => src/libsysprof}/stackstash.c          |   2 +-
 {lib/util => src/libsysprof}/stackstash.h          |   0
 src/libsysprof/sysprof.h                           |  49 +++++
 src/meson.build                                    |  40 ++--
 src/shared/meson.build                             |  33 ++++
 {lib => src/shared}/sp-address.c                   |   4 +-
 {lib => src/shared}/sp-address.h                   |   9 +-
 {lib => src/shared}/sp-clock.c                     |   4 +-
 {lib => src/shared}/sp-clock.h                     |  10 +-
 {lib => src/shared}/sp-error.c                     |   4 +-
 {lib => src/shared}/sp-error.h                     |   9 +-
 {lib => src/shared}/sp-kallsyms.c                  |   4 +-
 {lib => src/shared}/sp-kallsyms.h                  |  11 +-
 {lib/util => src/shared}/sp-line-reader.c          |   6 +-
 {lib/util => src/shared}/sp-line-reader.h          |   9 +-
 {lib/util => src/shared}/sp-platform.c             |   8 +-
 {lib/util => src/shared}/sp-platform.h             |   9 +-
 src/{resources => sysprof}/gtk/help-overlay.ui     |   0
 src/sysprof/meson.build                            |  28 +++
 src/{ => sysprof}/sp-application.c                 |   6 +-
 src/{ => sysprof}/sp-application.h                 |   2 +-
 src/{ => sysprof}/sp-credits.h                     |   0
 src/{ => sysprof}/sp-window-settings.c             |   2 +-
 src/{ => sysprof}/sp-window-settings.h             |   2 +-
 src/{ => sysprof}/sp-window.c                      |  10 +-
 src/{ => sysprof}/sp-window.h                      |   2 +-
 src/{ => sysprof}/sysprof.c                        |   2 +-
 src/{resources => sysprof}/sysprof.gresource.xml   |   0
 .../theme/Adwaita-shared.css                       |   0
 src/{resources => sysprof}/theme/shared.css        |   0
 src/{resources => sysprof}/ui/sp-window.ui         |   0
 src/sysprofd/meson.build                           |  60 ++++++
 {data => src/sysprofd}/org.gnome.Sysprof2.conf.in  |   0
 .../sysprofd}/org.gnome.Sysprof2.service.in        |   0
 {data => src/sysprofd}/org.gnome.Sysprof2.xml      |   0
 .../sysprofd}/org.gnome.sysprof2.policy.in         |   0
 {daemon => src/sysprofd}/sd-bus-helper.c           |   0
 {daemon => src/sysprofd}/sd-bus-helper.h           |   0
 {data => src/sysprofd}/sysprof2.service.in         |   0
 {daemon => src/sysprofd}/sysprofd.c                |   6 +-
 {tests => src/tests}/meson.build                   |  11 +-
 {tests => src/tests}/test-capture-cursor.c         |  24 ++-
 {tests => src/tests}/test-capture.c                |   8 +-
 {tests => src/tests}/test-kallsyms.c               |   4 +-
 {tests => src/tests}/test-model-filter.c           |   2 -
 {tests => src/tests}/test-process-model.c          |   0
 {tests => src/tests}/test-zoom.c                   |   2 +-
 src/tools/meson.build                              |  20 ++
 {tools => src/tools}/sysprof-cat.c                 |  11 +-
 {tools => src/tools}/sysprof-cli.c                 |   8 +-
 {tools => src/tools}/sysprof-dump.c                |   4 +-
 tools/meson.build                                  |  20 --
 193 files changed, 1397 insertions(+), 1133 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index cc924ae..f2b628c 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -1,6 +1,3 @@
-datadir = get_option('datadir')
-podir = join_paths(meson.source_root(), 'po')
-
 install_data('sysprof-mime.xml',
   install_dir: join_paths(datadir, 'mime/packages')
 )
@@ -10,53 +7,23 @@ install_data('org.gnome.sysprof2.gschema.xml',
 )
 
 i18n.merge_file(
-    input: 'org.gnome.Sysprof2.appdata.xml.in',
-    output: 'org.gnome.Sysprof2.appdata.xml',
-    po_dir: podir,
-    install: true,
+          input: 'org.gnome.Sysprof2.appdata.xml.in',
+         output: 'org.gnome.Sysprof2.appdata.xml',
+         po_dir: podir,
+        install: true,
     install_dir: join_paths(datadir, 'metainfo')
 )
 
 i18n.merge_file(
-    input: 'org.gnome.Sysprof2.desktop.in',
-    output: 'org.gnome.Sysprof2.desktop',
-    type: 'desktop',
-    po_dir: podir,
-    install: true,
+          input: 'org.gnome.Sysprof2.desktop.in',
+         output: 'org.gnome.Sysprof2.desktop',
+           type: 'desktop',
+         po_dir: podir,
+        install: true,
     install_dir: join_paths(datadir, 'applications')
 )
 
-pkgconf = configuration_data()
-pkgconf.set('VERSION', meson.project_version())
-pkgconf.set('API_VERSION', libsysprof_api_version)
-pkgconf.set('prefix', get_option('prefix'))
-pkgconf.set('libdir', join_paths('${exec_prefix}', get_option('libdir')))
-pkgconf.set('includedir', join_paths('${prefix}', get_option('includedir')))
-
-pkgconfigdir = join_paths(get_option('libdir'), 'pkgconfig')
-configure_file(
-  input: 'sysprof.pc.in',
-  output: 'sysprof-@0@.pc'.format(libsysprof_api_version),
-  configuration: pkgconf,
-  install: true,
-  install_dir: pkgconfigdir,
-)
-configure_file(
-  input: 'sysprof-capture.pc.in',
-  output: 'sysprof-capture-@0@.pc'.format(libsysprof_api_version),
-  configuration: pkgconf,
-  install: true,
-  install_dir: pkgconfigdir,
-)
 if get_option('enable_gtk')
-  configure_file(
-    input: 'sysprof-ui.pc.in',
-    output: 'sysprof-ui-@0@.pc'.format(libsysprof_api_version),
-    configuration: pkgconf,
-    install: true,
-    install_dir: pkgconfigdir,
-  )
-
   icon_sizes = ['scalable', 'symbolic']
   foreach size: icon_sizes
     install_subdir('icons/' + size,
@@ -64,45 +31,3 @@ if get_option('enable_gtk')
     )
   endforeach
 endif
-
-if get_option('with_sysprofd') == 'bundled'
-
-  sysprofdconf = configuration_data()
-  sysprofdconf.set('sysprofdprivdir', pkglibexecdir)
-
-  configure_file(
-    input: 'org.gnome.Sysprof2.service.in',
-    output: 'org.gnome.Sysprof2.service',
-    configuration: sysprofdconf,
-    install: true,
-    install_dir: join_paths(datadir, 'dbus-1/system-services'),
-  )
-  configure_file(
-    input: 'org.gnome.Sysprof2.conf.in',
-    output: 'org.gnome.Sysprof2.conf',
-    configuration: sysprofdconf,
-    install: true,
-    install_dir: join_paths(datadir, 'dbus-1/system.d'),
-  )
-
-  systemdunitdir = get_option('systemdunitdir')
-  if systemdunitdir == ''
-    systemdunitdir = dependency('systemd').get_pkgconfig_variable('systemdsystemunitdir')
-  endif
-  configure_file(
-    input: 'sysprof2.service.in',
-    output: 'sysprof2.service',
-    configuration: sysprofdconf,
-    install: true,
-    install_dir: systemdunitdir,
-  )
-
-  i18n.merge_file(
-    input: 'org.gnome.sysprof2.policy.in',
-    output: 'org.gnome.sysprof2.policy',
-    po_dir: podir,
-    install: true,
-    install_dir: join_paths(datadir, 'polkit-1/actions'),
-  )
-
-endif
diff --git a/meson.build b/meson.build
index da9237c..08eaf97 100644
--- a/meson.build
+++ b/meson.build
@@ -1,19 +1,30 @@
 project('sysprof', ['c', 'cpp'],
-  license: ['GPL3+', 'GPL2+'],
-  version: '3.32.0',
-  meson_version: '>=0.47.2',
-  default_options: [
-    'c_std=gnu11',
-    'cpp_std=c++03',
-    'warning_level=2',
+        license: ['GPL3+', 'GPL2+'],
+        version: '3.33.1',
+  meson_version: '>=0.49.0',
+  default_options: [ 'c_std=gnu11',
+                     'cpp_std=c++03',
+                     'warning_level=2',
   ]
 )
 
+gnome = import('gnome')
+pkgconfig = import('pkgconfig')
+i18n = import('i18n')
+
+libsysprof_api_version = 2
 version_split = meson.project_version().split('.')
+datadir = get_option('datadir')
+podir = join_paths(meson.source_root(), 'po')
+
+
+glib_req_version = '>= 2.60'
+gtk_req_version = '>= 3.24'
 
 cc = meson.get_compiler('c')
-config_h = configuration_data()
+cxx = meson.get_compiler('cpp')
 
+config_h = configuration_data()
 config_h.set_quoted('PACKAGE_NAME', 'sysprof')
 config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
 config_h.set_quoted('PACKAGE_STRING', 'sysprof-' + meson.project_version())
@@ -21,7 +32,10 @@ config_h.set_quoted('PACKAGE_BUGREPORT', 'https://bugzilla.gnome.org/enter_bug.c
 config_h.set('PACKAGE_TARNAME', 'PACKAGE_STRING')
 config_h.set('PACKAGE', 'PACKAGE_NAME')
 config_h.set('VERSION', 'PACKAGE_VERSION')
-# PACKAGE_URL
+
+if get_option('with_sysprofd') != 'none'
+  config_h.set10('ENABLE_POLKIT', true)
+endif
 
 debugdir = get_option('debugdir')
 if debugdir == ''
@@ -44,7 +58,6 @@ if has_use_clockid and has_clockid
 endif
 
 add_global_arguments([
-  '-DHAVE_CONFIG_H',
   '-I' + meson.build_root(), # config.h
 ], language: 'c')
 
@@ -145,27 +158,12 @@ int main(void) {
   error('Sysprof requires a C compiler with stdatomic support such as GCC 4.9 or newer')
 endif
 
-exe_c_args = []
-exe_link_args = []
-if cc.has_argument('-fPIE')
-  exe_c_args += '-fPIE'
-  exe_link_args += '-fpie'
-endif
-
 configure_file(
          output: 'config.h',
   configuration: config_h
 )
 
-gnome = import('gnome')
-i18n = import('i18n')
-
-subdir('lib')
-subdir('daemon')
 subdir('src')
-subdir('tools')
-subdir('tests')
-
 subdir('data')
 subdir('help')
 subdir('po')
diff --git a/src/libsysprof-capture/meson.build b/src/libsysprof-capture/meson.build
new file mode 100644
index 0000000..54427de
--- /dev/null
+++ b/src/libsysprof-capture/meson.build
@@ -0,0 +1,53 @@
+libsysprof_capture_headers = [
+  'sp-capture-condition.h',
+  'sp-capture-cursor.h',
+  'sp-capture-reader.h',
+  'sp-capture-types.h',
+  'sp-capture-writer.h',
+  'sysprof-capture.h',
+]
+
+libsysprof_capture_sources = [
+  'sp-capture-condition.c',
+  'sp-capture-cursor.c',
+  'sp-capture-reader.c',
+  'sp-capture-writer.c',
+]
+
+configure_file(
+          input: 'sysprof-version.h.in',
+         output: 'sysprof-version.h',
+  configuration: sysprof_version_conf,
+    install_dir: join_paths(get_option('includedir'), sysprof_header_subdir),
+)
+
+libsysprof_capture_deps = [
+  dependency('glib-2.0', version: glib_req_version),
+  libshared_dep,
+]
+
+install_headers(libsysprof_capture_headers, subdir: sysprof_header_subdir)
+
+libsysprof_capture = static_library('sysprof-capture-@0@'.format(libsysprof_api_version),
+  libsysprof_capture_sources,
+  dependencies: libsysprof_capture_deps,
+        c_args: [ '-DSYSPROF_CAPTURE_COMPILATION' ],
+   install_dir: get_option('libdir'),
+       install: true,
+)
+
+libsysprof_capture_dep = declare_dependency(
+           link_whole: libsysprof_capture,
+         dependencies: libsysprof_capture_deps,
+  include_directories: include_directories('.'),
+)
+
+pkgconfig.generate(
+      subdirs: [ sysprof_header_subdir ],
+      version: meson.project_version(),
+         name: 'sysprof-capture-@0@'.format(libsysprof_api_version),
+     filebase: 'sysprof-capture-@0@'.format(libsysprof_api_version),
+  description: 'The static capture library for tools that generate profiling capture data',
+  install_dir: join_paths(get_option('libdir'), 'pkgconfig'),
+     requires: [ 'glib-2.0' ],
+)
diff --git a/lib/capture/sp-capture-condition.c b/src/libsysprof-capture/sp-capture-condition.c
similarity index 88%
rename from lib/capture/sp-capture-condition.c
rename to src/libsysprof-capture/sp-capture-condition.c
index 07ab6fb..c06e320 100644
--- a/lib/capture/sp-capture-condition.c
+++ b/src/libsysprof-capture/sp-capture-condition.c
@@ -1,6 +1,6 @@
 /* sp-capture-condition.c
  *
- * Copyright © 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This file is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the Free
@@ -14,14 +14,18 @@
  *
  * You should have received a copy of the GNU General Public License along
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 
 #define G_LOG_DOMAIN "sp-capture-condition"
 
+#include "config.h"
+
 #include <string.h>
 
-#include "capture/sp-capture-condition.h"
+#include "sp-capture-condition.h"
 
 /**
  * SECTION:sp-capture-condition
@@ -45,6 +49,7 @@ typedef enum
 
 struct _SpCaptureCondition
 {
+  volatile gint ref_count;
   SpCaptureConditionType type;
   union {
     GArray *where_type_in;
@@ -144,11 +149,22 @@ sp_capture_condition_match (const SpCaptureCondition *self,
 }
 
 static SpCaptureCondition *
+sp_capture_condition_init (void)
+{
+  SpCaptureCondition *self;
+
+  self = g_slice_new0 (SpCaptureCondition);
+  self->ref_count = 1;
+
+  return g_steal_pointer (&self);
+}
+
+SpCaptureCondition *
 sp_capture_condition_copy (const SpCaptureCondition *self)
 {
   SpCaptureCondition *copy;
 
-  copy = g_slice_new0 (SpCaptureCondition);
+  copy = sp_capture_condition_init ();
   copy->type = self->type;
 
   switch (self->type)
@@ -185,13 +201,13 @@ sp_capture_condition_copy (const SpCaptureCondition *self)
 }
 
 static void
-sp_capture_condition_free (SpCaptureCondition *self)
+sp_capture_condition_finalize (SpCaptureCondition *self)
 {
   switch (self->type)
     {
     case SP_CAPTURE_CONDITION_AND:
-      sp_capture_condition_free (self->u.and.left);
-      sp_capture_condition_free (self->u.and.right);
+      sp_capture_condition_unref (self->u.and.left);
+      sp_capture_condition_unref (self->u.and.right);
       break;
 
     case SP_CAPTURE_CONDITION_WHERE_TYPE_IN:
@@ -217,10 +233,25 @@ sp_capture_condition_free (SpCaptureCondition *self)
   g_slice_free (SpCaptureCondition, self);
 }
 
-G_DEFINE_BOXED_TYPE (SpCaptureCondition,
-                     sp_capture_condition,
-                     sp_capture_condition_copy,
-                     sp_capture_condition_free)
+SpCaptureCondition *
+sp_capture_condition_ref (SpCaptureCondition *self)
+{
+  g_return_val_if_fail (self != NULL, NULL);
+  g_return_val_if_fail (self->ref_count > 0, NULL);
+
+  g_atomic_int_inc (&self->ref_count);
+  return self;
+}
+
+void
+sp_capture_condition_unref (SpCaptureCondition *self)
+{
+  g_return_if_fail (self != NULL);
+  g_return_if_fail (self->ref_count > 0);
+
+  if (g_atomic_int_dec_and_test (&self->ref_count))
+    sp_capture_condition_finalize (self);
+}
 
 SpCaptureCondition *
 sp_capture_condition_new_where_type_in (guint                     n_types,
@@ -230,7 +261,7 @@ sp_capture_condition_new_where_type_in (guint                     n_types,
 
   g_return_val_if_fail (types != NULL, NULL);
 
-  self = g_slice_new0 (SpCaptureCondition);
+  self = sp_capture_condition_init ();
   self->type = SP_CAPTURE_CONDITION_WHERE_TYPE_IN;
   self->u.where_type_in = g_array_sized_new (FALSE, FALSE, sizeof (SpCaptureFrameType), n_types);
   g_array_set_size (self->u.where_type_in, n_types);
@@ -252,7 +283,7 @@ sp_capture_condition_new_where_time_between (gint64 begin_time,
       end_time = tmp;
     }
 
-  self = g_slice_new0 (SpCaptureCondition);
+  self = sp_capture_condition_init ();
   self->type = SP_CAPTURE_CONDITION_WHERE_TIME_BETWEEN;
   self->u.where_time_between.begin = begin_time;
   self->u.where_time_between.end = end_time;
@@ -268,7 +299,7 @@ sp_capture_condition_new_where_pid_in (guint         n_pids,
 
   g_return_val_if_fail (pids != NULL, NULL);
 
-  self = g_slice_new0 (SpCaptureCondition);
+  self = sp_capture_condition_init ();
   self->type = SP_CAPTURE_CONDITION_WHERE_PID_IN;
   self->u.where_pid_in = g_array_sized_new (FALSE, FALSE, sizeof (gint32), n_pids);
   g_array_set_size (self->u.where_pid_in, n_pids);
@@ -285,7 +316,7 @@ sp_capture_condition_new_where_counter_in (guint        n_counters,
 
   g_return_val_if_fail (counters != NULL || n_counters == 0, NULL);
 
-  self = g_slice_new0 (SpCaptureCondition);
+  self = sp_capture_condition_init ();
   self->type = SP_CAPTURE_CONDITION_WHERE_COUNTER_IN;
   self->u.where_counter_in = g_array_sized_new (FALSE, FALSE, sizeof (guint), n_counters);
 
@@ -317,7 +348,7 @@ sp_capture_condition_new_and (SpCaptureCondition *left,
   g_return_val_if_fail (left != NULL, NULL);
   g_return_val_if_fail (right != NULL, NULL);
 
-  self = g_slice_new0 (SpCaptureCondition);
+  self = sp_capture_condition_init ();
   self->type = SP_CAPTURE_CONDITION_AND;
   self->u.and.left = left;
   self->u.and.right = right;
diff --git a/lib/capture/sp-capture-condition.h b/src/libsysprof-capture/sp-capture-condition.h
similarity index 78%
rename from lib/capture/sp-capture-condition.h
rename to src/libsysprof-capture/sp-capture-condition.h
index 659291b..0c29add 100644
--- a/lib/capture/sp-capture-condition.h
+++ b/src/libsysprof-capture/sp-capture-condition.h
@@ -1,6 +1,6 @@
 /* sp-capture-condition.h
  *
- * Copyright © 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This file is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the Free
@@ -14,20 +14,19 @@
  *
  * You should have received a copy of the GNU General Public License along
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#ifndef SP_CAPTURE_CONDITION_H
-#define SP_CAPTURE_CONDITION_H
-
-#include <glib-object.h>
+#pragma once
 
-#include "capture/sp-capture-types.h"
+#include "sp-capture-types.h"
 
 G_BEGIN_DECLS
 
-#define SP_TYPE_CAPTURE_CONDITION (sp_capture_condition_get_type())
-
-GType               sp_capture_condition_get_type               (void);
+SpCaptureCondition *sp_capture_condition_copy                   (const SpCaptureCondition *self);
+void                sp_capture_condition_unref                  (SpCaptureCondition       *self);
+SpCaptureCondition *sp_capture_condition_ref                    (SpCaptureCondition       *self);
 SpCaptureCondition *sp_capture_condition_new_and                (SpCaptureCondition       *left,
                                                                  SpCaptureCondition       *right);
 SpCaptureCondition *sp_capture_condition_new_where_type_in      (guint                     n_types,
@@ -41,6 +40,6 @@ SpCaptureCondition *sp_capture_condition_new_where_counter_in   (guint
 gboolean            sp_capture_condition_match                  (const SpCaptureCondition *self,
                                                                  const SpCaptureFrame     *frame);
 
-G_END_DECLS
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (SpCaptureCondition, sp_capture_condition_unref)
 
-#endif /* SP_CAPTURE_CONDITION_H */
+G_END_DECLS
diff --git a/lib/capture/sp-capture-cursor.c b/src/libsysprof-capture/sp-capture-cursor.c
similarity index 73%
rename from lib/capture/sp-capture-cursor.c
rename to src/libsysprof-capture/sp-capture-cursor.c
index 6877bec..72b9281 100644
--- a/lib/capture/sp-capture-cursor.c
+++ b/src/libsysprof-capture/sp-capture-cursor.c
@@ -1,6 +1,6 @@
 /* sp-capture-cursor.c
  *
- * Copyright © 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This file is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the Free
@@ -14,13 +14,17 @@
  *
  * You should have received a copy of the GNU General Public License along
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #define G_LOG_DOMAIN "sp-capture-cursor"
 
-#include "capture/sp-capture-condition.h"
-#include "capture/sp-capture-cursor.h"
-#include "capture/sp-capture-reader.h"
+#include "config.h"
+
+#include "sp-capture-condition.h"
+#include "sp-capture-cursor.h"
+#include "sp-capture-reader.h"
 
 #define READ_DELEGATE(f) ((ReadDelegate)(f))
 
@@ -28,51 +32,79 @@ typedef const SpCaptureFrame *(*ReadDelegate) (SpCaptureReader *);
 
 struct _SpCaptureCursor
 {
-  GObject          parent_instance;
+  volatile gint    ref_count;
   GPtrArray       *conditions;
   SpCaptureReader *reader;
   guint            reversed : 1;
 };
 
-G_DEFINE_TYPE (SpCaptureCursor, sp_capture_cursor, G_TYPE_OBJECT)
-
 static void
-destroy_condition (gpointer data)
+sp_capture_cursor_finalize (SpCaptureCursor *self)
 {
-  g_boxed_free (SP_TYPE_CAPTURE_CONDITION, data);
+  g_clear_pointer (&self->conditions, g_ptr_array_unref);
+  g_clear_pointer (&self->reader, sp_capture_reader_unref);
+  g_slice_free (SpCaptureCursor, self);
 }
 
-static void
-sp_capture_cursor_finalize (GObject *object)
+static SpCaptureCursor *
+sp_capture_cursor_init (void)
 {
-  SpCaptureCursor *self = (SpCaptureCursor *)object;
+  SpCaptureCursor *self;
 
-  g_clear_pointer (&self->conditions, g_ptr_array_unref);
-  g_clear_pointer (&self->reader, sp_capture_reader_unref);
+  self = g_slice_new0 (SpCaptureCursor);
+  self->conditions = g_ptr_array_new_with_free_func ((GDestroyNotify) sp_capture_condition_unref);
+  self->ref_count = 1;
 
-  G_OBJECT_CLASS (sp_capture_cursor_parent_class)->finalize (object);
+  return g_steal_pointer (&self);
 }
 
-static void
-sp_capture_cursor_class_init (SpCaptureCursorClass *klass)
+/**
+ * sp_capture_cursor_ref:
+ * @self: a #SpCaptureCursor
+ *
+ * Returns: (transfer full): @self
+ *
+ * Since: 3.34
+ */
+SpCaptureCursor *
+sp_capture_cursor_ref (SpCaptureCursor *self)
 {
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  g_return_val_if_fail (self != NULL, NULL);
+  g_return_val_if_fail (self->ref_count > 0, NULL);
 
-  object_class->finalize = sp_capture_cursor_finalize;
+  g_atomic_int_inc (&self->ref_count);
+  return self;
 }
 
-static void
-sp_capture_cursor_init (SpCaptureCursor *self)
+/**
+ * sp_capture_cursor_unref:
+ * @self: a #SpCaptureCursor
+ *
+ * Since: 3.34
+ */
+void
+sp_capture_cursor_unref (SpCaptureCursor *self)
 {
-  self->conditions = g_ptr_array_new_with_free_func (destroy_condition);
+  g_return_if_fail (self != NULL);
+  g_return_if_fail (self->ref_count > 0);
+
+  if (g_atomic_int_dec_and_test (&self->ref_count))
+    sp_capture_cursor_finalize (self);
 }
 
+/**
+ * sp_capture_cursor_foreach:
+ * @self: a #SpCaptureCursor
+ * @callback: (scope call): a closure to execute
+ * @user_data: user data for @callback
+ *
+ */
 void
 sp_capture_cursor_foreach (SpCaptureCursor         *self,
                            SpCaptureCursorCallback  callback,
                            gpointer                 user_data)
 {
-  g_return_if_fail (SP_IS_CAPTURE_CURSOR (self));
+  g_return_if_fail (self != NULL);
   g_return_if_fail (self->reader != NULL);
   g_return_if_fail (callback != NULL);
 
@@ -165,7 +197,7 @@ sp_capture_cursor_foreach (SpCaptureCursor         *self,
 void
 sp_capture_cursor_reset (SpCaptureCursor *self)
 {
-  g_return_if_fail (SP_IS_CAPTURE_CURSOR (self));
+  g_return_if_fail (self != NULL);
   g_return_if_fail (self->reader != NULL);
 
   sp_capture_reader_reset (self->reader);
@@ -174,7 +206,7 @@ sp_capture_cursor_reset (SpCaptureCursor *self)
 void
 sp_capture_cursor_reverse (SpCaptureCursor *self)
 {
-  g_return_if_fail (SP_IS_CAPTURE_CURSOR (self));
+  g_return_if_fail (self != NULL);
 
   self->reversed = !self->reversed;
 }
@@ -191,12 +223,18 @@ void
 sp_capture_cursor_add_condition (SpCaptureCursor    *self,
                                  SpCaptureCondition *condition)
 {
-  g_return_if_fail (SP_IS_CAPTURE_CURSOR (self));
+  g_return_if_fail (self != NULL);
   g_return_if_fail (condition != NULL);
 
   g_ptr_array_add (self->conditions, condition);
 }
 
+/**
+ * sp_capture_cursor_new:
+ * @self: a #SpCaptureCursor
+ *
+ * Returns: (transfer full): a new cursor for @reader
+ */
 SpCaptureCursor *
 sp_capture_cursor_new (SpCaptureReader *reader)
 {
@@ -204,7 +242,7 @@ sp_capture_cursor_new (SpCaptureReader *reader)
 
   g_return_val_if_fail (reader != NULL, NULL);
 
-  self = g_object_new (SP_TYPE_CAPTURE_CURSOR, NULL);
+  self = sp_capture_cursor_init ();
   self->reader = sp_capture_reader_copy (reader);
   sp_capture_reader_reset (self->reader);
 
@@ -221,7 +259,7 @@ sp_capture_cursor_new (SpCaptureReader *reader)
 SpCaptureReader *
 sp_capture_cursor_get_reader (SpCaptureCursor *self)
 {
-  g_return_val_if_fail (SP_IS_CAPTURE_CURSOR (self), NULL);
+  g_return_val_if_fail (self != NULL, NULL);
 
   return self->reader;
 }
diff --git a/lib/capture/sp-capture-cursor.h b/src/libsysprof-capture/sp-capture-cursor.h
similarity index 81%
rename from lib/capture/sp-capture-cursor.h
rename to src/libsysprof-capture/sp-capture-cursor.h
index d4ea900..1a88182 100644
--- a/lib/capture/sp-capture-cursor.h
+++ b/src/libsysprof-capture/sp-capture-cursor.h
@@ -1,6 +1,6 @@
 /* sp-capture-cursor.h
  *
- * Copyright © 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This file is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the Free
@@ -14,18 +14,17 @@
  *
  * You should have received a copy of the GNU General Public License along
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#ifndef SP_CAPTURE_CURSOR_H
-#define SP_CAPTURE_CURSOR_H
+#pragma once
 
-#include "capture/sp-capture-types.h"
+#include "sp-capture-types.h"
 
 G_BEGIN_DECLS
 
-#define SP_TYPE_CAPTURE_CURSOR (sp_capture_cursor_get_type())
-
-G_DECLARE_FINAL_TYPE (SpCaptureCursor, sp_capture_cursor, SP, CAPTURE_CURSOR, GObject)
+typedef struct _SpCaptureCursor SpCaptureCursor;
 
 /**
  * SpCaptureCursorCallback:
@@ -42,6 +41,8 @@ typedef gboolean (*SpCaptureCursorCallback) (const SpCaptureFrame *frame,
                                              gpointer              user_data);
 
 SpCaptureCursor *sp_capture_cursor_new            (SpCaptureReader         *reader);
+void             sp_capture_cursor_unref          (SpCaptureCursor         *self);
+SpCaptureCursor *sp_capture_cursor_ref            (SpCaptureCursor         *self);
 SpCaptureReader *sp_capture_cursor_get_reader     (SpCaptureCursor         *self);
 void             sp_capture_cursor_foreach        (SpCaptureCursor         *self,
                                                    SpCaptureCursorCallback  callback,
@@ -51,6 +52,6 @@ void             sp_capture_cursor_reverse        (SpCaptureCursor         *self
 void             sp_capture_cursor_add_condition  (SpCaptureCursor         *self,
                                                    SpCaptureCondition      *condition);
 
-G_END_DECLS
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (SpCaptureCursor, sp_capture_cursor_unref)
 
-#endif /* SP_CAPTURE_CURSOR_H */
+G_END_DECLS
diff --git a/lib/capture/sp-capture-reader.c b/src/libsysprof-capture/sp-capture-reader.c
similarity index 99%
rename from lib/capture/sp-capture-reader.c
rename to src/libsysprof-capture/sp-capture-reader.c
index 6fe6287..252a2d9 100644
--- a/lib/capture/sp-capture-reader.c
+++ b/src/libsysprof-capture/sp-capture-reader.c
@@ -1,6 +1,6 @@
 /* sp-capture-reader.c
  *
- * Copyright © 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This file is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the Free
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License along
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #include <errno.h>
@@ -23,9 +25,9 @@
 #include <sys/types.h>
 #include <unistd.h>
 
-#include "capture/sp-capture-reader.h"
-#include "capture/sp-capture-util-private.h"
-#include "capture/sp-capture-writer.h"
+#include "sp-capture-reader.h"
+#include "sp-capture-util-private.h"
+#include "sp-capture-writer.h"
 
 struct _SpCaptureReader
 {
diff --git a/lib/capture/sp-capture-reader.h b/src/libsysprof-capture/sp-capture-reader.h
similarity index 95%
rename from lib/capture/sp-capture-reader.h
rename to src/libsysprof-capture/sp-capture-reader.h
index 771ed76..656fe64 100644
--- a/lib/capture/sp-capture-reader.h
+++ b/src/libsysprof-capture/sp-capture-reader.h
@@ -1,6 +1,6 @@
 /* sp-capture-reader.h
  *
- * Copyright © 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This file is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the Free
@@ -14,12 +14,13 @@
  *
  * You should have received a copy of the GNU General Public License along
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#ifndef SP_CAPTURE_READER_H
-#define SP_CAPTURE_READER_H
+#pragma once
 
-#include "capture/sp-capture-types.h"
+#include "sp-capture-types.h"
 
 G_BEGIN_DECLS
 
@@ -69,5 +70,3 @@ gboolean                           sp_capture_reader_save_as             (SpCapt
 #endif
 
 G_END_DECLS
-
-#endif /* SP_CAPTURE_READER_H */
diff --git a/lib/capture/sp-capture-types.h b/src/libsysprof-capture/sp-capture-types.h
similarity index 96%
rename from lib/capture/sp-capture-types.h
rename to src/libsysprof-capture/sp-capture-types.h
index f065ed0..efff305 100644
--- a/lib/capture/sp-capture-types.h
+++ b/src/libsysprof-capture/sp-capture-types.h
@@ -1,6 +1,6 @@
 /* sp-capture-types.h
  *
- * Copyright © 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This file is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the Free
@@ -14,17 +14,14 @@
  *
  * You should have received a copy of the GNU General Public License along
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#ifndef SP_CAPTURE_FORMAT_H
-#define SP_CAPTURE_FORMAT_H
+#pragma once
 
 #include <glib.h>
 
-#ifdef SP_ENABLE_GOBJECT
-# include <glib-object.h>
-#endif
-
 #include "sp-clock.h"
 
 G_BEGIN_DECLS
@@ -257,5 +254,3 @@ sp_capture_address_compare (SpCaptureAddress a,
 }
 
 G_END_DECLS
-
-#endif /* SP_CAPTURE_FORMAT_H */
diff --git a/lib/capture/sp-capture-util-private.h b/src/libsysprof-capture/sp-capture-util-private.h
similarity index 90%
rename from lib/capture/sp-capture-util-private.h
rename to src/libsysprof-capture/sp-capture-util-private.h
index 9bf8669..63dd571 100644
--- a/lib/capture/sp-capture-util-private.h
+++ b/src/libsysprof-capture/sp-capture-util-private.h
@@ -1,6 +1,6 @@
 /* sp-capture-util-private.h
  *
- * Copyright © 2019 Christian Hergert <chergert redhat com>
+ * Copyright 2019 Christian Hergert <chergert redhat com>
  *
  * This file is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the Free
@@ -14,10 +14,11 @@
  *
  * You should have received a copy of the GNU General Public License along
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#ifndef SP_CAPTURE_UTIL_PRIVATE_H
-#define SP_CAPTURE_UTIL_PRIVATE_H
+#pragma once
 
 #include <glib.h>
 
@@ -53,5 +54,3 @@ ssize_t _sp_sendfile    (int     out_fd,
                          off_t  *offset,
                          size_t  count);
 #endif
-
-#endif /* SP_CAPTURE_UTIL_PRIVATE_H */
diff --git a/lib/capture/sp-capture-util.c b/src/libsysprof-capture/sp-capture-util.c
similarity index 97%
rename from lib/capture/sp-capture-util.c
rename to src/libsysprof-capture/sp-capture-util.c
index 0c6a907..52a390f 100644
--- a/lib/capture/sp-capture-util.c
+++ b/src/libsysprof-capture/sp-capture-util.c
@@ -1,6 +1,6 @@
 /* sp-capture-util.c
  *
- * Copyright © 2019 Christian Hergert <chergert redhat com>
+ * Copyright 2019 Christian Hergert <chergert redhat com>
  *
  * This file is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the Free
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License along
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #include <errno.h>
diff --git a/lib/capture/sp-capture-writer.c b/src/libsysprof-capture/sp-capture-writer.c
similarity index 99%
rename from lib/capture/sp-capture-writer.c
rename to src/libsysprof-capture/sp-capture-writer.c
index 24c0d43..85f42f0 100644
--- a/lib/capture/sp-capture-writer.c
+++ b/src/libsysprof-capture/sp-capture-writer.c
@@ -1,6 +1,6 @@
 /* sp-capture-writer.c
  *
- * Copyright © 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This file is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the Free
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License along
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #ifndef _GNU_SOURCE
@@ -29,9 +31,9 @@
 #include <sys/types.h>
 #include <unistd.h>
 
-#include "capture/sp-capture-reader.h"
-#include "capture/sp-capture-util-private.h"
-#include "capture/sp-capture-writer.h"
+#include "sp-capture-reader.h"
+#include "sp-capture-util-private.h"
+#include "sp-capture-writer.h"
 
 #define DEFAULT_BUFFER_SIZE (_sp_getpagesize() * 64L)
 #define INVALID_ADDRESS     (G_GUINT64_CONSTANT(0))
diff --git a/lib/capture/sp-capture-writer.h b/src/libsysprof-capture/sp-capture-writer.h
similarity index 97%
rename from lib/capture/sp-capture-writer.h
rename to src/libsysprof-capture/sp-capture-writer.h
index 336794b..39f817b 100644
--- a/lib/capture/sp-capture-writer.h
+++ b/src/libsysprof-capture/sp-capture-writer.h
@@ -1,6 +1,6 @@
 /* sp-capture-writer.h
  *
- * Copyright © 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This file is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the Free
@@ -14,12 +14,13 @@
  *
  * You should have received a copy of the GNU General Public License along
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#ifndef SP_CAPTURE_WRITER_H
-#define SP_CAPTURE_WRITER_H
+#pragma once
 
-#include "capture/sp-capture-types.h"
+#include "sp-capture-types.h"
 
 G_BEGIN_DECLS
 
@@ -131,5 +132,3 @@ gboolean            _sp_capture_writer_set_time_range (SpCaptureWriter         *
 #endif
 
 G_END_DECLS
-
-#endif /* SP_CAPTURE_WRITER_H */
diff --git a/lib/sysprof-capture.h b/src/libsysprof-capture/sysprof-capture.h
similarity index 72%
rename from lib/sysprof-capture.h
rename to src/libsysprof-capture/sysprof-capture.h
index 048b548..b7c1dc3 100644
--- a/lib/sysprof-capture.h
+++ b/src/libsysprof-capture/sysprof-capture.h
@@ -1,6 +1,6 @@
 /* sysprof-capture.h
  *
- * Copyright © 2018 Christian Hergert <chergert redhat com>
+ * Copyright 2018-2019 Christian Hergert <chergert redhat com>
  *
  * This file is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the Free
@@ -14,27 +14,27 @@
  *
  * You should have received a copy of the GNU General Public License along
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#ifndef SYSPROF_CAPTURE_H
-#define SYSPROF_CAPTURE_H
+#pragma once
 
 #include <glib.h>
 
 G_BEGIN_DECLS
 
-#define SYSPROF_INSIDE
+#define SYSPROF_CAPTURE_INSIDE
 
 # include "sp-address.h"
+# include "sp-capture-condition.h"
+# include "sp-capture-cursor.h"
+# include "sp-capture-reader.h"
+# include "sp-capture-writer.h"
 # include "sp-clock.h"
 # include "sp-error.h"
 # include "sysprof-version.h"
 
-# include "capture/sp-capture-reader.h"
-# include "capture/sp-capture-writer.h"
-
-#undef SYSPROF_INSIDE
+#undef SYSPROF_CAPTURE_INSIDE
 
 G_END_DECLS
-
-#endif /* SYSPROF_CAPTURE_H */
diff --git a/lib/sysprof-version.h.in b/src/libsysprof-capture/sysprof-version.h.in
similarity index 90%
rename from lib/sysprof-version.h.in
rename to src/libsysprof-capture/sysprof-version.h.in
index 90a2ca6..d511c72 100644
--- a/lib/sysprof-version.h.in
+++ b/src/libsysprof-capture/sysprof-version.h.in
@@ -1,6 +1,6 @@
 /* sysprof-version.h.in
  *
- * Copyright © 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This file is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the Free
@@ -14,13 +14,14 @@
  *
  * You should have received a copy of the GNU General Public License along
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#ifndef SYSPROF_VERSION_H
-#define SYSPROF_VERSION_H
+#pragma once
 
-#if !defined(SYSPROF_INSIDE) && !defined(SYSPROF_COMPILATION)
-# error "Only <sysprof.h> can be included directly."
+#if !defined(SYSPROF_CAPTURE_INSIDE) && !defined(SYSPROF_CAPTURE_COMPILATION)
+# error "Only <sysprof-capture.h> can be included directly."
 #endif
 
 /**
@@ -94,4 +95,3 @@
          (SYSPROF_MAJOR_VERSION == (major) && SYSPROF_MINOR_VERSION == (minor) && \
           SYSPROF_MICRO_VERSION >= (micro)))
 
-#endif /* SYSPROF_VERSION_H */
diff --git a/lib/resources/css/SpVisualizerView-Adwaita-dark.css 
b/src/libsysprof-ui/css/SpVisualizerView-Adwaita-dark.css
similarity index 100%
rename from lib/resources/css/SpVisualizerView-Adwaita-dark.css
rename to src/libsysprof-ui/css/SpVisualizerView-Adwaita-dark.css
diff --git a/lib/resources/css/SpVisualizerView-Adwaita.css 
b/src/libsysprof-ui/css/SpVisualizerView-Adwaita.css
similarity index 100%
rename from lib/resources/css/SpVisualizerView-Adwaita.css
rename to src/libsysprof-ui/css/SpVisualizerView-Adwaita.css
diff --git a/lib/resources/css/SpVisualizerView-shared.css b/src/libsysprof-ui/css/SpVisualizerView-shared.css
similarity index 100%
rename from lib/resources/css/SpVisualizerView-shared.css
rename to src/libsysprof-ui/css/SpVisualizerView-shared.css
diff --git a/lib/resources/libsysprof.gresource.xml b/src/libsysprof-ui/libsysprof-ui.gresource.xml
similarity index 100%
rename from lib/resources/libsysprof.gresource.xml
rename to src/libsysprof-ui/libsysprof-ui.gresource.xml
diff --git a/src/libsysprof-ui/meson.build b/src/libsysprof-ui/meson.build
new file mode 100644
index 0000000..92c5f61
--- /dev/null
+++ b/src/libsysprof-ui/meson.build
@@ -0,0 +1,85 @@
+libsysprof_ui_public_sources = [
+  'sp-callgraph-view.c',
+  'sp-color-cycle.c',
+  'sp-cpu-visualizer-row.c',
+  'sp-empty-state-view.c',
+  'sp-failed-state-view.c',
+  'sp-line-visualizer-row.c',
+  'sp-mark-visualizer-row.c',
+  'sp-model-filter.c',
+  'sp-multi-paned.c',
+  'sp-process-model-row.c',
+  'sp-profiler-menu-button.c',
+  'sp-recording-state-view.c',
+  'sp-visualizer-list.c',
+  'sp-visualizer-row.c',
+  'sp-visualizer-ticks.c',
+  'sp-visualizer-view.c',
+  'sp-zoom-manager.c',
+]
+
+libsysprof_ui_private_sources = [
+  'pointcache.c',
+  'rectangles.c',
+  'sp-cell-renderer-percent.c',
+  'sp-theme-manager.c',
+]
+
+libsysprof_ui_public_headers = [
+  'sp-callgraph-view.h',
+  'sp-cell-renderer-percent.h',
+  'sp-cpu-visualizer-row.h',
+  'sp-empty-state-view.h',
+  'sp-failed-state-view.h',
+  'sp-line-visualizer-row.h',
+  'sp-mark-visualizer-row.h',
+  'sp-model-filter.h',
+  'sp-multi-paned.h',
+  'sp-process-model-row.h',
+  'sp-profiler-menu-button.h',
+  'sp-recording-state-view.h',
+  'sp-visualizer-list.h',
+  'sp-visualizer-row.h',
+  'sp-visualizer-ticks.h',
+  'sp-visualizer-view.h',
+  'sp-zoom-manager.h',
+  'sysprof-ui.h',
+]
+
+libsysprof_ui_resources = gnome.compile_resources(
+  'libsysprof-ui-resources',
+  'libsysprof-ui.gresource.xml',
+  c_name: 'lisysprof_ui',
+)
+
+libsysprof_ui_deps = [
+  dependency('gio-2.0', version: glib_req_version),
+  dependency('gtk+-3.0', version: gtk_req_version),
+  libsysprof_dep,
+  libshared_dep,
+]
+
+libsysprof_ui = shared_library('sysprof-ui-@0@'.format(libsysprof_api_version),
+  libsysprof_ui_public_sources + libsysprof_ui_private_sources + libsysprof_ui_resources,
+         dependencies: libsysprof_ui_deps,
+          install_dir: get_option('libdir'),
+              install: true,
+)
+
+libsysprof_ui_dep = declare_dependency(
+               link_with: libsysprof_ui,
+            dependencies: libsysprof_ui_deps,
+     include_directories: include_directories('.'),
+)
+
+pkgconfig.generate(
+      subdirs: [ sysprof_header_subdir ],
+      version: meson.project_version(),
+         name: 'sysprof-ui-@0@'.format(libsysprof_api_version),
+     filebase: 'sysprof-ui-@0@'.format(libsysprof_api_version),
+  description: 'The UI library for GTK applications embedding sysprof',
+  install_dir: join_paths(get_option('libdir'), 'pkgconfig'),
+     requires: [ 'gio-2.0', 'gtk+-3.0' ],
+)
+
+install_headers(libsysprof_ui_public_headers, subdir: sysprof_header_subdir)
diff --git a/lib/util/pointcache.c b/src/libsysprof-ui/pointcache.c
similarity index 94%
rename from lib/util/pointcache.c
rename to src/libsysprof-ui/pointcache.c
index ccdf140..b760987 100644
--- a/lib/util/pointcache.c
+++ b/src/libsysprof-ui/pointcache.c
@@ -1,6 +1,6 @@
 /* pointcache.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,11 +14,13 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #define G_LOG_DOMAIN "pointcache"
 
-#include "util/pointcache.h"
+#include "pointcache.h"
 
 struct _PointCache
 {
diff --git a/lib/util/pointcache.h b/src/libsysprof-ui/pointcache.h
similarity index 94%
rename from lib/util/pointcache.h
rename to src/libsysprof-ui/pointcache.h
index 5accceb..a3b50b9 100644
--- a/lib/util/pointcache.h
+++ b/src/libsysprof-ui/pointcache.h
@@ -1,6 +1,6 @@
 /* pointcache.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #ifndef POINT_CACHE_H
diff --git a/lib/util/rectangles.c b/src/libsysprof-ui/rectangles.c
similarity index 97%
rename from lib/util/rectangles.c
rename to src/libsysprof-ui/rectangles.c
index 80a30d1..7dc6ff8 100644
--- a/lib/util/rectangles.c
+++ b/src/libsysprof-ui/rectangles.c
@@ -1,6 +1,6 @@
 /* rectangles.c
  *
- * Copyright 2018 Christian Hergert <chergert redhat com>
+ * Copyright 2018-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,9 +18,9 @@
  * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#include "util/rectangles.h"
-#include "util/sp-color-cycle.h"
-#include "visualizers/sp-visualizer-row.h"
+#include "rectangles.h"
+#include "sp-color-cycle.h"
+#include "sp-visualizer-row.h"
 
 typedef struct
 {
diff --git a/lib/util/rectangles.h b/src/libsysprof-ui/rectangles.h
similarity index 96%
rename from lib/util/rectangles.h
rename to src/libsysprof-ui/rectangles.h
index e733392..f71c3a4 100644
--- a/lib/util/rectangles.h
+++ b/src/libsysprof-ui/rectangles.h
@@ -1,6 +1,6 @@
 /* rectangles.h
  *
- * Copyright 2018 Christian Hergert <chergert redhat com>
+ * Copyright 2018-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/lib/callgraph/sp-callgraph-view.c b/src/libsysprof-ui/sp-callgraph-view.c
similarity index 99%
rename from lib/callgraph/sp-callgraph-view.c
rename to src/libsysprof-ui/sp-callgraph-view.c
index 4d2af31..2385ff0 100644
--- a/lib/callgraph/sp-callgraph-view.c
+++ b/src/libsysprof-ui/sp-callgraph-view.c
@@ -1,6 +1,6 @@
 /* sp-callgraph-view.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 /* Sysprof -- Sampling, systemwide CPU profiler
@@ -37,9 +39,9 @@
 
 #include <glib/gi18n.h>
 
-#include "callgraph/sp-callgraph-profile-private.h"
-#include "callgraph/sp-callgraph-view.h"
-#include "widgets/sp-cell-renderer-percent.h"
+#include "sp-callgraph-profile-private.h"
+#include "sp-callgraph-view.h"
+#include "sp-cell-renderer-percent.h"
 
 typedef struct
 {
diff --git a/lib/callgraph/sp-callgraph-view.h b/src/libsysprof-ui/sp-callgraph-view.h
similarity index 91%
rename from lib/callgraph/sp-callgraph-view.h
rename to src/libsysprof-ui/sp-callgraph-view.h
index 0d82716..9cc0d71 100644
--- a/lib/callgraph/sp-callgraph-view.h
+++ b/src/libsysprof-ui/sp-callgraph-view.h
@@ -1,6 +1,6 @@
 /* sp-callgraph-view.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #ifndef SP_CALLGRAPH_VIEW_H
@@ -21,7 +23,7 @@
 
 #include <gtk/gtk.h>
 
-#include "callgraph/sp-callgraph-profile.h"
+#include "sp-callgraph-profile.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/widgets/sp-cell-renderer-percent.c b/src/libsysprof-ui/sp-cell-renderer-percent.c
similarity index 96%
rename from lib/widgets/sp-cell-renderer-percent.c
rename to src/libsysprof-ui/sp-cell-renderer-percent.c
index 5f9ceec..898df21 100644
--- a/lib/widgets/sp-cell-renderer-percent.c
+++ b/src/libsysprof-ui/sp-cell-renderer-percent.c
@@ -1,6 +1,6 @@
 /* sp-cell-renderer-percent.c
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016-2019 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,11 +14,13 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #include <glib/gi18n.h>
 
-#include "widgets/sp-cell-renderer-percent.h"
+#include "sp-cell-renderer-percent.h"
 
 typedef struct
 {
diff --git a/lib/widgets/sp-cell-renderer-percent.h b/src/libsysprof-ui/sp-cell-renderer-percent.h
similarity index 95%
rename from lib/widgets/sp-cell-renderer-percent.h
rename to src/libsysprof-ui/sp-cell-renderer-percent.h
index 5a21fdc..56fc57f 100644
--- a/lib/widgets/sp-cell-renderer-percent.h
+++ b/src/libsysprof-ui/sp-cell-renderer-percent.h
@@ -1,6 +1,6 @@
 /* sp-cell-renderer-percent.h
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016-2019 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #ifndef SP_CELL_RENDERER_PERCENT_H
diff --git a/lib/util/sp-color-cycle.c b/src/libsysprof-ui/sp-color-cycle.c
similarity index 95%
rename from lib/util/sp-color-cycle.c
rename to src/libsysprof-ui/sp-color-cycle.c
index f827510..80b7f63 100644
--- a/lib/util/sp-color-cycle.c
+++ b/src/libsysprof-ui/sp-color-cycle.c
@@ -1,6 +1,6 @@
 /* sp-color-cycle.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,11 +14,13 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #define G_LOG_DOMAIN "sp-color-cycle"
 
-#include "util/sp-color-cycle.h"
+#include "sp-color-cycle.h"
 
 G_DEFINE_BOXED_TYPE (SpColorCycle, sp_color_cycle, sp_color_cycle_ref, sp_color_cycle_unref)
 
diff --git a/lib/util/sp-color-cycle.h b/src/libsysprof-ui/sp-color-cycle.h
similarity index 92%
rename from lib/util/sp-color-cycle.h
rename to src/libsysprof-ui/sp-color-cycle.h
index ecf65cc..4d79d48 100644
--- a/lib/util/sp-color-cycle.h
+++ b/src/libsysprof-ui/sp-color-cycle.h
@@ -1,6 +1,6 @@
 /* sp-color-cycle.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #ifndef SP_COLOR_CYCLE_H
diff --git a/lib/visualizers/sp-cpu-visualizer-row.c b/src/libsysprof-ui/sp-cpu-visualizer-row.c
similarity index 95%
rename from lib/visualizers/sp-cpu-visualizer-row.c
rename to src/libsysprof-ui/sp-cpu-visualizer-row.c
index b67fa0d..33ebfe7 100644
--- a/lib/visualizers/sp-cpu-visualizer-row.c
+++ b/src/libsysprof-ui/sp-cpu-visualizer-row.c
@@ -1,6 +1,6 @@
 /* sp-cpu-visualizer-row.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,14 +14,16 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #define G_LOG_DOMAIN "sp-cpu-visualizer-row"
 
-#include "capture/sp-capture-condition.h"
-#include "capture/sp-capture-cursor.h"
-#include "util/sp-color-cycle.h"
-#include "visualizers/sp-cpu-visualizer-row.h"
+#include "sp-capture-condition.h"
+#include "sp-capture-cursor.h"
+#include "sp-color-cycle.h"
+#include "sp-cpu-visualizer-row.h"
 
 struct _SpCpuVisualizerRow
 {
diff --git a/lib/visualizers/sp-cpu-visualizer-row.h b/src/libsysprof-ui/sp-cpu-visualizer-row.h
similarity index 87%
rename from lib/visualizers/sp-cpu-visualizer-row.h
rename to src/libsysprof-ui/sp-cpu-visualizer-row.h
index 99b0485..d2c58f2 100644
--- a/lib/visualizers/sp-cpu-visualizer-row.h
+++ b/src/libsysprof-ui/sp-cpu-visualizer-row.h
@@ -1,6 +1,6 @@
 /* sp-cpu-visualizer-row.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,12 +14,14 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #ifndef SP_CPU_VISUALIZER_ROW_H
 #define SP_CPU_VISUALIZER_ROW_H
 
-#include "visualizers/sp-line-visualizer-row.h"
+#include "sp-line-visualizer-row.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/widgets/sp-empty-state-view.c b/src/libsysprof-ui/sp-empty-state-view.c
similarity index 97%
rename from lib/widgets/sp-empty-state-view.c
rename to src/libsysprof-ui/sp-empty-state-view.c
index e98ebe6..fb551a7 100644
--- a/lib/widgets/sp-empty-state-view.c
+++ b/src/libsysprof-ui/sp-empty-state-view.c
@@ -1,6 +1,6 @@
 /* sp-empty-state-view.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,13 +14,15 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #define G_LOG_DOMAIN "sp-empty-state-view"
 
 #include <string.h>
 
-#include "widgets/sp-empty-state-view.h"
+#include "sp-empty-state-view.h"
 
 typedef struct
 {
diff --git a/lib/widgets/sp-empty-state-view.h b/src/libsysprof-ui/sp-empty-state-view.h
similarity index 90%
rename from lib/widgets/sp-empty-state-view.h
rename to src/libsysprof-ui/sp-empty-state-view.h
index 4e16e3e..45ad927 100644
--- a/lib/widgets/sp-empty-state-view.h
+++ b/src/libsysprof-ui/sp-empty-state-view.h
@@ -1,6 +1,6 @@
 /* sp-empty-state-view.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #ifndef SP_EMPTY_STATE_VIEW_H
diff --git a/lib/widgets/sp-failed-state-view.c b/src/libsysprof-ui/sp-failed-state-view.c
similarity index 89%
rename from lib/widgets/sp-failed-state-view.c
rename to src/libsysprof-ui/sp-failed-state-view.c
index 7e32201..654a7a9 100644
--- a/lib/widgets/sp-failed-state-view.c
+++ b/src/libsysprof-ui/sp-failed-state-view.c
@@ -1,6 +1,6 @@
 /* sp-failed-state-view.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,9 +14,11 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#include "widgets/sp-failed-state-view.h"
+#include "sp-failed-state-view.h"
 
 G_DEFINE_TYPE (SpFailedStateView, sp_failed_state_view, GTK_TYPE_BIN)
 
diff --git a/lib/widgets/sp-failed-state-view.h b/src/libsysprof-ui/sp-failed-state-view.h
similarity index 90%
rename from lib/widgets/sp-failed-state-view.h
rename to src/libsysprof-ui/sp-failed-state-view.h
index d977490..0826884 100644
--- a/lib/widgets/sp-failed-state-view.h
+++ b/src/libsysprof-ui/sp-failed-state-view.h
@@ -1,6 +1,6 @@
 /* sp-failed-state-view.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #ifndef SP_FAILED_STATE_VIEW_H
@@ -21,7 +23,7 @@
 
 #include <gtk/gtk.h>
 
-#include "profiler/sp-profiler.h"
+#include "sp-profiler.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/visualizers/sp-line-visualizer-row.c b/src/libsysprof-ui/sp-line-visualizer-row.c
similarity index 98%
rename from lib/visualizers/sp-line-visualizer-row.c
rename to src/libsysprof-ui/sp-line-visualizer-row.c
index cea7653..c43123d 100644
--- a/lib/visualizers/sp-line-visualizer-row.c
+++ b/src/libsysprof-ui/sp-line-visualizer-row.c
@@ -1,6 +1,6 @@
 /* sp-line-visualizer-row.c
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016-2019 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #define G_LOG_DOMAIN "sp-line-visualizer-row"
@@ -21,10 +23,10 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "util/pointcache.h"
-#include "capture/sp-capture-condition.h"
-#include "capture/sp-capture-cursor.h"
-#include "visualizers/sp-line-visualizer-row.h"
+#include "pointcache.h"
+#include "sp-capture-condition.h"
+#include "sp-capture-cursor.h"
+#include "sp-line-visualizer-row.h"
 
 typedef struct
 {
@@ -119,7 +121,7 @@ load_data_free (gpointer data)
   if (load != NULL)
     {
       g_clear_pointer (&load->lines, g_array_unref);
-      g_clear_object (&load->cursor);
+      g_clear_pointer (&load->cursor, sp_capture_cursor_unref);
       g_clear_pointer (&load->cache, point_cache_unref);
       g_slice_free (LoadData, load);
     }
diff --git a/lib/visualizers/sp-line-visualizer-row.h b/src/libsysprof-ui/sp-line-visualizer-row.h
similarity index 93%
rename from lib/visualizers/sp-line-visualizer-row.h
rename to src/libsysprof-ui/sp-line-visualizer-row.h
index 7b41244..5679f7f 100644
--- a/lib/visualizers/sp-line-visualizer-row.h
+++ b/src/libsysprof-ui/sp-line-visualizer-row.h
@@ -1,6 +1,6 @@
 /* sp-line-visualizer-row.h
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016-2019 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,12 +14,14 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #ifndef SP_LINE_VISUALIZER_ROW_H
 #define SP_LINE_VISUALIZER_ROW_H
 
-#include "visualizers/sp-visualizer-row.h"
+#include "sp-visualizer-row.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/visualizers/sp-mark-visualizer-row.c b/src/libsysprof-ui/sp-mark-visualizer-row.c
similarity index 98%
rename from lib/visualizers/sp-mark-visualizer-row.c
rename to src/libsysprof-ui/sp-mark-visualizer-row.c
index 9d75d47..383b533 100644
--- a/lib/visualizers/sp-mark-visualizer-row.c
+++ b/src/libsysprof-ui/sp-mark-visualizer-row.c
@@ -1,6 +1,6 @@
 /* sp-mark-visualizer-row.c
  *
- * Copyright 2018 Christian Hergert <chergert redhat com>
+ * Copyright 2018-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,14 +14,16 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #define G_LOG_DOMAIN "sp-mark-visualizer-row"
 
-#include "capture/sp-capture-condition.h"
-#include "capture/sp-capture-cursor.h"
-#include "util/rectangles.h"
-#include "visualizers/sp-mark-visualizer-row.h"
+#include "sp-capture-condition.h"
+#include "sp-capture-cursor.h"
+#include "rectangles.h"
+#include "sp-mark-visualizer-row.h"
 
 typedef struct
 {
@@ -204,7 +206,7 @@ sp_mark_visualizer_row_worker (GTask        *task,
   g_assert (G_IS_TASK (task));
   g_assert (SP_IS_MARK_VISUALIZER_ROW (source_object));
   g_assert (state != NULL);
-  g_assert (SP_IS_CAPTURE_CURSOR (state->cursor));
+  g_assert (state->cursor != NULL);
 
   sp_capture_cursor_foreach (state->cursor, sp_mark_visualizer_row_add_rect, state);
 
diff --git a/lib/visualizers/sp-mark-visualizer-row.h b/src/libsysprof-ui/sp-mark-visualizer-row.h
similarity index 90%
rename from lib/visualizers/sp-mark-visualizer-row.h
rename to src/libsysprof-ui/sp-mark-visualizer-row.h
index 2194ac8..4e08a18 100644
--- a/lib/visualizers/sp-mark-visualizer-row.h
+++ b/src/libsysprof-ui/sp-mark-visualizer-row.h
@@ -1,6 +1,6 @@
 /* sp-mark-visualizer-row.h
  *
- * Copyright 2018 Christian Hergert <chergert redhat com>
+ * Copyright 2018-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,11 +14,13 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #pragma once
 
-#include "visualizers/sp-visualizer-row.h"
+#include "sp-visualizer-row.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/util/sp-model-filter.c b/src/libsysprof-ui/sp-model-filter.c
similarity index 99%
rename from lib/util/sp-model-filter.c
rename to src/libsysprof-ui/sp-model-filter.c
index ae0ad86..9dea38e 100644
--- a/lib/util/sp-model-filter.c
+++ b/src/libsysprof-ui/sp-model-filter.c
@@ -1,6 +1,6 @@
 /* sp-model-filter.c
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016-2019 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,9 +14,11 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#include "util/sp-model-filter.h"
+#include "sp-model-filter.h"
 
 typedef struct
 {
diff --git a/lib/util/sp-model-filter.h b/src/libsysprof-ui/sp-model-filter.h
similarity index 93%
rename from lib/util/sp-model-filter.h
rename to src/libsysprof-ui/sp-model-filter.h
index a74a04c..c47bb80 100644
--- a/lib/util/sp-model-filter.h
+++ b/src/libsysprof-ui/sp-model-filter.h
@@ -1,6 +1,6 @@
 /* sp-model-filter.h
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016-2019 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #ifndef SP_MODEL_FILTER_H
diff --git a/lib/widgets/sp-multi-paned.c b/src/libsysprof-ui/sp-multi-paned.c
similarity index 99%
rename from lib/widgets/sp-multi-paned.c
rename to src/libsysprof-ui/sp-multi-paned.c
index 7feee18..2a2c8df 100644
--- a/lib/widgets/sp-multi-paned.c
+++ b/src/libsysprof-ui/sp-multi-paned.c
@@ -1,6 +1,6 @@
 /* sp-multi-paned.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -15,9 +15,11 @@
  * You should have received a copy of the GNU Lesser General Public License
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#include "widgets/sp-multi-paned.h"
+#include "sp-multi-paned.h"
 
 #define HANDLE_WIDTH  10
 #define HANDLE_HEIGHT 10
diff --git a/lib/widgets/sp-multi-paned.h b/src/libsysprof-ui/sp-multi-paned.h
similarity index 93%
rename from lib/widgets/sp-multi-paned.h
rename to src/libsysprof-ui/sp-multi-paned.h
index 1dd88fe..4618595 100644
--- a/lib/widgets/sp-multi-paned.h
+++ b/src/libsysprof-ui/sp-multi-paned.h
@@ -1,6 +1,6 @@
 /* sp-multi-paned.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -15,6 +15,8 @@
  * You should have received a copy of the GNU Lesser General Public License
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #ifndef SP_MULTI_PANED_H
diff --git a/lib/widgets/sp-process-model-row.c b/src/libsysprof-ui/sp-process-model-row.c
similarity index 98%
rename from lib/widgets/sp-process-model-row.c
rename to src/libsysprof-ui/sp-process-model-row.c
index d2e6ca6..f4d7c43 100644
--- a/lib/widgets/sp-process-model-row.c
+++ b/src/libsysprof-ui/sp-process-model-row.c
@@ -1,6 +1,6 @@
 /* sp-process-model-row.c
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016-2019 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,9 +14,11 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#include "widgets/sp-process-model-row.h"
+#include "sp-process-model-row.h"
 
 typedef struct
 {
diff --git a/lib/widgets/sp-process-model-row.h b/src/libsysprof-ui/sp-process-model-row.h
similarity index 91%
rename from lib/widgets/sp-process-model-row.h
rename to src/libsysprof-ui/sp-process-model-row.h
index a13faec..ffa76e5 100644
--- a/lib/widgets/sp-process-model-row.h
+++ b/src/libsysprof-ui/sp-process-model-row.h
@@ -1,6 +1,6 @@
 /* sp-process-model-row.h
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016-2019 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #ifndef SP_PROCESS_MODEL_ROW_H
@@ -21,7 +23,7 @@
 
 #include <gtk/gtk.h>
 
-#include "util/sp-process-model-item.h"
+#include "sp-process-model-item.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/widgets/sp-profiler-menu-button.c b/src/libsysprof-ui/sp-profiler-menu-button.c
similarity index 99%
rename from lib/widgets/sp-profiler-menu-button.c
rename to src/libsysprof-ui/sp-profiler-menu-button.c
index 09ddacb..12e4a7f 100644
--- a/lib/widgets/sp-profiler-menu-button.c
+++ b/src/libsysprof-ui/sp-profiler-menu-button.c
@@ -1,6 +1,6 @@
 /* sp-profiler-menu-button.c
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016-2019 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,16 +14,18 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #include <glib/gi18n.h>
 #include <string.h>
 
-#include "util/sp-model-filter.h"
-#include "util/sp-process-model.h"
-#include "util/sp-process-model-item.h"
-#include "widgets/sp-process-model-row.h"
-#include "widgets/sp-profiler-menu-button.h"
+#include "sp-model-filter.h"
+#include "sp-process-model.h"
+#include "sp-process-model-item.h"
+#include "sp-process-model-row.h"
+#include "sp-profiler-menu-button.h"
 
 typedef struct
 {
diff --git a/lib/widgets/sp-profiler-menu-button.h b/src/libsysprof-ui/sp-profiler-menu-button.h
similarity index 91%
rename from lib/widgets/sp-profiler-menu-button.h
rename to src/libsysprof-ui/sp-profiler-menu-button.h
index c7f9611..040a9e6 100644
--- a/lib/widgets/sp-profiler-menu-button.h
+++ b/src/libsysprof-ui/sp-profiler-menu-button.h
@@ -1,6 +1,6 @@
 /* sp-profiler-menu-button.h
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016-2019 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #ifndef SP_PROFILER_MENU_BUTTON_H
@@ -21,7 +23,7 @@
 
 #include <gtk/gtk.h>
 
-#include "profiler/sp-profiler.h"
+#include "sp-profiler.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/widgets/sp-recording-state-view.c b/src/libsysprof-ui/sp-recording-state-view.c
similarity index 97%
rename from lib/widgets/sp-recording-state-view.c
rename to src/libsysprof-ui/sp-recording-state-view.c
index 9094721..cdbec30 100644
--- a/lib/widgets/sp-recording-state-view.c
+++ b/src/libsysprof-ui/sp-recording-state-view.c
@@ -1,6 +1,6 @@
 /* sp-recording-state-view.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,9 +14,11 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#include "widgets/sp-recording-state-view.h"
+#include "sp-recording-state-view.h"
 
 typedef struct
 {
diff --git a/lib/widgets/sp-recording-state-view.h b/src/libsysprof-ui/sp-recording-state-view.h
similarity index 90%
rename from lib/widgets/sp-recording-state-view.h
rename to src/libsysprof-ui/sp-recording-state-view.h
index efa7c68..5654c06 100644
--- a/lib/widgets/sp-recording-state-view.h
+++ b/src/libsysprof-ui/sp-recording-state-view.h
@@ -1,6 +1,6 @@
 /* sp-recording-state-view.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #ifndef SP_RECORDING_STATE_VIEW_H
@@ -21,7 +23,7 @@
 
 #include <gtk/gtk.h>
 
-#include "profiler/sp-profiler.h"
+#include "sp-profiler.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/util/sp-theme-manager.c b/src/libsysprof-ui/sp-theme-manager.c
similarity index 98%
rename from lib/util/sp-theme-manager.c
rename to src/libsysprof-ui/sp-theme-manager.c
index f6320ec..03f4d39 100644
--- a/lib/util/sp-theme-manager.c
+++ b/src/libsysprof-ui/sp-theme-manager.c
@@ -1,6 +1,6 @@
 /* sp-theme-manager.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,11 +14,13 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #define G_LOG_DOMAIN "sp-theme-manager"
 
-#include "util/sp-theme-manager.h"
+#include "sp-theme-manager.h"
 
 struct _SpThemeManager
 {
diff --git a/lib/util/sp-theme-manager.h b/src/libsysprof-ui/sp-theme-manager.h
similarity index 93%
rename from lib/util/sp-theme-manager.h
rename to src/libsysprof-ui/sp-theme-manager.h
index c01098b..f010135 100644
--- a/lib/util/sp-theme-manager.h
+++ b/src/libsysprof-ui/sp-theme-manager.h
@@ -1,6 +1,6 @@
 /* sp-theme-manager.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #ifndef SP_THEME_MANAGER_H
diff --git a/lib/visualizers/sp-visualizer-list.c b/src/libsysprof-ui/sp-visualizer-list.c
similarity index 96%
rename from lib/visualizers/sp-visualizer-list.c
rename to src/libsysprof-ui/sp-visualizer-list.c
index e4edc30..7a4279b 100644
--- a/lib/visualizers/sp-visualizer-list.c
+++ b/src/libsysprof-ui/sp-visualizer-list.c
@@ -1,6 +1,6 @@
 /* sp-visualizer-list.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,19 +14,20 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #define G_LOG_DOMAIN "sp-visualizer-list"
 
 #include <glib/gi18n.h>
+#include <sysprof.h>
 
-#include "capture/sp-capture-condition.h"
-#include "capture/sp-capture-cursor.h"
-#include "visualizers/sp-cpu-visualizer-row.h"
-#include "visualizers/sp-visualizer-list.h"
-#include "visualizers/sp-visualizer-row.h"
-#include "visualizers/sp-mark-visualizer-row.h"
-#include "util/sp-zoom-manager.h"
+#include "sp-cpu-visualizer-row.h"
+#include "sp-visualizer-list.h"
+#include "sp-visualizer-row.h"
+#include "sp-mark-visualizer-row.h"
+#include "sp-zoom-manager.h"
 
 #define NSEC_PER_SEC              G_GUINT64_CONSTANT(1000000000)
 #define DEFAULT_PIXELS_PER_SECOND 20
@@ -64,7 +65,7 @@ discovery_free (Discovery *state)
 {
   g_clear_pointer (&state->mark_groups, g_hash_table_unref);
   g_clear_pointer (&state->memory, g_array_unref);
-  g_clear_object (&state->cursor);
+  g_clear_pointer (&state->cursor, sp_capture_cursor_unref);
   g_slice_free (Discovery, state);
 }
 
@@ -258,7 +259,7 @@ discover_new_rows_worker (GTask        *task,
   Discovery *state = task_data;
 
   g_assert (state != NULL);
-  g_assert (SP_IS_CAPTURE_CURSOR (state->cursor));
+  g_assert (state->cursor != NULL);
 
   sp_capture_cursor_foreach (state->cursor, discover_new_rows_frame_cb, state);
   g_task_return_boolean (task, TRUE);
diff --git a/lib/visualizers/sp-visualizer-list.h b/src/libsysprof-ui/sp-visualizer-list.h
similarity index 91%
rename from lib/visualizers/sp-visualizer-list.h
rename to src/libsysprof-ui/sp-visualizer-list.h
index 0d2c41e..6fe8927 100644
--- a/lib/visualizers/sp-visualizer-list.h
+++ b/src/libsysprof-ui/sp-visualizer-list.h
@@ -1,6 +1,6 @@
 /* sp-visualizer-list.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #ifndef SP_VISUALIZER_LIST_H
@@ -21,8 +23,8 @@
 
 #include <gtk/gtk.h>
 
-#include "capture/sp-capture-reader.h"
-#include "util/sp-zoom-manager.h"
+#include "sp-capture-reader.h"
+#include "sp-zoom-manager.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/visualizers/sp-visualizer-row-private.h b/src/libsysprof-ui/sp-visualizer-row-private.h
similarity index 86%
rename from lib/visualizers/sp-visualizer-row-private.h
rename to src/libsysprof-ui/sp-visualizer-row-private.h
index 53cdc45..c000a99 100644
--- a/lib/visualizers/sp-visualizer-row-private.h
+++ b/src/libsysprof-ui/sp-visualizer-row-private.h
@@ -1,6 +1,6 @@
 /* sp-visualizer-row-private.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,12 +14,14 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #ifndef SP_VISUALIZER_ROW_PRIVATE_H
 #define SP_VISUALIZER_ROW_PRIVATE_H
 
-#include "visualizers/sp-visualizer-row.h"
+#include "sp-visualizer-row.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/visualizers/sp-visualizer-row.c b/src/libsysprof-ui/sp-visualizer-row.c
similarity index 98%
rename from lib/visualizers/sp-visualizer-row.c
rename to src/libsysprof-ui/sp-visualizer-row.c
index 09a5429..8e2a9fe 100644
--- a/lib/visualizers/sp-visualizer-row.c
+++ b/src/libsysprof-ui/sp-visualizer-row.c
@@ -1,6 +1,6 @@
 /* sp-visualizer-row.c
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016-2019 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,12 +14,14 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #define G_LOG_DOMAIN "sp-visualizer-row"
 
-#include "visualizers/sp-visualizer-row.h"
-#include "visualizers/sp-visualizer-row-private.h"
+#include "sp-visualizer-row.h"
+#include "sp-visualizer-row-private.h"
 
 #define NSEC_PER_SEC              G_GINT64_CONSTANT(1000000000)
 #define DEFAULT_PIXELS_PER_SECOND 20
diff --git a/lib/visualizers/sp-visualizer-row.h b/src/libsysprof-ui/sp-visualizer-row.h
similarity index 93%
rename from lib/visualizers/sp-visualizer-row.h
rename to src/libsysprof-ui/sp-visualizer-row.h
index 2f15d95..f7885a7 100644
--- a/lib/visualizers/sp-visualizer-row.h
+++ b/src/libsysprof-ui/sp-visualizer-row.h
@@ -1,6 +1,6 @@
 /* sp-visualizer-row.h
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016-2019 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #ifndef SP_VISUALIZER_ROW_H
@@ -21,8 +23,8 @@
 
 #include <gtk/gtk.h>
 
-#include "capture/sp-capture-reader.h"
-#include "util/sp-zoom-manager.h"
+#include "sp-capture-reader.h"
+#include "sp-zoom-manager.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/visualizers/sp-visualizer-ticks.c b/src/libsysprof-ui/sp-visualizer-ticks.c
similarity index 98%
rename from lib/visualizers/sp-visualizer-ticks.c
rename to src/libsysprof-ui/sp-visualizer-ticks.c
index 5386c59..777e250 100644
--- a/lib/visualizers/sp-visualizer-ticks.c
+++ b/src/libsysprof-ui/sp-visualizer-ticks.c
@@ -1,6 +1,6 @@
 /* sp-visualizer-ticks.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,11 +14,13 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #include <glib/gi18n.h>
 
-#include "visualizers/sp-visualizer-ticks.h"
+#include "sp-visualizer-ticks.h"
 
 #define NSEC_PER_SEC G_GINT64_CONSTANT(1000000000)
 #define NSEC_PER_HOUR (NSEC_PER_SEC * 60 * 60)
diff --git a/lib/visualizers/sp-visualizer-ticks.h b/src/libsysprof-ui/sp-visualizer-ticks.h
similarity index 93%
rename from lib/visualizers/sp-visualizer-ticks.h
rename to src/libsysprof-ui/sp-visualizer-ticks.h
index 5efeee3..1531759 100644
--- a/lib/visualizers/sp-visualizer-ticks.h
+++ b/src/libsysprof-ui/sp-visualizer-ticks.h
@@ -1,6 +1,6 @@
 /* sp-visualizer-ticks.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #ifndef SP_VISUALIZER_TICKS_H
diff --git a/lib/visualizers/sp-visualizer-view.c b/src/libsysprof-ui/sp-visualizer-view.c
similarity index 98%
rename from lib/visualizers/sp-visualizer-view.c
rename to src/libsysprof-ui/sp-visualizer-view.c
index e889dd0..6ee0c1f 100644
--- a/lib/visualizers/sp-visualizer-view.c
+++ b/src/libsysprof-ui/sp-visualizer-view.c
@@ -1,6 +1,6 @@
 /* sp-visualizer-view.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,19 +14,21 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #define G_LOG_DOMAIN "sp-visualizer-view"
 
 #include <glib/gi18n.h>
 
-#include "util/sp-theme-manager.h"
-#include "visualizers/sp-visualizer-list.h"
-#include "visualizers/sp-visualizer-row.h"
-#include "visualizers/sp-visualizer-row-private.h"
-#include "util/sp-selection.h"
-#include "visualizers/sp-visualizer-ticks.h"
-#include "visualizers/sp-visualizer-view.h"
+#include "sp-theme-manager.h"
+#include "sp-visualizer-list.h"
+#include "sp-visualizer-row.h"
+#include "sp-visualizer-row-private.h"
+#include "sp-selection.h"
+#include "sp-visualizer-ticks.h"
+#include "sp-visualizer-view.h"
 
 #define NSEC_PER_SEC G_GINT64_CONSTANT(1000000000)
 #define DEFAULT_PIXELS_PER_SECOND 20
diff --git a/lib/visualizers/sp-visualizer-view.h b/src/libsysprof-ui/sp-visualizer-view.h
similarity index 91%
rename from lib/visualizers/sp-visualizer-view.h
rename to src/libsysprof-ui/sp-visualizer-view.h
index 953558f..15c7396 100644
--- a/lib/visualizers/sp-visualizer-view.h
+++ b/src/libsysprof-ui/sp-visualizer-view.h
@@ -1,6 +1,6 @@
 /* sp-visualizer-view.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,16 +14,19 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #ifndef SP_VISUALIZER_VIEW_H
 #define SP_VISUALIZER_VIEW_H
 
 #include <gtk/gtk.h>
+#include <sysprof.h>
 
-#include "visualizers/sp-visualizer-row.h"
-#include "util/sp-selection.h"
-#include "util/sp-zoom-manager.h"
+#include "sp-visualizer-row.h"
+#include "sp-selection.h"
+#include "sp-zoom-manager.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/util/sp-zoom-manager.c b/src/libsysprof-ui/sp-zoom-manager.c
similarity index 98%
rename from lib/util/sp-zoom-manager.c
rename to src/libsysprof-ui/sp-zoom-manager.c
index 39f2b63..03fd359 100644
--- a/lib/util/sp-zoom-manager.c
+++ b/src/libsysprof-ui/sp-zoom-manager.c
@@ -1,6 +1,6 @@
 /* sp-zoom-manager.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #define G_LOG_DOMAIN "sp-zoom-manager"
@@ -21,7 +23,7 @@
 #include <glib/gi18n.h>
 #include <gio/gio.h>
 
-#include "util/sp-zoom-manager.h"
+#include "sp-zoom-manager.h"
 
 struct _SpZoomManager
 {
diff --git a/lib/util/sp-zoom-manager.h b/src/libsysprof-ui/sp-zoom-manager.h
similarity index 94%
rename from lib/util/sp-zoom-manager.h
rename to src/libsysprof-ui/sp-zoom-manager.h
index ca2a786..29c8231 100644
--- a/lib/util/sp-zoom-manager.h
+++ b/src/libsysprof-ui/sp-zoom-manager.h
@@ -1,6 +1,6 @@
 /* sp-zoom-manager.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #ifndef SP_ZOOM_MANAGER_H
diff --git a/lib/sysprof-ui.h b/src/libsysprof-ui/sysprof-ui.h
similarity index 53%
rename from lib/sysprof-ui.h
rename to src/libsysprof-ui/sysprof-ui.h
index 8bb4c85..f8f4830 100644
--- a/lib/sysprof-ui.h
+++ b/src/libsysprof-ui/sysprof-ui.h
@@ -1,6 +1,6 @@
 /* sysprof-ui.h
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016-2019 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #ifndef SYSPROF_UI_H
@@ -24,22 +26,22 @@
 G_BEGIN_DECLS
 
 #define SYSPROF_INSIDE
-# include "callgraph/sp-callgraph-view.h"
-# include "widgets/sp-cell-renderer-percent.h"
-# include "visualizers/sp-cpu-visualizer-row.h"
-# include "widgets/sp-failed-state-view.h"
-# include "visualizers/sp-line-visualizer-row.h"
-# include "widgets/sp-empty-state-view.h"
-# include "util/sp-model-filter.h"
-# include "widgets/sp-multi-paned.h"
-# include "widgets/sp-recording-state-view.h"
-# include "util/sp-process-model.h"
-# include "util/sp-process-model-item.h"
-# include "widgets/sp-process-model-row.h"
-# include "widgets/sp-profiler-menu-button.h"
-# include "visualizers/sp-visualizer-row.h"
-# include "visualizers/sp-visualizer-view.h"
-# include "util/sp-zoom-manager.h"
+# include "sp-callgraph-view.h"
+# include "sp-cell-renderer-percent.h"
+# include "sp-cpu-visualizer-row.h"
+# include "sp-failed-state-view.h"
+# include "sp-line-visualizer-row.h"
+# include "sp-empty-state-view.h"
+# include "sp-model-filter.h"
+# include "sp-multi-paned.h"
+# include "sp-recording-state-view.h"
+# include "sp-process-model.h"
+# include "sp-process-model-item.h"
+# include "sp-process-model-row.h"
+# include "sp-profiler-menu-button.h"
+# include "sp-visualizer-row.h"
+# include "sp-visualizer-view.h"
+# include "sp-zoom-manager.h"
 #undef SYSPROF_INSIDE
 
 G_END_DECLS
diff --git a/lib/resources/ui/sp-callgraph-view.ui b/src/libsysprof-ui/ui/sp-callgraph-view.ui
similarity index 100%
rename from lib/resources/ui/sp-callgraph-view.ui
rename to src/libsysprof-ui/ui/sp-callgraph-view.ui
diff --git a/lib/resources/ui/sp-empty-state-view.ui b/src/libsysprof-ui/ui/sp-empty-state-view.ui
similarity index 100%
rename from lib/resources/ui/sp-empty-state-view.ui
rename to src/libsysprof-ui/ui/sp-empty-state-view.ui
diff --git a/lib/resources/ui/sp-failed-state-view.ui b/src/libsysprof-ui/ui/sp-failed-state-view.ui
similarity index 100%
rename from lib/resources/ui/sp-failed-state-view.ui
rename to src/libsysprof-ui/ui/sp-failed-state-view.ui
diff --git a/lib/resources/ui/sp-process-model-row.ui b/src/libsysprof-ui/ui/sp-process-model-row.ui
similarity index 100%
rename from lib/resources/ui/sp-process-model-row.ui
rename to src/libsysprof-ui/ui/sp-process-model-row.ui
diff --git a/lib/resources/ui/sp-profiler-menu-button.ui b/src/libsysprof-ui/ui/sp-profiler-menu-button.ui
similarity index 100%
rename from lib/resources/ui/sp-profiler-menu-button.ui
rename to src/libsysprof-ui/ui/sp-profiler-menu-button.ui
diff --git a/lib/resources/ui/sp-recording-state-view.ui b/src/libsysprof-ui/ui/sp-recording-state-view.ui
similarity index 100%
rename from lib/resources/ui/sp-recording-state-view.ui
rename to src/libsysprof-ui/ui/sp-recording-state-view.ui
diff --git a/lib/resources/ui/sp-visualizer-view.ui b/src/libsysprof-ui/ui/sp-visualizer-view.ui
similarity index 100%
rename from lib/resources/ui/sp-visualizer-view.ui
rename to src/libsysprof-ui/ui/sp-visualizer-view.ui
diff --git a/lib/util/binfile.c b/src/libsysprof/binfile.c
similarity index 99%
rename from lib/util/binfile.c
rename to src/libsysprof/binfile.c
index 133bc9f..a876179 100644
--- a/lib/util/binfile.c
+++ b/src/libsysprof/binfile.c
@@ -35,10 +35,9 @@
 #include <sys/stat.h>
 #include <stdint.h>
 
-#include "util/binfile.h"
-#include "util/elfparser.h"
-
-#include "symbols/sp-symbol-dirs.h"
+#include "binfile.h"
+#include "elfparser.h"
+#include "sp-symbol-dirs.h"
 
 struct bin_file_t
 {
diff --git a/lib/util/binfile.h b/src/libsysprof/binfile.h
similarity index 100%
rename from lib/util/binfile.h
rename to src/libsysprof/binfile.h
diff --git a/lib/util/demangle.cpp b/src/libsysprof/demangle.cpp
similarity index 100%
rename from lib/util/demangle.cpp
rename to src/libsysprof/demangle.cpp
diff --git a/lib/util/demangle.h b/src/libsysprof/demangle.h
similarity index 93%
rename from lib/util/demangle.h
rename to src/libsysprof/demangle.h
index 0783ad5..bbd482d 100644
--- a/lib/util/demangle.h
+++ b/src/libsysprof/demangle.h
@@ -1,6 +1,6 @@
 /* demangle.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/lib/util/elfparser.c b/src/libsysprof/elfparser.c
similarity index 99%
rename from lib/util/elfparser.c
rename to src/libsysprof/elfparser.c
index 58b9c08..881bcc2 100644
--- a/lib/util/elfparser.c
+++ b/src/libsysprof/elfparser.c
@@ -20,8 +20,8 @@
 #include <elf.h>
 #include <sys/mman.h>
 
-#include "util/demangle.h"
-#include "util/elfparser.h"
+#include "demangle.h"
+#include "elfparser.h"
 
 typedef struct Section Section;
 
diff --git a/lib/util/elfparser.h b/src/libsysprof/elfparser.h
similarity index 100%
rename from lib/util/elfparser.h
rename to src/libsysprof/elfparser.h
diff --git a/src/libsysprof/meson.build b/src/libsysprof/meson.build
new file mode 100644
index 0000000..597597b
--- /dev/null
+++ b/src/libsysprof/meson.build
@@ -0,0 +1,97 @@
+libsysprof_public_sources = [
+  'sp-callgraph-profile.c',
+  'sp-capture-gobject.c',
+  'sp-elf-symbol-resolver.c',
+  'sp-gjs-source.c',
+  'sp-hostinfo-source.c',
+  'sp-jitmap-symbol-resolver.c',
+  'sp-kernel-symbol.c',
+  'sp-kernel-symbol-resolver.c',
+  'sp-local-profiler.c',
+  'sp-map-lookaside.c',
+  'sp-memory-source.c',
+  'sp-perf-counter.c',
+  'sp-perf-source.c',
+  'sp-process-model.c',
+  'sp-process-model-item.c',
+  'sp-proc-source.c',
+  'sp-profile.c',
+  'sp-profiler.c',
+  'sp-selection.c',
+  'sp-source.c',
+  'sp-symbol-dirs.c',
+  'sp-symbol-resolver.c',
+]
+
+libsysprof_public_headers = [
+  'sp-callgraph-profile.h',
+  'sp-callgraph-profile-private.h',
+  'sp-capture-gobject.h',
+  'sp-elf-symbol-resolver.h',
+  'sp-gjs-source.h',
+  'sp-hostinfo-source.h',
+  'sp-jitmap-symbol-resolver.h',
+  'sp-kernel-symbol.h',
+  'sp-kernel-symbol-resolver.h',
+  'sp-local-profiler.h',
+  'sp-map-lookaside.h',
+  'sp-memory-source.h',
+  'sp-perf-counter.h',
+  'sp-perf-source.h',
+  'sp-process-model.h',
+  'sp-process-model-item.h',
+  'sp-proc-source.h',
+  'sp-profile.h',
+  'sp-profiler.h',
+  'sp-selection.h',
+  'sp-source.h',
+  'sp-symbol-dirs.h',
+  'sp-symbol-resolver.h',
+  'sysprof.h',
+]
+
+libsysprof_private_sources = [
+  'binfile.c',
+  'demangle.cpp',
+  'elfparser.c',
+  'stackstash.c',
+  'sp-source-util.c',
+]
+
+libsysprof_deps = [
+  cxx.find_library('stdc++'),
+  dependency('gio-2.0', version: glib_req_version),
+  dependency('gio-unix-2.0', version: glib_req_version),
+  libsysprof_capture_dep,
+  libshared_dep,
+]
+
+if get_option('with_sysprofd') != 'none'
+  libsysprof_deps += dependency('polkit-gobject-1')
+endif
+
+libsysprof = shared_library('sysprof-@0@'.format(libsysprof_api_version),
+  libsysprof_public_sources + libsysprof_private_sources,
+  dependencies: libsysprof_deps,
+        c_args: [ '-DSYSPROF_COMPILATION' ],
+       install: true,
+   install_dir: get_option('libdir'),
+)
+
+libsysprof_dep = declare_dependency(
+            link_with: libsysprof,
+         dependencies: libsysprof_deps,
+  include_directories: include_directories('.'),
+)
+
+pkgconfig.generate(
+      subdirs: [ sysprof_header_subdir ],
+      version: meson.project_version(),
+         name: 'sysprof-@0@'.format(libsysprof_api_version),
+     filebase: 'sysprof-@0@'.format(libsysprof_api_version),
+  description: 'The library for console applications embedding sysprof',
+  install_dir: join_paths(get_option('libdir'), 'pkgconfig'),
+     requires: [ 'gio-2.0' ],
+)
+
+install_headers(libsysprof_public_headers, subdir: sysprof_header_subdir)
diff --git a/lib/callgraph/sp-callgraph-profile-private.h b/src/libsysprof/sp-callgraph-profile-private.h
similarity index 87%
rename from lib/callgraph/sp-callgraph-profile-private.h
rename to src/libsysprof/sp-callgraph-profile-private.h
index 59d1b9c..62816f5 100644
--- a/lib/callgraph/sp-callgraph-profile-private.h
+++ b/src/libsysprof/sp-callgraph-profile-private.h
@@ -1,6 +1,6 @@
 /* sp-callgraph-profile-private.h
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,8 +19,8 @@
 #ifndef SP_CALLGRAPH_PROFILE_PRIVATE_H
 #define SP_CALLGRAPH_PROFILE_PRIVATE_H
 
-#include "callgraph/sp-callgraph-profile.h"
-#include "util/stackstash.h"
+#include "sp-callgraph-profile.h"
+#include "stackstash.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/callgraph/sp-callgraph-profile.c b/src/libsysprof/sp-callgraph-profile.c
similarity index 97%
rename from lib/callgraph/sp-callgraph-profile.c
rename to src/libsysprof/sp-callgraph-profile.c
index d0c0442..5bb90b8 100644
--- a/lib/callgraph/sp-callgraph-profile.c
+++ b/src/libsysprof/sp-callgraph-profile.c
@@ -1,6 +1,6 @@
 /* sp-callgraph-profile.c
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -36,19 +36,18 @@
 
 #include <glib/gi18n.h>
 #include <string.h>
+#include <sysprof-capture.h>
 #include <unistd.h>
 
-#include "sp-address.h"
-#include "callgraph/sp-callgraph-profile.h"
-#include "callgraph/sp-callgraph-profile-private.h"
-#include "capture/sp-capture-reader.h"
-#include "symbols/sp-elf-symbol-resolver.h"
-#include "symbols/sp-jitmap-symbol-resolver.h"
-#include "util/sp-map-lookaside.h"
-#include "symbols/sp-kernel-symbol-resolver.h"
-#include "util/sp-selection.h"
-
-#include "util/stackstash.h"
+#include "sp-callgraph-profile.h"
+#include "sp-callgraph-profile-private.h"
+#include "sp-capture-reader.h"
+#include "sp-elf-symbol-resolver.h"
+#include "sp-jitmap-symbol-resolver.h"
+#include "sp-map-lookaside.h"
+#include "sp-kernel-symbol-resolver.h"
+#include "sp-selection.h"
+#include "stackstash.h"
 
 #define CHECK_CANCELLABLE_INTERVAL 100
 
diff --git a/lib/callgraph/sp-callgraph-profile.h b/src/libsysprof/sp-callgraph-profile.h
similarity index 90%
rename from lib/callgraph/sp-callgraph-profile.h
rename to src/libsysprof/sp-callgraph-profile.h
index 501bb89..0ff02a1 100644
--- a/lib/callgraph/sp-callgraph-profile.h
+++ b/src/libsysprof/sp-callgraph-profile.h
@@ -1,6 +1,6 @@
 /* sp-callgraph-profile.h
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,8 +19,8 @@
 #ifndef SP_CALLGRAPH_PROFILE_H
 #define SP_CALLGRAPH_PROFILE_H
 
-#include "profiler/sp-profile.h"
-#include "util/sp-selection.h"
+#include "sp-profile.h"
+#include "sp-selection.h"
 
 G_BEGIN_DECLS
 
diff --git a/src/libsysprof/sp-capture-gobject.c b/src/libsysprof/sp-capture-gobject.c
new file mode 100644
index 0000000..9fa0294
--- /dev/null
+++ b/src/libsysprof/sp-capture-gobject.c
@@ -0,0 +1,25 @@
+/* sp-capture-gobject.c
+ *
+ * Copyright 2019 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#include "sp-capture-gobject.h"
+
+G_DEFINE_BOXED_TYPE (SpCaptureReader, sp_capture_reader, (GBoxedCopyFunc)sp_capture_reader_ref, 
(GBoxedFreeFunc)sp_capture_reader_unref)
+G_DEFINE_BOXED_TYPE (SpCaptureWriter, sp_capture_writer, (GBoxedCopyFunc)sp_capture_writer_ref, 
(GBoxedFreeFunc)sp_capture_writer_unref)
+G_DEFINE_BOXED_TYPE (SpCaptureCursor, sp_capture_cursor, (GBoxedCopyFunc)sp_capture_cursor_ref, 
(GBoxedFreeFunc)sp_capture_cursor_unref)
diff --git a/src/libsysprof/sp-capture-gobject.h b/src/libsysprof/sp-capture-gobject.h
new file mode 100644
index 0000000..540da2f
--- /dev/null
+++ b/src/libsysprof/sp-capture-gobject.h
@@ -0,0 +1,36 @@
+/* sp-capture-gobject.h
+ *
+ * Copyright 2019 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <glib-object.h>
+#include <sysprof-capture.h>
+
+G_BEGIN_DECLS
+
+#define SP_TYPE_CAPTURE_READER (sp_capture_reader_get_type())
+#define SP_TYPE_CAPTURE_WRITER (sp_capture_writer_get_type())
+#define SP_TYPE_CAPTURE_CURSOR (sp_capture_cursor_get_type())
+
+GType sp_capture_reader_get_type (void);
+GType sp_capture_writer_get_type (void);
+GType sp_capture_cursor_get_type (void);
+
+G_END_DECLS
diff --git a/lib/symbols/sp-elf-symbol-resolver.c b/src/libsysprof/sp-elf-symbol-resolver.c
similarity index 98%
rename from lib/symbols/sp-elf-symbol-resolver.c
rename to src/libsysprof/sp-elf-symbol-resolver.c
index 5b55f6e..c967aaf 100644
--- a/lib/symbols/sp-elf-symbol-resolver.c
+++ b/src/libsysprof/sp-elf-symbol-resolver.c
@@ -1,6 +1,6 @@
 /* sp-elf-symbol-resolver.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,10 +18,10 @@
 
 #include <string.h>
 
-#include "symbols/sp-elf-symbol-resolver.h"
-#include "util/binfile.h"
-#include "util/elfparser.h"
-#include "util/sp-map-lookaside.h"
+#include "sp-elf-symbol-resolver.h"
+#include "binfile.h"
+#include "elfparser.h"
+#include "sp-map-lookaside.h"
 
 struct _SpElfSymbolResolver
 {
diff --git a/lib/symbols/sp-elf-symbol-resolver.h b/src/libsysprof/sp-elf-symbol-resolver.h
similarity index 91%
rename from lib/symbols/sp-elf-symbol-resolver.h
rename to src/libsysprof/sp-elf-symbol-resolver.h
index 0982f5b..659c6ee 100644
--- a/lib/symbols/sp-elf-symbol-resolver.h
+++ b/src/libsysprof/sp-elf-symbol-resolver.h
@@ -1,6 +1,6 @@
 /* sp-elf-symbol-resolver.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
 #ifndef SP_ELF_SYMBOL_RESOLVER_H
 #define SP_ELF_SYMBOL_RESOLVER_H
 
-#include "symbols/sp-symbol-resolver.h"
+#include "sp-symbol-resolver.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/sources/sp-gjs-source.c b/src/libsysprof/sp-gjs-source.c
similarity index 97%
rename from lib/sources/sp-gjs-source.c
rename to src/libsysprof/sp-gjs-source.c
index b607b93..615fe7e 100644
--- a/lib/sources/sp-gjs-source.c
+++ b/src/libsysprof/sp-gjs-source.c
@@ -1,6 +1,6 @@
 /* sp-gjs-source.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,8 +19,8 @@
 #include <signal.h>
 #include <string.h>
 
-#include "capture/sp-capture-reader.h"
-#include "sources/sp-gjs-source.h"
+#include "sp-capture-reader.h"
+#include "sp-gjs-source.h"
 
 struct _SpGjsSource
 {
diff --git a/lib/sources/sp-gjs-source.h b/src/libsysprof/sp-gjs-source.h
similarity index 91%
rename from lib/sources/sp-gjs-source.h
rename to src/libsysprof/sp-gjs-source.h
index b8247bd..94836c3 100644
--- a/lib/sources/sp-gjs-source.h
+++ b/src/libsysprof/sp-gjs-source.h
@@ -1,6 +1,6 @@
 /* sp-gjs-source.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
 #ifndef SP_GJS_SOURCE_H
 #define SP_GJS_SOURCE_H
 
-#include "sources/sp-source.h"
+#include "sp-source.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/sources/sp-hostinfo-source.c b/src/libsysprof/sp-hostinfo-source.c
similarity index 99%
rename from lib/sources/sp-hostinfo-source.c
rename to src/libsysprof/sp-hostinfo-source.c
index dc636e4..972978f 100644
--- a/lib/sources/sp-hostinfo-source.c
+++ b/src/libsysprof/sp-hostinfo-source.c
@@ -1,6 +1,6 @@
 /* sp-hostinfo-source.c
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-#include "sources/sp-hostinfo-source.h"
+#include "sp-hostinfo-source.h"
 
 #define PROC_STAT_BUF_SIZE 4096
 
diff --git a/lib/sources/sp-hostinfo-source.h b/src/libsysprof/sp-hostinfo-source.h
similarity index 91%
rename from lib/sources/sp-hostinfo-source.h
rename to src/libsysprof/sp-hostinfo-source.h
index df78342..2bd4a75 100644
--- a/lib/sources/sp-hostinfo-source.h
+++ b/src/libsysprof/sp-hostinfo-source.h
@@ -1,6 +1,6 @@
 /* sp-hostinfo-source.h
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
 #ifndef SP_HOSTINFO_SOURCE_H
 #define SP_HOSTINFO_SOURCE_H
 
-#include "sources/sp-source.h"
+#include "sp-source.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/symbols/sp-jitmap-symbol-resolver.c b/src/libsysprof/sp-jitmap-symbol-resolver.c
similarity index 96%
rename from lib/symbols/sp-jitmap-symbol-resolver.c
rename to src/libsysprof/sp-jitmap-symbol-resolver.c
index 84329a2..fccd2b1 100644
--- a/lib/symbols/sp-jitmap-symbol-resolver.c
+++ b/src/libsysprof/sp-jitmap-symbol-resolver.c
@@ -1,6 +1,6 @@
 /* sp-jitmap-symbol-resolver.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,8 +16,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "symbols/sp-kernel-symbol.h"
-#include "symbols/sp-jitmap-symbol-resolver.h"
+#include "sp-kernel-symbol.h"
+#include "sp-jitmap-symbol-resolver.h"
 
 struct _SpJitmapSymbolResolver
 {
diff --git a/lib/symbols/sp-jitmap-symbol-resolver.h b/src/libsysprof/sp-jitmap-symbol-resolver.h
similarity index 91%
rename from lib/symbols/sp-jitmap-symbol-resolver.h
rename to src/libsysprof/sp-jitmap-symbol-resolver.h
index 2a9777e..daf32b1 100644
--- a/lib/symbols/sp-jitmap-symbol-resolver.h
+++ b/src/libsysprof/sp-jitmap-symbol-resolver.h
@@ -1,6 +1,6 @@
 /* sp-jitmap-symbol-resolver.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
 #ifndef SP_JITMAP_SYMBOL_RESOLVER_H
 #define SP_JITMAP_SYMBOL_RESOLVER_H
 
-#include "symbols/sp-symbol-resolver.h"
+#include "sp-symbol-resolver.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/symbols/sp-kernel-symbol-resolver.c b/src/libsysprof/sp-kernel-symbol-resolver.c
similarity index 94%
rename from lib/symbols/sp-kernel-symbol-resolver.c
rename to src/libsysprof/sp-kernel-symbol-resolver.c
index 1213137..8d38e2e 100644
--- a/lib/symbols/sp-kernel-symbol-resolver.c
+++ b/src/libsysprof/sp-kernel-symbol-resolver.c
@@ -1,6 +1,6 @@
 /* sp-kernel-symbol-resolver.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,8 +16,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "symbols/sp-kernel-symbol.h"
-#include "symbols/sp-kernel-symbol-resolver.h"
+#include "sp-kernel-symbol.h"
+#include "sp-kernel-symbol-resolver.h"
 
 struct _SpKernelSymbolResolver
 {
diff --git a/lib/symbols/sp-kernel-symbol-resolver.h b/src/libsysprof/sp-kernel-symbol-resolver.h
similarity index 91%
rename from lib/symbols/sp-kernel-symbol-resolver.h
rename to src/libsysprof/sp-kernel-symbol-resolver.h
index dc3d326..e1c0c9c 100644
--- a/lib/symbols/sp-kernel-symbol-resolver.h
+++ b/src/libsysprof/sp-kernel-symbol-resolver.h
@@ -1,6 +1,6 @@
 /* sp-kernel-symbol-resolver.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
 #ifndef SP_KERNEL_SYMBOL_RESOLVER_H
 #define SP_KERNEL_SYMBOL_RESOLVER_H
 
-#include "symbols/sp-symbol-resolver.h"
+#include "sp-symbol-resolver.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/symbols/sp-kernel-symbol.c b/src/libsysprof/sp-kernel-symbol.c
similarity index 98%
rename from lib/symbols/sp-kernel-symbol.c
rename to src/libsysprof/sp-kernel-symbol.c
index 14e026f..c45fd72 100644
--- a/lib/symbols/sp-kernel-symbol.c
+++ b/src/libsysprof/sp-kernel-symbol.c
@@ -1,6 +1,6 @@
 /* sp-kernel-symbol.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -21,15 +21,14 @@
 #include "config.h"
 
 #include <gio/gio.h>
-
 #ifdef ENABLE_POLKIT
 # include <polkit/polkit.h>
 #endif
+#include <sysprof-capture.h>
 
 #include "sp-kallsyms.h"
-
-#include "util/sp-line-reader.h"
-#include "symbols/sp-kernel-symbol.h"
+#include "sp-line-reader.h"
+#include "sp-kernel-symbol.h"
 
 static GArray *kernel_symbols;
 static GStringChunk *kernel_symbol_strs;
diff --git a/lib/symbols/sp-kernel-symbol.h b/src/libsysprof/sp-kernel-symbol.h
similarity index 90%
rename from lib/symbols/sp-kernel-symbol.h
rename to src/libsysprof/sp-kernel-symbol.h
index 4ba4953..b2b7364 100644
--- a/lib/symbols/sp-kernel-symbol.h
+++ b/src/libsysprof/sp-kernel-symbol.h
@@ -1,6 +1,6 @@
 /* sp-kernel-symbol.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
 #ifndef SP_KERNEL_SYMBOL_H
 #define SP_KERNEL_SYMBOL_H
 
-#include "capture/sp-capture-types.h"
+#include "sp-capture-types.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/profiler/sp-local-profiler.c b/src/libsysprof/sp-local-profiler.c
similarity index 99%
rename from lib/profiler/sp-local-profiler.c
rename to src/libsysprof/sp-local-profiler.c
index fda366a..47b5f53 100644
--- a/lib/profiler/sp-local-profiler.c
+++ b/src/libsysprof/sp-local-profiler.c
@@ -1,6 +1,6 @@
 /* sp-local-profiler.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -21,8 +21,8 @@
 #include <errno.h>
 #include <unistd.h>
 
-#include "profiler/sp-local-profiler.h"
-#include "util/sp-platform.h"
+#include "sp-local-profiler.h"
+#include "sp-platform.h"
 
 typedef struct
 {
diff --git a/lib/profiler/sp-local-profiler.h b/src/libsysprof/sp-local-profiler.h
similarity index 91%
rename from lib/profiler/sp-local-profiler.h
rename to src/libsysprof/sp-local-profiler.h
index 4cff09a..2acffdd 100644
--- a/lib/profiler/sp-local-profiler.h
+++ b/src/libsysprof/sp-local-profiler.h
@@ -1,6 +1,6 @@
 /* sp-local-profiler.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
 #ifndef SP_LOCAL_PROFILER_H
 #define SP_LOCAL_PROFILER_H
 
-#include "profiler/sp-profiler.h"
+#include "sp-profiler.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/util/sp-map-lookaside.c b/src/libsysprof/sp-map-lookaside.c
similarity index 96%
rename from lib/util/sp-map-lookaside.c
rename to src/libsysprof/sp-map-lookaside.c
index 319f3c7..0a9231d 100644
--- a/lib/util/sp-map-lookaside.c
+++ b/src/libsysprof/sp-map-lookaside.c
@@ -1,6 +1,6 @@
 /* sp-map-lookaside.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "util/sp-map-lookaside.h"
+#include "sp-map-lookaside.h"
 
 struct _SpMapLookaside
 {
diff --git a/lib/util/sp-map-lookaside.h b/src/libsysprof/sp-map-lookaside.h
similarity index 93%
rename from lib/util/sp-map-lookaside.h
rename to src/libsysprof/sp-map-lookaside.h
index 0b2d8b3..5de7bdb 100644
--- a/lib/util/sp-map-lookaside.h
+++ b/src/libsysprof/sp-map-lookaside.h
@@ -1,6 +1,6 @@
 /* sp-map-lookaside.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@
 
 #include <glib.h>
 
-#include "capture/sp-capture-types.h"
+#include "sp-capture-types.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/sources/sp-memory-source.c b/src/libsysprof/sp-memory-source.c
similarity index 99%
rename from lib/sources/sp-memory-source.c
rename to src/libsysprof/sp-memory-source.c
index 52cfc3f..44a21ce 100644
--- a/lib/sources/sp-memory-source.c
+++ b/src/libsysprof/sp-memory-source.c
@@ -25,11 +25,10 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
+#include <sysprof-capture.h>
 #include <unistd.h>
 
-#include "sp-clock.h"
-
-#include "sources/sp-memory-source.h"
+#include "sp-memory-source.h"
 
 #define BUF_SIZE 4096
 
diff --git a/lib/sources/sp-memory-source.h b/src/libsysprof/sp-memory-source.h
similarity index 97%
rename from lib/sources/sp-memory-source.h
rename to src/libsysprof/sp-memory-source.h
index a50636e..a3aa29f 100644
--- a/lib/sources/sp-memory-source.h
+++ b/src/libsysprof/sp-memory-source.h
@@ -20,7 +20,7 @@
 
 #pragma once
 
-#include "sources/sp-source.h"
+#include "sp-source.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/sources/sp-perf-counter.c b/src/libsysprof/sp-perf-counter.c
similarity index 99%
rename from lib/sources/sp-perf-counter.c
rename to src/libsysprof/sp-perf-counter.c
index 5d44a99..65f5728 100644
--- a/lib/sources/sp-perf-counter.c
+++ b/src/libsysprof/sp-perf-counter.c
@@ -1,6 +1,6 @@
 /* sp-perf-counter.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -35,13 +35,14 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
+#include "config.h"
 
 #include <errno.h>
 #include <gio/gio.h>
 #include <gio/gunixfdlist.h>
+#ifdef ENABLE_POLKIT
+# include <polkit/polkit.h>
+#endif
 #include <stdatomic.h>
 #include <string.h>
 #include <sys/ioctl.h>
@@ -49,11 +50,7 @@
 #include <sys/syscall.h>
 #include <unistd.h>
 
-#ifdef ENABLE_POLKIT
-# include <polkit/polkit.h>
-#endif
-
-#include "sources/sp-perf-counter.h"
+#include "sp-perf-counter.h"
 
 /*
  * Number of pages to map for the ring buffer.  We map one additional buffer
diff --git a/lib/sources/sp-perf-counter.h b/src/libsysprof/sp-perf-counter.h
similarity index 98%
rename from lib/sources/sp-perf-counter.h
rename to src/libsysprof/sp-perf-counter.h
index 3451842..f20fce9 100644
--- a/lib/sources/sp-perf-counter.h
+++ b/src/libsysprof/sp-perf-counter.h
@@ -1,6 +1,6 @@
 /* sp-perf-counter.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/lib/sources/sp-perf-source.c b/src/libsysprof/sp-perf-source.c
similarity index 99%
rename from lib/sources/sp-perf-source.c
rename to src/libsysprof/sp-perf-source.c
index 08c2cba..05f1432 100644
--- a/lib/sources/sp-perf-source.c
+++ b/src/libsysprof/sp-perf-source.c
@@ -1,6 +1,6 @@
 /* sp-perf-source.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -35,9 +35,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
+#include "config.h"
 
 #include <gio/gio.h>
 #include <glib/gi18n.h>
@@ -48,9 +46,9 @@
 #include <unistd.h>
 
 #include "sp-clock.h"
-#include "util/sp-line-reader.h"
-#include "sources/sp-perf-counter.h"
-#include "sources/sp-perf-source.h"
+#include "sp-line-reader.h"
+#include "sp-perf-counter.h"
+#include "sp-perf-source.h"
 
 #define N_WAKEUP_EVENTS 149
 
diff --git a/lib/sources/sp-perf-source.h b/src/libsysprof/sp-perf-source.h
similarity index 92%
rename from lib/sources/sp-perf-source.h
rename to src/libsysprof/sp-perf-source.h
index 948c2c9..b52d5c2 100644
--- a/lib/sources/sp-perf-source.h
+++ b/src/libsysprof/sp-perf-source.h
@@ -1,6 +1,6 @@
 /* sp-perf-source.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
 #ifndef SP_PERF_SOURCE_H
 #define SP_PERF_SOURCE_H
 
-#include "sources/sp-source.h"
+#include "sp-source.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/sources/sp-proc-source.c b/src/libsysprof/sp-proc-source.c
similarity index 99%
rename from lib/sources/sp-proc-source.c
rename to src/libsysprof/sp-proc-source.c
index d48c424..4edd176 100644
--- a/lib/sources/sp-proc-source.c
+++ b/src/libsysprof/sp-proc-source.c
@@ -1,6 +1,6 @@
 /* sp-proc-source.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -39,7 +39,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "sources/sp-proc-source.h"
+#include "sp-proc-source.h"
 
 struct _SpProcSource
 {
diff --git a/lib/sources/sp-proc-source.h b/src/libsysprof/sp-proc-source.h
similarity index 92%
rename from lib/sources/sp-proc-source.h
rename to src/libsysprof/sp-proc-source.h
index 8506d0f..7d1bce8 100644
--- a/lib/sources/sp-proc-source.h
+++ b/src/libsysprof/sp-proc-source.h
@@ -1,6 +1,6 @@
 /* sp-proc-source.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
 #ifndef SP_PROC_SOURCE_H
 #define SP_PROC_SOURCE_H
 
-#include "sources/sp-source.h"
+#include "sp-source.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/util/sp-process-model-item.c b/src/libsysprof/sp-process-model-item.c
similarity index 97%
rename from lib/util/sp-process-model-item.c
rename to src/libsysprof/sp-process-model-item.c
index a4b998a..7d4b62a 100644
--- a/lib/util/sp-process-model-item.c
+++ b/src/libsysprof/sp-process-model-item.c
@@ -1,6 +1,6 @@
 /* sp-process-model-item.c
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,8 +18,8 @@
 
 #include <string.h>
 
-#include "util/sp-process-model-item.h"
-#include "sources/sp-proc-source.h"
+#include "sp-process-model-item.h"
+#include "sp-proc-source.h"
 
 struct _SpProcessModelItem
 {
diff --git a/lib/util/sp-process-model-item.h b/src/libsysprof/sp-process-model-item.h
similarity index 96%
rename from lib/util/sp-process-model-item.h
rename to src/libsysprof/sp-process-model-item.h
index 3db0dfa..ec5b0e9 100644
--- a/lib/util/sp-process-model-item.h
+++ b/src/libsysprof/sp-process-model-item.h
@@ -1,6 +1,6 @@
 /* sp-process-model-item.h
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/lib/util/sp-process-model.c b/src/libsysprof/sp-process-model.c
similarity index 98%
rename from lib/util/sp-process-model.c
rename to src/libsysprof/sp-process-model.c
index 8d55e36..198ab8d 100644
--- a/lib/util/sp-process-model.c
+++ b/src/libsysprof/sp-process-model.c
@@ -1,6 +1,6 @@
 /* sp-process-model.c
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,8 +18,8 @@
 
 #include <stdlib.h>
 
-#include "util/sp-process-model.h"
-#include "util/sp-process-model-item.h"
+#include "sp-process-model.h"
+#include "sp-process-model-item.h"
 
 #define QUEUE_RELOAD_TIMEOUT_MSEC 100
 
diff --git a/lib/util/sp-process-model.h b/src/libsysprof/sp-process-model.h
similarity index 94%
rename from lib/util/sp-process-model.h
rename to src/libsysprof/sp-process-model.h
index 300ad90..a4a878e 100644
--- a/lib/util/sp-process-model.h
+++ b/src/libsysprof/sp-process-model.h
@@ -1,6 +1,6 @@
 /* sp-process-model.h
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/lib/profiler/sp-profile.c b/src/libsysprof/sp-profile.c
similarity index 96%
rename from lib/profiler/sp-profile.c
rename to src/libsysprof/sp-profile.c
index 23a4029..01f75eb 100644
--- a/lib/profiler/sp-profile.c
+++ b/src/libsysprof/sp-profile.c
@@ -1,6 +1,6 @@
 /* sp-profile.c
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "profiler/sp-profile.h"
+#include "sp-profile.h"
 
 G_DEFINE_INTERFACE (SpProfile, sp_profile, G_TYPE_OBJECT)
 
diff --git a/lib/profiler/sp-profile.h b/src/libsysprof/sp-profile.h
similarity index 95%
rename from lib/profiler/sp-profile.h
rename to src/libsysprof/sp-profile.h
index 7e8e2d1..c7fcbc9 100644
--- a/lib/profiler/sp-profile.h
+++ b/src/libsysprof/sp-profile.h
@@ -1,6 +1,6 @@
 /* sp-profile.h
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@
 
 #include <gio/gio.h>
 
-#include "capture/sp-capture-reader.h"
+#include "sp-capture-reader.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/profiler/sp-profiler.c b/src/libsysprof/sp-profiler.c
similarity index 98%
rename from lib/profiler/sp-profiler.c
rename to src/libsysprof/sp-profiler.c
index e7fb902..290efc4 100644
--- a/lib/profiler/sp-profiler.c
+++ b/src/libsysprof/sp-profiler.c
@@ -1,6 +1,6 @@
 /* sp-profiler.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "profiler/sp-profiler.h"
+#include "sp-profiler.h"
 
 G_DEFINE_INTERFACE (SpProfiler, sp_profiler, G_TYPE_OBJECT)
 
diff --git a/lib/profiler/sp-profiler.h b/src/libsysprof/sp-profiler.h
similarity index 97%
rename from lib/profiler/sp-profiler.h
rename to src/libsysprof/sp-profiler.h
index 4711164..638a61a 100644
--- a/lib/profiler/sp-profiler.h
+++ b/src/libsysprof/sp-profiler.h
@@ -1,6 +1,6 @@
 /* sp-profiler.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,8 +19,8 @@
 #ifndef SP_PROFILER_H
 #define SP_PROFILER_H
 
-#include "capture/sp-capture-writer.h"
-#include "sources/sp-source.h"
+#include "sp-capture-writer.h"
+#include "sp-source.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/util/sp-selection.c b/src/libsysprof/sp-selection.c
similarity index 98%
rename from lib/util/sp-selection.c
rename to src/libsysprof/sp-selection.c
index 52ced15..af54581 100644
--- a/lib/util/sp-selection.c
+++ b/src/libsysprof/sp-selection.c
@@ -1,6 +1,6 @@
 /* sp-selection.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
 
 #define G_LOG_DOMAIN "sp-selection"
 
-#include "util/sp-selection.h"
+#include "sp-selection.h"
 
 struct _SpSelection
 {
diff --git a/lib/util/sp-selection.h b/src/libsysprof/sp-selection.h
similarity index 87%
rename from lib/util/sp-selection.h
rename to src/libsysprof/sp-selection.h
index c261e3b..4faedbb 100644
--- a/lib/util/sp-selection.h
+++ b/src/libsysprof/sp-selection.h
@@ -1,6 +1,6 @@
 /* sp-selection.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -28,9 +28,9 @@ G_BEGIN_DECLS
 G_DECLARE_FINAL_TYPE (SpSelection, sp_selection, SP, SELECTION, GObject)
 
 typedef void (*SpSelectionForeachFunc) (SpSelection *self,
-                                        gint64                 begin_time,
-                                        gint64                 end_time,
-                                        gpointer               user_data);
+                                        gint64       begin_time,
+                                        gint64       end_time,
+                                        gpointer     user_data);
 
 gboolean     sp_selection_get_has_selection (SpSelection            *self);
 gboolean     sp_selection_contains          (SpSelection            *self,
diff --git a/src/libsysprof/sp-source-util-private.h b/src/libsysprof/sp-source-util-private.h
new file mode 100644
index 0000000..6d2756e
--- /dev/null
+++ b/src/libsysprof/sp-source-util-private.h
@@ -0,0 +1,34 @@
+/* sp-source-util-private.h
+ *
+ * Copyright 2019 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+gboolean   sp_host_file_get_contents (const gchar  *host_path,
+                                      gchar       **contents,
+                                      gsize        *len,
+                                      GError      **error);
+gchar    **sp_host_list_directories  (const gchar  *directory,
+                                      GError      **error);
+
+G_END_DECLS
diff --git a/src/libsysprof/sp-source-util.c b/src/libsysprof/sp-source-util.c
new file mode 100644
index 0000000..8aa792c
--- /dev/null
+++ b/src/libsysprof/sp-source-util.c
@@ -0,0 +1,203 @@
+/* sp-source-util.c
+ *
+ * Copyright 2019 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#include <gio/gio.h>
+#include <string.h>
+
+#include "sp-source-util-private.h"
+
+gboolean
+sp_host_file_get_contents (const gchar  *host_path,
+                           gchar       **contents,
+                           gsize        *len,
+                           GError      **error)
+{
+  g_autofree gchar *alt_path = NULL;
+
+  g_return_val_if_fail (host_path != NULL, FALSE);
+
+  if (!g_file_test ("/.flatpak-info", G_FILE_TEST_EXISTS))
+    return g_file_get_contents (host_path, contents, len, error);
+
+  if (contents != NULL)
+    *contents = NULL;
+
+  if (len != NULL)
+    *len = 0;
+
+  alt_path = g_build_filename ("/var/run/host", host_path, NULL);
+
+  if (g_file_test (alt_path, G_FILE_TEST_EXISTS))
+    return g_file_get_contents (alt_path, contents, len, error);
+
+  /*
+   * Fallback to try to get it with "cat" on the host since we
+   * may not have access (like for /proc) from /var/run/host.
+   */
+
+  {
+    g_autoptr(GSubprocessLauncher) launcher = NULL;
+    g_autoptr(GSubprocess) subprocess = NULL;
+    g_autoptr(GBytes) stdout_buf = NULL;
+
+    launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_STDOUT_PIPE |
+                                          G_SUBPROCESS_FLAGS_STDERR_SILENCE);
+
+    subprocess = g_subprocess_launcher_spawn (launcher, error,
+                                              "flatpak-spawn",
+                                              "--clear-env",
+                                              "--host",
+                                              "cat",
+                                              host_path,
+                                              NULL);
+
+    if (subprocess == NULL)
+      return FALSE;
+
+    if (!g_subprocess_communicate (subprocess, NULL, NULL, &stdout_buf, NULL, error))
+      return FALSE;
+
+    if (len != NULL)
+      *len = g_bytes_get_size (stdout_buf);
+
+    if (contents != NULL)
+      {
+        const guint8 *data;
+        gsize n;
+
+        /* g_file_get_contents() gurantees a trailing null byte */
+        data = g_bytes_get_data (stdout_buf, &n);
+        *contents = g_malloc (n + 1);
+        memcpy (*contents, data, n);
+        (*contents)[n] = '\0';
+      }
+  }
+
+  return TRUE;
+}
+
+gchar **
+sp_host_list_directories (const gchar  *directory,
+                          GError      **error)
+{
+  g_autofree gchar *alt_path = NULL;
+
+  g_return_val_if_fail (directory != NULL, NULL);
+
+  if (g_file_test ("/.flatpak-info", G_FILE_TEST_IS_REGULAR))
+    {
+      g_autoptr(GSubprocessLauncher) launcher = NULL;
+      g_autoptr(GSubprocess) subprocess = NULL;
+      g_autofree gchar *stdout_buf = NULL;
+      g_auto(GStrv) lines = NULL;
+      gsize len;
+      guint j = 0;
+
+      alt_path = g_build_filename ("/var/run/host", directory, NULL);
+
+      if (g_file_test (alt_path, G_FILE_TEST_IS_DIR))
+        {
+          directory = alt_path;
+          goto try_native;
+        }
+
+      launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_STDOUT_PIPE |
+                                            G_SUBPROCESS_FLAGS_STDERR_SILENCE);
+      subprocess = g_subprocess_launcher_spawn (launcher, error,
+                                                "flatpak-spawn",
+                                                "--clear-env",
+                                                "--host",
+                                                "ls",
+                                                "-1",
+                                                "-U",
+                                                "--file-type",
+                                                directory,
+                                                NULL);
+      if (subprocess == NULL)
+        return NULL;
+
+      if (!g_subprocess_communicate_utf8 (subprocess, NULL, NULL, &stdout_buf, NULL, error))
+        return NULL;
+
+      lines = g_strsplit (stdout_buf, "\n", 0);
+      len = g_strv_length (lines);
+
+      for (gsize i = 0; i < len; i++)
+        {
+          gsize llen = strlen (lines[i]);
+
+          if (llen == 0 || lines[i][llen-1] != '/')
+            {
+              /* Remove this entry, we'll compress the list later */
+              g_free (lines[i]);
+              lines[i] = NULL;
+            }
+          else
+            {
+              /* trim trailing / */
+              lines[i][llen-1] = 0;
+            }
+        }
+
+      /* Compress the list by removing NULL links */
+      for (gsize i = 0; i < len; i++)
+        {
+          if (lines[i] == NULL)
+            {
+              if (j <= i)
+                j = i + 1;
+
+              for (; j < len; j++)
+                {
+                  if (lines[j] != NULL)
+                    {
+                      lines[i] = g_steal_pointer (&lines[j]);
+                      break;
+                    }
+                }
+            }
+        }
+
+      return g_steal_pointer (&lines);
+    }
+
+try_native:
+
+    {
+      g_autoptr(GDir) dir = g_dir_open (directory, 0, error);
+      g_autoptr(GPtrArray) dirs = g_ptr_array_new_with_free_func (g_free);
+      const gchar *name;
+
+      if (dir == NULL)
+        return NULL;
+
+      while ((name = g_dir_read_name (dir)))
+        {
+          g_autofree gchar *path = g_build_filename (directory, name, NULL);
+
+          if (g_file_test (path, G_FILE_TEST_IS_DIR))
+            g_ptr_array_add (dirs, g_steal_pointer (&path));
+        }
+
+      g_ptr_array_add (dirs, NULL);
+
+      return (gchar **)g_ptr_array_free (g_steal_pointer (&dirs), FALSE);
+    }
+}
diff --git a/lib/sources/sp-source.c b/src/libsysprof/sp-source.c
similarity index 97%
rename from lib/sources/sp-source.c
rename to src/libsysprof/sp-source.c
index dda0e3a..c03d658 100644
--- a/lib/sources/sp-source.c
+++ b/src/libsysprof/sp-source.c
@@ -1,6 +1,6 @@
 /* sp-source.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "sources/sp-source.h"
+#include "sp-source.h"
 
 G_DEFINE_INTERFACE (SpSource, sp_source, G_TYPE_OBJECT)
 
diff --git a/lib/sources/sp-source.h b/src/libsysprof/sp-source.h
similarity index 97%
rename from lib/sources/sp-source.h
rename to src/libsysprof/sp-source.h
index 625e863..6149808 100644
--- a/lib/sources/sp-source.h
+++ b/src/libsysprof/sp-source.h
@@ -1,6 +1,6 @@
 /* sp-source.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@
 
 #include <glib-object.h>
 
-#include "capture/sp-capture-writer.h"
+#include "sp-capture-writer.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/symbols/sp-symbol-dirs.c b/src/libsysprof/sp-symbol-dirs.c
similarity index 97%
rename from lib/symbols/sp-symbol-dirs.c
rename to src/libsysprof/sp-symbol-dirs.c
index ccc0d50..9055022 100644
--- a/lib/symbols/sp-symbol-dirs.c
+++ b/src/libsysprof/sp-symbol-dirs.c
@@ -1,6 +1,6 @@
 /* sp-symbol-dirs.c
  *
- * Copyright (C) 2017 Christian Hergert <chergert redhat com>
+ * Copyright 2017 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
 
 #include "config.h"
 
-#include "symbols/sp-symbol-dirs.h"
+#include "sp-symbol-dirs.h"
 
 static GPtrArray *sp_symbol_dirs;
 
diff --git a/lib/symbols/sp-symbol-dirs.h b/src/libsysprof/sp-symbol-dirs.h
similarity index 94%
rename from lib/symbols/sp-symbol-dirs.h
rename to src/libsysprof/sp-symbol-dirs.h
index 8149ad7..1665e3a 100644
--- a/lib/symbols/sp-symbol-dirs.h
+++ b/src/libsysprof/sp-symbol-dirs.h
@@ -1,6 +1,6 @@
 /* sp-symbol-dirs.h
  *
- * Copyright (C) 2017 Christian Hergert <chergert redhat com>
+ * Copyright 2017 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/lib/symbols/sp-symbol-resolver.c b/src/libsysprof/sp-symbol-resolver.c
similarity index 97%
rename from lib/symbols/sp-symbol-resolver.c
rename to src/libsysprof/sp-symbol-resolver.c
index 7847a02..bdc647f 100644
--- a/lib/symbols/sp-symbol-resolver.c
+++ b/src/libsysprof/sp-symbol-resolver.c
@@ -1,6 +1,6 @@
 /* sp-symbol-resolver.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "symbols/sp-symbol-resolver.h"
+#include "sp-symbol-resolver.h"
 
 G_DEFINE_INTERFACE (SpSymbolResolver, sp_symbol_resolver, G_TYPE_OBJECT)
 
diff --git a/lib/symbols/sp-symbol-resolver.h b/src/libsysprof/sp-symbol-resolver.h
similarity index 96%
rename from lib/symbols/sp-symbol-resolver.h
rename to src/libsysprof/sp-symbol-resolver.h
index a347685..149d954 100644
--- a/lib/symbols/sp-symbol-resolver.h
+++ b/src/libsysprof/sp-symbol-resolver.h
@@ -1,6 +1,6 @@
 /* sp-symbol-resolver.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 #include <glib-object.h>
 
 #include "sp-address.h"
-#include "capture/sp-capture-reader.h"
+#include "sp-capture-reader.h"
 
 G_BEGIN_DECLS
 
diff --git a/lib/util/stackstash.c b/src/libsysprof/stackstash.c
similarity index 99%
rename from lib/util/stackstash.c
rename to src/libsysprof/stackstash.c
index 3e338f4..9b33359 100644
--- a/lib/util/stackstash.c
+++ b/src/libsysprof/stackstash.c
@@ -17,7 +17,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#include "util/stackstash.h"
+#include "stackstash.h"
 
 struct StackStash
 {
diff --git a/lib/util/stackstash.h b/src/libsysprof/stackstash.h
similarity index 100%
rename from lib/util/stackstash.h
rename to src/libsysprof/stackstash.h
diff --git a/src/libsysprof/sysprof.h b/src/libsysprof/sysprof.h
new file mode 100644
index 0000000..fa50c34
--- /dev/null
+++ b/src/libsysprof/sysprof.h
@@ -0,0 +1,49 @@
+/* sysprof.h
+ *
+ * Copyright 2016 Christian Hergert <christian hergert me>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <sysprof-capture.h>
+
+G_BEGIN_DECLS
+
+#define SYSPROF_INSIDE
+
+# include "sp-callgraph-profile.h"
+# include "sp-capture-gobject.h"
+# include "sp-local-profiler.h"
+# include "sp-profile.h"
+# include "sp-profiler.h"
+# include "sp-gjs-source.h"
+# include "sp-hostinfo-source.h"
+# include "sp-map-lookaside.h"
+# include "sp-memory-source.h"
+# include "sp-perf-source.h"
+# include "sp-proc-source.h"
+# include "sp-source.h"
+# include "sp-elf-symbol-resolver.h"
+# include "sp-jitmap-symbol-resolver.h"
+# include "sp-kernel-symbol-resolver.h"
+# include "sp-kernel-symbol.h"
+# include "sp-symbol-dirs.h"
+# include "sp-symbol-resolver.h"
+# include "sp-map-lookaside.h"
+# include "sp-selection.h"
+#undef SYSPROF_INSIDE
+
+G_END_DECLS
diff --git a/src/meson.build b/src/meson.build
index 4804fb7..4e91322 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,27 +1,17 @@
-if get_option('enable_gtk')
+sysprof_header_subdir = 'sysprof-@0@'.format(libsysprof_api_version)
 
-sysprof_sources = [
-  'sysprof.c',
-  'sp-application.c',
-  'sp-application.h',
-  'sp-credits.h',
-  'sp-window.c',
-  'sp-window.h',
-  'sp-window-settings.c',
-  'sp-window-settings.h',
-]
+sysprof_version_conf = configuration_data()
+sysprof_version = meson.project_version().split('.')
+sysprof_version_conf.set('MAJOR_VERSION', sysprof_version[0])
+sysprof_version_conf.set('MINOR_VERSION', sysprof_version[1])
+sysprof_version_conf.set('MICRO_VERSION', sysprof_version[2])
+sysprof_version_conf.set('VERSION', meson.project_version())
 
-sysprof_resources = gnome.compile_resources('sp-resources', 'resources/sysprof.gresource.xml',
-  source_dir: 'resources',
-      c_name: 'sysprof',
-)
-
-sysprof = executable('sysprof', sysprof_resources + sysprof_sources,
-       gui_app: true,
-       install: true,
-        c_args: release_flags + exe_c_args,
-  dependencies: [libsysprof_ui_dep, cc.find_library('m', required: false)],
-     link_args: exe_link_args,
-)
-
-endif
+subdir('shared')
+subdir('libsysprof-capture')
+subdir('sysprofd')
+subdir('libsysprof')
+subdir('libsysprof-ui')
+subdir('sysprof')
+subdir('tools')
+subdir('tests')
diff --git a/src/shared/meson.build b/src/shared/meson.build
new file mode 100644
index 0000000..980c7b5
--- /dev/null
+++ b/src/shared/meson.build
@@ -0,0 +1,33 @@
+shared_sources = [
+  'sp-address.c',
+  'sp-clock.c',
+  'sp-error.c',
+  'sp-line-reader.c',
+  'sp-platform.c',
+]
+
+shared_public_headers = [
+  'sp-address.h',
+  'sp-clock.h',
+  'sp-error.h',
+  'sp-platform.h',
+]
+
+install_headers(shared_public_headers, subdir: sysprof_header_subdir)
+
+if host_machine.system() == 'linux'
+  shared_sources += ['sp-kallsyms.c']
+endif
+
+libshared_deps = [
+  dependency('glib-2.0'),
+]
+
+libshared = static_library('shared', shared_sources,
+  dependencies: libshared_deps,
+)
+
+libshared_dep = declare_dependency(
+           link_whole: libshared,
+  include_directories: include_directories('.'),
+)
diff --git a/lib/sp-address.c b/src/shared/sp-address.c
similarity index 95%
rename from lib/sp-address.c
rename to src/shared/sp-address.c
index b3dadb5..4f3415c 100644
--- a/lib/sp-address.c
+++ b/src/shared/sp-address.c
@@ -1,6 +1,6 @@
 /* sp-address.c
  *
- * Copyright © 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #include <linux/perf_event.h>
diff --git a/lib/sp-address.h b/src/shared/sp-address.h
similarity index 91%
rename from lib/sp-address.h
rename to src/shared/sp-address.h
index 81f4fbc..af8b302 100644
--- a/lib/sp-address.h
+++ b/src/shared/sp-address.h
@@ -1,6 +1,6 @@
 /* sp-address.h
  *
- * Copyright © 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This file is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the Free
@@ -14,10 +14,11 @@
  *
  * You should have received a copy of the GNU General Public License along
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#ifndef SP_ADDRESS_H
-#define SP_ADDRESS_H
+#pragma once
 
 #include <glib.h>
 
@@ -55,5 +56,3 @@ sp_address_compare (SpAddress a,
 }
 
 G_END_DECLS
-
-#endif /* SP_ADDRESS_H */
diff --git a/lib/sp-clock.c b/src/shared/sp-clock.c
similarity index 91%
rename from lib/sp-clock.c
rename to src/shared/sp-clock.c
index 48cc9c3..4b6a4e7 100644
--- a/lib/sp-clock.c
+++ b/src/shared/sp-clock.c
@@ -1,6 +1,6 @@
 /* sp-clock.c
  *
- * Copyright © 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This file is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the Free
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License along
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #include "sp-clock.h"
diff --git a/lib/sp-clock.h b/src/shared/sp-clock.h
similarity index 91%
rename from lib/sp-clock.h
rename to src/shared/sp-clock.h
index 7b2f3fe..9edeb74 100644
--- a/lib/sp-clock.h
+++ b/src/shared/sp-clock.h
@@ -1,6 +1,6 @@
 /* sp-clock.h
  *
- * Copyright © 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This file is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the Free
@@ -14,10 +14,11 @@
  *
  * You should have received a copy of the GNU General Public License along
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#ifndef SP_CLOCK_H
-#define SP_CLOCK_H
+#pragma once
 
 #include <glib.h>
 #include <time.h>
@@ -52,6 +53,3 @@ sp_clock_get_relative_time (SpTimeStamp epoch)
 void sp_clock_init (void);
 
 G_END_DECLS
-
-#endif /* SP_CLOCK_H */
-
diff --git a/lib/sp-error.c b/src/shared/sp-error.c
similarity index 88%
rename from lib/sp-error.c
rename to src/shared/sp-error.c
index 1b52e85..dd9cf4e 100644
--- a/lib/sp-error.c
+++ b/src/shared/sp-error.c
@@ -1,6 +1,6 @@
 /* sp-error.c
  *
- * Copyright © 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #include "sp-error.h"
diff --git a/lib/sp-error.h b/src/shared/sp-error.h
similarity index 86%
rename from lib/sp-error.h
rename to src/shared/sp-error.h
index db69d1c..c4fb8d1 100644
--- a/lib/sp-error.h
+++ b/src/shared/sp-error.h
@@ -1,6 +1,6 @@
 /* sp-error.h
  *
- * Copyright © 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This file is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the Free
@@ -14,10 +14,11 @@
  *
  * You should have received a copy of the GNU General Public License along
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#ifndef SP_ERROR_H
-#define SP_ERROR_H
+#pragma once
 
 #include <glib.h>
 
@@ -28,5 +29,3 @@ G_BEGIN_DECLS
 GQuark sp_error_quark (void);
 
 G_END_DECLS
-
-#endif /* SP_ERROR_H */
diff --git a/lib/sp-kallsyms.c b/src/shared/sp-kallsyms.c
similarity index 96%
rename from lib/sp-kallsyms.c
rename to src/shared/sp-kallsyms.c
index daf635f..7a4b0d4 100644
--- a/lib/sp-kallsyms.c
+++ b/src/shared/sp-kallsyms.c
@@ -1,6 +1,6 @@
 /* sp-kallsyms.c
  *
- * Copyright © 2018 Christian Hergert <chergert redhat com>
+ * Copyright 2018-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #define G_LOG_DOMAIN "sp-kallsyms"
diff --git a/lib/sp-kallsyms.h b/src/shared/sp-kallsyms.h
similarity index 88%
rename from lib/sp-kallsyms.h
rename to src/shared/sp-kallsyms.h
index 0761a42..70cee2d 100644
--- a/lib/sp-kallsyms.h
+++ b/src/shared/sp-kallsyms.h
@@ -1,6 +1,6 @@
 /* sp-kallsyms.h
  *
- * Copyright © 2018 Christian Hergert <chergert redhat com>
+ * Copyright 2018-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,12 +14,13 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#ifndef SP_KALLSYMS_H
-#define SP_KALLSYMS_H
+#pragma once
 
-#include <gio/gio.h>
+#include <glib.h>
 
 #include "sp-kallsyms.h"
 
@@ -37,5 +38,3 @@ void        sp_kallsyms_free (SpKallsyms   *self);
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (SpKallsyms, sp_kallsyms_free)
 
 G_END_DECLS
-
-#endif /* SP_KALLSYMS_H */
diff --git a/lib/util/sp-line-reader.c b/src/shared/sp-line-reader.c
similarity index 95%
rename from lib/util/sp-line-reader.c
rename to src/shared/sp-line-reader.c
index ba4fed2..a61c537 100644
--- a/lib/util/sp-line-reader.c
+++ b/src/shared/sp-line-reader.c
@@ -1,6 +1,6 @@
 /* sp-line-reader.c
  *
- * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ * Copyright 2015-2019 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,11 +14,13 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #include <string.h>
 
-#include "util/sp-line-reader.h"
+#include "sp-line-reader.h"
 
 struct _SpLineReader
 {
diff --git a/lib/util/sp-line-reader.h b/src/shared/sp-line-reader.h
similarity index 88%
rename from lib/util/sp-line-reader.h
rename to src/shared/sp-line-reader.h
index c95f54a..fd2fcfb 100644
--- a/lib/util/sp-line-reader.h
+++ b/src/shared/sp-line-reader.h
@@ -1,6 +1,6 @@
 /* sp-line-reader.h
  *
- * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ * Copyright 2015-2019 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,10 +14,11 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#ifndef SP_LINE_READER_H
-#define SP_LINE_READER_H
+#pragma once
 
 #include <glib.h>
 
@@ -34,5 +35,3 @@ const gchar  *sp_line_reader_next (SpLineReader  *self,
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (SpLineReader, sp_line_reader_free)
 
 G_END_DECLS
-
-#endif /* SP_LINE_READER_H */
diff --git a/lib/util/sp-platform.c b/src/shared/sp-platform.c
similarity index 91%
rename from lib/util/sp-platform.c
rename to src/shared/sp-platform.c
index b952801..f105a01 100644
--- a/lib/util/sp-platform.c
+++ b/src/shared/sp-platform.c
@@ -1,6 +1,6 @@
 /* sp-platform.c
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016-2019 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,14 +14,18 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
+#include "config.h"
+
 #include <glib.h>
 #include <glib/gstdio.h>
 #include <sys/syscall.h>
 #include <unistd.h>
 
-#include "util/sp-platform.h"
+#include "sp-platform.h"
 
 /**
  * sp_memfd_create:
diff --git a/lib/util/sp-platform.h b/src/shared/sp-platform.h
similarity index 84%
rename from lib/util/sp-platform.h
rename to src/shared/sp-platform.h
index b46de9f..c564627 100644
--- a/lib/util/sp-platform.h
+++ b/src/shared/sp-platform.h
@@ -1,6 +1,6 @@
 /* sp-platform.h
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016-2019 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,10 +14,11 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#ifndef SP_PLATFORM_H
-#define SP_PLATFORM_H
+#pragma once
 
 #include <glib.h>
 
@@ -26,5 +27,3 @@ G_BEGIN_DECLS
 int sp_memfd_create (const gchar *desc);
 
 G_END_DECLS
-
-#endif /* SP_PLATFORM_H */
diff --git a/src/resources/gtk/help-overlay.ui b/src/sysprof/gtk/help-overlay.ui
similarity index 100%
rename from src/resources/gtk/help-overlay.ui
rename to src/sysprof/gtk/help-overlay.ui
diff --git a/src/sysprof/meson.build b/src/sysprof/meson.build
new file mode 100644
index 0000000..72c11a4
--- /dev/null
+++ b/src/sysprof/meson.build
@@ -0,0 +1,28 @@
+if get_option('enable_gtk')
+
+sysprof_sources = [
+  'sysprof.c',
+  'sp-application.c',
+  'sp-window.c',
+  'sp-window-settings.c',
+]
+
+sysprof_resources = gnome.compile_resources('sysprof-resources', 'sysprof.gresource.xml',
+  source_dir: 'resources',
+      c_name: 'sysprof',
+)
+
+sysprof_deps = [
+  cc.find_library('m', required: false),
+  libsysprof_ui_dep,
+]
+
+sysprof = executable('sysprof', sysprof_resources + sysprof_sources,
+  dependencies: sysprof_deps,
+       gui_app: true,
+   install_dir: get_option('bindir'),
+       install: true,
+          pie: true,
+)
+
+endif
diff --git a/src/sp-application.c b/src/sysprof/sp-application.c
similarity index 97%
rename from src/sp-application.c
rename to src/sysprof/sp-application.c
index 679a301..b1fb59f 100644
--- a/src/sp-application.c
+++ b/src/sysprof/sp-application.c
@@ -1,6 +1,6 @@
 /* sp-application.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -182,8 +182,8 @@ sysprof_about (GSimpleAction *action,
                          "authors", sysprof_authors,
                          "artists", sysprof_artists,
                          "comments", _("A system profiler"),
-                         "copyright", "Copyright © 2004-2009 Søren Sandmann Pedersen\n"
-                                      "Copyright © 2016-2018 Christian Hergert",
+                         "copyright", "Copyright 2004-2009 Søren Sandmann Pedersen\n"
+                                      "Copyright 2016-2018 Christian Hergert",
                          "transient-for", best_toplevel,
                          "modal", TRUE,
                          "translator-credits", _("translator-credits"),
diff --git a/src/sp-application.h b/src/sysprof/sp-application.h
similarity index 94%
rename from src/sp-application.h
rename to src/sysprof/sp-application.h
index ab5af6f..4952048 100644
--- a/src/sp-application.h
+++ b/src/sysprof/sp-application.h
@@ -1,6 +1,6 @@
 /* sp-application.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/sp-credits.h b/src/sysprof/sp-credits.h
similarity index 100%
rename from src/sp-credits.h
rename to src/sysprof/sp-credits.h
diff --git a/src/sp-window-settings.c b/src/sysprof/sp-window-settings.c
similarity index 98%
rename from src/sp-window-settings.c
rename to src/sysprof/sp-window-settings.c
index 7d60e94..cc81e77 100644
--- a/src/sp-window-settings.c
+++ b/src/sysprof/sp-window-settings.c
@@ -1,6 +1,6 @@
 /* sp-window-settings.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/sp-window-settings.h b/src/sysprof/sp-window-settings.h
similarity index 93%
rename from src/sp-window-settings.h
rename to src/sysprof/sp-window-settings.h
index 7173e97..223dc77 100644
--- a/src/sp-window-settings.h
+++ b/src/sysprof/sp-window-settings.h
@@ -1,6 +1,6 @@
 /* sp-window-settings.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/sp-window.c b/src/sysprof/sp-window.c
similarity index 99%
rename from src/sp-window.c
rename to src/sysprof/sp-window.c
index 4643057..b2655dd 100644
--- a/src/sp-window.c
+++ b/src/sysprof/sp-window.c
@@ -1,6 +1,6 @@
 /* sp-window.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,23 +16,19 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "config.h"
-
 #define G_LOG_DOMAIN "sp-window"
 
+#include "config.h"
+
 #include <errno.h>
 #include <glib/gi18n.h>
 #include <math.h>
-#include <sysprof.h>
 #include <sysprof-ui.h>
 
 #include "sp-application.h"
 #include "sp-window.h"
 #include "sp-window-settings.h"
 
-#include "widgets/sp-multi-paned.h"
-#include "visualizers/sp-visualizer-view.h"
-
 struct _SpWindow
 {
   GtkApplicationWindow  parent_instance;
diff --git a/src/sp-window.h b/src/sysprof/sp-window.h
similarity index 96%
rename from src/sp-window.h
rename to src/sysprof/sp-window.h
index 5f6bcb3..689b610 100644
--- a/src/sp-window.h
+++ b/src/sysprof/sp-window.h
@@ -1,6 +1,6 @@
 /* sp-window.h
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/sysprof.c b/src/sysprof/sysprof.c
similarity index 94%
rename from src/sysprof.c
rename to src/sysprof/sysprof.c
index 1ad8158..9517807 100644
--- a/src/sysprof.c
+++ b/src/sysprof/sysprof.c
@@ -1,6 +1,6 @@
 /* main.c
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/src/resources/sysprof.gresource.xml b/src/sysprof/sysprof.gresource.xml
similarity index 100%
rename from src/resources/sysprof.gresource.xml
rename to src/sysprof/sysprof.gresource.xml
diff --git a/src/resources/theme/Adwaita-shared.css b/src/sysprof/theme/Adwaita-shared.css
similarity index 100%
rename from src/resources/theme/Adwaita-shared.css
rename to src/sysprof/theme/Adwaita-shared.css
diff --git a/src/resources/theme/shared.css b/src/sysprof/theme/shared.css
similarity index 100%
rename from src/resources/theme/shared.css
rename to src/sysprof/theme/shared.css
diff --git a/src/resources/ui/sp-window.ui b/src/sysprof/ui/sp-window.ui
similarity index 100%
rename from src/resources/ui/sp-window.ui
rename to src/sysprof/ui/sp-window.ui
diff --git a/src/sysprofd/meson.build b/src/sysprofd/meson.build
new file mode 100644
index 0000000..c3a9534
--- /dev/null
+++ b/src/sysprofd/meson.build
@@ -0,0 +1,60 @@
+if get_option('with_sysprofd') == 'bundled'
+
+sysprofd_sources = [
+  'sysprofd.c',
+  'sd-bus-helper.c',
+  'sd-bus-helper.h',
+]
+
+pkglibexecdir = join_paths(get_option('prefix'), get_option('libexecdir'))
+
+sysprofd_deps = [
+  dependency('libsystemd', version: '>=222'),
+  dependency('glib-2.0', version: glib_req_version),
+  libshared_dep,
+]
+
+sysprofd = executable('sysprofd', sysprofd_sources,
+  dependencies: sysprofd_deps,
+       install: true,
+   install_dir: pkglibexecdir,
+           pie: true,
+)
+
+sysprofdconf = configuration_data()
+sysprofdconf.set('sysprofdprivdir', pkglibexecdir)
+
+configure_file(
+          input: 'org.gnome.Sysprof2.service.in',
+         output: 'org.gnome.Sysprof2.service',
+  configuration: sysprofdconf,
+    install_dir: join_paths(datadir, 'dbus-1/system-services'),
+)
+
+configure_file(
+          input: 'org.gnome.Sysprof2.conf.in',
+         output: 'org.gnome.Sysprof2.conf',
+  configuration: sysprofdconf,
+    install_dir: join_paths(datadir, 'dbus-1/system.d'),
+)
+
+systemdunitdir = get_option('systemdunitdir')
+if systemdunitdir == ''
+  systemdunitdir = dependency('systemd').get_pkgconfig_variable('systemdsystemunitdir')
+endif
+configure_file(
+          input: 'sysprof2.service.in',
+         output: 'sysprof2.service',
+  configuration: sysprofdconf,
+    install_dir: systemdunitdir,
+)
+
+i18n.merge_file(
+        input: 'org.gnome.sysprof2.policy.in',
+       output: 'org.gnome.sysprof2.policy',
+       po_dir: podir,
+      install: true,
+  install_dir: join_paths(datadir, 'polkit-1/actions'),
+)
+
+endif
diff --git a/data/org.gnome.Sysprof2.conf.in b/src/sysprofd/org.gnome.Sysprof2.conf.in
similarity index 100%
rename from data/org.gnome.Sysprof2.conf.in
rename to src/sysprofd/org.gnome.Sysprof2.conf.in
diff --git a/data/org.gnome.Sysprof2.service.in b/src/sysprofd/org.gnome.Sysprof2.service.in
similarity index 100%
rename from data/org.gnome.Sysprof2.service.in
rename to src/sysprofd/org.gnome.Sysprof2.service.in
diff --git a/data/org.gnome.Sysprof2.xml b/src/sysprofd/org.gnome.Sysprof2.xml
similarity index 100%
rename from data/org.gnome.Sysprof2.xml
rename to src/sysprofd/org.gnome.Sysprof2.xml
diff --git a/data/org.gnome.sysprof2.policy.in b/src/sysprofd/org.gnome.sysprof2.policy.in
similarity index 100%
rename from data/org.gnome.sysprof2.policy.in
rename to src/sysprofd/org.gnome.sysprof2.policy.in
diff --git a/daemon/sd-bus-helper.c b/src/sysprofd/sd-bus-helper.c
similarity index 100%
rename from daemon/sd-bus-helper.c
rename to src/sysprofd/sd-bus-helper.c
diff --git a/daemon/sd-bus-helper.h b/src/sysprofd/sd-bus-helper.h
similarity index 100%
rename from daemon/sd-bus-helper.h
rename to src/sysprofd/sd-bus-helper.h
diff --git a/data/sysprof2.service.in b/src/sysprofd/sysprof2.service.in
similarity index 100%
rename from data/sysprof2.service.in
rename to src/sysprofd/sysprof2.service.in
diff --git a/daemon/sysprofd.c b/src/sysprofd/sysprofd.c
similarity index 99%
rename from daemon/sysprofd.c
rename to src/sysprofd/sysprofd.c
index be4ef91..0354983 100644
--- a/daemon/sysprofd.c
+++ b/src/sysprofd/sysprofd.c
@@ -1,6 +1,6 @@
 /* sysprofd.c
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016 Christian Hergert <christian hergert me>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,18 +19,18 @@
 #include "config.h"
 
 #include <assert.h>
-#include <stdio.h>
 #include <errno.h>
 #include <glib.h>
 #include <linux/capability.h>
 #include <linux/perf_event.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <sys/syscall.h>
 #include <time.h>
 #include <unistd.h>
 
 #include "sd-bus-helper.h"
-#include "../lib/sp-kallsyms.h"
+#include "sp-kallsyms.h"
 
 #define BUS_TIMEOUT_USEC (1000000L * 10L)
 
diff --git a/tests/meson.build b/src/tests/meson.build
similarity index 88%
rename from tests/meson.build
rename to src/tests/meson.build
index 3e3d88e..dde1483 100644
--- a/tests/meson.build
+++ b/src/tests/meson.build
@@ -8,23 +8,23 @@ test_env = [
 
 test_cflags = [
   '-DTEST_DATA_DIR="@0@/data/"'.format(meson.current_source_dir()),
-  '-I' + join_paths(meson.source_root(), 'lib'),
 ]
 
 test_capture = executable('test-capture', 'test-capture.c',
         c_args: test_cflags,
   dependencies: libsysprof_capture_dep,
 )
-test('test-capture', test_capture, env: test_env)
 
 test_capture_cursor = executable('test-capture-cursor', 'test-capture-cursor.c',
         c_args: test_cflags,
-  dependencies: libsysprof_dep,
+  dependencies: libsysprof_capture_dep,
 )
+
+test('test-capture', test_capture, env: test_env)
 test('test-capture-cursor', test_capture_cursor, env: test_env)
 
 # Use ./tests/test-kallsyms /proc/kallsyms to test (as user or root)
-test_kallsyms = executable('test-kallsyms', ['test-kallsyms.c', '../lib/sp-kallsyms.c'],
+test_kallsyms = executable('test-kallsyms', 'test-kallsyms.c',
         c_args: test_cflags,
   dependencies: libsysprof_dep,
 )
@@ -35,7 +35,6 @@ if get_option('enable_gtk')
           c_args: test_cflags,
     dependencies: libsysprof_ui_dep,
   )
-  test('test-model-filter', test_model_filter, env: test_env)
 
   test_process_model = executable('test-process-model', 'test-process-model.c',
           c_args: test_cflags,
@@ -46,6 +45,8 @@ if get_option('enable_gtk')
           c_args: test_cflags,
     dependencies: libsysprof_ui_dep,
   )
+
+  test('test-model-filter', test_model_filter, env: test_env)
   test('test-zoom', test_zoom, env: test_env)
 
 endif
diff --git a/tests/test-capture-cursor.c b/src/tests/test-capture-cursor.c
similarity index 59%
rename from tests/test-capture-cursor.c
rename to src/tests/test-capture-cursor.c
index 66bcefc..c3248a4 100644
--- a/tests/test-capture-cursor.c
+++ b/src/tests/test-capture-cursor.c
@@ -1,5 +1,25 @@
+/* test-capture-cursor.c
+ *
+ * Copyright 2016o-2019 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
 #include <glib/gstdio.h>
-#include <sysprof.h>
+#include <sysprof-capture.h>
 
 static gboolean
 increment (const SpCaptureFrame *frame,
@@ -42,7 +62,7 @@ test_cursor_basic (void)
   cursor = sp_capture_cursor_new (reader);
   sp_capture_cursor_foreach (cursor, increment, &count);
   g_assert_cmpint (count, ==, 100);
-  g_clear_object (&cursor);
+  g_clear_pointer (&cursor, sp_capture_cursor_unref);
 
   sp_capture_reader_unref (reader);
   sp_capture_writer_unref (writer);
diff --git a/tests/test-capture.c b/src/tests/test-capture.c
similarity index 99%
rename from tests/test-capture.c
rename to src/tests/test-capture.c
index 119a857..6a98bcb 100644
--- a/tests/test-capture.c
+++ b/src/tests/test-capture.c
@@ -1,6 +1,6 @@
 /* test-capture.c
  *
- * Copyright (C) 2016 Christian Hergert <christian hergert me>
+ * Copyright 2016 Christian Hergert <christian hergert me>
  *
  * This file is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -16,8 +16,12 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#define G_LOG_DOMAIN "test-capture"
+
+#include "config.h"
+
 #include <glib/gstdio.h>
-#include <sysprof.h>
+#include <sysprof-capture.h>
 
 static void
 test_reader_basic (void)
diff --git a/tests/test-kallsyms.c b/src/tests/test-kallsyms.c
similarity index 89%
rename from tests/test-kallsyms.c
rename to src/tests/test-kallsyms.c
index f07c53a..be14112 100644
--- a/tests/test-kallsyms.c
+++ b/src/tests/test-kallsyms.c
@@ -1,5 +1,5 @@
-#include "../lib/sp-address.h"
-#include "../lib/sp-kallsyms.h"
+#include "../shared/sp-address.h"
+#include "../shared/sp-kallsyms.h"
 
 #include <glib.h>
 #include <stdlib.h>
diff --git a/tests/test-model-filter.c b/src/tests/test-model-filter.c
similarity index 99%
rename from tests/test-model-filter.c
rename to src/tests/test-model-filter.c
index 82111e3..a1da344 100644
--- a/tests/test-model-filter.c
+++ b/src/tests/test-model-filter.c
@@ -1,8 +1,6 @@
 #include <sysprof-ui.h>
 #include <string.h>
 
-#include "util/sp-model-filter.h"
-
 #define TEST_TYPE_ITEM (test_item_get_type())
 
 struct _TestItem
diff --git a/tests/test-process-model.c b/src/tests/test-process-model.c
similarity index 100%
rename from tests/test-process-model.c
rename to src/tests/test-process-model.c
diff --git a/tests/test-zoom.c b/src/tests/test-zoom.c
similarity index 97%
rename from tests/test-zoom.c
rename to src/tests/test-zoom.c
index 701648e..519445d 100644
--- a/tests/test-zoom.c
+++ b/src/tests/test-zoom.c
@@ -1,4 +1,4 @@
-#include "util/sp-zoom-manager.h"
+#include "sp-zoom-manager.h"
 
 static void
 test_zoom_manager (void)
diff --git a/src/tools/meson.build b/src/tools/meson.build
new file mode 100644
index 0000000..97ad825
--- /dev/null
+++ b/src/tools/meson.build
@@ -0,0 +1,20 @@
+
+sysprof_cli = executable('sysprof-cli', 'sysprof-cli.c',
+  dependencies: libsysprof_dep,
+   install_dir: get_option('bindir'),
+       install: true,
+)
+
+sysprof_cat = executable('sysprof-cat', 'sysprof-cat.c',
+  dependencies: libsysprof_capture_dep,
+   install_dir: get_option('bindir'),
+       install: true,
+           pie: true,
+)
+
+sysprof_dump = executable('sysprof-dump', 'sysprof-dump.c',
+  dependencies: libsysprof_capture_dep,
+   install_dir: get_option('bindir'),
+       install: true,
+           pie: true,
+)
diff --git a/tools/sysprof-cat.c b/src/tools/sysprof-cat.c
similarity index 98%
rename from tools/sysprof-cat.c
rename to src/tools/sysprof-cat.c
index b2e5ac8..323be57 100644
--- a/tools/sysprof-cat.c
+++ b/src/tools/sysprof-cat.c
@@ -1,6 +1,6 @@
 /* sysprof-cat.c
  *
- * Copyright © 2018 Christian Hergert <chergert redhat com>
+ * Copyright 2018-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,18 +14,19 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
+#define G_LOG_DOMAIN "sysprof-cat"
+
 #include "config.h"
 
 #include <glib/gstdio.h>
 #include <stdlib.h>
+#include <sysprof-capture.h>
 #include <unistd.h>
 
-#include "capture/sp-capture-reader.h"
-#include "capture/sp-capture-writer.h"
-#include "util/sp-platform.h"
-
 typedef struct
 {
   guint64 src;
diff --git a/tools/sysprof-cli.c b/src/tools/sysprof-cli.c
similarity index 98%
rename from tools/sysprof-cli.c
rename to src/tools/sysprof-cli.c
index 8f1f0b8..b535971 100644
--- a/tools/sysprof-cli.c
+++ b/src/tools/sysprof-cli.c
@@ -1,6 +1,6 @@
 /* sysprof-cli.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,11 +14,11 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
+#include "config.h"
 
 #include <fcntl.h>
 #include <glib/gi18n.h>
diff --git a/tools/sysprof-dump.c b/src/tools/sysprof-dump.c
similarity index 98%
rename from tools/sysprof-dump.c
rename to src/tools/sysprof-dump.c
index 867f0c7..191945f 100644
--- a/tools/sysprof-dump.c
+++ b/src/tools/sysprof-dump.c
@@ -1,6 +1,6 @@
 /* sysprof-dump.c
  *
- * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ * Copyright 2016-2019 Christian Hergert <chergert redhat com>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -14,6 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
 #include <stdio.h>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]