diff --git a/.gitignore b/.gitignore index 9703579..fab12b1 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,5 @@ debian/* !debian/copyright !debian/install !debian/rules -!debian/source \ No newline at end of file +!debian/source +.DS_Store diff --git a/README.md b/README.md index e40a451..38c76ef 100644 --- a/README.md +++ b/README.md @@ -25,11 +25,14 @@ 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` @@ -37,29 +40,15 @@ Dependencies: - `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 @@ -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 diff --git a/justfile b/justfile index 77b3152..070c59b 100644 --- a/justfile +++ b/justfile @@ -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}}" @@ -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 @@ -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 diff --git a/res/linux/icons/hicolor/128x128/apps/com.vkhitrin.cosmicding.png b/res/linux/icons/hicolor/128x128/apps/com.vkhitrin.cosmicding.png index 94d3296..87fc4ed 100644 Binary files a/res/linux/icons/hicolor/128x128/apps/com.vkhitrin.cosmicding.png and b/res/linux/icons/hicolor/128x128/apps/com.vkhitrin.cosmicding.png differ diff --git a/res/linux/icons/hicolor/16x16/apps/com.vkhitrin.cosmicding.png b/res/linux/icons/hicolor/16x16/apps/com.vkhitrin.cosmicding.png index 9204e93..dfad860 100644 Binary files a/res/linux/icons/hicolor/16x16/apps/com.vkhitrin.cosmicding.png and b/res/linux/icons/hicolor/16x16/apps/com.vkhitrin.cosmicding.png differ diff --git a/res/linux/icons/hicolor/256x256/apps/com.vkhitrin.cosmicding.png b/res/linux/icons/hicolor/256x256/apps/com.vkhitrin.cosmicding.png index 3166f63..0314a68 100644 Binary files a/res/linux/icons/hicolor/256x256/apps/com.vkhitrin.cosmicding.png and b/res/linux/icons/hicolor/256x256/apps/com.vkhitrin.cosmicding.png differ diff --git a/res/linux/icons/hicolor/32x32/apps/com.vkhitrin.cosmicding.png b/res/linux/icons/hicolor/32x32/apps/com.vkhitrin.cosmicding.png index 07b8e59..ea2675f 100644 Binary files a/res/linux/icons/hicolor/32x32/apps/com.vkhitrin.cosmicding.png and b/res/linux/icons/hicolor/32x32/apps/com.vkhitrin.cosmicding.png differ diff --git a/res/linux/icons/hicolor/48x48/apps/com.vkhitrin.cosmicding.png b/res/linux/icons/hicolor/48x48/apps/com.vkhitrin.cosmicding.png index f2fc076..85dbb1a 100644 Binary files a/res/linux/icons/hicolor/48x48/apps/com.vkhitrin.cosmicding.png and b/res/linux/icons/hicolor/48x48/apps/com.vkhitrin.cosmicding.png differ diff --git a/res/linux/icons/hicolor/64x64/apps/com.vkhitrin.cosmicding.png b/res/linux/icons/hicolor/64x64/apps/com.vkhitrin.cosmicding.png index 46da770..316b8cf 100644 Binary files a/res/linux/icons/hicolor/64x64/apps/com.vkhitrin.cosmicding.png and b/res/linux/icons/hicolor/64x64/apps/com.vkhitrin.cosmicding.png differ diff --git a/res/macOS/cosmicding.app/Contents/Resources/AppIcon.icns b/res/macOS/cosmicding.app/Contents/Resources/AppIcon.icns new file mode 100644 index 0000000..5b56229 Binary files /dev/null and b/res/macOS/cosmicding.app/Contents/Resources/AppIcon.icns differ diff --git a/res/macOS/cosmicding.app/Contents/Resources/cosmicding.icns b/res/macOS/cosmicding.app/Contents/Resources/cosmicding.icns deleted file mode 100644 index 56fa3b7..0000000 Binary files a/res/macOS/cosmicding.app/Contents/Resources/cosmicding.icns and /dev/null differ