Skip to content

Commit e054ea2

Browse files
authored
chore: Adding Initial macOS Build Support (#23)
1 parent 01581b0 commit e054ea2

File tree

12 files changed

+88
-5
lines changed

12 files changed

+88
-5
lines changed

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<p align="center">
2-
<img alt="cosmicding logo" src="./res/icons/hicolor/256x256/apps/com.vkhitrin.cosmicding.png" alt="Logo" height="192px" width="192px">
2+
<img alt="cosmicding logo" src="./res/linux/icons/hicolor/256x256/apps/com.vkhitrin.cosmicding.png" alt="Logo" height="192px" width="192px">
33
</p>
44

55
<p align="center">
@@ -33,7 +33,9 @@ cosmicding was tested against linkding releases `1.31.0`, and `1.36.0`.
3333

3434
## Installation
3535

36-
### Local
36+
cosmicding is not distributed at the moment, and has to be built manually.
37+
38+
### Local (Linux)
3739

3840
```shell
3941
# Clone the repository
@@ -49,6 +51,22 @@ just build-release
4951
sudo just install
5052
```
5153

54+
### Local (macOS)
55+
56+
```shell
57+
# Clone the repository
58+
git clone https://github.com/vkhitrin/cosmicding
59+
60+
# Change directory to the project folder
61+
cd cosmicding
62+
63+
# Build Release version
64+
just build-macos
65+
66+
# Install globally (for all users)
67+
cp -r target/release/macos/cosmicding.app /Applications
68+
```
69+
5270
## Roadmap
5371

5472
### Future

justfile

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,27 @@ bin-src := 'target' / 'release' / name
1111
bin-dst := base-dir / 'bin' / name
1212

1313
desktop := appid + '.desktop'
14-
desktop-src := 'res' / desktop
14+
desktop-src := 'res' / 'linux' / desktop
1515
desktop-dst := clean(rootdir / prefix) / 'share' / 'applications' / desktop
1616

17-
icons-src := 'res' / 'icons' / 'hicolor'
17+
icons-src := 'res' / 'linux' / 'icons' / 'hicolor'
1818
icons-dst := clean(rootdir / prefix) / 'share' / 'icons' / 'hicolor'
1919

20+
# NOTE: macOS related, should be consolidated
21+
assets-dir := 'res' / 'macOS'
22+
release-dir := 'target' / 'release'
23+
app-name := name + '.app'
24+
app-template := assets-dir / app-name
25+
app-template-plist := app-template / 'Contents' / 'Info.plist'
26+
app-dir := release-dir / 'macos'
27+
app-binary := release-dir / name
28+
app-binary-dir := app-dir / app-name / 'Contents' / 'MacOS'
29+
app-extras-dir := app-dir / app-name / 'Contents' / 'Resources'
30+
dmg-name := name + '.dmg'
31+
dmg-release := release-dir / 'macos'
32+
version := '0.1.0'
33+
build := 'test'
34+
2035
default: build-release
2136

2237
clean:
@@ -34,6 +49,17 @@ build-release *args: (build-debug '--release' args)
3449

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

52+
build-macos:
53+
cargo build --release --target=aarch64-apple-darwin
54+
lipo "target/aarch64-apple-darwin/release/{{name}}" -create -output "{{app-binary}}"
55+
56+
mkdir -p "{{app-binary-dir}}"
57+
mkdir -p "{{app-extras-dir}}"
58+
cp -fRp "{{app-template}}" "{{app-dir}}"
59+
cp -fp "{{app-binary}}" "{{app-binary-dir}}"
60+
touch -r "{{app-binary}}" "{{app-dir}}/{{app-name}}"
61+
echo "Created '{{app-name}}' in '{{app-dir}}'"
62+
3763
check *args:
3864
cargo clippy --all-features {{args}} -- -W clippy::pedantic
3965

@@ -44,7 +70,7 @@ run *args:
4470

4571
install: install-migrations
4672
install -Dm0755 {{bin-src}} {{bin-dst}}
47-
install -Dm0644 res/app.desktop {{desktop-dst}}
73+
install -Dm0644 res/linux/app.desktop {{desktop-dst}}
4874
for size in `ls {{icons-src}}`; do \
4975
install -Dm0644 "{{icons-src}}/$size/apps/{{appid}}.png" "{{icons-dst}}/$size/apps/{{appid}}.png"; \
5076
done
File renamed without changes.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleExecutable</key>
8+
<string>cosmicding</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>com.vkhitrin.cosmicding</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>cosmicding</string>
15+
<key>CFBundlePackageType</key>
16+
<string>APPL</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>{{ VERSION }}</string>
19+
<key>CFBundleSupportedPlatforms</key>
20+
<array>
21+
<string>MacOSX</string>
22+
</array>
23+
<key>CFBundleVersion</key>
24+
<string>{{ BUILD }}</string>
25+
<key>CFBundleIconFile</key>
26+
<string>cosmicding.icns</string>
27+
<key>NSHighResolutionCapable</key>
28+
<true/>
29+
<key>NSMainNibFile</key>
30+
<string></string>
31+
<key>NSSupportsAutomaticGraphicsSwitching</key>
32+
<true/>
33+
<key>CFBundleDisplayName</key>
34+
<string>cosmicding</string>
35+
<key>NSRequiresAquaSystemAppearance</key>
36+
<string>NO</string>
37+
<key>CFBundleURLTypes</key>
38+
</dict>
39+
</plist>
Binary file not shown.

0 commit comments

Comments
 (0)