Skip to content

Commit

Permalink
chore: Consolidate just Targets For Cross Platform (#47)
Browse files Browse the repository at this point in the history
* Consolidating just targets for macOS/Linux.
  Executing a target will trigger that platform-specific steps.
* Update README with cross-platform improvements.
* Updating `.gitignore`.
* Redesigning application icon.
* Resolves #27.
  • Loading branch information
vkhitrin authored Dec 29, 2024
1 parent 1ef1861 commit 5bab72c
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 38 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ debian/*
!debian/copyright
!debian/install
!debian/rules
!debian/source
!debian/source
.DS_Store
33 changes: 11 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,41 +25,30 @@ cosmicding was tested against linkding releases `1.31.0`, and `1.36.0`.

## Installation

> [!NOTE]
> Currently cosmicding is hard-codded to build Apple Silicon releases for macOS.
cosmicding is not distributed at the moment, and has to be built manually.

### Local (Linux)
### Local Install

Dependencies:
Dependencies (Linux)

- `cargo`
- `just`
- `libxkbcommon-dev`
- `libcosmic`
- `libsqlite3-dev`

```shell
# Clone the repository
git clone https://github.com/vkhitrin/cosmicding

# Change directory to the project folder
cd cosmicding

# Build Release version
just build-release

# Install
sudo just install
```

### Local (macOS)

Dependencies:
Dependencies (macOS)

- `cargo`
- `just`
- `libxkbcommon`
- `sqlite3`

Installation:

```shell
# Clone the repository
git clone https://github.com/vkhitrin/cosmicding
Expand All @@ -68,10 +57,10 @@ git clone https://github.com/vkhitrin/cosmicding
cd cosmicding

# Build Release version
just build-macos
just build-release

# Install globally (for all users)
cp -r target/release/macos/cosmicding.app /Applications
# Install
sudo just install
```

## Roadmap
Expand Down
65 changes: 50 additions & 15 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,22 @@ clean-dist: clean clean-vendor
build-debug *args:
cargo build {{args}}

build-release *args: (build-debug '--release' args)
build-release *args:
#!/usr/bin/env sh
if [ "$(uname)" = "Linux" ]; then
just build-release-linux
elif [ "$(uname)" = "Darwin" ]; then
just build-release-macos
fi
build-release-linux *args: (build-debug '--release' args)
build-vendored *args: vendor-extract (build-release '--frozen --offline' args)
build-release-macos *args:
cargo build --release --target=aarch64-apple-darwin {{args}}

# Using native macOS' sed
/usr/bin/sed -i '' -e "s/__VERSION__/$(cargo pkgid | cut -d "#" -f2)/g" {{app-template-plist}}
/usr/bin/sed -i '' -e "s/__BUILD__/$(git describe --always --exclude='*')/g" {{app-template-plist}}

build-macos:
cargo build --release --target=aarch64-apple-darwin
lipo "target/aarch64-apple-darwin/release/{{name}}" -create -output "{{app-binary}}"

mkdir -p "{{app-binary-dir}}"
Expand All @@ -59,21 +69,41 @@ build-macos:
cp -fp "{{app-binary}}" "{{app-binary-dir}}"
touch -r "{{app-binary}}" "{{app-dir}}/{{app-name}}"
echo "Created '{{app-name}}' in '{{app-dir}}'"
git stash -- {{app-template-plist}}

build-vendored *args: vendor-extract (build-release '--frozen --offline' args)

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

check-json: (check '--message-format=json')

run *args:
run-linux *args:
env RUST_BACKTRACE=full cargo run --release {{args}}

install: install-migrations
install -Dm0755 {{bin-src}} {{bin-dst}}
install -Dm0644 res/linux/app.desktop {{desktop-dst}}
for size in `ls {{icons-src}}`; do \
install -Dm0644 "{{icons-src}}/$size/apps/{{appid}}.png" "{{icons-dst}}/$size/apps/{{appid}}.png"; \
done
run-macos:
env RUST_BACKTRACE=full {{app-binary-dir}}/{{name}}

run *args:
#!/usr/bin/env sh
if [ "$(uname)" = "Linux" ]; then
just run-linux
elif [ "$(uname)" = "Darwin" ]; then
just run-macos
fi
install:
#!/usr/bin/env sh
if [ "$(uname)" = "Linux" ]; then
just install-migrations
install -Dm0755 {{bin-src}} {{bin-dst}}
install -Dm0644 res/linux/app.desktop {{desktop-dst}}
for size in `ls {{icons-src}}`; do \
install -Dm0644 "{{icons-src}}/$size/apps/{{appid}}.png" "{{icons-dst}}/$size/apps/{{appid}}.png"; \
done
elif [ "$(uname)" = "Darwin" ]; then
cp -r {{app-dir}}/{{name}}.app /Applications/
fi
install-migrations:
#!/usr/bin/env sh
Expand All @@ -83,10 +113,15 @@ install-migrations:
done
uninstall:
rm {{bin-dst}} {{desktop-dst}}
for size in `ls {{icons-src}}`; do \
rm "{{icons-dst}}/$size/apps/{{appid}}.png"; \
done
#!/usr/bin/env sh
if [ "$(uname)" = "Linux" ]; then
rm {{bin-dst}} {{desktop-dst}}
for size in `ls {{icons-src}}`; do \
rm "{{icons-dst}}/$size/apps/{{appid}}.png"; \
done
elif [ "$(uname)" = "Darwin" ]; then
rm -rf /Applications/{{name}}.app
fi
vendor:
#!/usr/bin/env bash
Expand Down
Binary file modified res/linux/icons/hicolor/128x128/apps/com.vkhitrin.cosmicding.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/linux/icons/hicolor/16x16/apps/com.vkhitrin.cosmicding.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/linux/icons/hicolor/256x256/apps/com.vkhitrin.cosmicding.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/linux/icons/hicolor/32x32/apps/com.vkhitrin.cosmicding.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/linux/icons/hicolor/48x48/apps/com.vkhitrin.cosmicding.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/linux/icons/hicolor/64x64/apps/com.vkhitrin.cosmicding.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.

0 comments on commit 5bab72c

Please sign in to comment.