Skip to content

Commit ae8a339

Browse files
committed
offline build flag
1 parent e561eef commit ae8a339

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

build-aux/dist-vendor.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
export DIST="$1"
3+
export SOURCE_ROOT="$2"
4+
5+
cd "$SOURCE_ROOT"
6+
mkdir "$DIST"/.cargo
7+
cargo vendor | sed 's/^directory = ".*"/directory = "vendor"/g' > $DIST/.cargo/config
8+
# Move vendor into dist tarball directory
9+
mv vendor "$DIST"

meson.build

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
project('distroshelf', 'rust',
1+
project('distroshelf', 'rust',
22
version: '0.1.0',
33
meson_version: '>= 1.0.0',
44
default_options: [ 'warning_level=2', 'werror=false', ],
@@ -7,8 +7,13 @@ project('distroshelf', 'rust',
77
i18n = import('i18n')
88
gnome = import('gnome')
99

10+
version = meson.project_version()
1011

11-
12+
meson.add_dist_script(
13+
'build-aux/dist-vendor.sh',
14+
join_paths(meson.project_build_root(), 'meson-dist', meson.project_name() + '-' + version),
15+
meson.project_source_root()
16+
)
1217

1318
subdir('data')
1419
subdir('src')

meson_options.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
option('offline', type: 'boolean', value: false)

src/meson.build

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ else
4040
rust_target = 'debug'
4141
endif
4242

43+
if get_option('offline')
44+
cargo_opt += [ '--offline' ]
45+
message('Building offline')
46+
endif
47+
4348
cargo_build = custom_target(
4449
'cargo-build',
4550
build_by_default: true,

0 commit comments

Comments
 (0)