Skip to content

Commit

Permalink
chore: justification
Browse files Browse the repository at this point in the history
  • Loading branch information
mmstick authored and wash2 committed Feb 3, 2023
1 parent f7a3493 commit 4fe5223
Show file tree
Hide file tree
Showing 22 changed files with 178 additions and 263 deletions.
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ Layer Shell frontend for https://github.com/pop-os/launcher. Currently the under

# Building

Cosmic Launcher is set up to build a deb and a Nix flake, but it can be built using meson.
Cosmic Launcher is set up to build a deb and a Nix flake, but it can be built using just.

Some Build Dependencies:
```
```
cargo,
meson,
just,
intltool,
appstream-util,
desktop-file-utils,
Expand All @@ -18,6 +18,24 @@ Some Build Dependencies:
desktop-file-utils,
```

## Build Commands

For a typical install from source, use `just` followed with `sudo just install`.
```sh
just
sudo just install
```

If you are packaging, run `just vendor` outside of your build chroot, then use `just build-vendored` inside the build-chroot. Then you can specify a custom root directory and prefix.
```sh
# Outside build chroot
just clean-dist
just vendor

# Inside build chroot
just build-vendored
sudo just rootdir=debian/cosmic-launcher prefix=/usr install
```

# Translators

Expand Down
1 change: 1 addition & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fn main() {}
11 changes: 11 additions & 0 deletions data/com.system76.CosmicLauncher.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Desktop Entry]
Name=COSMIC Launcher
Comment=COSMIC Launcher
Type=Application
Exec=cosmic-launcher
Terminal=false
Categories=GNOME;GTK;
Keywords=Gnome;GTK;
Icon=com.system76.CosmicLauncher
StartupNotify=true
X-HostWaylandDisplay=true
13 changes: 0 additions & 13 deletions data/com.system76.CosmicLauncher.desktop.in.in

This file was deleted.

26 changes: 26 additions & 0 deletions data/com.system76.CosmicLauncher.metainfo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Ashley Wulber 2019 <[email protected]> -->
<component type="desktop-application">
<id>com.system76.CosmicLauncher</id>
<metadata_license>CC0</metadata_license>
<project_license>GPL-3.0-only</project_license>
<name>COSMIC Launcher</name>
<summary>COSMIC frontend for Pop Launcher</summary>
<description>
<p>The COSMIC frontend for Pop Launcher</p>
</description>
<url type="homepage">https://github.com/pop-os/cosmic-launcher</url>
<url type="bugtracker">https://github.com/pop-os/cosmic-launcher/issues</url>
<content_rating type="oars-1.0" />
<releases>
<release version="0.1.0" date="2023-01-01" />
</releases>
<kudos>
<kudo>ModernToolkit</kudo>
<kudo>HiDpiIcon</kudo>
</kudos>
<developer_name>Ashley Wulber</developer_name>
<update_contact>[email protected]</update_contact>
<translation type="gettext">cosmic-launcher</translation>
<launchable type="desktop-id">com.system76.CosmicLauncher.desktop</launchable>
</component>
37 changes: 0 additions & 37 deletions data/com.system76.CosmicLauncher.metainfo.xml.in.in

This file was deleted.

15 changes: 15 additions & 0 deletions data/icons/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
appid := env_var('APPID')
install-dir := env_var('INSTALL_DIR')

scalable-src := appid + '.svg'
scalable-dst := install-dir / 'icons' / 'hicolor' / 'scalable' / 'apps' / scalable-src

symbolic-src := appid + '-symbolic.svg'
symbolic-dst := install-dir / 'icons' / 'hicolor' / 'symbolic' / 'apps' / symbolic-src

install:
install -Dm0644 {{scalable-src}} {{scalable-dst}}
install -Dm0644 {{symbolic-src}} {{symbolic-dst}}

uninstall:
rm {{scalable-dst}} {{symbolic-dst}}
10 changes: 0 additions & 10 deletions data/icons/meson.build

This file was deleted.

15 changes: 15 additions & 0 deletions data/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
appid := env_var('APPID')
install-dir := env_var('INSTALL_DIR')

desktop-src := appid + '.desktop'
desktop-dst := install-dir / 'applications' / desktop-src

metainfo-src := appid + '.metainfo.xml'
metainfo-dst := install-dir / 'metainfo' / metainfo-src

install:
install -Dm0644 {{desktop-src}} {{desktop-dst}}
install -Dm0644 {{metainfo-src}} {{metainfo-dst}}

uninstall:
rm {{desktop-dst}} {{metainfo-dst}}
54 changes: 0 additions & 54 deletions data/meson.build

This file was deleted.

5 changes: 1 addition & 4 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ Build-Depends:
debhelper-compat (= 11),
rustc (>=1.63),
cargo,
meson,
just,
intltool,
appstream-util,
desktop-file-utils,
libxkbcommon-dev,
pkg-config,
desktop-file-utils,
Standards-Version: 4.3.0
Homepage: https://github.com/pop-os/cosmic-launcher

Expand Down
5 changes: 5 additions & 0 deletions debian/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/usr/bin/cosmic-launcher
/usr/share/applications/com.system76.CosmicLauncher.desktop
/usr/share/icons/hicolor/scalable/apps/com.system76.CosmicLauncher.svg
/usr/share/icons/hicolor/symbolic/apps/com.system76.CosmicLauncher-symbolic.svg
/usr/share/metainfo/com.system76.CosmicLauncher.metainfo.xml
6 changes: 6 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ override_dh_auto_clean:
tar pcf vendor.tar vendor; \
rm -rf vendor; \
fi

override_dh_auto_build:
just build-vendored

override_dh_install:
just rootdir=$(DESTDIR) install
1 change: 0 additions & 1 deletion debian/source/options
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
tar-ignore=target
tar-ignore=vendor
tar-ignore=obj-*
6 changes: 2 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@
./Cargo.lock
./i18n
./i18n.toml
./meson.build
./meson_options.txt
./justfile
./build-aux
./data
./po
];
};
nativeBuildInputs = with pkgs; [
meson
just
pkg-config
autoPatchelfHook
];
Expand All @@ -46,7 +45,6 @@
glib
gtk4
desktop-file-utils
ninja # Makes Meson happy
];
runtimeDependencies = with pkgs; [
wayland
Expand Down
65 changes: 65 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name := 'cosmic-launcher'
export APPID := 'com.system76.CosmicLauncher'

rootdir := ''
prefix := '/usr'

export INSTALL_DIR := clean(justfile_directory() / rootdir / prefix / 'share')

bin-src := 'target' / 'release' / name
bin-dst := INSTALL_DIR / 'bin' / name

# Default recipe which runs `just build-release`
default: build-release

# Runs `cargo clean`
clean:
cargo clean

# `cargo clean` and removes vendored dependencies
clean-dist: clean
rm -rf .cargo vendor vendor.tar

# Compiles with debug profile
build-debug *args:
cargo build {{args}}

# Compiles with release profile
build-release *args: (build-debug '--release' args)

# Compiles release profile with vendored dependencies
build-vendored *args: vendor-extract (build-release '--frozen --offline' args)

# Runs a clippy check
check *args:
cargo clippy --all-features {{args}} -- -W clippy::pedantic

# Runs a clippy check with JSON message format
check-json: (check '--message-format=json')

# Installs files
install:
install -Dm0644 {{bin-src}} {{bin-dst}}
@just data/install
@just data/icons/install

# Uninstalls installed files
uninstall:
rm {{bin-dst}}
@just data/uninstall
@just data/icons/uninstall

# Vendor dependencies locally
vendor:
mkdir -p .cargo
cargo vendor --sync Cargo.toml \
| head -n -1 > .cargo/config
echo 'directory = "vendor"' >> .cargo/config
tar pcf vendor.tar vendor
rm -rf vendor

# Extracts vendored dependencies
vendor-extract:
#!/usr/bin/env sh
rm -rf vendor
tar pxf vendor.tar
Loading

0 comments on commit 4fe5223

Please sign in to comment.