[libadwaita/wip/exalm/dist-script: 1/2] build: Add a dist script




commit cff090ac7d0121ac12e9bde692e3dae8460a36e8
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Sat Jan 1 16:48:22 2022 +0500

    build: Add a dist script
    
    Include pre-built stylesheet and docs into release tarballs.
    
    Fixes https://gitlab.gnome.org/GNOME/libadwaita/-/issues/372

 build-aux/meson/dist-data.py | 34 ++++++++++++++++++++++++++++++++++
 meson.build                  |  2 ++
 2 files changed, 36 insertions(+)
---
diff --git a/build-aux/meson/dist-data.py b/build-aux/meson/dist-data.py
new file mode 100644
index 00000000..86f38c2b
--- /dev/null
+++ b/build-aux/meson/dist-data.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python3
+
+import os
+import shutil
+import subprocess
+
+from pathlib import PurePath
+
+stylesheets = [
+    'src/stylesheet/base.css',
+    'src/stylesheet/base-hc.css',
+    'src/stylesheet/defaults-light.css',
+    'src/stylesheet/defaults-dark.css',
+]
+
+references = [
+    'doc/libadwaita-1',
+]
+
+sourceroot = os.environ.get('MESON_SOURCE_ROOT')
+buildroot = os.environ.get('MESON_BUILD_ROOT')
+distroot = os.environ.get('MESON_DIST_ROOT')
+
+for stylesheet in stylesheets:
+    stylesheet_path = PurePath(stylesheet)
+    src = PurePath(sourceroot, stylesheet_path.with_suffix('.scss'))
+    dst = PurePath(distroot, stylesheet_path)
+    subprocess.call(['sassc', '-a', '-M', '-t', 'compact', src, dst])
+
+for reference in references:
+    src_path = os.path.join(buildroot, reference)
+    if os.path.isdir(src_path):
+        dst_path = os.path.join(distroot, reference)
+        shutil.copytree(src_path, dst_path)
diff --git a/meson.build b/meson.build
index 8c174b2d..b340efd6 100644
--- a/meson.build
+++ b/meson.build
@@ -132,6 +132,8 @@ configure_file(
          output: 'run',
   configuration: run_data)
 
+meson.add_dist_script('build-aux'/ 'meson'/ 'dist-data.py')
+
 summary(
   {
     'Tests': get_option('tests'),


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