11name := ' cosmicding'
22appid := ' com.vkhitrin.cosmicding'
3- migrations_folder := clean (rootdir / prefix) / ' share' / appid / ' migrations'
43
54rootdir := ' '
65prefix := ' /usr'
@@ -14,6 +13,8 @@ desktop := appid + '.desktop'
1413desktop-src := ' res' / ' linux' / desktop
1514desktop-dst := clean (rootdir / prefix) / ' share' / ' applications' / desktop
1615
16+ metainfo-dst := clean (rootdir / prefix) / ' share' / ' metainfo' / ' com.vkhitrin.cosmicding.metainfo.xml'
17+
1718icons-src := ' res' / ' linux' / ' icons' / ' hicolor'
1819icons-dst := clean (rootdir / prefix) / ' share' / ' icons' / ' hicolor'
1920
@@ -47,19 +48,54 @@ build-release *args:
4748 if [ " $( uname) " = " Linux" ]; then
4849 just build-release-linux
4950 elif [ " $( uname) " = " Darwin" ]; then
50- just build-release-macos
51+ if [ " $( uname -m) " = " arm64" ]; then
52+ just build-release-macos-aarch64
53+ elif [ " $( uname -m) " = " x86_64" ]; then
54+ just build-release-macos-x86_64
55+ fi
5156 fi
57+
5258build-release-linux * args : (build-debug ' --release' args)
5359
54- build-release-macos * args :
55- cargo build --release --target=aarch64 -apple-darwin {{ args}}
60+ build-release-macos-aarch64 * args :
61+ #!/usr/bin/env sh
62+ if [ ! -z $COSMICDING_UNIVERAL_BUILD ]; then
63+ SDKROOT=" $( xcrun --sdk macosx --show-sdk-path) "
64+ CFLAGS=" -isysroot $SDKROOT "
65+ rustup run stable cargo build --release --target aarch64-apple-darwin {{args}}
66+ else
67+ cargo build --release --target=aarch64-apple-darwin {{args}}
68+ lipo " target/aarch64-apple-darwin/release/{{name}}" -create -output " {{macos-app-binary}}"
69+ just bundle-macos
70+ fi
71+
72+ build-release-macos-x86_64 * args :
73+ #!/usr/bin/env sh
74+ echo $COSMICDING_UNIVERAL_BUILD
75+ if [ ! -z $COSMICDING_UNIVERAL_BUILD ]; then
76+ SDKROOT=" $( xcrun --sdk macosx --show-sdk-path) "
77+ CFLAGS=" -isysroot $SDKROOT "
78+ rustup run stable cargo build --release --target x86_64-apple-darwin {{args}}
79+ else
80+ cargo build --release --target x86_64-apple-darwin {{args}}
81+ lipo " target/x86_64-apple-darwin/release/{{name}}" -create -output " {{macos-app-binary}}"
82+ just bundle-macos
83+ fi
5684
85+ build-release-macos-universal * args :
86+ which rustup || exit 1
87+ rustup toolchain install stable
88+ rustup target add aarch64 -apple-darwin
89+ rustup target add x86 _64 -apple-darwin
90+ env COSMICDING_UNIVERAL_BUILD=true just build-release-macos-aarch64
91+ env COSMICDING_UNIVERAL_BUILD=true just build-release-macos-x86 _64
92+ lipo " target/aarch64-apple-darwin/release/{{ name}} " " target/x86_64-apple-darwin/release/{{ name}} " -create -output " {{ macos-app-binary}} "
93+ just bundle-macos
94+
95+ bundle-macos :
5796 # Using native macOS' sed
5897 / usr/ bin/ sed -i ' ' -e " s/__VERSION__/$(cargo pkgid | cut -d "#" -f2)/g" {{macos-app-template-plist}}
5998 / usr/ bin/ sed -i ' ' -e " s/__BUILD__/$(git describe --always --exclude='*')/g" {{ macos-app-template-plist}}
60-
61- lipo " target/aarch64-apple-darwin/release/{{ name}} " -create -output " {{ macos-app-binary}} "
62-
6399 mkdir -p " {{ macos-app-binary-dir}} "
64100 mkdir -p " {{ macos-app-extras-dir}} /icons/"
65101 cp -fRp " {{ macos-app-template}} " " {{ macos-app-dir}} "
@@ -69,6 +105,31 @@ build-release-macos *args:
69105 echo " Created '{{ macos-app-name}} ' in '{{ macos-app-dir}} '"
70106 git stash -- {{ macos-app-template-plist}}
71107
108+ distribute-macos-dmg :
109+ which create-dmg || exit 1
110+ create-dmg \
111+ - -volname " cosmicding Installer" \
112+ - -window-pos 200 120 \
113+ - -window-size 800 400 \
114+ - -icon-size 100 \
115+ - -hide-extension " cosmicding.app" \
116+ - -icon {{ macos-app-name}} 200 160 \
117+ - -app-drop-link 600 155 \
118+ {{ macos-app-dir}} / {{ macos-dmg-name}} \
119+ {{ macos-app-dir}} / {{ macos-app-name}}
120+
121+ build-release-linux-flatpak :
122+ which flatpak-builder || exit 1
123+ flatpak-builder --force-clean \
124+ - -sandbox \
125+ - -user \
126+ - -install \
127+ - -install-deps-from=flathub \
128+ - -ccache \
129+ - -mirror-screenshots-url=https:// dl.flathub.org/ media/ \
130+ - -repo=flatpak-repo builddir \
131+ res/ flatpak/ com.vkhitrin.cosmicding.yaml
132+
72133build-vendored * args : vendor-extract (build-release ' --frozen --offline' args)
73134
74135check * args :
@@ -94,23 +155,16 @@ run *args:
94155install :
95156 #!/usr/bin/env sh
96157 if [ " $( uname) " = " Linux" ]; then
97- just install-migrations
98158 install -Dm0755 {{bin-src}} {{bin-dst}}
99- install -Dm0644 res/linux/app.desktop {{desktop-dst}}
100159 for size in ` ls {{icons-src}}` ; do \
101160 install -Dm0644 " {{icons-src}}/$size /apps/{{appid}}.png" " {{icons-dst}}/$size /apps/{{appid}}.png" ; \
102161 done
162+ install -Dm0644 res/linux/app.desktop {{desktop-dst}}
163+ install -Dm0644 res/flatpak/com.vkhitrin.cosmicding.metainfo.xml {{metainfo-dst}}
103164 elif [ " $( uname) " = " Darwin" ]; then
104165 cp -r {{macos-app-dir}}/{{name}}.app /Applications/
105166 fi
106167
107- install-migrations :
108- #!/usr/bin/env sh
109- set -ex
110- for file in ./migrations/* ; do
111- install -Dm0644 $file " {{migrations_folder}}/$( basename " $file " ) "
112- done
113-
114168uninstall :
115169 #!/usr/bin/env sh
116170 if [ " $( uname) " = " Linux" ]; then
0 commit comments