2022-05-25 17:11:42 -04:00
rootdir := ''
prefix := '/usr'
clean := '0'
debug := '0'
vendor := '0'
target := if debug = = '1' { 'debug' } else { 'release' }
vendor_args := if vendor = = '1' { '--frozen --offline' } else { '' }
debug_args := if debug = = '1' { '' } else { '--release' }
cargo_args := vendor_args + ' ' + debug_args
2024-02-06 14:10:27 +01:00
targetdir := env( 'CARGO_TARGET_DIR' , 'target' )
2022-05-25 17:11:42 -04:00
sharedir := rootdir + prefix + '/share'
2023-08-08 16:18:12 -04:00
iconsdir := sharedir + '/icons/hicolor'
2024-03-19 12:06:40 -04:00
prefixdir := prefix + '/bin'
bindir := rootdir + prefixdir
2025-12-09 18:41:37 -08:00
libdir := rootdir + prefix + '/lib'
2024-03-08 13:47:58 -05:00
default-schema-target := sharedir / 'cosmic'
2022-05-25 17:11:42 -04:00
2024-03-19 12:06:40 -04:00
cosmic-applets-bin := prefixdir / 'cosmic-applets'
2024-03-14 18:47:41 +01:00
2024-09-30 13:31:24 -04:00
metainfo := 'com.system76.CosmicApplets.metainfo.xml'
metainfo-src := 'data' / metainfo
metainfo-dst := clean( rootdir / prefix) / 'share' / 'metainfo' / metainfo
2024-03-14 18:47:41 +01:00
default : build -release
2022-12-23 15:14:15 -05:00
2023-06-26 17:36:23 -04:00
# Compiles with debug profile
build-debug *args :
cargo build { { args} }
# Compiles with release profile
build-release *args : (build -debug '--release ' args )
2024-03-14 18:47:41 +01:00
# Compile with a vendored tarball
build-vendored *args : vendor -extract (build -release '--frozen --offline ' args )
_link_applet name :
2024-03-15 15:12:21 +01:00
ln -sf { { cosmic-applets-bin} } { { bindir} } /{ { name} }
2024-03-14 18:47:41 +01:00
2023-08-08 16:18:12 -04:00
_install_icons name :
find { { name} } /'data' /'icons' -type f -exec echo { } \; | rev | cut -d'/' -f-3 | rev | xargs -d '\n' -I { } install -Dm0644 { { name} } /'data' /'icons' /{ } { { iconsdir} } /{ }
2022-05-25 17:11:42 -04:00
2024-03-08 13:47:58 -05:00
_install_default_schema name :
find { { name} } /'data' /'default_schema' -type f -exec echo { } \; | rev | cut -d'/' -f-3 | rev | xargs -d '\n' -I { } install -Dm0644 { { name} } /'data' /'default_schema' /{ } { { default-schema-target} } /{ }
2023-02-16 14:45:13 -08:00
_install_desktop path :
install -Dm0644 { { path} } { { sharedir} } /applications/{ { file_name( path) } }
2022-06-10 15:29:45 -07:00
2023-02-16 14:45:13 -08:00
_install_bin name :
2024-02-06 14:10:27 +01:00
install -Dm0755 { { targetdir} } /{ { target} } /{ { name} } { { bindir} } /{ { name} }
2022-06-03 19:36:05 -07:00
2024-03-14 18:47:41 +01:00
_install_applet id name : (_install_icons name ) \
( _install_desktop name + '/data/' + id + '.desktop' ) \
( _link_applet name)
2023-08-08 16:18:12 -04:00
_install_button id name : (_install_icons name ) (_install_desktop name + '/data /' + id + '.desktop ')
2023-02-09 20:09:31 -05:00
2024-09-30 13:31:24 -04:00
_install_metainfo :
install -Dm0644 { { metainfo-src} } { { metainfo-dst} }
2025-12-09 18:41:37 -08:00
_install_status_notifier_watcher :
sed "s|@bindir@|{{prefixdir}}|" cosmic-applet-status-area/data/dbus-1/com.system76.CosmicStatusNotifierWatcher.service.in > cosmic-applet-status-area/data/dbus-1/com.system76.CosmicStatusNotifierWatcher.service
install -Dm0644 cosmic-applet-status-area/data/dbus-1/com.system76.CosmicStatusNotifierWatcher.service { { sharedir} } /dbus-1/services/com.system76.CosmicStatusNotifierWatcher.service
sed "s|@bindir@|{{prefixdir}}|" cosmic-applet-status-area/data/com.system76.CosmicStatusNotifierWatcher.service.in > cosmic-applet-status-area/data/com.system76.CosmicStatusNotifierWatcher.service
install -Dm0644 cosmic-applet-status-area/data/com.system76.CosmicStatusNotifierWatcher.service { { libdir} } /systemd/user/com.system76.CosmicStatusNotifierWatcher.service
2023-02-16 14:45:13 -08:00
# Installs files into the system
2025-12-09 18:41:37 -08:00
install : (_install_bin 'cosmic -applets ') (_link_applet 'cosmic -panel -button ') (_install_applet 'com .system 76.CosmicAppList ' 'cosmic -app -list ') (_install_default_schema 'cosmic -app -list ') (_install_applet 'com .system 76.CosmicAppletA 11y ' 'cosmic -applet -a 11y ') (_install_applet 'com .system 76.CosmicAppletAudio ' 'cosmic -applet -audio ') (_install_applet 'com .system 76.CosmicAppletInputSources ' 'cosmic -applet -input -sources ') (_install_applet 'com .system 76.CosmicAppletBattery ' 'cosmic -applet -battery ') (_install_applet 'com .system 76.CosmicAppletBluetooth ' 'cosmic -applet -bluetooth ') (_install_applet 'com .system 76.CosmicAppletMinimize ' 'cosmic -applet -minimize ') (_install_applet 'com .system 76.CosmicAppletNetwork ' 'cosmic -applet -network ') (_install_applet 'com .system 76.CosmicAppletNotifications ' 'cosmic -applet -notifications ') (_install_applet 'com .system 76.CosmicAppletPower ' 'cosmic -applet -power ') (_install_applet 'com .system 76.CosmicAppletStatusArea ' 'cosmic -applet -status -area ') (_install_applet 'com .system 76.CosmicAppletTiling ' 'cosmic -applet -tiling ') (_install_applet 'com .system 76.CosmicAppletTime ' 'cosmic -applet -time ') (_install_applet 'com .system 76.CosmicAppletWorkspaces ' 'cosmic -applet -workspaces ') (_install_button 'com .system 76.CosmicPanelAppButton ' 'cosmic -panel -app -button ') (_install_button 'com .system 76.CosmicPanelLauncherButton ' 'cosmic -panel -launcher -button ') (_install_button 'com .system 76.CosmicPanelWorkspacesButton ' 'cosmic -panel -workspaces -button ') (_install_metainfo ) (_install_status_notifier_watcher )
2024-03-14 18:47:41 +01:00
# Vendor Cargo dependencies locally
vendor :
mkdir -p .cargo
cargo vendor | head -n -1 > .cargo/config
echo 'directory = "vendor"' >> .cargo/config
tar pcf vendor.tar vendor
rm -rf vendor
# Extracts vendored dependencies
[ p r i v a t e ]
vendor-extract :
rm -rf vendor
2026-01-13 17:21:37 +01:00
tar pxf vendor.tar
# Bump cargo version, create git commit, and create tag
tag version :
find -type f -name Cargo.toml -exec sed -i '0,/^version/s/^version.*/version = "{{version}}"/' '{}' \; -exec git add '{}' \;
cargo check
cargo clean
dch -D noble -v { { version} }
git add Cargo.lock debian/changelog